@libxai/board 1.9.45 → 1.9.48
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 +38 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +277 -19
- package/dist/index.d.ts +277 -19
- package/dist/index.js +38 -38
- package/dist/index.js.map +1 -1
- package/dist/styles.css +106 -27
- package/package.json +142 -142
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=lp(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let i=lp(t[o]||"");if(i.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((m,f)=>{l[m]=i[f]||"";});let p=l.Column||"Unnamed";n.has(p)||n.set(p,{id:`col-${n.size+1}`,title:p,position:n.size+1,cardIds:[]});let u=n.get(p),d={id:l["Card ID"]||`card-${o}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:u.id,position:u.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),u.cardIds.push(d.id);}catch(i){s.push(`Line ${o+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.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 lp(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function cp(e,t){switch(t){case "json":return Zb(e);case "csv":return eh(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dp(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var kc=createContext(null);function up(){return useContext(kc)}var pp=createContext(null);function mp({children:e,themeName:t}){return jsx(pp.Provider,{value:{themeName:t},children:e})}function Wi(){return useContext(pp)}function ga({children:e,container:t}){let[a,r]=useState(false),n=up(),s=Wi();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:i,themeName:c}=n,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var yp={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},lh="#BDC3C7",ch=({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 Mo({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,b=160,h=220,y=4,x=m.right-b;x<10&&(x=m.left),x+b>v-10&&(x=v-b-10);let w=f-m.bottom,C=m.top,P;w>=h+y?P=m.bottom+y:C>=h+y?P=m.top-h-y:P=w>=C?m.bottom+y:Math.max(10,m.top-h-y),o({top:P,left:x}),n(true);};useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let p=m=>{t(m),n(false);},u=e?yp[e]:null,d=u?.color||lh;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?n(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:u?.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:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ga,{children:jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(yp).map(([m,f])=>jsxs("button",{onClick:()=>p(m),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:f.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(ch,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var dh=[{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 Vs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),d=(Wi()?.themeName||"dark")==="dark",m=()=>{if(!l.current)return;let x=l.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,P=320,O=380,T=4,D=x.left;D+P>C-10&&(D=C-P-10),D<10&&(D=10);let M=w-x.bottom,N=x.top,z;M>=O+T?z=x.bottom+T:N>=O+T?z=x.top-O-T:z=M>=N?x.bottom+T:Math.max(10,x.top-O-T),i({top:z,left:D}),s(true);};useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!l.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,C=D=>{let M=D.getFullYear(),N=String(D.getMonth()+1).padStart(2,"0"),z=String(D.getDate()).padStart(2,"0");return `${M}-${N}-${z}`},P=C(w),O=new Date(w);O.setDate(O.getDate()+x);let T=C(O);a(P,T),s(false);},v=()=>{if(!e||!t)return "Set date";let x=O=>{if(O instanceof Date)return O;if(typeof O!="string"||!O.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=O.split("-").map(Number);if(T.length!==3||T.some(z=>isNaN(z)))return null;let D=T[0],M=T[1],N=T[2];return D===void 0||M===void 0||N===void 0?null:new Date(D,M-1,N)},w=x(e),C=x(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${P[w.getMonth()]} ${w.getDate()} \u2013 ${P[C.getMonth()]} ${C.getDate()}`},b=e&&t,y=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:b?`${v()}`:"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:v()})]}),n&&jsx(ga,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"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:d?"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:d?"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:dh.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"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:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[i,c]=useState(""),[l,p]=useState({top:0,left:0}),u=useRef(null),d=useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,C=300,P=380,O=4,T=y.right-C;T<10&&(T=y.left),T+C>w-10&&(T=w-C-10);let D=x-y.bottom,M=y.top,N;D>=P+O?N=y.bottom+O:M>=P+O?N=y.top-P-O:N=D>=M?y.bottom+O:Math.max(10,y.top-P-O),p({top:N,left:T}),o(true);};useEffect(()=>{let y=x=>{u.current&&!u.current.contains(x.target)&&!d.current?.contains(x.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=x=>{x.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let x=e.some(w=>w.id===y.id);a(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),b=e.slice(0,n),h=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:d,onClick:()=>s?o(false):m(),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:[b.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),h>0&&jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):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(ga,{children:jsxs("div",{ref:u,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:y=>c(y.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:v.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"}):v.map(y=>{let x=e.some(w=>w.id===y.id);return jsxs("button",{onClick:()=>f(y),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:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.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:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#00E5CC":"transparent"},children:x?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(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 zi(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let u=p;return u.taskId||u.targetId||""}).filter(Boolean);r.set(c.id,l);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,i=c=>{if(!s.has(c)){s.add(c),o.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(o.has(p))return true}}return o.delete(c),false};return i(a)}function _s({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[i,c]=useState(false),[l,p]=useState(""),[u,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,b]=useState(null),h=useRef(null),y=useRef(null),x=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),D=window.innerHeight,M=window.innerWidth,N=300,z=u?380:120,$=4,Y=T.right-N;Y<10&&(Y=T.left),Y+N>M-10&&(Y=M-N-10);let A=D-T.bottom,Se=T.top,W;A>=z+$?W=T.bottom+$:Se>=z+$?W=T.top-z-$:W=A>=Se?T.bottom+$:Math.max(10,T.top-z-$),f({top:W,left:Y}),c(true);};useEffect(()=>{if(!i||!y.current)return;let T=y.current.getBoundingClientRect(),D=window.innerHeight,M=window.innerWidth,N=300,z=u?380:120,$=4,Y=T.right-N;Y<10&&(Y=T.left),Y+N>M-10&&(Y=M-N-10);let A=D-T.bottom,Se=T.top,W;A>=z+$?W=T.bottom+$:Se>=z+$?W=T.top-z-$:W=A>=Se?T.bottom+$:Math.max(10,T.top-z-$),f({top:W,left:Y});},[u,i]),useEffect(()=>{let T=D=>{h.current&&!h.current.contains(D.target)&&!y.current?.contains(D.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useEffect(()=>{let T=D=>{D.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]);let w=T=>{let D=t.includes(T),M=a.find(N=>N.id===T);if(b(null),D){let N=t.filter(z=>z!==T);r(N),N.length===0&&d(false);}else {if(s&&zi(a,T,e)){let z=`Cannot add "${M?.title||T}" as dependency - would create circular reference`;b(z),o?.(T,M?.title||T),setTimeout(()=>b(null),3e3);return}r([...t,T]),d(true);}},C=()=>{let T=!u;d(T),T||r([]);},P=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),O=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:y,onClick:()=>i?c(false):x(),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:O,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:O},children:t.length})]}),i&&jsx(ga,{children:jsxs("div",{ref:h,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.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:[v&&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:v})]}),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:C,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:u?"#00E5CC":"transparent",borderColor:u?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:u&&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"})]})}),u&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:T=>p(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:P.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"}):P.map(T=>{let D=t.includes(T.id);return jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.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:D?"#00E5CC":"transparent",borderColor:D?"#00E5CC":"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"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var zn=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:u,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:$i.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:u,style:v,...l,...p,onClick:()=>a?.(e),children:t(e)});let b=i.filter(w=>e.assignedUserIds?.includes(w.id)),h=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:u,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,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";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[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:y.slice(0,4).map((w,C)=>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:P=>{P.currentTarget.style.display="none";}}),C===3&&y.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:["+",y.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:h?"line-through":"none",opacity:h?.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(Mo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Vs,{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,C)=>o?.(e.id,{startDate:w,endDate:C})})}),i.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Fo,{assignedUsers:b,availableUsers:i,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(_s,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:c,onChange:w=>o?.(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:"#00E5CC"},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:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));zn.displayName="Card";var Gi={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"}},Ep=({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 Mp({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=[...Object.entries(Gi).map(([b,h])=>({id:b,label:h.label,color:h.color,icon:h.icon})),...r.filter(b=>!Object.keys(Gi).includes(b.id)).map(b=>({id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}))],u=()=>{let b=Gi[e];if(b)return {...b,id:e};let h=r.find(y=>y.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Gi.todo,id:"todo"}},d=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,x=180,w=280,C=4,P=b.right-x;P<10&&(P=b.left),P+x>y-10&&(P=y-x-10);let O=h-b.bottom,T=b.top,D;O>=w+C?D=b.bottom+C:T>=w+C?D=b.top-w-C:D=O>=T?b.bottom+C:Math.max(10,b.top-w-C),i({top:D,left:P}),s(true);};useEffect(()=>{let b=h=>{c.current&&!c.current.contains(h.target)&&!l.current?.contains(h.target)&&s(false);};if(n)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{let b=h=>{h.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]);let m=b=>{t(b),s(false);},f=u(),v=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>n?s(false):d(),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:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsx(Ep,{icon:f.icon,color:v})}),n&&jsx(ga,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:p.map(b=>jsxs("button",{onClick:()=>m(b.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:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx(Ep,{icon:b.icon,color:b.color}),jsx("span",{className:"font-semibold",children:b.label}),e===b.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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},b.id))})]})})]})}var Pp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Fp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Pp[s]||Pp.en,[i,c]=useState(false),[l,p]=useState(false),[u,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),b=useRef(null),h=useRef(null);useEffect(()=>{if(i&&b.current){let C=b.current.getBoundingClientRect();f({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),useEffect(()=>{let C=P=>{v.current&&!v.current.contains(P.target)&&!b.current?.contains(P.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),useEffect(()=>{let C=P=>{P.key==="Escape"&&(c(false),p(false),d(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select());},[l]);let y=()=>{p(true),d(e);},x=()=>{let C=u.trim();C&&C!==e&&t(C),p(false),c(false),d(e);},w=C=>{C.key==="Enter"?x():C.key==="Escape"&&(p(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:b,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(ga,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.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:o.renameColumn}),jsx("input",{ref:h,type:"text",value:u,onChange:C=>d(C.target.value),onKeyDown:w,onBlur:x,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-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,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:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var is=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:u=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:b=false,className:h,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),P=useRef(null),O=p??ap(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>P.current,estimateSize:()=>u,enabled:O}),D=t.filter(Y=>!Y.metadata?.isContainer).length;if(a)return jsx("div",{ref:w,className:h,children:a(e,t)});let N=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let Y=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:Y}:Y>=80?{state:"warning",percentage:Y}:Y>=60?{state:"approaching",percentage:Y}:{state:"ok",percentage:Y}})(),z=N.state==="exceeded",$=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",z&&"ring-2 ring-asakaa-accent-red",h),children:[n?n(e,D):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:g($()),children:[D,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&N.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${N.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[N.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"})]}),N.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"})]}),N.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"})}),N.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"})]})]}),(f||v)&&jsx(Fp,{columnTitle:e.title,onRename:Y=>f?.(e.id,Y),onDelete:v?()=>v(e.id):void 0,isDeletable:b,locale:x}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!d&&jsx("div",{ref:P,className:"asakaa-column-cards",style:{maxHeight:O?"600px":void 0},children:jsx(SortableContext,{items:t.map(Y=>Y.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"})}):O?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(Y=>{let A=t[Y.index];return A?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Y.start}px)`},children:jsx(zn,{card:A,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l})},A.id):null})}):t.map(Y=>jsx(zn,{card:Y,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l},Y.id))})})]})});is.displayName="Column";function Sc({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):o(e),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:p=>o(p.target.value),onBlur:c,onKeyDown:l,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Ph(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function $p(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(u=>u===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Fh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Lh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ah=["\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 Op({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:u=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let b=i==="dark",[h,y]=useState(false),[x,w]=useState([]),[C,P]=useState(0),[O,T]=useState(null),[D,M]=useState(false),N=useRef(null),z=useRef(null),$=useRef(null),Y=useRef(null),A=useCallback((oe,Be)=>{let le=Ph(oe,Be);if(T(le),le){let He=r.filter($e=>$e.name.toLowerCase().includes(le.query)||$e.email&&$e.email.toLowerCase().includes(le.query)).slice(0,5);w(He),y(He.length>0),P(0);}else y(false),w([]);},[r]),Se=oe=>{let Be=oe.target.value;if(t(Be),A(Be,oe.target.selectionStart||0),N.current){N.current.style.height="24px";let le=N.current.scrollHeight,He=280,$e=Math.min(le,He);N.current.style.height=`${$e}px`,N.current.style.overflowY=le>He?"auto":"hidden";}},W=()=>{N.current&&A(e,N.current.selectionStart||0);},Ce=useCallback(oe=>{if(!O||!N.current)return;let Be=e.slice(0,O.start),le=e.slice(O.end),He=`@${oe.name.replace(/\s+/g,"")} `,$e=Be+He+le;t($e),y(false),T(null),setTimeout(()=>{if(N.current){let Pe=O.start+He.length;N.current.selectionStart=Pe,N.current.selectionEnd=Pe,N.current.focus();}},0);},[O,e,t]),R=oe=>{if(h&&x.length>0)switch(oe.key){case "ArrowDown":oe.preventDefault(),P(Be=>Be<x.length-1?Be+1:0);break;case "ArrowUp":oe.preventDefault(),P(Be=>Be>0?Be-1:x.length-1);break;case "Enter":{oe.preventDefault();let Be=x[C];Be&&Ce(Be);break}case "Tab":{oe.preventDefault();let Be=x[C];Be&&Ce(Be);break}case "Escape":oe.preventDefault(),y(false);break}else oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),a());};useEffect(()=>{let oe=Be=>{z.current&&!z.current.contains(Be.target)&&N.current&&!N.current.contains(Be.target)&&y(false),Y.current&&!Y.current.contains(Be.target)&&M(false);};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]);let we=useCallback(oe=>{if(!N.current)return;let Be=N.current.selectionStart||e.length,le=e.slice(0,Be)+oe+e.slice(Be);t(le),M(false),setTimeout(()=>{if(N.current){let He=Be+oe.length;N.current.selectionStart=He,N.current.selectionEnd=He,N.current.focus();}},0);},[e,t]),G=useCallback(oe=>{if(!m||!oe.target.files)return;let Be=Array.from(oe.target.files),le=v*1024*1024,He=Be.filter($e=>$e.size>le?(console.warn(`File ${$e.name} exceeds max size of ${v}MB`),false):true);He.length>0&&m(He),oe.target.value="";},[m,v]),Ve=useCallback(oe=>oe.type.startsWith("image/")?Image:oe.type.includes("pdf")||oe.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(h&&z.current){let oe=z.current.children[C];oe&&oe.scrollIntoView({block:"nearest"});}},[C,h]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map(oe=>{let Be=Ve(oe.file),le=oe.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",b?"bg-white/10":"bg-gray-100"),children:[le&&oe.preview?jsx("img",{src:oe.preview,alt:oe.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Be,{className:g("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",b?"text-white":"text-gray-900"),children:oe.file.name}),jsx("p",{className:g("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Lh(oe.file.size)})]}),f&&jsx("button",{onClick:()=>f(oe.id),className:g("p-0.5 rounded-full transition-colors",b?"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"})})]},oe.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>M(!D),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:D&&jsx(motion.div,{ref:Y,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",b?"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:Ah.map(oe=>jsx("button",{type:"button",onClick:()=>we(oe),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",b?"hover:bg-white/10":"hover:bg-gray-100"),children:oe},oe))})})})]}),u&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:$,type:"file",multiple:true,onChange:G,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:N,value:e,onChange:Se,onSelect:W,onKeyDown:R,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",b?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":b?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?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:h&&x.length>0&&jsx(motion.div,{ref:z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((oe,Be)=>jsxs("button",{type:"button",onClick:()=>Ce(oe),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Be===C?b?"bg-white/10":"bg-gray-100":b?"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:oe.color||"#8B5CF6"},children:Fh(oe.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",b?"text-white":"text-gray-900"),children:oe.name}),oe.email&&jsx("p",{className:g("text-xs truncate",b?"text-[#6B7280]":"text-gray-500"),children:oe.email})]})]},oe.id))})})]})]})]})}function Hp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:i.value},c):jsx("span",{children:i.value},c))})}var qi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function ls({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[i,c]=useState(false),[l,p]=useState(""),[u,d]=useState(false),[m,f]=useState(qi[10]||"#00E5CC"),[v,b]=useState({top:0,left:0}),h=useRef(null),y=useRef(null),x=useRef(null),w=useRef(null),C=t.filter(N=>N.name.toLowerCase().includes(l.toLowerCase())),P=t.some(N=>N.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&y.current){let N=y.current.getBoundingClientRect();b({top:N.bottom+6,left:N.left});}},[i]),useEffect(()=>{let N=z=>{let $=z.target,Y=h.current?.contains($),A=x.current?.contains($);!Y&&!A&&(c(false),p(""),d(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useEffect(()=>{i&&w.current&&w.current.focus();},[i]);let O=N=>{let z=e.some($=>$.id===N.id);a(z?e.filter($=>$.id!==N.id):[...e,N]);},T=async()=>{if(!(!r||!l.trim())){d(true);try{let N=await r(l.trim(),m);N&&(a([...e,N]),p(""),f(qi[Math.floor(Math.random()*qi.length)]||"#00E5CC"));}finally{d(false);}}},D=(N,z)=>{z.stopPropagation(),a(e.filter($=>$.id!==N));},M={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:h,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,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:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:x,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:v.top,left:v.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:l,onChange:N=>p(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&l.trim()&&!P&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.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=>D(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:C.length>0?C.map(N=>{let z=e.some($=>$.id===N.id);return jsxs("button",{type:"button",onClick:()=>O(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:n.textPrimary},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:$=>{z||($.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)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!P&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:qi.map(N=>jsx("button",{type:"button",onClick:()=>f(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:m===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:T,disabled:u,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:u?.7:1},children:[u?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function Mc({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:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Wp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Mc,{tag:s,size:a},s.id)),n>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:["+",n]})]})}var Ao=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{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 zp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function zh(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Gh({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Pc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=zh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=zp(e.loggedMinutes),l=e.estimateMinutes?zp(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(Gh,{className:i[t]}),jsx("span",{children:p})]})}function Vh(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Xi(e){let t=Vh(e);return t!==null?String(t):e}function Vp(e){let a=Xi(e).trim().toLowerCase();if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ji(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Kh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function qh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Yh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function jp({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Xh({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Fc({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:u}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Ji(t.estimateMinutes):""),[b,h]=useState(""),[y,x]=useState(false),[w,C]=useState(false),P=useRef(null);useEffect(()=>{P.current?.focus();},[]);let O=async()=>{let M=Vp(d);if(!(M<=0||!s)){x(true);try{await s({durationMinutes:M,note:b.trim()||void 0,source:"manual"}),m(""),h("");}finally{x(false);}}},T=async()=>{if(!o)return;let M=f.trim()?Vp(f):null;await o(M),C(false);},D=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),O()),M.key==="Escape"&&p?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",u),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(jp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Kh(n)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Yh,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(jp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(qh,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Xh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:P,type:"text",value:d,onChange:M=>m(M.target.value),onKeyDown:D,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:O,disabled:y||!d.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:b,onChange:M=>h(M.target.value),onKeyDown:D,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Ji(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:M=>v(M.target.value),onKeyDown:M=>{M.key==="Enter"&&T(),M.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ji(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(M=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:M.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ji(M.durationMinutes)})]},M.id))})]})]})}function ty(e){let a=Xi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function ay(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Pn({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[i,c]=useState(ay(r)),[l,p]=useState(""),[u,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=ty(i);await n(x&&x>0?x:null,l||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},b=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},h={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:h[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:i,onChange:x=>c(x.target.value),onKeyDown:b,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:x=>p(x.target.value),onKeyDown:b,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:u||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:u?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:u,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function ry(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function ny(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Ac({summary:e,showLabel:t=false,size:a="md",className:r}){let n=ry(e.health),s=ny(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",r),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function cs(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function sy(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function iy(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function ly(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function cy({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",cs(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:cs(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:cs(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function dy({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?cs(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:cs(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[n,cs(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",iy(e.status,a),sy(e.status,a)),children:ly(e.status,t)})})]})}function Ic({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",i=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",l=o?"border-white/[0.08]":"border-gray-200",p=o?"text-white/[0.92]":"text-gray-900",u=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",u,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",u,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",i,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",u),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(cy,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",l),children:m.map(f=>jsx(dy,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",u),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function ds(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Ty(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function tm(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==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(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Ny(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 Io({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:u,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:b,mentionableUsers:h=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:P=false,timerElapsedSeconds:O=0,onTimeLog:T,onEstimateUpdate:D,onSoldEffortUpdate:M,onTimerStart:N,onTimerStop:z,onTimerDiscard:$,blurFinancials:Y=false}){let A=s==="dark",Se={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},W=e&&"title"in e&&!("name"in e),Ce=e,[R,we]=useState(e?tm(e,i):null),[G,Ve]=useState(false),[oe,Be]=useState(false),[le,He]=useState(false),[$e,Pe]=useState(null),[je,tt]=useState(new Date),[ee,Ae]=useState(false),[ot,Ie]=useState(false),[zt,st]=useState(""),[bt,Ee]=useState(false),[Dt,ht]=useState(false),[_e,dt]=useState(false),[L,J]=useState(false),[xe,I]=useState(""),j=useRef(null),ke=useRef(null),[Ue,ue]=useState(""),at=useRef(null),[yt,Ye]=useState(""),[vt,Xt]=useState(false),[wt,Ut]=useState([]),[Ht,he]=useState(""),[Fe,Qe]=useState(false),rt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let S=tm(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),we(S),I(S.description||""),ue(S.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!xe)return;let S=setTimeout(()=>{let H=ke.current;H&&(H.style.height="auto",H.style.height=`${Math.max(100,H.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,xe]),useEffect(()=>()=>{j.current&&clearTimeout(j.current),at.current&&clearTimeout(at.current);},[]),useEffect(()=>{t&&rt.current&&f.length>0&&setTimeout(()=>{rt.current&&(rt.current.scrollTop=rt.current.scrollHeight);},100);},[t,f.length]);let Tt=useCallback(S=>{we(S),W&&n&&Ce?n(Ny(S,Ce)):r&&r(S);},[W,Ce,n,r]),Ft=useCallback(()=>{Ve(false),Be(false),He(false),Pe(null),Ie(false),st(""),Ee(false);},[]),kt=useCallback((S,H)=>{if(!R)return;let Z={...R,[S]:H};Tt(Z);},[R,Tt]),Da=useCallback(()=>{let S=ke.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),aa=useCallback(S=>{I(S),setTimeout(Da,0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{if(R){let H={...R,description:S};Tt(H);}},800);},[R,Tt,Da]),cr=useCallback(S=>{ue(S),at.current&&clearTimeout(at.current),at.current=setTimeout(()=>{if(R&&S.trim()){let H={...R,name:S.trim()};Tt(H);}},800);},[R,Tt]),Xe=useCallback(S=>{let H=S.map(Z=>{let Te={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Z};return Z.type.startsWith("image/")&&(Te.preview=URL.createObjectURL(Z)),Te});Ut(Z=>[...Z,...H]);},[]),et=useCallback(S=>{Ut(H=>{let Z=H.find(Te=>Te.id===S);return Z?.preview&&URL.revokeObjectURL(Z.preview),H.filter(Te=>Te.id!==S)});},[]),Sa=useCallback(async()=>{if(!(!R||!yt.trim()&&wt.length===0||!v)){Xt(true);try{let S=$p(yt,h),H=[];if(wt.length>0&&y){let Z=wt.map(Te=>Te.file);H=await y(Z);}await v(R.id,yt.trim(),S.length>0?S:void 0,H.length>0?H:void 0),Ye(""),wt.forEach(Z=>{Z.preview&&URL.revokeObjectURL(Z.preview);}),Ut([]);}finally{Xt(false);}}},[R,yt,wt,v,h,y]),Ia=useCallback(()=>{if(!R||!Ht.trim())return;let S=R.subtasks||[],H={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Ht.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},Z=[...S,H],Te={...R,subtasks:Z};Tt(Te),he(""),Qe(false);},[R,Ht,Tt]),dr=useCallback(S=>{if(!R?.subtasks)return;let H=R.subtasks.map(Te=>Te.id===S?{...Te,progress:Te.progress===100?0:100}:Te),Z={...R,subtasks:H};Tt(Z);},[R,Tt]),xr=useCallback(S=>{if(!R?.subtasks)return;let H=R.subtasks.filter(Te=>Te.id!==S),Z={...R,subtasks:H};Tt(Z);},[R,Tt]),Ra=useCallback(S=>{let H=typeof S=="string"?new Date(S):S,Te=new Date().getTime()-H.getTime(),gt=Math.floor(Te/6e4),fe=Math.floor(Te/36e5),Ne=Math.floor(Te/864e5);return gt<1?o==="es"?"Ahora":"Just now":gt<60?o==="es"?`Hace ${gt} min`:`${gt}m ago`:fe<24?o==="es"?`Hace ${fe}h`:`${fe}h ago`:Ne<7?o==="es"?`Hace ${Ne}d`:`${Ne}d ago`:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),Ja=useCallback(S=>{if(!R)return;let H=R.progress||0;S==="completed"?H=100:S==="in-progress"&&H===0?H=10:S==="todo"&&(H=0);let Z={...R,status:S,progress:H};Tt(Z),Ve(false);},[R,Tt]),se=useCallback((S,H)=>{if(!R)return;let Z={...R,startDate:S,endDate:H};Tt(Z);},[R,Tt]),me=useCallback(()=>{let S=je.getFullYear(),H=je.getMonth(),Z=new Date(S,H,1),gt=new Date(S,H+1,0).getDate(),fe=Z.getDay(),Ne=[],ye=new Date(S,H,0).getDate();for(let Et=fe-1;Et>=0;Et--)Ne.push({date:new Date(S,H-1,ye-Et),isCurrentMonth:false});for(let Et=1;Et<=gt;Et++)Ne.push({date:new Date(S,H,Et),isCurrentMonth:true});let lt=42-Ne.length;for(let Et=1;Et<=lt;Et++)Ne.push({date:new Date(S,H+1,Et),isCurrentMonth:false});return Ne},[je]),q=useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),dt(false),!R||!u)return;let H=Array.from(S.dataTransfer.files);if(H.length!==0){J(true);try{await u(R.id,H);}finally{J(false);}}},[R,u]),pe=useCallback(async S=>{if(!R||!u||!S.target.files)return;let H=Array.from(S.target.files);if(H.length!==0){J(true);try{await u(R.id,H);}finally{J(false);}S.target.value="";}},[R,u]),ce=useCallback(S=>{S.preventDefault(),S.stopPropagation(),dt(true);},[]),B=useCallback(S=>{S.preventDefault(),S.stopPropagation(),dt(false);},[]),re=useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),be=useCallback(S=>S.startsWith("image/")?Image:S.includes("pdf")||S.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",A?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",A?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let S=R.progress===100?0:100,Z={...R,progress:S,status:S===100?"completed":"todo"};Tt(Z);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ue,onChange:S=>cr(S.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":A?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ft(),Ve(!G);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:G&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ve(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxs("button",{onClick:()=>Ja(S.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",R.status===S.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ft(),He(!le);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((S,H)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},H)),R.assignees.length>3&&jsxs("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(S=>{let H=R.assignees?.some(Z=>Z.name===S.name);return jsxs("button",{onClick:()=>{let Z=R.assignees||[],Te;H?Te=Z.filter(gt=>gt.name!==S.name):Te=[...Z,S],kt("assignees",Te);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",H&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",A?"text-white":"text-gray-900"),children:S.name}),H&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Pe($e?null:"start"),tt(R.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:$e&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,H=new Date(S);H.setDate(S.getDate()+1);let Z=new Date(S);Z.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Te=new Date(S);Te.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let gt=new Date(S);gt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let fe=new Date(S);fe.setDate(S.getDate()+14);let Ne=new Date(S);return Ne.setDate(S.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:Z,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Te,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:gt,display:gt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:fe,display:fe.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:Ne,display:Ne.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((lt,Et)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if($e==="start"){let Qt=R.endDate&<.date>R.endDate?lt.date:R.endDate;se(lt.date,Qt),Pe("end");}else {let Qt=R.startDate&<.date<R.startDate?lt.date:R.startDate;se(Qt,lt.date),Pe(null);}},children:[jsx("span",{children:lt.label}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:lt.display})]},Et))})(),jsx("div",{className:g("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{se(void 0,void 0),Pe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:$e==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="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:g("font-medium",A?"text-white":"text-gray-900"),children:je.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>tt(new Date),className:g("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>tt(new Date(je.getFullYear(),je.getMonth()-1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>tt(new Date(je.getFullYear(),je.getMonth()+1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:me().map((S,H)=>{let Z=S.date.toDateString()===new Date().toDateString(),Te=R.startDate?.toDateString()===S.date.toDateString(),gt=R.endDate?.toDateString()===S.date.toDateString(),fe=Te||gt,Ne=R.startDate&&R.endDate&&S.date>=R.startDate&&S.date<=R.endDate;return jsx("button",{onClick:()=>{let ye=new Date(S.date);if($e==="start"){let lt=R.endDate&&ye>R.endDate?ye:R.endDate;se(ye,lt),Pe("end");}else {let lt=R.startDate&&ye<R.startDate?ye:R.startDate;se(lt,ye),Pe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(A?"text-white":"text-gray-900"),Z&&"ring-2 ring-[#00E5CC]",Te&&"bg-[#00E5CC] text-white",gt&&!Te&&"bg-[#7C3AED] text-white",Ne&&!fe&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!fe&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},H)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ft(),Be(!oe);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxs("button",{onClick:()=>{kt("priority",S.id),Be(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",R.priority===S.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:S=>{let H=parseInt(S.target.value),Z=R.status;H===100?Z="completed":H>0?Z="in-progress":Z="todo";let Te={...R,progress:H,status:Z};Tt(Te);},onBlur:()=>Ae(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ae(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",A?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?ds(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>ht("estimate"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ds(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>ht("estimate"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Dt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Pn,{mode:"estimate",locale:o,isDark:A,currentValue:w?.estimateMinutes||null,onSave:async S=>{await D?.(R.id,S),ht(false);},onClose:()=>ht(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:Y?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?ds(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>ht("quoted"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ds(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>ht("quoted"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Dt==="quoted"&&!Y&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Pn,{mode:"quoted",locale:o,isDark:A,currentValue:R.quotedMinutes||null,onSave:async S=>{M?(await M(R.id,S),we(H=>H?{...H,quotedMinutes:S}:null)):kt("quotedMinutes",S),ht(false);},onClose:()=>ht(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):P?jsxs("button",{type:"button",onClick:()=>z?.(R.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),Ty(O||0)]}):jsx("button",{type:"button",onClick:()=>N?.(R.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>ht("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":A?"text-white":"text-gray-900"),children:[ds(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",ds(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Dt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Pn,{mode:"log",locale:o,isDark:A,currentValue:null,onSave:async(S,H)=>{S&&await T?.(R.id,{durationMinutes:S,note:H,source:"manual"}),ht(false);},onClose:()=>ht(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(ls,{selectedTags:R.tags||[],availableTags:c,onChange:S=>{kt("tags",S);},onCreateTag:l,theme:Se})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(S=>{let H=m.find(Z=>Z.id===S);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[H?.name||S.slice(0,8),jsx("button",{onClick:()=>{let Z=(R.dependencies||[]).filter(Te=>Te!==S);kt("dependencies",Z);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},S)})}),jsxs("button",{onClick:()=>{Ft(),Ie(!ot);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ot&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(false),st("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:zt,onChange:S=>st(S.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(S=>S.id!==R.id).filter(S=>zt===""||S.name.toLowerCase().includes(zt.toLowerCase())).map(S=>{let H=R.dependencies?.includes(S.id);return jsxs("button",{onClick:()=>{let Z=R.dependencies||[],Te;H?Te=Z.filter(gt=>gt!==S.id):Te=[...Z,S.id],kt("dependencies",Te);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",H&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-[#00E5CC] border-[#00E5CC]":A?"border-white/30":"border-gray-300"),children:H&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",A?"text-white":"text-gray-900"),children:S.name}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ft(),Ee(!bt);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:R.color||"#6366F1"}}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:Ao.find(S=>S.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:bt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Ao.map(S=>{let H=R.color===S.value;return jsx("button",{onClick:()=>{kt("color",S.value),Ee(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:H?S.value:void 0},title:S.name,children:H&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:S=>kt("isMilestone",S.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":A?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ke,value:xe,onChange:S=>aa(S.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(S=>S.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((S,H)=>(S.position??0)-(H.position??0)).map(S=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>dr(S.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.progress===100?"bg-green-500 border-green-500":A?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:S.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:S.name}),jsx("button",{onClick:()=>xr(S.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},S.id))}),Fe?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Ht,onChange:S=>he(S.target.value),onKeyDown:S=>{S.key==="Enter"&&Ht.trim()?Ia():S.key==="Escape"&&(Qe(false),he(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",A?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Ia,disabled:!Ht.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Ht.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":A?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Qe(false),he("");},className:g("p-2 rounded-lg transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Qe(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(S=>{let H=be(S.type),Z=S.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Z&&S.thumbnailUrl?jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsx(H,{className:g("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:S.name}),jsx("p",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:re(S.size)})]}),d&&jsx("button",{onClick:()=>d(S.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxs("div",{onDragOver:ce,onDragLeave:B,onDrop:q,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",_e?A?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",L&&"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:!u||L}),L?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",_e?"text-[#00E5CC]":A?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:_e?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="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"})]})}),!u&&jsx("p",{className:g("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",A?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
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 Py 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,Diamond,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Paperclip,Users,Tag,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,CalendarClock,FileText,Timer,Clock,CalendarCheck,Flag,CircleDot,Filter,Rows3,MoreHorizontal,Moon,Sun,Palette,Check,ZoomOut,ZoomIn,ChevronsDownUp,User,Keyboard,ChevronRight,Image,File,CalendarDays,X,Hourglass,Play,Square,Upload,MessageSquare,Rows4,Rows2,Zap,Layers,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,Columns3,ChevronLeft,GripVertical,Smile,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var Dl=(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 Nl=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 [Nl.Translate.toString(e),Nl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:n}=e;return t+" "+a+"ms "+n}}});function g(...e){return twMerge(clsx(e))}function Sl(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 Dy(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function fd(e,t){return e.length===0?1e3:t===0?Sl(null,e[0].position):t>=e.length?Sl(e[e.length-1].position,null):Sl(e[t-1].position,e[t].position)}function Cm(e,t=100){return e>t}var Ny=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 Sy(e,t,a,n){let r=t*Math.pow(a,e-1),s=r*.2*Math.random();return Math.min(r+s,n)}async function El(e,t={}){let{maxAttempts:a=3,initialDelay:n=1e3,backoffMultiplier:r=2,maxDelay:s=1e4,shouldRetry:o=Ny,onRetry:i}=t,c,l=0;for(let u=1;u<=a;u++){l=u;try{return {data:await e(),attempts:l,success:!0}}catch(p){if(c=p,u===a||!o(c,u))return {error:c,attempts:l,success:false};let m=Sy(u,n,r,s);if(i)try{i(c,u,m);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,m));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function Ey(e,t=3){let a;for(let n=1;n<=t;n++)try{return {data:e(),success:!0}}catch(r){if(a=r,n===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function My(e,t={}){return async(...a)=>El(()=>e(...a),t)}var bd=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 Tm=(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))(Tm||{}),ds=class ds{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:n,message:r,component:s,...o}=t,i=`[${a}] [${n}] [${s}]`,c=Object.keys(o).length>0;switch(n){case "DEBUG":console.debug(i,r,c?o:"");break;case "INFO":console.info(i,r,c?o:"");break;case "WARN":console.warn(i,r,c?o:"");break;case "ERROR":console.error(i,r,c?o:""),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",...ds.globalOptions};}static configure(t){ds.globalOptions={...ds.globalOptions,...t};}child(t){return new ds({...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,n){this.log(3,t,{...n,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ml((a,n)=>{this.log(0,`${t} completed`,{...n,action:t,duration:a});},true):new Ml(()=>{},false)}log(t,a,n){if(!this.options.enabled||t<this.options.minLevel)return;let r={timestamp:new Date().toISOString(),level:Tm[t],message:a,component:this.options.componentName,...n};this.options.onLog(r);}};ds.globalOptions={};var hd=ds,Ml=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}},Dm=new hd;function Fy(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 Ly(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],n=e.cards.map(s=>{let o=e.columns.find(i=>i.id===s.columnId);return [s.id,yd(s.title),yd(s.description||""),yd(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...n.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function Ay(e,t,a){let n=t;if(!n){let o=document.querySelector(".asakaa-board");o&&(n=o.parentElement||o);}if(n)try{let o=await Py(n,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:n.scrollWidth,windowHeight:n.scrollHeight}),i=o.toDataURL("image/png"),c=297,l=210,u=o.width/o.height,p=c-20,d=p/u;d>l-20&&(d=l-20,p=d*u);let m=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,c,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(c-p)/2;return m.addImage(i,"PNG",f,20,p,d),m}catch(o){console.error("Error capturing board:",o);}let r=new jsPDF,s=20;return r.setFontSize(20),r.text(e.title||"Kanban Board",20,s),s+=10,r.setFontSize(10),r.setTextColor(128,128,128),r.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,r.setTextColor(0,0,0),e.columns.forEach(o=>{let i=e.cards.filter(c=>c.columnId===o.id);s>250&&(r.addPage(),s=20),r.setFontSize(16),r.setFont("helvetica","bold"),r.text(o.title,20,s),s+=8,i.length===0?(r.setFontSize(10),r.setFont("helvetica","italic"),r.setTextColor(128,128,128),r.text("No cards in this column",20,s),r.setTextColor(0,0,0),s+=10):i.forEach(c=>{if(s>260&&(r.addPage(),s=20),r.setFontSize(12),r.setFont("helvetica","bold"),r.text(c.title,25,s),s+=6,c.description){r.setFontSize(9),r.setFont("helvetica","normal");let u=r.splitTextToSize(c.description,160);r.text(u,25,s),s+=u.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),l.push(u.join(" \u2192 "));}l.length>0&&(r.setFontSize(8),r.setTextColor(100,100,100),r.text(l.join(" \u2022 "),25,s),r.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),r}function yd(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Sm(e,t,a,n){switch(t){case "json":return Fy(e,n);case "csv":return Ly(e);case "pdf":return await Ay(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Em(e,t,a){let n=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${n}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${n}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:o[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Iy(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 Ry(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=Mm(t[0]),n=[],r=new Map,s=[];for(let o=1;o<t.length;o++)try{let i=Mm(t[o]||"");if(i.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((m,f)=>{l[m]=i[f]||"";});let u=l.Column||"Unnamed";r.has(u)||r.set(u,{id:`col-${r.size+1}`,title:u,position:r.size+1,cardIds:[]});let p=r.get(u),d={id:l["Card ID"]||`card-${o}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};n.push(d),p.cardIds.push(d.id);}catch(i){s.push(`Line ${o+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return n.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:n.length,columnsImported:r.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 Mm(e){let t=[],a="",n=false;for(let r=0;r<e.length;r++){let s=e[r],o=e[r+1];s==='"'&&n&&o==='"'?(a+='"',r++):s==='"'?n=!n:s===","&&!n?(t.push(a),a=""):a+=s;}return t.push(a),t}function Pm(e,t){switch(t){case "json":return Iy(e);case "csv":return Ry(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Fm(e){return new Promise((t,a)=>{let n=new FileReader;n.onload=r=>{r.target?.result?t(r.target.result):a(new Error("Failed to read file"));},n.onerror=()=>a(new Error("Failed to read file")),n.readAsText(e);})}var xd=createContext(null);function Lm(){return useContext(xd)}var Am=createContext(null);function Im({children:e,themeName:t}){return jsx(Am.Provider,{value:{themeName:t},children:e})}function Pl(){return useContext(Am)}function Fa({children:e,container:t}){let[a,n]=useState(false),r=Lm(),s=Pl();if(useEffect(()=>(n(true),()=>n(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(r){let{theme:i,themeName:c}=r,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Hm={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},jy="#BDC3C7",Vy=({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 us({priority:e,onChange:t,className:a}){let[n,r]=useState(false),[s,o]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,b=160,w=220,h=4,x=m.right-b;x<10&&(x=m.left),x+b>v-10&&(x=v-b-10);let y=f-m.bottom,k=m.top,M;y>=w+h?M=m.bottom+h:k>=w+h?M=m.top-w-h:M=y>=k?m.bottom+h:Math.max(10,m.top-w-h),o({top:M,left:x}),r(true);};useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&!c.current?.contains(f.target)&&r(false);};if(n)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]),useEffect(()=>{let m=f=>{f.key==="Escape"&&r(false);};if(n)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]);let u=m=>{t(m),r(false);},p=e?Hm[e]:null,d=p?.color||jy;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>n?r(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.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:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),n&&jsx(Fa,{children:jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(Hm).map(([m,f])=>jsxs("button",{onClick:()=>u(m),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:f.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(Vy,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Gy=[{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 Pi({startDate:e,endDate:t,onChange:a,className:n}){let[r,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),d=(Pl()?.themeName||"dark")==="dark",m=()=>{if(!l.current)return;let x=l.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,M=320,z=380,L=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let D=y-x.bottom,S=x.top,V;D>=z+L?V=x.bottom+L:S>=z+L?V=x.top-z-L:V=D>=S?x.bottom+L:Math.max(10,x.top-z-L),i({top:V,left:N}),s(true);};useEffect(()=>{let x=y=>{c.current&&!c.current.contains(y.target)&&!l.current?.contains(y.target)&&s(false);};if(r)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[r]),useEffect(()=>{let x=y=>{y.key==="Escape"&&s(false);};if(r)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]);let f=x=>{let y=new Date,k=N=>{let D=N.getFullYear(),S=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${D}-${S}-${V}`},M=k(y),z=new Date(y);z.setDate(z.getDate()+x);let L=k(z);a(M,L),s(false);},v=()=>{if(!e||!t)return "Set date";let x=z=>{if(z instanceof Date)return z;if(typeof z!="string"||!z.match(/^\d{4}-\d{2}-\d{2}$/))return null;let L=z.split("-").map(Number);if(L.length!==3||L.some(V=>isNaN(V)))return null;let N=L[0],D=L[1],S=L[2];return N===void 0||D===void 0||S===void 0?null:new Date(N,D-1,S)},y=x(e),k=x(t);if(!y||!k||isNaN(y.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[y.getMonth()]} ${y.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},b=e&&t,h=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),x<y})();return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:l,onClick:()=>r?s(false):m(),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:b?`${v()}`:"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:v()})]}),r&&jsx(Fa,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"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:d?"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:d?"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:Gy.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"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:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Bo({assignedUsers:e=[],availableUsers:t,onChange:a,className:n,maxVisibleAvatars:r=3,variante:s,nombreDeLaTarea:o,es:i=true}){let[c,l]=useState(false),[u,p]=useState(""),[d,m]=useState({top:0,left:0}),f=useRef(null),v=useRef(null),b=()=>{if(!v.current)return;let k=v.current.getBoundingClientRect(),M=window.innerHeight,z=window.innerWidth,L=300,N=380,D=4,S=k.right-L;S<10&&(S=k.left),S+L>z-10&&(S=z-L-10);let V=M-k.bottom,U=k.top,W;V>=N+D?W=k.bottom+D:U>=N+D?W=k.top-N-D:W=V>=U?k.bottom+D:Math.max(10,k.top-N-D),m({top:W,left:S}),l(true);};useEffect(()=>{let k=M=>{f.current&&!f.current.contains(M.target)&&!v.current?.contains(M.target)&&(l(false),p(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(l(false),p(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let M=e.some(z=>z.id===k.id);a(M?e.filter(z=>z.id!==k.id):[...e,k]);},h=t.filter(k=>k.name.toLowerCase().includes(u.toLowerCase())),x=e.slice(0,r),y=e.length-r;return jsxs("div",{className:`relative ${n||""}`,children:[s==="v6"?jsxs("button",{ref:v,type:"button","data-resp-v6":true,onClick:()=>c?l(false):b(),"aria-label":e.length>0?`${i?"Responsable":"Owner"}: ${e.map(k=>k.name).join(", ")}`:`${i?"Sin responsable. Asignar":"No owner. Assign"} ${o??""}`.trim(),title:e.map(k=>k.name).join(", ")||void 0,style:{width:22,height:22,padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",cursor:"pointer",position:"relative",border:e.length>0?0:"1px dashed var(--v6-tenue-borde, #7A848E)",background:e.length>0?"var(--v6-neutro-fondo, #E1E4E8)":"transparent",color:e.length>0?"var(--v6-texto, #0E1114)":"var(--v6-tenue, #5F6972)",fontSize:11,fontWeight:600,letterSpacing:"-0.03em",overflow:"hidden"},children:[e.length===0?jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[jsx("path",{d:"M5 12h14"}),jsx("path",{d:"M12 5v14"})]}):e[0]?.avatar?jsx("img",{src:e[0].avatar,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):e[0]?.initials,e.length>1&&jsxs("span",{"aria-hidden":true,style:{position:"absolute",right:-4,bottom:-3,minWidth:12,height:12,padding:"0 2px",borderRadius:6,fontSize:8,lineHeight:"12px",background:"var(--v6-tarjeta, #fff)",color:"var(--v6-texto-2, #4D5761)",boxShadow:"0 0 0 1px var(--v6-borde, #E2E5E9)"},children:["+",e.length-1]})]}):jsx("button",{ref:v,onClick:()=>c?l(false):b(),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:[x.map(k=>jsx("div",{className:"asakaa-avatar",title:k.name,children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"asakaa-avatar-img"}):k.initials},k.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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"})]})})}),c&&jsx(Fa,{children:jsxs("div",{ref:f,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.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:u,onChange:k=>p(k.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:h.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"}):h.map(k=>{let M=e.some(z=>z.id===k.id);return jsxs("button",{onClick:()=>w(k),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:z=>{z.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:z=>{z.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:k.color,color:"#fff"},children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.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:k.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:M?"#00E5CC":"transparent"},children:M?"\u2713":""})]},k.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),l(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 Fl(e,t,a){let n=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);n.set(c.id,l);}});let r=n.get(a)||[];n.set(a,[...r,t]);let s=new Set,o=new Set,i=c=>{if(!s.has(c)){s.add(c),o.add(c);let l=n.get(c)||[];for(let u of l){if(!s.has(u)&&i(u))return true;if(o.has(u))return true}}return o.delete(c),false};return i(a)}function Li({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:n,className:r,validateCircular:s=true,onCircularDependencyError:o}){let[i,c]=useState(false),[l,u]=useState(""),[p,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,b]=useState(null),w=useRef(null),h=useRef(null),x=()=>{if(!h.current)return;let L=h.current.getBoundingClientRect(),N=window.innerHeight,D=window.innerWidth,S=300,V=p?380:120,U=4,W=L.right-S;W<10&&(W=L.left),W+S>D-10&&(W=D-S-10);let E=N-L.bottom,Pe=L.top,J;E>=V+U?J=L.bottom+U:Pe>=V+U?J=L.top-V-U:J=E>=Pe?L.bottom+U:Math.max(10,L.top-V-U),f({top:J,left:W}),c(true);};useEffect(()=>{if(!i||!h.current)return;let L=h.current.getBoundingClientRect(),N=window.innerHeight,D=window.innerWidth,S=300,V=p?380:120,U=4,W=L.right-S;W<10&&(W=L.left),W+S>D-10&&(W=D-S-10);let E=N-L.bottom,Pe=L.top,J;E>=V+U?J=L.bottom+U:Pe>=V+U?J=L.top-V-U:J=E>=Pe?L.bottom+U:Math.max(10,L.top-V-U),f({top:J,left:W});},[p,i]),useEffect(()=>{let L=N=>{w.current&&!w.current.contains(N.target)&&!h.current?.contains(N.target)&&(c(false),u(""));};if(i)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i]),useEffect(()=>{let L=N=>{N.key==="Escape"&&(c(false),u(""));};if(i)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i]);let y=L=>{let N=t.includes(L),D=a.find(S=>S.id===L);if(b(null),N){let S=t.filter(V=>V!==L);n(S),S.length===0&&d(false);}else {if(s&&Fl(a,L,e)){let V=`Cannot add "${D?.title||L}" as dependency - would create circular reference`;b(V),o?.(L,D?.title||L),setTimeout(()=>b(null),3e3);return}n([...t,L]),d(true);}},k=()=>{let L=!p;d(L),L||n([]);},M=a.filter(L=>L.id!==e).filter(L=>L.title.toLowerCase().includes(l.toLowerCase())||L.id.toLowerCase().includes(l.toLowerCase())),z=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:h,onClick:()=>i?c(false):x(),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:z,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:z},children:t.length})]}),i&&jsx(Fa,{children:jsxs("div",{ref:w,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.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:[v&&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:v})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&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"})]})}),p&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:L=>u(L.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:M.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"}):M.map(L=>{let N=t.includes(L.id);return jsxs("button",{onClick:()=>y(L.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:D=>{D.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:D=>{D.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:N?"#00E5CC":"transparent",borderColor:N?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:N&&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:L.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:L.id})]})]},L.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{n([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var xo=memo(({card:e,render:t,onClick:a,isSelected:n,disableDrag:r,className:s,onUpdate:o,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:r,data:{type:"card",card:e}}),v={transform:Nl.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:p,style:v,...l,...u,onClick:()=>a?.(e),children:t(e)});let b=i.filter(y=>e.assignedUserIds?.includes(y.id)),w=e.progress===100,h=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",n&&"ring-2 ring-asakaa-accent-blue",s),...l,...u,onClick:y=>{y.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:y=>{y.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:y=>{y.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((y,k)=>jsxs("div",{className:"relative",children:[jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:M=>{M.currentTarget.style.display="none";}}),k===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},y.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:w?"line-through":"none",opacity:w?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:y=>y.stopPropagation(),className:"priority-selector",children:jsx(us,{priority:e.priority,onChange:y=>o?.(e.id,{priority:y})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsx(Pi,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(y,k)=>o?.(e.id,{startDate:y,endDate:k})})}),i.length>0&&jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsx(Bo,{assignedUsers:b,availableUsers:i,onChange:y=>o?.(e.id,{assignedUserIds:y.map(k=>k.id)})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsx(Li,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:c,onChange:y=>o?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsx("span",{className:"asakaa-label",children:y},y))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},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:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));xo.displayName="Card";var Ai={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!",columns:"Columns"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task",dependencies:"Dependencies\u2026"},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"}},_m={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos los niveles",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista de seguimiento",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!",columns:"Columnas"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea",dependencies:"Dependencias\u2026"},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:"Completada"},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"}},Cd={en:Ai,es:_m};function Km(e){return Cd[e]||Cd.en}function Td(e,t){let a=Km(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 gs=createContext(Ai);function Un(){return useContext(gs)}function vo(){let e=useContext(gs);return e===Ai&&typeof document<"u"?document.documentElement.lang?.startsWith("es")??false:e.toolbar.visibility==="Visibilidad"}var Ii={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"}},Qm=({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 Zm({status:e="todo",onChange:t,className:a,customStatuses:n=[]}){let[r,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=vo()?{todo:"Por hacer","in-progress":"En progreso",completed:"Completada"}:{todo:"To do","in-progress":"In progress",completed:"Completed"},d=[...Object.entries(Ii).map(([h,x])=>({id:h,label:p[h]??x.label,color:x.color,icon:x.icon})),...n.filter(h=>!Object.keys(Ii).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let h=Ii[e];if(h)return {...h,label:p[e]??h.label,id:e};let x=n.find(y=>y.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Ii.todo,label:p.todo??Ii.todo.label,id:"todo"}},f=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),x=window.innerHeight,y=window.innerWidth,k=180,M=280,z=4,L=h.right-k;L<10&&(L=h.left),L+k>y-10&&(L=y-k-10);let N=x-h.bottom,D=h.top,S;N>=M+z?S=h.bottom+z:D>=M+z?S=h.top-M-z:S=N>=D?h.bottom+z:Math.max(10,h.top-M-z),i({top:S,left:L}),s(true);};useEffect(()=>{let h=x=>{c.current&&!c.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),useEffect(()=>{let h=x=>{x.key==="Escape"&&s(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let v=h=>{t(h),s(false);},b=m(),w=b.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>r?s(false):f(),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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:b.label,children:jsx(Qm,{icon:b.icon,color:w})}),r&&jsx(Fa,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.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:d.map(h=>jsxs("button",{onClick:()=>v(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Qm,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var eg={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function tg({columnTitle:e,onRename:t,onDelete:a,isDeletable:n=false,className:r,locale:s="en"}){let o=eg[s]||eg.en,[i,c]=useState(false),[l,u]=useState(false),[p,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),b=useRef(null),w=useRef(null);useEffect(()=>{if(i&&b.current){let k=b.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[i]),useEffect(()=>{let k=M=>{v.current&&!v.current.contains(M.target)&&!b.current?.contains(M.target)&&(c(false),u(false));};if(i)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(e));};if(i)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i,e]),useEffect(()=>{l&&w.current&&(w.current.focus(),w.current.select());},[l]);let h=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},y=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(e));};return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:b,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-[var(--pj-hover,rgba(255,255,255,0.1))]",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(Fa,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,background:"var(--pj-superficie, var(--asakaa-color-background-card, #1f1f1f))",borderColor:"var(--pj-borde, rgba(255, 255, 255, 0.15))",color:"var(--pj-texto, var(--asakaa-color-text-primary, #f4f5f8))",boxShadow:"var(--pj-elev-2, 0 20px 60px rgba(0, 0, 0, 0.8))",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold uppercase tracking-wider block mb-2 opacity-80",children:o.renameColumn}),jsx("input",{ref:w,type:"text",value:p,onChange:k=>d(k.target.value),onKeyDown:y,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm border outline-none transition-all bg-[var(--pj-superficie,rgba(255,255,255,0.05))] border-[var(--pj-borde,rgba(255,255,255,0.2))] text-[color:inherit] placeholder:opacity-50 focus:border-[var(--pj-acento,#00E5CC)]",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm hover:bg-[var(--pj-hover,rgba(255,255,255,0.1))] 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:o.rename})]}),n&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px mx-2 my-1",style:{background:"var(--pj-borde, rgba(255, 255, 255, 0.15))"}}),jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-[color:var(--pj-peligro,#f87171)] 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:o.delete})]})]})]})})})]})}var Il=e=>!String(e||"es").toLowerCase().startsWith("en"),Jy=["CO","MX","AR","CL","PE","EC","UY","BR","US","ES"];function Qy(){try{let e=typeof document<"u"?document.documentElement.dataset.pais:void 0;return e&&Jy.includes(e)?e:"CO"}catch{return "CO"}}var ag=e=>`${Il(e)?"es":"en"}-${Qy()}`;function Zy(e,t){if(!e)return "$";try{return new Intl.NumberFormat(ag(t),{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(0).find(a=>a.type==="currency")?.value??"$"}catch{return "$"}}function Ho(e,t="es",a=0){return Number.isFinite(e)?new Intl.NumberFormat(ag(t),{minimumFractionDigits:0,maximumFractionDigits:a}).format(e):"\u2014"}function nn(e,t,a="es",n={}){if(!Number.isFinite(e))return "\u2014";let r=e<0?"-":"",s=Math.abs(e),o;if(n.compacto&&s>=1e3){let c=Il(a),[l,u]=s>=1e9?[1e9,c?" mil M":"B"]:s>=1e6?[1e6,c?" M":"M"]:[1e3,c?" mil":"K"];o=Ho(s/l,a,1)+u;}else o=Ho(s,a,n.decimales??0);let i=Zy(t,a);return i==="$"||!t?`${r}$${o}${t?` ${t}`:""}`:Il(a)?`${r}${o} ${i}`:`${r}${i}${o}`}function hr(e,t="es"){if(!Number.isFinite(e))return "\u2014";let a=e<0?"-":"",n=Math.round(Math.abs(e)),r=Math.floor(n/60),s=n%60;return r===0&&s===0?"0 h":r===0?`${a}${s} min`:`${a}${Ho(r,t)} h${s?` ${s} min`:""}`}function Xn(e,t="es",a=0){return Number.isFinite(e)?`${Ho(e,t,a)}%`:"\u2014"}var ex=["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],tx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jn(e,t="es",a={}){let n=ax(e);if(!n)return "\u2014";let r=a.hoy??new Date,s=a.anio==="siempre"||a.anio!=="nunca"&&n.getFullYear()!==r.getFullYear();return Il(t)?`${n.getDate()} ${ex[n.getMonth()]}${s?` ${n.getFullYear()}`:""}`:`${tx[n.getMonth()]} ${n.getDate()}${s?`, ${n.getFullYear()}`:""}`}function ax(e){if(!e)return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;if(e.length===10&&e[4]==="-"&&e[7]==="-"){let[a=NaN,n=NaN,r=NaN]=e.split("-").map(Number),s=new Date(a,n-1,r);return isNaN(s.getTime())?null:s}let t=new Date(e);return isNaN(t.getTime())?null:t}var js=memo(({column:e,cards:t,renderColumn:a,renderCard:n,renderHeader:r,renderEmptyState:s,onCardClick:o,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:b=false,className:w,renderMetrics:h,locale:x})=>{let{setNodeRef:y,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),M=useRef(null),z=u??Cm(t.length),L=useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:z}),N=t.filter(W=>!W.metadata?.isContainer).length;if(a)return jsx("div",{ref:y,className:w,children:a(e,t)});let S=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let W=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:W}:W>=80?{state:"warning",percentage:W}:W>=60?{state:"approaching",percentage:W}:{state:"ok",percentage:W}})(),V=S.state==="exceeded",U=()=>"asakaa-column-count";return jsxs("div",{ref:y,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",w),children:[r?r(e,N):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:g(U()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&S.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${Xn(S.percentage,x==="es"?"es":"en")} capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[S.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"})]}),S.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"})]}),S.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"})}),S.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"})]})]}),(f||v)&&jsx(tg,{columnTitle:e.title,onRename:W=>f?.(e.id,W),onDelete:v?()=>v(e.id):void 0,isDeletable:b,locale:x}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!d&&jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:z?"600px":void 0},children:jsx(SortableContext,{items:t.map(W=>W.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"})}):z?jsx("div",{style:{height:`${L.getTotalSize()}px`,position:"relative"},children:L.getVirtualItems().map(W=>{let E=t[W.index];return E?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${W.start}px)`},children:jsx(xo,{card:E,render:n,onClick:o,onUpdate:i,availableUsers:c,allCards:l})},E.id):null})}):t.map(W=>jsx(xo,{card:W,render:n,onClick:o,onUpdate:i,availableUsers:c,allCards:l},W.id))})})]})});js.displayName="Column";function Nd({title:e,onSave:t,className:a}){let[n,r]=useState(false),[s,o]=useState(e),i=useRef(null);useEffect(()=>{n&&i.current&&(i.current.focus(),i.current.select());},[n]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),r(false);},l=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),r(false));};return n?jsx("input",{ref:i,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:l,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>r(true),title:"Click to edit",children:e})}function ma(e){let t=(e??"").trim().split(/\s+/).filter(n=>/[\p{L}\p{N}]/u.test(n)),a=n=>n.match(/[\p{L}\p{N}]/u)?.[0]??"";return t.length>=2?(a(t[0])+a(t[t.length-1])).toUpperCase():t.length===1?t[0].replace(/[^\p{L}\p{N}]/gu,"").slice(0,2).toUpperCase():"?"}function yx(e,t){let a=e.slice(0,t),n=a.lastIndexOf("@");if(n===-1)return null;let r=a[n-1];if(n>0&&r&&!/\s/.test(r))return null;let s=a.slice(n+1);return /\s/.test(s)?null:{start:n,end:t,query:s.toLowerCase()}}function lg(e,t){let a=[],n=/@(\S+)/g,r;for(;(r=n.exec(e))!==null;){let s=r[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(l===s||c===s||u.some(p=>p===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function xx(e){return ma(e)}function vx(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var wx=["\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 cg({value:e,onChange:t,onSubmit:a,users:n,placeholder:r,disabled:s=false,isSubmitting:o=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let b=i==="dark",[w,h]=useState(false),[x,y]=useState([]),[k,M]=useState(0),[z,L]=useState(null),[N,D]=useState(false),S=useRef(null),V=useRef(null),U=useRef(null),W=useRef(null),E=useCallback((B,ce)=>{let oe=yx(B,ce);if(L(oe),oe){let gt=n.filter(Je=>Je.name.toLowerCase().includes(oe.query)||Je.email&&Je.email.toLowerCase().includes(oe.query)).slice(0,5);y(gt),h(gt.length>0),M(0);}else h(false),y([]);},[n]),Pe=B=>{let ce=B.target.value;if(t(ce),E(ce,B.target.selectionStart||0),S.current){S.current.style.height="24px";let oe=S.current.scrollHeight,gt=280,Je=Math.min(oe,gt);S.current.style.height=`${Je}px`,S.current.style.overflowY=oe>gt?"auto":"hidden";}},J=()=>{S.current&&E(e,S.current.selectionStart||0);},de=useCallback(B=>{if(!z||!S.current)return;let ce=e.slice(0,z.start),oe=e.slice(z.end),gt=`@${B.name.replace(/\s+/g,"")} `,Je=ce+gt+oe;t(Je),h(false),L(null),setTimeout(()=>{if(S.current){let ct=z.start+gt.length;S.current.selectionStart=ct,S.current.selectionEnd=ct,S.current.focus();}},0);},[z,e,t]),R=B=>{if(w&&x.length>0)switch(B.key){case "ArrowDown":B.preventDefault(),M(ce=>ce<x.length-1?ce+1:0);break;case "ArrowUp":B.preventDefault(),M(ce=>ce>0?ce-1:x.length-1);break;case "Enter":{B.preventDefault();let ce=x[k];ce&&de(ce);break}case "Tab":{B.preventDefault();let ce=x[k];ce&&de(ce);break}case "Escape":B.preventDefault(),h(false);break}else B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),a());};useEffect(()=>{let B=ce=>{V.current&&!V.current.contains(ce.target)&&S.current&&!S.current.contains(ce.target)&&h(false),W.current&&!W.current.contains(ce.target)&&D(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let Ae=useCallback(B=>{if(!S.current)return;let ce=S.current.selectionStart||e.length,oe=e.slice(0,ce)+B+e.slice(ce);t(oe),D(false),setTimeout(()=>{if(S.current){let gt=ce+B.length;S.current.selectionStart=gt,S.current.selectionEnd=gt,S.current.focus();}},0);},[e,t]),nt=useCallback(B=>{if(!m||!B.target.files)return;let ce=Array.from(B.target.files),oe=v*1024*1024,gt=ce.filter(Je=>Je.size>oe?(console.warn(`File ${Je.name} exceeds max size of ${v}MB`),false):true);gt.length>0&&m(gt),B.target.value="";},[m,v]),Ge=useCallback(B=>B.type.startsWith("image/")?Image:B.type.includes("pdf")||B.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(w&&V.current){let B=V.current.children[k];B&&B.scrollIntoView({block:"nearest"});}},[k,w]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map(B=>{let ce=Ge(B.file),oe=B.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",b?"bg-white/10":"bg-gray-100"),children:[oe&&B.preview?jsx("img",{src:B.preview,alt:B.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(ce,{className:g("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",b?"text-white":"text-gray-900"),children:B.file.name}),jsx("p",{className:g("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:vx(B.file.size)})]}),f&&jsx("button",{onClick:()=>f(B.id),className:g("p-0.5 rounded-full transition-colors",b?"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"})})]},B.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?ma(l.name):"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>D(!N),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{ref:W,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",b?"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:wx.map(B=>jsx("button",{type:"button",onClick:()=>Ae(B),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",b?"hover:bg-white/10":"hover:bg-gray-100"),children:B},B))})})})]}),p&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:U,type:"file",multiple:true,onChange:nt,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:Pe,onSelect:J,onKeyDown:R,placeholder:r||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",b?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":b?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?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:w&&x.length>0&&jsx(motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((B,ce)=>jsxs("button",{type:"button",onClick:()=>de(B),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ce===k?b?"bg-white/10":"bg-gray-100":b?"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:B.color||"#8B5CF6"},children:xx(B.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",b?"text-white":"text-gray-900"),children:B.name}),B.email&&jsx("p",{className:g("text-xs truncate",b?"text-[#6B7280]":"text-gray-500"),children:B.email})]})]},B.id))})})]})]})]})}function dg({content:e,theme:t="dark"}){let a=t==="dark",n=[],r=/@(\S+)/g,s=0,o;for(;(o=r.exec(e))!==null;)o.index>s&&n.push({type:"text",value:e.slice(s,o.index)}),n.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&n.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:n.map((i,c)=>i.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:i.value},c):jsx("span",{children:i.value},c))})}var $l=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Vs({selectedTags:e,availableTags:t,onChange:a,onCreateTag:n,theme:r,disabled:s=false,compact:o=true}){let[i,c]=useState(false),[l,u]=useState(""),[p,d]=useState(false),[m,f]=useState($l[10]||"#00E5CC"),[v,b]=useState({top:0,left:0}),w=useRef(null),h=useRef(null),x=useRef(null),y=useRef(null),k=t.filter(S=>S.name.toLowerCase().includes(l.toLowerCase())),M=t.some(S=>S.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&h.current){let S=h.current.getBoundingClientRect();b({top:S.bottom+6,left:S.left});}},[i]),useEffect(()=>{let S=V=>{let U=V.target,W=w.current?.contains(U),E=x.current?.contains(U);!W&&!E&&(c(false),u(""),d(false));};if(i)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),useEffect(()=>{i&&y.current&&y.current.focus();},[i]);let z=S=>{let V=e.some(U=>U.id===S.id);a(V?e.filter(U=>U.id!==S.id):[...e,S]);},L=async()=>{if(!(!n||!l.trim())){d(true);try{let S=await n(l.trim(),m);S&&(a([...e,S]),u(""),f($l[Math.floor(Math.random()*$l.length)]||"#00E5CC"));}finally{d(false);}}},N=(S,V)=>{V.stopPropagation(),a(e.filter(U=>U.id!==S));},D={backgroundColor:`${r.textTertiary}15`,border:`1px solid ${r.borderLight}`,color:r.textSecondary};return jsxs("div",{ref:w,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:D,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(S=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:r.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:r.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:x,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:v.top,left:v.left,zIndex:99999,backgroundColor:r.bgPrimary,border:`1px solid ${r.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:r.border},children:jsx("input",{ref:y,type:"text",value:l,onChange:S=>u(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:r.bgSecondary,color:r.textPrimary,border:`1px solid ${r.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&l.trim()&&!M&&n&&L();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:r.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:r.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${S.color}20`,color:S.color},onClick:V=>N(S.id,V),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(S=>{let V=e.some(U=>U.id===S.id);return jsxs("button",{type:"button",onClick:()=>z(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${S.color}15`:"transparent",color:r.textPrimary},onMouseEnter:U=>{V||(U.currentTarget.style.backgroundColor=r.hoverBg);},onMouseLeave:U=>{V||(U.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsx("span",{className:"flex-1 text-left",children:S.name}),V&&jsx(Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:r.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:r.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!M&&n&&jsxs("div",{className:"p-2 border-t",style:{borderColor:r.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:r.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:$l.map(S=>jsx("button",{type:"button",onClick:()=>f(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:m===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxs("button",{type:"button",onClick:L,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:p?.7:1},children:[p?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function Ed({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:r=>{r.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function pg({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let n=e.slice(0,t),r=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[n.map(s=>jsx(Ed,{tag:s,size:a},s.id)),r>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:["+",r]})]})}var fs=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function mg(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Px(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Fx({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Md({summary:e,size:t="sm",showEstimate:a=true,onClick:n,className:r}){let s=Px(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=mg(e.loggedMinutes),l=e.estimateMinutes?mg(e.estimateMinutes):null,u=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(n?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],n&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",r),onClick:n,type:n?"button":void 0,children:[jsx(Fx,{className:i[t]}),jsx("span",{children:u})]})}function Lx(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let n=new Function(`"use strict"; return (${a});`)();return typeof n!="number"||!isFinite(n)||n<0?null:n}catch{return null}}function Hl(e){let t=Lx(e);return t!==null?String(t):e}function fg(e){let a=Hl(e).trim().toLowerCase();if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let n=a.match(/(\d+(?:\.\d+)?)\s*h/),r=a.match(/(\d+)\s*m/);if(n||r){let o=n?.[1]?parseFloat(n[1]):0,i=r?.[1]?parseInt(r[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Wl(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Rx(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),n=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${a}:${n.toString().padStart(2,"0")}`}function Bx({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function $x({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function bg({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Ox({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Pd({taskId:e,summary:t,entries:a=[],isTimerRunning:n=false,timerElapsedSeconds:r=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:u,className:p}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Wl(t.estimateMinutes):""),[b,w]=useState(""),[h,x]=useState(false),[y,k]=useState(false),M=useRef(null);useEffect(()=>{M.current?.focus();},[]);let z=async()=>{let D=fg(d);if(!(D<=0||!s)){x(true);try{await s({durationMinutes:D,note:b.trim()||void 0,source:"manual"}),m(""),w("");}finally{x(false);}}},L=async()=>{if(!o)return;let D=f.trim()?fg(f):null;await o(D),k(false);},N=D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),z()),D.key==="Escape"&&u?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",p),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(bg,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:n?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Rx(r)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx($x,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(bg,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Bx,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Ox,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:M,type:"text",value:d,onChange:D=>m(D.target.value),onKeyDown:N,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:z,disabled:h||!d.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:b,onChange:D=>w(D.target.value),onKeyDown:N,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Wl(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),y?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:D=>v(D.target.value),onKeyDown:D=>{D.key==="Enter"&&L(),D.key==="Escape"&&k(false);},onBlur:L,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Wl(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(D=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:D.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Wl(D.durationMinutes)})]},D.id))})]})]})}function jx(e){let a=Hl(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let n=a.match(/(\d+(?:\.\d+)?)\s*h/),r=a.match(/(\d+)\s*m/);if(n||r){let o=n?.[1]?parseFloat(n[1]):0,i=r?.[1]?parseInt(r[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Vx(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function no({mode:e,locale:t,isDark:a,currentValue:n,onSave:r,onClose:s,className:o}){let[i,c]=useState(Vx(n)),[l,u]=useState(""),[p,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=jx(i);await r(x&&x>0?x:null,l||void 0),d(false);},v=async()=>{d(true),await r(null),d(false);},b=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},w={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:w[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:i,onChange:x=>c(x.target.value),onKeyDown:b,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:x=>u(x.target.value),onKeyDown:b,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:p||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),n&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:p,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Gx(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function _x(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Ld({summary:e,showLabel:t=false,size:a="md",className:n}){let r=Gx(e.health),s=_x(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",n),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:g("h-full w-1/4",r)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",n),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:g("h-full transition-all duration-300",r),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function Gs(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),n=t%60;return n===0?`${a}h`:`${a}h ${n}m`}function qx(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Yx(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Xx(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function Jx({summary:e,locale:t,isDark:a}){let n=e.totalVarianceMinutes>0,r=n?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",r),children:[n?"+":"",Gs(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:Gs(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:Gs(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Qx({task:e,locale:t,isDark:a,onClick:n}){let r=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,n&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>n?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Gs(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Gs(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[r,Gs(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[r,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Yx(e.status,a),qx(e.status,a)),children:Xx(e.status,t)})})]})}function Ad({report:e,isLoading:t=false,locale:a="en",theme:n="light",className:r,onTaskClick:s}){let o=n==="dark",i=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",l=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",p=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",p,r),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",p,r),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",i,r),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Jx,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",l),children:m.map(f=>jsx(Qx,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",p),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function _s(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function pv(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),n=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`}function Ng(e,t=[]){if("title"in e&&!("name"in e)){let a=e,n=(a.assignedUserIds||[]).map(r=>{let s=t.find(o=>o.id===r);return s||null}).filter(r=>r!==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:n,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(r=>typeof r=="string"?r:r.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(r=>({id:r.id,name:r.title,progress:r.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function mv(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 bs({task:e,isOpen:t,onClose:a,onTaskUpdate:n,onCardUpdate:r,theme:s="dark",locale:o="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:b,mentionableUsers:w=[],onUploadCommentAttachments:h,enableTimeTracking:x=false,timeTrackingSummary:y,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:z=0,onTimeLog:L,onEstimateUpdate:N,onSoldEffortUpdate:D,onTimerStart:S,onTimerStop:V,onTimerDiscard:U,blurFinancials:W=false}){let E=s==="dark",Pe={textTertiary:E?"#6B7280":"#9CA3AF",textSecondary:E?"#9CA3AF":"#6B7280",textPrimary:E?"#FFFFFF":"#111827",borderLight:E?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:E?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:E?"#1A1D25":"#FFFFFF",bgSecondary:E?"#0A0A0A":"#F9FAFB",hoverBg:E?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},J=e&&"title"in e&&!("name"in e),de=e,[R,Ae]=useState(e?Ng(e,i):null),[nt,Ge]=useState(false),[B,ce]=useState(false),[oe,gt]=useState(false),[Je,ct]=useState(null),[ft,ut]=useState(new Date),[Rt,lt]=useState(false),[vt,Mt]=useState(false),[Pt,zt]=useState(""),[Ne,Ot]=useState(false),[wt,Ut]=useState(false),[Ye,qe]=useState(false),[_,he]=useState(false),[Z,ze]=useState(""),Me=useRef(null),Ve=useRef(null),[O,xe]=useState(""),Be=useRef(null),[Qe,Ft]=useState(""),[Xe,Tt]=useState(false),[it,ba]=useState([]),[Jt,Ht]=useState(""),[we,Te]=useState(false),dt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Ng(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),Ae(P),ze(P.description||""),xe(P.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!Z)return;let P=setTimeout(()=>{let ie=Ve.current;ie&&(ie.style.height="auto",ie.style.height=`${Math.max(100,ie.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Z]),useEffect(()=>()=>{Me.current&&clearTimeout(Me.current),Be.current&&clearTimeout(Be.current);},[]),useEffect(()=>{t&&dt.current&&f.length>0&&setTimeout(()=>{dt.current&&(dt.current.scrollTop=dt.current.scrollHeight);},100);},[t,f.length]);let ht=useCallback(P=>{Ae(P),J&&r&&de?r(mv(P,de)):n&&n(P);},[J,de,r,n]),jt=useCallback(()=>{Ge(false),ce(false),gt(false),ct(null),Mt(false),zt(""),Ot(false);},[]),Dt=useCallback((P,ie)=>{if(!R)return;let $={...R,[P]:ie};ht($);},[R,ht]),la=useCallback(()=>{let P=Ve.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),ha=useCallback(P=>{ze(P),setTimeout(la,0),Me.current&&clearTimeout(Me.current),Me.current=setTimeout(()=>{if(R){let ie={...R,description:P};ht(ie);}},800);},[R,ht,la]),Ha=useCallback(P=>{xe(P),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(R&&P.trim()){let ie={...R,name:P.trim()};ht(ie);}},800);},[R,ht]),Zt=useCallback(P=>{let ie=P.map($=>{let te={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:$};return $.type.startsWith("image/")&&(te.preview=URL.createObjectURL($)),te});ba($=>[...$,...ie]);},[]),Wa=useCallback(P=>{ba(ie=>{let $=ie.find(te=>te.id===P);return $?.preview&&URL.revokeObjectURL($.preview),ie.filter(te=>te.id!==P)});},[]),Va=useCallback(async()=>{if(!(!R||!Qe.trim()&&it.length===0||!v)){Tt(true);try{let P=lg(Qe,w),ie=[];if(it.length>0&&h){let $=it.map(te=>te.file);ie=await h($);}await v(R.id,Qe.trim(),P.length>0?P:void 0,ie.length>0?ie:void 0),Ft(""),it.forEach($=>{$.preview&&URL.revokeObjectURL($.preview);}),ba([]);}finally{Tt(false);}}},[R,Qe,it,v,w,h]),xn=useCallback(()=>{if(!R||!Jt.trim())return;let P=R.subtasks||[],ie={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},$=[...P,ie],te={...R,subtasks:$};ht(te),Ht(""),Te(false);},[R,Jt,ht]),ia=useCallback(P=>{if(!R?.subtasks)return;let ie=R.subtasks.map(te=>te.id===P?{...te,progress:te.progress===100?0:100}:te),$={...R,subtasks:ie};ht($);},[R,ht]),vn=useCallback(P=>{if(!R?.subtasks)return;let ie=R.subtasks.filter(te=>te.id!==P),$={...R,subtasks:ie};ht($);},[R,ht]),A=useCallback(P=>{let ie=typeof P=="string"?new Date(P):P,te=new Date().getTime()-ie.getTime(),I=Math.floor(te/6e4),H=Math.floor(te/36e5),fe=Math.floor(te/864e5);return I<1?o==="es"?"Ahora":"Just now":I<60?o==="es"?`Hace ${I} min`:`${I}m ago`:H<24?o==="es"?`Hace ${H}h`:`${H}h ago`:fe<7?o==="es"?`Hace ${fe}d`:`${fe}d ago`:ie.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),Y=useCallback(P=>{if(!R)return;let ie=R.progress||0;P==="completed"?ie=100:P==="in-progress"&&ie===0?ie=10:P==="todo"&&(ie=0);let $={...R,status:P,progress:ie};ht($),Ge(false);},[R,ht]),ee=useCallback((P,ie)=>{if(!R)return;let $={...R,startDate:P,endDate:ie};ht($);},[R,ht]),q=useCallback(()=>{let P=ft.getFullYear(),ie=ft.getMonth(),$=new Date(P,ie,1),I=new Date(P,ie+1,0).getDate(),H=$.getDay(),fe=[],me=new Date(P,ie,0).getDate();for(let pe=H-1;pe>=0;pe--)fe.push({date:new Date(P,ie-1,me-pe),isCurrentMonth:false});for(let pe=1;pe<=I;pe++)fe.push({date:new Date(P,ie,pe),isCurrentMonth:true});let ge=42-fe.length;for(let pe=1;pe<=ge;pe++)fe.push({date:new Date(P,ie+1,pe),isCurrentMonth:false});return fe},[ft]),He=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),qe(false),!R||!p)return;let ie=Array.from(P.dataTransfer.files);if(ie.length!==0){he(true);try{await p(R.id,ie);}finally{he(false);}}},[R,p]),Ze=useCallback(async P=>{if(!R||!p||!P.target.files)return;let ie=Array.from(P.target.files);if(ie.length!==0){he(true);try{await p(R.id,ie);}finally{he(false);}P.target.value="";}},[R,p]),$e=useCallback(P=>{P.preventDefault(),P.stopPropagation(),qe(true);},[]),Q=useCallback(P=>{P.preventDefault(),P.stopPropagation(),qe(false);},[]),Ie=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),pt=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},role:"dialog","aria-modal":"true","aria-label":o==="es"?"Detalle de la tarea":"Task details",className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",E?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",E?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",E?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",E?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",E?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=R.progress===100?0:100,$={...R,progress:P,status:P===100?"completed":"todo"};ht($);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":E?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:O,onChange:P=>Ha(P.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":E?"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:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{jt(),Ge(!nt);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":E?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:nt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ge(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxs("button",{onClick:()=>Y(P.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",R.status===P.id&&(E?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:E?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{jt(),gt(!oe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((P,ie)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||ma(P.name)},ie)),R.assignees.length>3&&jsxs("span",{className:g("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:g("text-sm",E?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",E?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>gt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(P=>{let ie=R.assignees?.some($=>$.name===P.name);return jsxs("button",{onClick:()=>{let $=R.assignees||[],te;ie?te=$.filter(I=>I.name!==P.name):te=[...$,P],Dt("assignees",te);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",ie&&(E?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||ma(P.name)}),jsx("span",{className:g("flex-1",E?"text-white":"text-gray-900"),children:P.name}),ie&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",E?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ct(Je?null:"start"),ut(R.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",E?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ct(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",E?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ie=new Date(P);ie.setDate(P.getDate()+1);let $=new Date(P);$.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let te=new Date(P);te.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let I=new Date(P);I.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let H=new Date(P);H.setDate(P.getDate()+14);let fe=new Date(P);return fe.setDate(P.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:ie,display:ie.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:te,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:fe,display:fe.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ge,pe)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",E?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Je==="start"){let Ce=R.endDate&&ge.date>R.endDate?ge.date:R.endDate;ee(ge.date,Ce),ct("end");}else {let Ce=R.startDate&&ge.date<R.startDate?ge.date:R.startDate;ee(Ce,ge.date),ct(null);}},children:[jsx("span",{children:ge.label}),jsx("span",{className:g("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:ge.display})]},pe))})(),jsx("div",{className:g("border-t mt-2 pt-2",E?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ee(void 0,void 0),ct(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",E?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",E?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Je==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="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:g("font-medium",E?"text-white":"text-gray-900"),children:ft.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ut(new Date),className:g("p-1 rounded text-sm transition-colors",E?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ut(new Date(ft.getFullYear(),ft.getMonth()-1)),className:g("p-1 rounded",E?"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:()=>ut(new Date(ft.getFullYear(),ft.getMonth()+1)),className:g("p-1 rounded",E?"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:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",E?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:q().map((P,ie)=>{let $=P.date.toDateString()===new Date().toDateString(),te=R.startDate?.toDateString()===P.date.toDateString(),I=R.endDate?.toDateString()===P.date.toDateString(),H=te||I,fe=R.startDate&&R.endDate&&P.date>=R.startDate&&P.date<=R.endDate;return jsx("button",{onClick:()=>{let me=new Date(P.date);if(Je==="start"){let ge=R.endDate&&me>R.endDate?me:R.endDate;ee(me,ge),ct("end");}else {let ge=R.startDate&&me<R.startDate?me:R.startDate;ee(ge,me),ct(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(E?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(E?"text-white":"text-gray-900"),$&&"ring-2 ring-[#00E5CC]",te&&"bg-[#00E5CC] text-white",I&&!te&&"bg-[#7C3AED] text-white",fe&&!H&&(E?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(E?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},ie)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{jt(),ce(!B);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":E?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:B&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ce(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxs("button",{onClick:()=>{Dt("priority",P.id),ce(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",R.priority===P.id&&(E?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:E?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",E?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",E?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Rt?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:P=>{let ie=parseInt(P.target.value),$=R.status;ie===100?$="completed":ie>0?$="in-progress":$="todo";let te={...R,progress:ie,status:$};ht(te);},onBlur:()=>lt(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",E?"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-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>lt(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",E?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",E?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",E?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:y?.estimateMinutes?_s(y.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Ut("estimate"),className:g("text-sm px-2 py-0.5 rounded",E?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:_s(y.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Ut("estimate"),className:g("text-sm",E?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:wt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(no,{mode:"estimate",locale:o,isDark:E,currentValue:y?.estimateMinutes||null,onSave:async P=>{await N?.(R.id,P),Ut(false);},onClose:()=>Ut(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:W?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",E?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",E?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?_s(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>Ut("quoted"),className:g("text-sm px-2 py-0.5 rounded",E?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:_s(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Ut("quoted"),className:g("text-sm",E?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:wt==="quoted"&&!W&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(no,{mode:"quoted",locale:o,isDark:E,currentValue:R.quotedMinutes||null,onSave:async P=>{D?(await D(R.id,P),Ae(ie=>ie?{...ie,quotedMinutes:P}:null)):Dt("quotedMinutes",P),Ut(false);},onClose:()=>Ut(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",E?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxs("button",{type:"button",onClick:()=>V?.(R.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),pv(z||0)]}):jsx("button",{type:"button",onClick:()=>S?.(R.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",E?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",E?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Ut("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",E?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),y&&y.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":E?"text-white":"text-gray-900"),children:[_s(y.loggedMinutes),y.estimateMinutes&&jsxs("span",{className:g("font-normal",E?"text-[#6B7280]":"text-gray-400"),children:[" / ",_s(y.estimateMinutes)]})]}),y.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:wt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(no,{mode:"log",locale:o,isDark:E,currentValue:null,onSave:async(P,ie)=>{P&&await L?.(R.id,{durationMinutes:P,note:ie,source:"manual"}),Ut(false);},onClose:()=>Ut(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Vs,{selectedTags:R.tags||[],availableTags:c,onChange:P=>{Dt("tags",P);},onCreateTag:l,theme:Pe})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(P=>{let ie=m.find($=>$.id===P);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",E?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[ie?.name||P.slice(0,8),jsx("button",{onClick:()=>{let $=(R.dependencies||[]).filter(te=>te!==P);Dt("dependencies",$);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{jt(),Mt(!vt);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"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:g("text-sm",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:vt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Mt(false),zt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",E?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Pt,onChange:P=>zt(P.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",E?"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:m.length>0?m.filter(P=>P.id!==R.id).filter(P=>Pt===""||P.name.toLowerCase().includes(Pt.toLowerCase())).map(P=>{let ie=R.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let $=R.dependencies||[],te;ie?te=$.filter(I=>I!==P.id):te=[...$,P.id],Dt("dependencies",te);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",ie&&(E?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ie?"bg-[#00E5CC] border-[#00E5CC]":E?"border-white/30":"border-gray-300"),children:ie&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",E?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:g("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",E?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{jt(),Ot(!Ne);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:R.color||"#6366F1"}}),jsx("span",{className:g("text-sm",E?"text-white":"text-gray-900"),children:fs.find(P=>P.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",E?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ne&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ot(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:fs.map(P=>{let ie=R.color===P.value;return jsx("button",{onClick:()=>{Dt("color",P.value),Ot(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",ie&&"ring-2 ring-offset-2",E?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ie?P.value:void 0},title:P.name,children:ie&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:P=>Dt("isMilestone",P.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":E?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",E?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",E?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",E?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:Ve,value:Z,onChange:P=>ha(P.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("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",E?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",E?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",E?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",E?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(P=>P.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((P,ie)=>(P.position??0)-(ie.position??0)).map(P=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",E?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>ia(P.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":E?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":E?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>vn(P.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",E?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),we?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Jt,onChange:P=>Ht(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Jt.trim()?xn():P.key==="Escape"&&(Te(false),Ht(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",E?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:xn,disabled:!Jt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Jt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":E?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Te(false),Ht("");},className:g("p-2 rounded-lg transition-colors",E?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Te(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",E?"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"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",E?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",E?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",E?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(P=>{let ie=pt(P.type),$=P.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[$&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",E?"bg-white/10":"bg-gray-200"),children:jsx(ie,{className:g("w-5 h-5",E?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",E?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:g("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:Ie(P.size)})]}),d&&jsx("button",{onClick:()=>d(P.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",E?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:$e,onDragLeave:Q,onDrop:He,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ye?E?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":E?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",_&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ze,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||_}),_?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",E?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",Ye?"text-[#00E5CC]":E?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",E?"text-[#9CA3AF]":"text-gray-500"),children:Ye?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="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"})]})}),!p&&jsx("p",{className:g("text-xs mt-1",E?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",E?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",E?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",E?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",E?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",E?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -13,10 +13,10 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
13
13
|
border-radius: 4px !important;
|
|
14
14
|
}
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
|
-
background: ${
|
|
16
|
+
background: ${E?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:rt,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",A?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((S,H)=>{let Z=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,Te=typeof H.createdAt=="string"?new Date(H.createdAt):H.createdAt;return Z.getTime()-Te.getTime()}).map(S=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:S.user?.color||"#8B5CF6"},children:S.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:g("text-sm font-medium",A?"text-white":"text-gray-900"),children:S.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Ra(S.createdAt)})]}),jsx("div",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Hp,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(H=>{let Z=H.type.startsWith("image/");return jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Z?jsx(Image,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",A?"text-white":"text-gray-900"),children:H.name})]},H.id)})})]})]},S.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",A?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",A?"border-white/10":"border-gray-200"),children:jsx(Op,{value:yt,onChange:Ye,onSubmit:Sa,users:h,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:vt,theme:s,locale:o,currentUser:b,enableEmoji:true,enableAttachments:!!y,pendingFiles:wt,onFilesSelect:Xe,onRemoveFile:et})})]})]})]})})}function Bc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function lo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:i,isLoading:c,error:l,children:p,availableTags:u=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:O,timeEntries:T,timerState:D,onLogTime:M,onUpdateEstimate:N,onUpdateSoldEffort:z,onStartTimer:$,onStopTimer:Y,onDiscardTimer:A,blurFinancials:Se=false,sidePanel:W,renderColumnMetrics:Ce,suppressDetailModal:R=false}){let[we,G]=Bc(),[Ve,oe]=useState(null),[Be,le]=useState(false),He=useRef(null),$e=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Pe=n?.theme||"dark",je=Pe==="dark"||Pe==="neutral",tt=je?"dark":"",ee=useCallback((L,J)=>{t.onCardUpdate?.(L,J);},[t]),Ae=useCallback((L,J)=>{t.onColumnUpdate?.(L,{title:J});},[t]),ot=useCallback(L=>{t.onColumnDelete?.(L);},[t]),Ie=["todo","in-progress","completed"],zt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),st=useMemo(()=>{let L=new Map;return e.columns.forEach(J=>{let xe=J.cardIds.map(I=>e.cards.find(j=>j.id===I)).filter(I=>I!==void 0).sort((I,j)=>I.position-j.position);L.set(J.id,xe);}),L},[e.cards,e.columns]);useEffect(()=>{let L=He.current;if(!L)return;let J=ke=>{let Ue=ke.target,ue=ke.button===1,at=Ue===L||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(ue||ke.button===0&&at&&!we.isDragging)&&(ke.preventDefault(),le(true),$e.current={x:ke.clientX,y:ke.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},xe=ke=>{if(!Be)return;let Ue=ke.clientX-$e.current.x,ue=ke.clientY-$e.current.y;L.scrollLeft=$e.current.scrollLeft-Ue,L.scrollTop=$e.current.scrollTop-ue;},I=()=>{Be&&(le(false),L.style.cursor="",L.style.userSelect="");},j=()=>{Be&&(le(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",J),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",I),L.addEventListener("mouseleave",j),()=>{L.removeEventListener("mousedown",J),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",I),L.removeEventListener("mouseleave",j);}},[Be,we.isDragging]);let bt=useMemo(()=>e.cards.map(L=>({id:L.id,name:L.title,startDate:L.startDate?new Date(L.startDate):void 0,endDate:L.endDate?new Date(L.endDate):void 0,progress:L.progress||0,status:L.columnId,priority:L.priority?.toLowerCase(),dependencies:Array.isArray(L.dependencies)?L.dependencies.map(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),Ee=useCallback(L=>{let{active:J}=L,xe=e.cards.find(I=>I.id===J.id);xe&&G({isDragging:true,draggedCardId:xe.id,sourceColumnId:xe.columnId,targetColumnId:xe.columnId});},[e.cards,G]),Dt=useCallback(L=>{let{active:J,over:xe}=L;if(!xe||!e.cards.find(ke=>ke.id===J.id))return;let j=null;xe.data.current?.type==="column"?j=xe.id:xe.data.current?.type==="card"&&(j=e.cards.find(Ue=>Ue.id===xe.id)?.columnId||null),j&&j!==we.targetColumnId&&G({...we,targetColumnId:j});},[e.cards,we,G]),ht=useCallback(async L=>{let{active:J,over:xe}=L;if(G({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!xe)return;let I=e.cards.find(ue=>ue.id===J.id);if(!I)return;let j,ke;if(xe.data.current?.type==="column"){j=xe.id;let ue=st.get(j)||[];ke=yc(ue,0);}else {let ue=e.cards.find(Ye=>Ye.id===xe.id);if(!ue)return;j=ue.columnId;let at=st.get(j)||[],yt=at.findIndex(Ye=>Ye.id===xe.id);ke=yc(at,yt);}let Ue=e.columns.find(ue=>ue.id===j);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let ue=st.get(j)||[];if(I.columnId!==j&&ue.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,I);return}}(I.columnId!==j||I.position!==ke)&&await t.onCardMove?.(I.id,j,ke);},[e.cards,e.columns,st,t,G]),_e=useCallback(L=>{R||oe(L),a?.(L),w?.(L.id);},[a,w,R]),dt=useCallback(L=>{t.onCardUpdate?.(L.id,L),oe(L);},[t]);return c?jsx("div",{className:g("asakaa-board",tt,o),style:i,children:jsx($y,{columnCount:3})}):l?jsx("div",{className:g("asakaa-board",tt,o),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(mp,{themeName:Pe,children:[jsxs("div",{className:g("flex h-full overflow-hidden",W?"flex-row":""),children:[jsxs(DndContext,{sensors:zt,collisionDetection:closestCorners,onDragStart:Ee,onDragOver:Dt,onDragEnd:ht,children:[jsxs("div",{ref:He,className:g("asakaa-board",W?"flex-1":"",tt,o),style:{...i,cursor:Be?"grabbing":void 0},"data-theme":Pe,children:[e.columns.sort((L,J)=>L.position-J.position).map(L=>{let J=st.get(L.id)||[],xe=!Ie.includes(L.id),I=r?.renderColumnFooter?.(L);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(is,{column:L,cards:J,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ce?(j,ke)=>Ce(j,ke):void 0,onCardClick:_e,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?Ae:void 0,onColumnDelete:t.onColumnDelete?ot:void 0,isDeletable:xe,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(L.id)}),I]},L.id)}),p]}),jsx(DragOverlay,{children:we.draggedCardId?jsx(zn,{card:e.cards.find(L=>L.id===we.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),W]}),!R&&jsx(Io,{task:Ve,isOpen:!!Ve,onClose:()=>oe(null),onCardUpdate:dt,theme:je?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:u,onCreateTag:d,attachments:Ve?m?.get(Ve.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:bt,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:O,timeEntries:T,isTimerRunning:D?.isRunning,timerElapsedSeconds:D?.elapsedSeconds,onTimeLog:M,onEstimateUpdate:N,onSoldEffortUpdate:z,onTimerStart:$,onTimerStop:Y,onTimerDiscard:A,blurFinancials:Se})]})}function $y({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 zy={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Gy={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:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Vy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},jy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function _y({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&o(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),o(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,p)=>l.position-p.position).map((l,p)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Ky({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(a||r||n))return null;let u=[{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:n}].filter(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}finally{c(null),o(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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:u.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.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:f<u.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.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===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function qy({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Oc({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p,toolbarEndContent:u}){let d=r==="dark"?zy:Gy,m={...n==="es"?Vy:jy,...l},f=o||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[p,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Ky,{theme:d,t:m,onExportCSV:o,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),u,t&&(s?jsx(_y,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(qy,{onClick:()=>t(),label:a||m.newTask}))]})})}function Uc({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let d=i.trim();d&&(e(d),c(""),o(false));},[i,e]),p=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(c(""),o(false));},[l]),u=useCallback(()=>{setTimeout(()=>{i.trim()||o(false);},150);},[i]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:d=>c(d.target.value),onKeyDown:p,onBlur:u,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),o(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:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,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 ei({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:i="up"}){let[c,l]=useState(""),[p,u]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[b,h]=useState(false),[y,x]=useState(false),[w,C]=useState(false),[P,O]=useState(s||new Date),T=useRef(null),D=n==="es",M=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let N=useCallback(()=>{h(false),x(false),C(false);},[]),z=useCallback(()=>{l(""),u(void 0),m(null),v(null),N(),t();},[t,N]),$=f||s||new Date,Y=useCallback(()=>{let W=c.trim();if(!W)return;let Ce=a.find(we=>we.id===d),R=$;e({name:W,priority:p,assignee:Ce||void 0,assigneeId:d,startDate:R,endDate:R}),l(""),u(void 0),m(null),v(null),N(),T.current?.focus();},[c,p,d,$,a,e,N]),A=useCallback(W=>{W.key==="Enter"&&c.trim()&&(W.preventDefault(),Y()),W.key==="Escape"&&z();},[Y,z,c]),Se=$;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>N(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:c,onChange:W=>l(W.target.value),placeholder:D?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:A})}),jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:W=>{W.stopPropagation(),h(!b),x(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[{id:"urgent",label:D?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:D?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:D?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:D?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:D?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(W=>jsxs("button",{onClick:()=>{u(W.id),h(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===W.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",W.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:W.label})]},W.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:W=>{W.stopPropagation(),C(!w),h(false),x(false),O(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),Se.toLocaleDateString(D?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let W=new Date,Ce=new Date(W);Ce.setDate(W.getDate()+1);let R=new Date(W);R.setDate(W.getDate()+((6-W.getDay()+7)%7||7));let we=new Date(W);we.setDate(W.getDate()+((1-W.getDay()+7)%7||7));let G=new Date(W);G.setDate(W.getDate()+14);let Ve=new Date(W);Ve.setDate(W.getDate()+28);let oe=D?"es-ES":"en-US";return [{label:D?"Hoy":"Today",date:W,display:W.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:D?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:D?"Este fin de semana":"This weekend",date:R,display:D?"s\xE1b.":"sat."},{label:D?"Pr\xF3xima semana":"Next week",date:we,display:D?"lun.":"mon."},{label:D?"2 semanas":"2 weeks",date:G,display:G.toLocaleDateString(oe,{day:"numeric",month:"short"})},{label:D?"4 semanas":"4 weeks",date:Ve,display:Ve.toLocaleDateString(oe,{day:"numeric",month:"short"})}].map((le,He)=>jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(le.date),C(false);},children:[jsx("span",{children:le.label}),jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:le.display})]},He))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:P.toLocaleDateString(D?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>O(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:D?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>O(new Date(P.getFullYear(),P.getMonth()-1)),className:g("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>O(new Date(P.getFullYear(),P.getMonth()+1)),className:g("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(D?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(W=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:W},W))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let W=P.getFullYear(),Ce=P.getMonth(),R=new Date(W,Ce,1).getDay(),we=new Date(W,Ce+1,0).getDate(),G=new Date(W,Ce,0).getDate(),Ve=new Date().toDateString(),oe=[];for(let le=R-1;le>=0;le--)oe.push({dayNum:G-le,isCurrent:false,date:new Date(W,Ce-1,G-le)});for(let le=1;le<=we;le++)oe.push({dayNum:le,isCurrent:true,date:new Date(W,Ce,le)});let Be=42-oe.length;for(let le=1;le<=Be;le++)oe.push({dayNum:le,isCurrent:false,date:new Date(W,Ce+1,le)});return oe.map((le,He)=>{let $e=le.date.toDateString()===Ve,Pe=(f||s)?.toDateString()===le.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!le.isCurrent&&(r?"text-white/20":"text-gray-300"),le.isCurrent&&(r?"text-white":"text-gray-900"),$e&&"ring-1 ring-[#007FFF]",Pe&&"bg-[#007FFF] text-white",!Pe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(le.date),C(false);},children:le.dayNum},He)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:W=>{W.stopPropagation(),x(!y),h(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(W=>W.id===d)?.color||"#007FFF"},children:a.find(W=>W.id===d)?.initials||a.find(W=>W.id===d)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:D?"Sin asignar":"Unassigned"})]}),a.map(W=>jsxs("button",{type:"button",onClick:()=>{m(W.id),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",d===W.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:W.color||"#007FFF"},children:W.initials||W.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:W.name})]},W.id)),a.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:D?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:Y,disabled:!c.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:D?"Guardar":"Save"})]})]})}function jc({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:i="es"}){let[c,l]=useState(false),p=useRef(null),u=useRef(null),[d,m]=useState({}),[f,v]=useState(false),b=o==="dark",y={buttonLabel:n||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!p.current)return;let w=90,C=()=>{let P=p.current.getBoundingClientRect(),T=window.innerHeight-P.bottom<w+8;v(T),m({position:"fixed",...T?{bottom:window.innerHeight-P.top+4}:{top:P.bottom+4},left:P.left,width:P.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),useEffect(()=>{if(!c)return;let w=C=>{let P=C.target;u.current&&!u.current.contains(P)&&p.current&&!p.current.contains(P)&&l(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let x=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:p,className:g("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:u,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:d,className:g("rounded-lg shadow-2xl",b?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(ei,{onSubmit:x,onCancel:()=>l(false),availableUsers:a,isDark:b,locale:i,dropdownDirection:"up"})})}),document.body)]})}var ai=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(lo,{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 n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function hm(e={}){return new ai(e)}var us=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:n,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}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=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:o?`Error in ${o}`:"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"})]})]})}):n}};function _c(e,t){let a=r=>jsx(us,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function qc({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[u,d]=useState(false),[m,f]=useState(""),[v,b]=useState("home"),[h,y]=useState(""),[x,w]=useState("");useEffect(()=>{let T=D=>{(D.metaKey||D.ctrlKey)&&D.key===l&&(D.preventDefault(),d(M=>!M)),D.key==="Escape"&&(d(false),b("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),useEffect(()=>{u||(b("home"),f(""),y(""),w(""));},[u]);let C=useCallback(()=>{d(false);},[]),P=useCallback(T=>{let[D,M]=T.split(":");switch(D){case "create-card":b("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),C()):b("navigate");break;case "search":r?.(m),C();break;case "priority":b("priority");break;case "set-priority":x&&M&&(n?.(x,M),C());break;case "assign":b("assign");break;case "assign-user":x&&M&&(s?.(x,M),C());break;case "ai":b("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":b("home");break;}},[m,x,t,a,r,n,s,o,i,c,C]),O=useCallback(()=>{h&&m.trim()&&(t?.(h,m.trim()),C());},[h,m,t,C]);return u?jsx(ga,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${p}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,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:v==="create-card"&&h?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&v==="create-card"&&h&&O();}}),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."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:P,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:P,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:P,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:P,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:P,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},T.id))})]}),v==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let D=e.columns.find(M=>M.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:P,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(M=>jsx("span",{className:"command-palette-item-label",children:M},M))})]},T.id)})})]}),v==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:P,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:P,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:P,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:P,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 vm(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:dt,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",E?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((P,ie)=>{let $=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,te=typeof ie.createdAt=="string"?new Date(ie.createdAt):ie.createdAt;return $.getTime()-te.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?ma(P.user.name):"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:g("text-sm font-medium",E?"text-white":"text-gray-900"),children:P.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:A(P.createdAt)})]}),jsx("div",{className:g("text-sm",E?"text-[#9CA3AF]":"text-gray-600"),children:jsx(dg,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(ie=>{let $=ie.type.startsWith("image/");return jsxs("a",{href:ie.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[$?jsx(Image,{className:g("w-4 h-4",E?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",E?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",E?"text-white":"text-gray-900"),children:ie.name})]},ie.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",E?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",E?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",E?"border-white/10":"border-gray-200"),children:jsx(cg,{value:Qe,onChange:Ft,onSubmit:Va,users:w,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:Xe,theme:s,locale:o,currentUser:b,enableEmoji:true,enableAttachments:!!h,pendingFiles:it,onFilesSelect:Zt,onRemoveFile:Wa})})]})]})]})})}function Rd(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(r=>{t(r);}),[]);let a=useCallback(n=>{dragStore.setState(n);},[]);return [e,a]}function jo({board:e,callbacks:t,onCardClick:a,renderProps:n,config:r,availableUsers:s=[],className:o,style:i,isLoading:c,error:l,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:b,onAddComment:w,currentUser:h,mentionableUsers:x,onTaskOpen:y,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:z,timeEntries:L,timerState:N,onLogTime:D,onUpdateEstimate:S,onUpdateSoldEffort:V,onStartTimer:U,onStopTimer:W,onDiscardTimer:E,blurFinancials:Pe=false,sidePanel:J,renderColumnMetrics:de,suppressDetailModal:R=false}){let[Ae,nt]=Rd(),[Ge,B]=useState(null),[ce,oe]=useState(false),gt=useRef(null),Je=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ct=r?.theme||"dark",ft=ct==="dark"||ct==="neutral",ut=ft?"dark":"",Rt=useCallback((_,he)=>{t.onCardUpdate?.(_,he);},[t]),lt=useCallback((_,he)=>{t.onColumnUpdate?.(_,{title:he});},[t]),vt=useCallback(_=>{t.onColumnDelete?.(_);},[t]),Mt=["todo","in-progress","completed"],Pt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),zt=useMemo(()=>{let _=new Map;return e.columns.forEach(he=>{let Z=he.cardIds.map(ze=>e.cards.find(Me=>Me.id===ze)).filter(ze=>ze!==void 0).sort((ze,Me)=>ze.position-Me.position);_.set(he.id,Z);}),_},[e.cards,e.columns]);useEffect(()=>{let _=gt.current;if(!_)return;let he=Ve=>{let O=Ve.target,xe=Ve.button===1,Be=O===_||O.classList.contains("asakaa-column")&&!O.closest(".asakaa-card");(xe||Ve.button===0&&Be&&!Ae.isDragging)&&(Ve.preventDefault(),oe(true),Je.current={x:Ve.clientX,y:Ve.clientY,scrollLeft:_.scrollLeft,scrollTop:_.scrollTop},_.style.cursor="grabbing",_.style.userSelect="none");},Z=Ve=>{if(!ce)return;let O=Ve.clientX-Je.current.x,xe=Ve.clientY-Je.current.y;_.scrollLeft=Je.current.scrollLeft-O,_.scrollTop=Je.current.scrollTop-xe;},ze=()=>{ce&&(oe(false),_.style.cursor="",_.style.userSelect="");},Me=()=>{ce&&(oe(false),_.style.cursor="",_.style.userSelect="");};return _.addEventListener("mousedown",he),document.addEventListener("mousemove",Z),document.addEventListener("mouseup",ze),_.addEventListener("mouseleave",Me),()=>{_.removeEventListener("mousedown",he),document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",ze),_.removeEventListener("mouseleave",Me);}},[ce,Ae.isDragging]);let Ne=useMemo(()=>e.cards.map(_=>({id:_.id,name:_.title,startDate:_.startDate?new Date(_.startDate):void 0,endDate:_.endDate?new Date(_.endDate):void 0,progress:_.progress||0,status:_.columnId,priority:_.priority?.toLowerCase(),dependencies:Array.isArray(_.dependencies)?_.dependencies.map(he=>typeof he=="string"?he:he.taskId):[]})),[e.cards]),Ot=useCallback(_=>{let{active:he}=_,Z=e.cards.find(ze=>ze.id===he.id);Z&&nt({isDragging:true,draggedCardId:Z.id,sourceColumnId:Z.columnId,targetColumnId:Z.columnId});},[e.cards,nt]),wt=useCallback(_=>{let{active:he,over:Z}=_;if(!Z||!e.cards.find(Ve=>Ve.id===he.id))return;let Me=null;Z.data.current?.type==="column"?Me=Z.id:Z.data.current?.type==="card"&&(Me=e.cards.find(O=>O.id===Z.id)?.columnId||null),Me&&Me!==Ae.targetColumnId&&nt({...Ae,targetColumnId:Me});},[e.cards,Ae,nt]),Ut=useCallback(async _=>{let{active:he,over:Z}=_;if(nt({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Z)return;let ze=e.cards.find(xe=>xe.id===he.id);if(!ze)return;let Me,Ve;if(Z.data.current?.type==="column"){Me=Z.id;let xe=zt.get(Me)||[];Ve=fd(xe,0);}else {let xe=e.cards.find(Ft=>Ft.id===Z.id);if(!xe)return;Me=xe.columnId;let Be=zt.get(Me)||[],Qe=Be.findIndex(Ft=>Ft.id===Z.id);Ve=fd(Be,Qe);}let O=e.columns.find(xe=>xe.id===Me);if(O&&O.wipLimit&&O.wipLimitType==="hard"){let xe=zt.get(Me)||[];if(ze.columnId!==Me&&xe.length>=O.wipLimit){t.onWipLimitExceeded?.(O,ze);return}}(ze.columnId!==Me||ze.position!==Ve)&&await t.onCardMove?.(ze.id,Me,Ve);},[e.cards,e.columns,zt,t,nt]),Ye=useCallback(_=>{R||B(_),a?.(_),y?.(_.id);},[a,y,R]),qe=useCallback(_=>{t.onCardUpdate?.(_.id,_),B(_);},[t]);return c?jsx("div",{className:g("asakaa-board",ut,o),style:i,children:jsx(Dv,{columnCount:3})}):l?jsx("div",{className:g("asakaa-board",ut,o),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(Im,{themeName:ct,children:[jsxs("div",{className:g("flex h-full overflow-hidden",J?"flex-row":""),children:[jsxs(DndContext,{sensors:Pt,collisionDetection:closestCorners,onDragStart:Ot,onDragOver:wt,onDragEnd:Ut,children:[jsxs("div",{ref:gt,className:g("asakaa-board",J?"flex-1":"",ut,o),style:{...i,cursor:ce?"grabbing":void 0},"data-theme":ct,children:[e.columns.sort((_,he)=>_.position-he.position).map(_=>{let he=zt.get(_.id)||[],Z=!Mt.includes(_.id),ze=n?.renderColumnFooter?.(_);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(js,{column:_,cards:he,renderCard:n?.renderCard,renderColumn:n?.renderColumn,renderHeader:n?.renderColumnHeader,renderEmptyState:n?.renderEmptyState,renderMetrics:de?(Me,Ve)=>de(Me,Ve):void 0,onCardClick:Ye,onCardUpdate:Rt,onColumnRename:t.onColumnUpdate?lt:void 0,onColumnDelete:t.onColumnDelete?vt:void 0,isDeletable:Z,locale:r?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:r?.enableVirtualization,cardHeight:r?.cardHeight,isCollapsed:r?.collapsedColumnIds?.includes(_.id)}),ze]},_.id)}),u]}),jsx(DragOverlay,{children:Ae.draggedCardId?jsx(xo,{card:e.cards.find(_=>_.id===Ae.draggedCardId),render:n?.renderCardOverlay||n?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),J]}),!R&&jsx(bs,{task:Ge,isOpen:!!Ge,onClose:()=>B(null),onCardUpdate:qe,theme:ft?"dark":"light",locale:r?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:Ge?m?.get(Ge.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:Ne,comments:b,onAddComment:w,currentUser:h,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:z,timeEntries:L,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:S,onSoldEffortUpdate:V,onTimerStart:U,onTimerStop:W,onTimerDiscard:E,blurFinancials:Pe})]})}function Dv({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 Pv={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Fv={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:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Lv={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Av={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Iv({columns:e,onSelect:t,theme:a,t:n,createTaskLabel:r}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let l=u=>{i.current&&!i.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),o(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, var(--marca-acento, #00E5CC) 0%, var(--marca-acento-hover, #00C4AE) 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:r||n.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:n.selectColumn}),e.sort((l,u)=>l.position-u.position).map((l,u)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Rv({theme:e,t,onExportCSV:a,onExportJSON:n,onExportExcel:r}){let[s,o]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(a||n||r))return null;let p=[{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:n},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r}].filter(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}finally{c(null),o(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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:p.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.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:f<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.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===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function Bv({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, var(--marca-acento, #00E5CC) 0%, var(--marca-acento-hover, #00C4AE) 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function $d({columns:e,onCreateTask:t,createTaskLabel:a,theme:n="dark",locale:r="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:u,toolbarEndContent:p,toolbarLeftContent:d}){let m=n==="dark"?Pv:Fv,f={...r==="es"?Lv:Av,...l},v=o||i||c;return jsxs("div",{className:`min-h-[48px] px-4 py-1.5 flex flex-wrap items-center gap-y-2 ${d?"justify-between gap-x-3":"justify-end"} border-b sticky top-0 z-10`,style:{backgroundColor:m.bgGrid,borderColor:m.border},children:[d&&jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:d}),jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),v&&jsxs(Fragment,{children:[jsx(Rv,{theme:m,t:f,onExportCSV:o,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),p,t&&(s?jsx(Iv,{columns:e,onSelect:t,theme:m,t:f,createTaskLabel:a}):jsx(Bv,{onClick:()=>t(),label:a||f.newTask}))]})]})}function Hd({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:n="Agregar Columna",disabled:r=false}){let[s,o]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let d=i.trim();d&&(e(d),c(""),o(false));},[i,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(c(""),o(false));},[l]),p=useCallback(()=>{setTimeout(()=>{i.trim()||o(false);},150);},[i]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:d=>c(d.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),o(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:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:r,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"})]}),n]})})}function Ui({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:n=true,locale:r="es",defaultDate:s,className:o,dropdownDirection:i="up"}){let[c,l]=useState(""),[u,p]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[b,w]=useState(false),[h,x]=useState(false),[y,k]=useState(false),[M,z]=useState(s||new Date),L=useRef(null),N=r==="es",D=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{L.current?.focus();},[]);let S=useCallback(()=>{w(false),x(false),k(false);},[]),V=useCallback(()=>{l(""),p(void 0),m(null),v(null),S(),t();},[t,S]),U=f||s||new Date,W=useCallback(()=>{let J=c.trim();if(!J)return;let de=a.find(Ae=>Ae.id===d),R=U;e({name:J,priority:u,assignee:de||void 0,assigneeId:d,startDate:R,endDate:R}),l(""),p(void 0),m(null),v(null),S(),L.current?.focus();},[c,u,d,U,a,e,S]),E=useCallback(J=>{J.key==="Enter"&&c.trim()&&(J.preventDefault(),W()),J.key==="Escape"&&V();},[W,V,c]),Pe=U;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:L,type:"text",value:c,onChange:J=>l(J.target.value),placeholder:N?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",n?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:E})}),jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",n?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),w(!b),x(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":n?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",D,n?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:N?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:N?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:N?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:N?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:N?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxs("button",{onClick:()=>{p(J.id),w(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",n?"hover:bg-white/5":"hover:bg-gray-50",u===J.id&&(n?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",J.color)}),jsx("span",{className:n?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:J=>{J.stopPropagation(),k(!y),w(false),x(false),z(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?n?"bg-[#00C4AE]/20 text-[#00C4AE]":"bg-[#00E5CC]/20 text-[#00C4AE]":n?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),Pe.toLocaleDateString(N?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",D,n?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",n?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,de=new Date(J);de.setDate(J.getDate()+1);let R=new Date(J);R.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let Ae=new Date(J);Ae.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let nt=new Date(J);nt.setDate(J.getDate()+14);let Ge=new Date(J);Ge.setDate(J.getDate()+28);let B=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:J,display:J.toLocaleDateString(B,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:de,display:de.toLocaleDateString(B,{weekday:"short"}).slice(0,3)+"."},{label:N?"Este fin de semana":"This weekend",date:R,display:N?"s\xE1b.":"sat."},{label:N?"Pr\xF3xima semana":"Next week",date:Ae,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:nt,display:nt.toLocaleDateString(B,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(B,{day:"numeric",month:"short"})}].map((oe,gt)=>jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",n?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(oe.date),k(false);},children:[jsx("span",{children:oe.label}),jsx("span",{className:g("text-[10px] font-mono",n?"text-white/30":"text-gray-400"),children:oe.display})]},gt))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",n?"text-white":"text-gray-900"),children:M.toLocaleDateString(N?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>z(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",n?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:N?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>z(new Date(M.getFullYear(),M.getMonth()-1)),className:g("p-0.5 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>z(new Date(M.getFullYear(),M.getMonth()+1)),className:g("p-0.5 rounded",n?"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:(N?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",n?"text-white/30":"text-gray-400"),children:J},J))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=M.getFullYear(),de=M.getMonth(),R=new Date(J,de,1).getDay(),Ae=new Date(J,de+1,0).getDate(),nt=new Date(J,de,0).getDate(),Ge=new Date().toDateString(),B=[];for(let oe=R-1;oe>=0;oe--)B.push({dayNum:nt-oe,isCurrent:false,date:new Date(J,de-1,nt-oe)});for(let oe=1;oe<=Ae;oe++)B.push({dayNum:oe,isCurrent:true,date:new Date(J,de,oe)});let ce=42-B.length;for(let oe=1;oe<=ce;oe++)B.push({dayNum:oe,isCurrent:false,date:new Date(J,de+1,oe)});return B.map((oe,gt)=>{let Je=oe.date.toDateString()===Ge,ct=(f||s)?.toDateString()===oe.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(n?"text-white/20":"text-gray-300"),oe.isCurrent&&(n?"text-white":"text-gray-900"),Je&&"ring-1 ring-[#00C4AE]",ct&&"bg-[#00C4AE] text-white",!ct&&(n?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(oe.date),k(false);},children:oe.dayNum},gt)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),x(!h),w(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#00C4AE] bg-[#00C4AE]/20":n?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(J=>J.id===d)?.color||"#00C4AE"},children:a.find(J=>J.id===d)?.initials||ma(a.find(J=>J.id===d)?.name)}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",D,n?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",n?"hover:bg-white/5":"hover:bg-gray-50",!d&&(n?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",n?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:n?"text-white/40":"text-gray-500",children:N?"Sin asignar":"Unassigned"})]}),a.map(J=>jsxs("button",{type:"button",onClick:()=>{m(J.id),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",n?"hover:bg-white/5":"hover:bg-gray-50",d===J.id&&(n?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:J.color||"#00C4AE"},children:J.initials||ma(J.name)}),jsx("span",{className:n?"text-white":"text-gray-900",children:J.name})]},J.id)),a.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",n?"text-white/30":"text-gray-400"),children:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:W,disabled:!c.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#00C4AE] hover:bg-[#00A896] text-white":n?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:N?"Guardar":"Save"})]})]})}function Vd({columnId:e,onAddCard:t,availableUsers:a=[],className:n,buttonLabel:r,disabled:s=false,theme:o="dark",locale:i="es"}){let[c,l]=useState(false),u=useRef(null),p=useRef(null),[d,m]=useState({}),[f,v]=useState(false),b=o==="dark",h={buttonLabel:r||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let y=90,k=()=>{let M=u.current.getBoundingClientRect(),L=window.innerHeight-M.bottom<y+8;v(L),m({position:"fixed",...L?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),useEffect(()=>{if(!c)return;let y=k=>{let M=k.target;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&l(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]);let x=useCallback(y=>{t({name:y.name,columnId:e,assigneeIds:y.assigneeId?[y.assigneeId]:void 0,startDate:y.startDate,endDate:y.endDate,priority:y.priority});},[t,e]);return jsxs("div",{ref:u,className:g("asakaa-add-card",n),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:p,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:d,className:g("rounded-lg shadow-2xl",b?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Ui,{onSubmit:x,onCancel:()=>l(false),availableUsers:a,isDark:b,locale:i,dropdownDirection:"up"})})}),document.body)]})}var Vi=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,n){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=n,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(jo,{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(n=>{let r=this.data.columns.find(s=>s.id===n.columnId);a.push([n.id,n.title,r?.title||"",n.description||"",n.labels?.join(", ")||"",n.assignedUserIds?.join(", ")||n.assigneeId||"",n.dueDate?.toString()||"",n.position.toString()]);}),a.map(n=>n.map(r=>`"${r}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let n=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((r,s)=>{n.toBlob(o=>{o?r(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Ug(e={}){return new Vi(e)}var Ks=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,n){let{onError:r,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",n)),this.setState({errorInfo:n}),r)try{r(a,n);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:n}=this.state,{children:r,fallback:s,componentName:o}=this.props;return a&&n?s?s(n,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:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:n.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:n.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"})]})]})}):r}};function Gd(e,t){let a=n=>jsx(Ks,{...t,children:jsx(e,{...n})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Kd({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:n,onChangePriority:r,onAssignUser:s,onGeneratePlan:o,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:u=""}){let[p,d]=useState(false),[m,f]=useState(""),[v,b]=useState("home"),[w,h]=useState(""),[x,y]=useState("");useEffect(()=>{let L=N=>{(N.metaKey||N.ctrlKey)&&N.key===l&&(N.preventDefault(),d(D=>!D)),N.key==="Escape"&&(d(false),b("home"),f(""));};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[l]),useEffect(()=>{p||(b("home"),f(""),h(""),y(""));},[p]);let k=useCallback(()=>{d(false);},[]),M=useCallback(L=>{let[N,D]=L.split(":");switch(N){case "create-card":b("create-card");break;case "create-card-in":h(D||"");break;case "navigate":D?(a?.(D),k()):b("navigate");break;case "search":n?.(m),k();break;case "priority":b("priority");break;case "set-priority":x&&D&&(r?.(x,D),k());break;case "assign":b("assign");break;case "assign-user":x&&D&&(s?.(x,D),k());break;case "ai":b("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":i?.(),k();break;case "ai-usage":c?.(),k();break;case "back":b("home");break;}},[m,x,t,a,n,r,s,o,i,c,k]),z=useCallback(()=>{w&&m.trim()&&(t?.(w,m.trim()),k());},[w,m,t,k]);return p?jsx(Fa,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:L=>L.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,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:v==="create-card"&&w?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:L=>{L.key==="Enter"&&v==="create-card"&&w&&z();}}),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."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:M,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:M,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:M,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:M,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(L=>jsxs(Command.Item,{value:`navigate:${L.id}`,onSelect:M,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:L.title}),L.labels&&L.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:L.labels.slice(0,2).map(N=>jsx("span",{className:"command-palette-item-label",children:N},N))})]},L.id))})]}),v==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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(L=>jsxs(Command.Item,{value:`create-card-in:${L.id}`,onSelect:M,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:L.title}),jsxs("div",{className:"command-palette-item-count",children:[L.cardIds.length," cards"]})]},L.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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(L=>{let N=e.columns.find(D=>D.id===L.columnId);return jsxs(Command.Item,{value:`navigate:${L.id}`,onSelect:M,className:"command-palette-item",keywords:[L.title,L.description||"",...L.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:L.title}),jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),L.labels&&L.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:L.labels.slice(0,2).map(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},L.id)})})]}),v==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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:M,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:M,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:M,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 Gg(e,t,a,n,r){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -30,7 +30,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
30
30
|
max-height: 92vh !important;
|
|
31
31
|
object-fit: contain !important;
|
|
32
32
|
cursor: default !important;
|
|
33
|
-
`,i.onclick=
|
|
33
|
+
`,i.onclick=p=>p.stopPropagation();let c=document.createElement("div");c.className="attachment-lightbox-hint",c.textContent="Click anywhere or press ESC to close",c.style.cssText=`
|
|
34
34
|
position: absolute !important;
|
|
35
35
|
bottom: 24px !important;
|
|
36
36
|
left: 50% !important;
|
|
@@ -38,7 +38,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let l=()=>{o.remove(),document.removeEventListener("keydown",
|
|
41
|
+
`;let l=()=>{o.remove(),document.removeEventListener("keydown",u);},u=p=>{if(p.key==="Escape")l();else if(p.key==="ArrowLeft"&&a.length>1){let d=n>0?n-1:a.length-1;l(),r(d);}else if(p.key==="ArrowRight"&&a.length>1){let d=n<a.length-1?n+1:0;l(),r(d);}};if(o.onclick=l,document.addEventListener("keydown",u),a.length>1){let p=document.createElement("div");p.className="attachment-lightbox-dots",p.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,15 +48,15 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,
|
|
51
|
+
`,p.onclick=f=>f.stopPropagation(),a.forEach((f,v)=>{let b=document.createElement("button");b.className=`attachment-lightbox-dot ${v===n?"active":""}`,b.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
55
|
-
background: ${v===
|
|
55
|
+
background: ${v===n?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,b.onclick=
|
|
59
|
+
`,b.onclick=w=>{w.stopPropagation(),l(),r(v);},p.appendChild(b);});let d=document.createElement("button");d.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",d.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',d.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -69,7 +69,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
69
69
|
border: none !important;
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
opacity: 0.5 !important;
|
|
72
|
-
`,d.onmouseenter=()=>{d.style.opacity="1";},d.onmouseleave=()=>{d.style.opacity="0.5";},d.onclick=f=>{f.stopPropagation();let v=
|
|
72
|
+
`,d.onmouseenter=()=>{d.style.opacity="1";},d.onmouseleave=()=>{d.style.opacity="0.5";},d.onclick=f=>{f.stopPropagation();let v=n>0?n-1:a.length-1;l(),r(v);};let m=document.createElement("button");m.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",m.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',m.style.cssText=`
|
|
73
73
|
position: absolute !important;
|
|
74
74
|
right: 0 !important;
|
|
75
75
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=r<a.length-1?r+1:0;l(),n(v);},o.appendChild(u),o.appendChild(d),o.appendChild(m);}o.appendChild(i),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function cx(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 dx(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 Xc(e){return e.startsWith("image/")}function ps({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,i]=useState(false),[c,l]=useState(false),[p,u]=useState(null),d=useRef(null),m=useRef(e);m.current=e;let f=useCallback((T,D)=>{D.preventDefault(),D.stopPropagation();let M=m.current.filter($=>Xc($.type)),N=M.findIndex($=>$.id===T.id),z=$=>{let Y=m.current.filter(Se=>Xc(Se.type)),A=Y[$];A&&vm(A.url,A.name,Y,$,z);};vm(T.url,T.name,M,N,z);},[]),v=useCallback(T=>{let D=[],M=[];return e.length+T.length>s?(M.push(`Maximum ${s} files allowed`),{valid:D,errors:M}):(T.forEach(N=>{if(N.size/1048576>r){M.push(`${N.name} is too large (max ${r}MB)`);return}if(n&&!n.some($=>N.type.match($))){M.push(`${N.name} has invalid file type`);return}D.push(N);}),{valid:D,errors:M})},[e.length,s,r,n]),b=useCallback(async T=>{let{valid:D,errors:M}=v(T);if(M.length>0){u(M.join(", ")),setTimeout(()=>u(null),5e3);return}if(D.length!==0){l(true),u(null);try{await t?.(D);}catch(N){u(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>u(null),5e3);}finally{l(false);}}},[v,t]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(true);},[]),y=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);},[]),x=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);let D=Array.from(T.dataTransfer.files);b(D);},[b]),C=useCallback(T=>{let D=T.target.files?Array.from(T.target.files):[];b(D),d.current&&(d.current.value="");},[b]),P=useCallback(()=>{d.current?.click();},[]),O=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:h,onDragLeave:y,onDragOver:x,onDrop:w,onClick:P,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Xc(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:D=>f(T,D),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:dx(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:cx(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>O(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function yx({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 Qc({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(yx,{})}),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}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",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((o,i)=>o+i.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,i)=>o+i.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,i)=>o+(i.planned||0),0)})]})]})]})}function Sx({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 Zc({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,l=o<=i;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?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(Sx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Bx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Em=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function $x({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,i=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Mm({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=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:[n,"%"]})]})]})}function ed({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,l)=>c+l.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Bx[c.name]||Em[e.indexOf(c)%Em.length]})),i=o.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?$x:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(Mm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,u=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${u}%)`}})]}):jsxs(BarChart$1,{data:o,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(Mm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var cl=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,i]=useState(false),[c,l]=useState(false),[p,u]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{r.onBulkUpdate?.(f,{priority:w}),i(false);},b=w=>{r.onBulkMove?.(f,w),l(false),a();},h=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),u(false);},y=w=>{let C=new Set;e.forEach(O=>{O.labels?.forEach(T=>C.add(T));});let P=Array.from(new Set([...C,...w]));r.onBulkUpdate?.(f,{labels:P}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w),children:[jsx("span",{className:g("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))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([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:()=>m(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,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"})})]})]})})});cl.displayName="BulkOperationsToolbar";function zx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,i,c,l;switch(t){case "assignee":let p=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);p.length>0?p.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,i=f?.name||`User ${m}`,c=f?.color,l=f?.avatar,r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];i=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:i,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,i=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",i="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function td({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:i,config:c,onCardClick:l,suppressDetailModal:p,availableTags:u,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),b=useMemo(()=>s||zx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),h={callbacks:r,availableUsers:a,renderProps:i,config:c,onCardClick:l,suppressDetailModal:p,availableTags:u,attachmentsByCard:d,renderColumnMetrics:m},y=useCallback(x=>{v(w=>{let C=new Set(w);return C.has(x)?C.delete(x):C.add(x),C});},[]);return !s&&(t.groupBy==="none"||b.length===0)?jsx(lo,{board:e,className:n,...h}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[b.map(x=>{let w=f.has(x.id),C=e.cards.filter(O=>x.cardIds.includes(O.id)),P={...e,cards:C};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>y(x.id)}):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&&y(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(lo,{board:P,...h})})]},x.id)}),b.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 ad=[{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 rd({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),i=ad.find(l=>l.value===e)||ad[0];useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),n(false);};return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:g("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:ad.map(l=>jsxs("button",{onClick:()=>c(l.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ni=[{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 jx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,i=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&i&&c}function Im(e={}){let{shortcuts:t=ni,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(c=>{n.current=[...n.current,c];},[]),i=useCallback(c=>{n.current=n.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let u of n.current)if(jx(l,u)){r&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:u.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:o,unregisterShortcut:i,isEnabled:a}}function Kx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function qx(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 Yx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=qx(e),r=t?Kx(t):"";return a?`${a} + ${r}`:r}function Xx(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 nd({shortcuts:e=ni,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!n||!t)return null;let o=Xx(e);return jsxs("div",{className:g("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(o).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Yx(l)})]},l.action))})]},i))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var od=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=n<a.length-1?n+1:0;l(),r(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(i),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Jv(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,n)*100)/100+" "+a[n]}function Qv(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 Yd(e){return e.startsWith("image/")}function qs({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:n=10,allowedTypes:r,maxFiles:s=10,locale:o="en"}){let i=o==="es",[c,l]=useState(false),[u,p]=useState(false),[d,m]=useState(null),f=useRef(null),v=useRef(e);v.current=e;let b=useCallback((D,S)=>{S.preventDefault(),S.stopPropagation();let V=v.current.filter(E=>Yd(E.type)),U=V.findIndex(E=>E.id===D.id),W=E=>{let Pe=v.current.filter(de=>Yd(de.type)),J=Pe[E];J&&Gg(J.url,J.name,Pe,E,W);};Gg(D.url,D.name,V,U,W);},[]),w=useCallback(D=>{let S=[],V=[];return e.length+D.length>s?(V.push(i?`M\xE1ximo ${s} archivos`:`Maximum ${s} files allowed`),{valid:S,errors:V}):(D.forEach(U=>{if(U.size/1048576>n){V.push(i?`${U.name} es demasiado grande (m\xE1x. ${n} MB)`:`${U.name} is too large (max ${n}MB)`);return}if(r&&!r.some(E=>U.type.match(E))){V.push(`${U.name} has invalid file type`);return}S.push(U);}),{valid:S,errors:V})},[e.length,s,n,r]),h=useCallback(async D=>{let{valid:S,errors:V}=w(D);if(V.length>0){m(V.join(", ")),setTimeout(()=>m(null),5e3);return}if(S.length!==0){p(true),m(null);try{await t?.(S);}catch(U){m(U instanceof Error?U.message:i?"No se pudo subir":"Upload failed"),setTimeout(()=>m(null),5e3);}finally{p(false);}}},[w,t]),x=useCallback(D=>{D.preventDefault(),D.stopPropagation(),l(true);},[]),y=useCallback(D=>{D.preventDefault(),D.stopPropagation(),l(false);},[]),k=useCallback(D=>{D.preventDefault(),D.stopPropagation();},[]),M=useCallback(D=>{D.preventDefault(),D.stopPropagation(),l(false);let S=Array.from(D.dataTransfer.files);h(S);},[h]),z=useCallback(D=>{let S=D.target.files?Array.from(D.target.files):[];h(S),f.current&&(f.current.value="");},[h]),L=useCallback(()=>{f.current?.click();},[]),N=useCallback(D=>{confirm(i?"\xBFEliminar este adjunto?":"Are you sure you want to delete this attachment?")&&a?.(D);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${c?"dragging":""} ${u?"uploading":""}`,onDragEnter:x,onDragLeave:y,onDragOver:k,onDrop:M,onClick:L,children:[jsx("input",{ref:f,type:"file",multiple:true,onChange:z,style:{display:"none"},accept:r?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:u?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:i?"Subiendo\u2026":"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:c?i?"Suelta los archivos aqu\xED":"Drop files here":i?"Arrastra archivos aqu\xED":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:i?"o haz clic para elegirlos":"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:[i?"M\xE1x.":"Max"," ",n,"MB \u2022 ",e.length,"/",s," ",i?"archivos":"files"]})]})})]}),d&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(D=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Yd(D.type)&&D.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>b(D,S),title:"Click to view full size",children:[jsx("img",{src:D.thumbnailUrl||D.url,alt:D.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:Qv(D.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:D.name,children:D.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Jv(D.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(D.uploadedAt).toLocaleDateString(i?"es-CO":"en-US")})]})]}),jsx("button",{onClick:()=>N(D.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"})})})]},D.id))})]})}function sw({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,n)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},n))]})}function Jd({data:e,title:t="Team Velocity",height:a=300,showAverage:n=true,showPlanned:r=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(sw,{})}),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}}),r&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),n&&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((o,i)=>o+i.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,i)=>o+i.completed,0)/e.length).toFixed(1)})]}),r&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,i)=>o+(i.planned||0),0)})]})]})]})}function fw({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,n)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},n))]})}function Qd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:n,useArea:r=false}){let s=n??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,l=o<=i;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(r?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(fw,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),r?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Tw={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Zg=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Dw({cx:e,cy:t,midAngle:a,innerRadius:n,outerRadius:r,percent:s}){let o=n+(r-n)*.5,i=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function ef({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,n=t[0].payload.totalValue||0,r=n>0?(a.value/n*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:[r,"%"]})]})]})}function Zd({data:e,title:t="Distribution",type:a="pie",height:n=300,showPercentages:r=true}){let s=e.reduce((c,l)=>c+l.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Tw[c.name]||Zg[e.indexOf(c)%Zg.length]})),i=o.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:n,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:r?Dw:false,outerRadius:n*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(ef,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let u=l.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${p}%)`}})]}):jsxs(BarChart$1,{data:o,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(ef,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var Ql=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:n,columns:r=[],availableLabels:s=[]})=>{let[o,i]=useState(false),[c,l]=useState(false),[u,p]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(y=>y.id),v=y=>{n.onBulkUpdate?.(f,{priority:y}),i(false);},b=y=>{n.onBulkMove?.(f,y),l(false),a();},w=y=>{n.onBulkUpdate?.(f,{assignedUserIds:y}),p(false);},h=y=>{let k=new Set;e.forEach(z=>{z.labels?.forEach(L=>k.add(L));});let M=Array.from(new Set([...k,...y]));n.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(n.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(y),children:[jsx("span",{className:g("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:r.map(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(y.id),children:y.title},y.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w([y.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,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"})})]})]})})});Ql.displayName="BulkOperationsToolbar";function Pw(e,t,a){if(t==="none")return [];let n=new Map;return e.forEach(r=>{let s,o,i,c,l;switch(t){case "assignee":let u=r.assignedUserIds||(r.assigneeId?[r.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,i=f?.name||`User ${m}`,c=f?.color,l=f?.avatar,n.has(o)||n.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c,icon:l}),n.get(o).cardIds.push(r.id);}):(o="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",n.has(o)||n.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c,icon:l}),n.get(o).cardIds.push(r.id));break;case "priority":s=r.priority||"NONE",o=`priority-${s}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];i=d.title,c=d.color,n.has(o)||n.set(o,{id:o,title:i,groupValue:s,cardIds:[],color:c}),n.get(o).cardIds.push(r.id);break;case "label":r.labels&&r.labels.length>0?r.labels.forEach(m=>{o=`label-${m}`,i=m,c="#6b7280",n.has(o)||n.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c}),n.get(o).cardIds.push(r.id);}):(o="label-none",i="No Labels",c="#6b7280",n.has(o)||n.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c}),n.get(o).cardIds.push(r.id));break}}),Array.from(n.values()).sort((r,s)=>r.title.localeCompare(s.title))}function eu({board:e,swimlaneConfig:t,availableUsers:a,callbacks:n,className:r,swimlanes:s,renderSwimlaneHeader:o,renderProps:i,config:c,onCardClick:l,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let y of s)y.isCollapsed&&x.add(y.id);return x}),b=useMemo(()=>s||Pw(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),w={callbacks:n,availableUsers:a,renderProps:i,config:c,onCardClick:l,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},h=useCallback(x=>{v(y=>{let k=new Set(y);return k.has(x)?k.delete(x):k.add(x),k});},[]);return !s&&(t.groupBy==="none"||b.length===0)?jsx(jo,{board:e,className:r,...w}):jsxs("div",{className:g("asakaa-swimlane-view",r),children:[b.map(x=>{let y=f.has(x.id),k=e.cards.filter(z=>x.cardIds.includes(z.id)),M={...e,cards:k};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:y,cardCount:x.cardIds.length,onToggleCollapse:()=>h(x.id)}):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&&h(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":y?"Expand lane":"Collapse lane",children:y?"\u25B6":"\u25BC"})]}),!y&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(jo,{board:M,...w})})]},x.id)}),b.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 tu=[{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 au({value:e,onChange:t,className:a}){let[n,r]=useState(false),s=useRef(null),o=useRef(null),i=tu.find(l=>l.value===e)||tu[0];useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&r(false);}if(n)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]);let c=l=>{t(l),r(false);};return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>r(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",n&&"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"})})]}),n&&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:tu.map(l=>jsxs("button",{onClick:()=>c(l.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var _i=[{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 Aw(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let r=t.modifiers||{},s=r.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=r.shift?e.shiftKey:!e.shiftKey,i=r.alt?e.altKey:!e.altKey,c=r.meta?e.metaKey:true;return s&&o&&i&&c}function of(e={}){let{shortcuts:t=_i,enabled:a=true,preventDefault:n=true}=e,r=useRef(t),s=useRef(a);useEffect(()=>{r.current=t,s.current=a;},[t,a]);let o=useCallback(c=>{r.current=[...r.current,c];},[]),i=useCallback(c=>{r.current=r.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let u=l.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let p of r.current)if(Aw(l,p)){n&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[n]),{registerShortcut:o,unregisterShortcut:i,isEnabled:a}}function Rw(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Bw(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 $w(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Bw(e),n=t?Rw(t):"";return a?`${a} + ${n}`:n}function Ow(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 nu({shortcuts:e=_i,isOpen:t,onClose:a,className:n}){let[r,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!r||!t)return null;let o=Ow(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",n),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(o).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:$w(l)})]},l.action))})]},i))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var ru=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,24 +122,24 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function sd({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),n(false);},c=e.reduce((l,p)=>{let u=p.category||"Other";return l[u]||(l[u]=[]),l[u].push(p),l},{});return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,p])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:p.map(u=>jsxs("button",{onClick:()=>i(u),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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:u.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:u.name}),u.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:u.description})]})]},u.id))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ld({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,i]=useState("export"),[c,l]=useState("json"),[p,u]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,b=await sp(e,c,v);ip(b,c);},f=async v=>{let b=v.target.files?.[0];if(b){try{let h=await dp(b),y=b.name.endsWith(".json")?"json":"csv",x=cp(h,y);u(x),x.success&&r&&r(x,h);}catch(h){u({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="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(v=>jsxs("button",{onClick:()=>l(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"border-[#00E5CC] bg-[#00E5CC]/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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="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:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxs("div",{className:g("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:p.errors.map((v,b)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},b))})]})]})]})]})]})}var tv=["URGENT","HIGH","MEDIUM","LOW"],av=[{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"}],rv=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function cd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:u=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,b]=useState(true),h=useCallback(P=>{a({search:P.target.value});},[a]),y=useCallback(P=>{a({dateFilter:P.target.value});},[a]),x=useCallback(P=>{r({by:P.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=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 ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>b(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"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"}),C&&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)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[u&&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"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:y,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:P=>{let O=P.target.value;a({priorities:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),tv.map(P=>jsx("option",{value:P,children:P},P))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:P=>{let O=P.target.value;a({assignees:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(P=>jsx("option",{value:P.id,children:P.name},P.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:P=>{let O=P.target.value;a({labels:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(P=>jsx("option",{value:P,children:P},P))]})}),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:x,className:"filter-bar__select filter-bar__select--sm",children:av.map(P=>jsx("option",{value:P.value,children:P.label},P.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"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:P=>f(P.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:rv.map(P=>jsx("option",{value:P.value,children:P.label},P.value))})}),C&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function dd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=useState(false),u=useRef(null);useEffect(()=>{let m=f=>{u.current&&!u.current.contains(f.target)&&p(false);};return l&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[l]);let d=m=>{m(),p(false);};return jsxs("div",{className:g("relative",r),ref:u,children:[jsxs("button",{onClick:()=>p(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(async()=>await o?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 ud={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:"#00E5CC",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"}},pd={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:"#00E5CC",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"}},md={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bo={dark:ud,light:pd,neutral:md},ul="dark";var pl=createContext(void 0),mv="asakaa-theme";function $m({children:e,defaultTheme:t=ul,storageKey:a=mv}){let[r,n]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{n(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Bo[r];Object.entries(c.colors).forEach(([p,u])=>{u&&i.style.setProperty(`--theme-${gv(p)}`,u);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,u])=>{let d=c.colors[p];d&&i.style.setProperty(u,d);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:Bo};return jsx(pl.Provider,{value:o,children:e})}function fs(){let e=useContext(pl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function gd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=fs();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Bo).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/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:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.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}var ft={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",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:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function Om(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ft[e]||ft.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",ft[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ft[e].bgSecondary),bgGrid:r("--theme-bg-card",ft[e].bgGrid),bgWeekend:r("--theme-bg-hover",ft[e].bgWeekend),border:r("--theme-border-primary",ft[e].border),borderLight:r("--theme-border-subtle",ft[e].borderLight),textPrimary:r("--theme-text-primary",ft[e].textPrimary),textSecondary:r("--theme-text-secondary",ft[e].textSecondary),textTertiary:r("--theme-text-tertiary",ft[e].textTertiary),accent:r("--theme-accent-primary",ft[e].accent),accentHover:r("--theme-accent-hover",ft[e].accentHover),accentLight:r("--theme-accent-primary",ft[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ft[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ft[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ft[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ft[e].dependency),dependencyHover:r("--theme-border-secondary",ft[e].dependencyHover),criticalPath:r("--theme-error",ft[e].criticalPath),criticalPathLight:r("--theme-error",ft[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ft[e].today):e==="neutral"?r("--theme-text-primary",ft[e].today):r("--theme-error",ft[e].today),todayLight:e==="light"?r("--theme-accent-primary",ft[e].todayLight):e==="neutral"?r("--theme-text-primary",ft[e].todayLight):r("--theme-error",ft[e].todayLight),milestone:r("--theme-warning",ft[e].milestone),milestoneLight:r("--theme-warning",ft[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ft[e].statusTodo),statusInProgress:r("--theme-accent-primary",ft[e].statusInProgress),statusCompleted:r("--theme-success",ft[e].statusCompleted),hoverBg:r("--theme-bg-hover",ft[e].hoverBg),focusRing:r("--theme-accent-primary",ft[e].focusRing),...ft[e].dotGrid&&{dotGrid:ft[e].dotGrid},...ft[e].glassHeader&&{glassHeader:ft[e].glassHeader},...ft[e].glassToolbar&&{glassToolbar:ft[e].glassToolbar},...ft[e].forecastHud&&{forecastHud:ft[e].forecastHud},...ft[e].neonRedGlow&&{neonRedGlow:ft[e].neonRedGlow},...ft[e].executionBarBg&&{executionBarBg:ft[e].executionBarBg}}}var ml={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!",columns:"Columns"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Hm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!",columns:"Columnas"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},fd={en:ml,es:Hm};function Um(e){return fd[e]||fd.en}function bd(e,t){let a=Um(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 hs=createContext(ml);function Ur(){return useContext(hs)}function ii(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),i=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),n}function qm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[i,c]=useState(false),[l,p]=useState(null),u=useRef(null),d=useRef(null),m=Ur(),f=ii(u,i,"right",176);if(useEffect(()=>{if(!i)return;let y=x=>{let w=x.target;u.current&&!u.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),!(t||a||r||n||s||o))return null;let b=[{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:n},{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:o}].filter(y=>y.handler),h=async(y,x)=>{if(x){p(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{p(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:u,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:b.map((y,x)=>jsxs(motion.button,{onClick:()=>h(y.id,y.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<b.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function hd({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,i]=useState(false),[c,l]=useState(null),[p,u]=useState(false),d=useRef(null),m=useRef(null),f=Ur(),v=ii(d,o,"right",224),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",h=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let C=P=>{let O=P.target;d.current&&!d.current.contains(O)&&m.current&&!m.current.contains(O)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),x=async(C,P)=>{if(P){l(C);try{await P();}catch(O){console.error(`Export ${C} failed:`,O);}finally{l(null),i(false);}}},w=()=>{s?.(),u(true),setTimeout(()=>u(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>i(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.map((C,P)=>jsxs(motion.button,{onClick:()=>x(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:P*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===C.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:p?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Bv({options:e,value:t,onChange:a,theme:r,layoutId:n="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 o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,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:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function $v({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.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}})]},n.value)})})}function yd({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),i=useRef(null),c=Ur(),l=ii(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&i.current&&!i.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],u=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${u}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:u})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:p.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{a(d.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function xd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),i=useRef(null),c=useRef(null),l=Ur(),p=ii(i,s,"left");useEffect(()=>{if(!s)return;let v=setTimeout(()=>{let b=y=>{let x=y.target;i.current&&!i.current.contains(x)&&c.current&&!c.current.contains(x)&&o(false);},h=y=>{y.key==="Escape"&&o(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[s]);let u=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=(t!=="all"?1:0)+(r?1:0),f=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:v=>{v.stopPropagation(),o(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?f?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?f?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#00E5CC":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"}),jsxs("span",{children:[l.toolbar.filter||"Filters",m>0?` \xB7 ${m}`:""]})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${f?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:u.map(v=>{let b=t===v.value&&!r,h=()=>v.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):v.icon;return jsxs(motion.button,{onClick:()=>{a(v.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?v.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:v.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},v.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":f?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function zm({value:e,onChange:t,theme:a}){let r=Ur(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let i=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Ov({theme:e,forecast:t}){let a=Ur(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,u=t?.costAtCompletion,d=t?.currency||"$",m=u!=null?u>=1e6?`${d}${(u/1e6).toFixed(2)}M`:u>=1e3?`${d}${(u/1e3).toFixed(1)}K`:`${d}${u.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,b=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,h=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:i})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&b&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:h.bg,color:h.text,fontFamily:"'JetBrains Mono', monospace"},children:b})]})]})]})}function Gm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:u=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),b=Ur(),h=ii(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let P=O=>{let T=O.target;f.current&&!f.current.contains(T)&&v.current&&!v.current.contains(T)&&m(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[d]);let x=b.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!u,tooltip:u?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],C=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>m(!d),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:d?e.accent:e.textTertiary,backgroundColor:d?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:h.top,left:h.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((P,O)=>{let T=P.icon,D=P.disabled,M=P.tooltip;return jsxs(motion.button,{onClick:()=>!D&&P.onChange?.(!P.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:D?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:D?"not-allowed":"pointer"},whileHover:D?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:O*.03},title:M,children:[jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:D?y?"rgba(255,255,255,0.2)":"#D1D5DB":P.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:P.label}),P.active&&!D&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((P,O)=>{let T=l===P.value;return jsxs(motion.button,{onClick:()=>p(P.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+O)*.03},children:[jsx("span",{style:{color:T?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:P.label}),T&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.value)})]})]})}),document.body)]})}function Hv({theme:e,etiqueta:t,children:a}){let[r,n]=useState(false),s=useRef(null);return useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},i=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i);}},[r]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),r&&jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:a})]})}function gl({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:p=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:h,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:P="execution",onViewModeChange:O,projectForecast:T,hideForecastHud:D,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportCSV:$,onExportJSON:Y,onExportMSProject:A,showCriticalPath:Se=true,onShowCriticalPathChange:W,showDependencies:Ce=true,onShowDependenciesChange:R,highlightWeekends:we=true,onHighlightWeekendsChange:G,showBaseline:Ve=false,onShowBaselineChange:oe,onCopySnapshotLink:Be,hasDependencies:le=true}){let He=Ur(),$e=M||N||z||$||Y||A,Pe=!!t.glassToolbar,je=[{value:"day",label:He.toolbar.day},{value:"week",label:He.toolbar.week},{value:"month",label:He.toolbar.month}],tt=[{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"})}],ee=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(zm,{value:a,onChange:r,theme:t}),v&&jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y,jsx(Gm,{theme:t,showCriticalPath:Se,onShowCriticalPathChange:W,showBaseline:Ve,onShowBaselineChange:oe,highlightWeekends:we,onHighlightWeekendsChange:G,showDependencies:Ce,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:le}),jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportMSProject:A,onCopySnapshotLink:Be}),(O||w)&&jsxs(Hv,{theme:t,etiqueta:He.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[O&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(Ae=>jsxs("button",{type:"button",onClick:()=>O(Ae),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:P===Ae?ee?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[Ae==="execution"?He.toolbar.viewExecution:He.toolbar.viewOracle,P===Ae&&jsx(Check,{className:"w-3.5 h-3.5"})]},Ae))}),w&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C})})]})]});if(Pe){let Ae=ee?"rgba(255,255,255,0.08)":t.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:O&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ee?"#000000":t.bgSecondary,border:`1px solid ${ee?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>O("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="execution"?ee?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:P==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="execution"?{color:t.textSecondary}:{},children:He.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>O("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="oracle"?ee?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:P==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="oracle"?{color:t.textSecondary}:{},children:He.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(zm,{value:a,onChange:r,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ae}}),w&&jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:Ae}}),y]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ae}}),jsx(Gm,{theme:t,showCriticalPath:Se,onShowCriticalPathChange:W,showBaseline:Ve,onShowBaselineChange:oe,highlightWeekends:we,onHighlightWeekendsChange:G,showDependencies:Ce,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:le}),jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportMSProject:A,onCopySnapshotLink:Be}),u&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ee?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ee?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||He.toolbar.createTask})]})]})]}),T&&!D&&jsx(Ov,{theme:t,forecast:T})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx($v,{options:je,value:a,onChange:Ae=>r(Ae),theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsx(motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.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:t.borderLight}}),w&&jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[y&&jsxs(Fragment,{children:[y,jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),u&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||He.toolbar.createTask})]}),($e||p)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportMSProject:A,onCopySnapshotLink:Be}),p&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),p&&jsx(Bv,{options:tt,value:o,onChange:Ae=>i(Ae),theme:t})]})]})}function fl({columns:e,onToggleColumn:t,theme:a}){let r=Ur(),[n,s]=useState(false),[o,i]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!n)return;let u=d=>{c.current&&!c.current.contains(d.target)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let p=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!n&&l.current){let u=l.current.getBoundingClientRect();i({x:u.left,y:u.bottom+4});}s(!n);},className:"p-2 rounded-md transition-colors flex items-center gap-1",title:r.toolbar.columns||"Columns","aria-label":r.toolbar.columns||"Columns",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Columns3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:n&&jsx(ga,{children:jsx(motion.div,{ref:c,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:`${o.x}px`,top:`${o.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"}),p.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function ys({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,u=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,b=a;t+p+d>m&&(v=t-p,v<d&&(v=d)),a+u+d>f&&(b=f-u-d,b<d&&(b=d)),c({x:v,y:b});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=d=>{o.current&&!o.current.contains(d.target)&&n();},u=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",u);}},[e,n]),!e)return null;let l=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(p=>jsxs("div",{children:[p.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),n());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:u=>{p.disabled||(u.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var ua={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function tg({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:u,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let w=[],C=P=>{for(let O of P)w.push(O),O.subtasks&&O.subtasks.length>0&&O.isExpanded&&C(O.subtasks);};return C(x),w},[]),b=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),h=useCallback((x,w)=>{let C=v(e);if(C.length===0)return;let P=b();if(!P){a(C[0].id,false);return}let O=C.findIndex(M=>M.id===P.id);if(O===-1)return;let T=x==="up"?O-1:O+1;if(T<0||T>=C.length)return;let D=C[T];a(D.id,w);},[e,b,v,a]),y=useCallback(x=>{if(!d)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){x.key==="Escape"&&(w.blur(),m.current=false);return}let O=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,T=Array.from(t),D=b();if(x.key==="ArrowUp"){x.preventDefault(),h("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),h("down",x.shiftKey);return}if(D&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!D.isExpanded||x.key==="ArrowLeft"&&D.isExpanded)&&p(D.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){T.length>0&&(x.preventDefault(),o(T,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){T.length>0&&(x.preventDefault(),i(T));return}if(x.key==="Tab"&&x.shiftKey){T.length>0&&(x.preventDefault(),c(T));return}if(x.key==="Enter"&&!x.shiftKey&&!O){D&&(x.preventDefault(),r(D.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!O){D&&(x.preventDefault(),r(D.id,"above"));return}if(x.key==="Enter"&&O){D&&(x.preventDefault(),u(D.id));return}if(x.key==="F2"){D&&(x.preventDefault(),l(D.id));return}if(x.key==="Delete"||x.key==="Backspace"&&O){T.length>0&&(x.preventDefault(),n(T));return}if(x.key==="d"&&O&&!x.shiftKey){T.length>0&&(x.preventDefault(),s(T));return}},[d,t,b,h,r,n,s,o,i,c,l,p,u]);return useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function rg(e){let[t,a]=useState(new Set),[r,n]=useState(null);useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=useCallback(d=>{a(new Set([d])),n(d);},[]),o=useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),i=useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let b=Math.min(f,v),h=Math.max(f,v),y=m.slice(b,h+1);a(new Set(y)),n(d);},[r,s]),c=useCallback((d,m,f,v)=>{v?i(d,m):f?o(d):s(d);},[s,o,i]),l=useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),p=useCallback(()=>{a(new Set),n(null);},[]),u=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:p,isTaskSelected:u}}function Td(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Td(t.subtasks):t.subtasks}))}function Uo(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<o.length;i++){let c={...o[i],parentId:n,level:s,position:o[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function xs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xs(a.subtasks,t);if(r)return r}}return null}function Cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Cd(a.subtasks,t);if(r)return r}return null}function Nd(e,t){if(t.length===0)return e;let a=Uo(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(b=>{if(m.has(b.id))return f.push(b),false;if(b.subtasks){let h=o(b.subtasks,m);b.subtasks=h.tasks,f.push(...h.removed);}return true}),removed:f}},i=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:i(v.subtasks,m,f)}:v),c=new Set(t),{tasks:l,removed:p}=o(e,c),u=i(l,s.id,p);return Td(u)}function Dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Cd(a,r);if(!n)continue;let s=Cd(a,n.id),o=(l,p,u)=>{for(let d=0;d<l.length;d++){let m=l[d];if(m.id===p&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===u);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,p,u);if(f)return f}}return null},i=(l,p,u)=>{let d=l.findIndex(m=>m.id===p);if(d!==-1)return l.splice(d+1,0,u),l;for(let m of l)m.subtasks&&i(m.subtasks,p,u);return l},c=o(a,n.id,r);c&&(s&&s.subtasks?i(s.subtasks,n.id,c):i(a,n.id,c));}return Td(a)}function Sd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,i,c)=>{let l=o.findIndex(u=>u.id===i);if(l===-1){for(let u of o)if(u.subtasks&&s(u.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=o.length?false:([o[l],o[p]]=[o[p],o[l]],o[l]={...o[l],position:l},o[p]={...o[p],position:p},true)};return s(r,n,a),r}function Ed(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ci(e,t){let a=[...e],r=[];for(let n of t){let s=(c,l)=>c.map((p,u)=>({...p,id:`${p.id}-copy-${Date.now()}-${u}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${u}`):void 0})),o=c=>{let l=c.findIndex(m=>m.id===n);if(l===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let p=c[l],u=`${p.id}-copy-${Date.now()}`,d={...p,id:u,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,u):void 0};return c.splice(l+1,0,d),d},i=o(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function ng(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},i=c=>{let l=c.findIndex(u=>u.id===t);if(l===-1){for(let u of c)if(u.subtasks&&i(u.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,o),true};return i(r),{tasks:r,newTask:o}}function Md(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Md(r.subtasks,t,a)}:r)}function Pd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Pd(a.subtasks,t)}:a)}function Fd(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,i=r?.endDate||s,c=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(i),color:r?.color||"#00E5CC",position:l,parentId:t},u=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,p],isExpanded:true}}return m.subtasks?{...m,subtasks:u(m.subtasks)}:m});return {tasks:u(e),newTask:p}}function og(e,t,a,r){if(t===a)return e;let n=xs(e,t);if(!n)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(n,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,u)=>{let d=l?{...p,position:u}:p;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let i=r!==void 0?r:o.length;o.splice(i,0,{...n,parentId:void 0}),o=o.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],u=r!==void 0?r:p.length,d=[...p];d.splice(u,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...l,subtasks:m,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});o=i(o);}return o}function tn(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=tn(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function hl({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:i,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:p,scrollTop:u,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:b,onTaskIndent:h,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:P,onTaskRename:O,addTaskRow:T,onCreateSubtask:D,onOpenTaskModal:M,onDeleteRequest:N,onTaskReparent:z,allTasks:$,scrollContainerRef:Y,showCriticalPath:A=false}){let Se=useContext(hs),[W,Ce]=useState(null),[R,we]=useState(null),[G,Ve]=useState(""),oe=useRef(null),[Be,le]=useState(null),[He,$e]=useState(0),[Pe,je]=useState(0),[tt,ee]=useState({isOpen:false,x:0,y:0,type:"header"}),[Ae,ot]=useState(null),[Ie,zt]=useState(null),[st,bt]=useState(null),Ee=useRef(0),Dt=5,ht=useRef(false),[_e,dt]=useState(null),[L,J]=useState(false),xe=useRef(null),[I,j]=useState(null),[ke,Ue]=useState(null),[ue,at]=useState(false),yt=useRef(null);useEffect(()=>{function se(me){yt.current&&!yt.current.contains(me.target)&&at(false);}if(ue)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[ue]),useEffect(()=>{R&&oe.current&&(oe.current.focus(),oe.current.select());},[R]),useEffect(()=>{if(!Be)return;let se=q=>{let pe=q.clientX-He,ce=Pe+pe;f?.(Be,ce);},me=()=>{le(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,He,Pe,f]);let{selectedTaskIds:Ye,handleTaskClick:vt,isTaskSelected:Xt}=rg(i),{setIsEditing:wt}=tg({tasks:e,selectedTaskIds:Ye,onTaskSelect:(se,me)=>{let pe=Uo(e).map(ce=>ce.id);vt(se,pe,me||false,false),o?.(se);},onTaskCreate:P||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:se=>{let me=Uo(e).find(q=>q.id===se);me&&kt(me);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:se=>{let me=Uo(e).find(q=>q.id===se);me&&M&&M(me);},enableKeyboard:true}),Ut=(se,me=0,q="")=>{let pe=[],ce=[...se].sort((B,re)=>(B.position??0)-(re.position??0));for(let B=0;B<ce.length;B++){let re=ce[B],be=B+1,S=q?`${q}.${be}`:`${be}.0`,H=re.wbsCode||S;if(re.wbsCode=H,pe.push({task:re,level:me}),re.subtasks&&re.subtasks.length>0&&re.isExpanded){let Te=re.wbsCode?.replace(/\.0$/,"")||(q?`${q}.${be}`:`${be}`);pe.push(...Ut(re.subtasks,me+1,Te));}}return pe},Ht=Ut(e),he=48,Fe=Math.max(Ht.length*a,600-he),Qe=(se,me)=>me==="assignees"?se.assignees:me==="startDate"?se.startDate:se.endDate,rt=(se,me,q,pe)=>{se.preventDefault(),se.stopPropagation(),j({sourceTaskId:me,column:q,sourceIndex:pe,targetIndex:pe}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ce=se.currentTarget.closest("[data-grid-body]"),B=fe=>{let Ne=ce?.getBoundingClientRect().top??0,ye=Math.floor((fe-Ne)/a);return ye=Math.max(0,Math.min(Ht.length-1,ye)),ye<pe&&(ye=pe),ye},re=se.clientY,be=Y?.current??null,S=()=>{xe.current&&(cancelAnimationFrame(xe.current),xe.current=null);},H=()=>{let fe=B(re);j(Ne=>Ne&&{...Ne,targetIndex:fe});},Z=()=>{if(S(),!be)return;let fe=be.getBoundingClientRect(),Ne=60,ye=12,lt=re-fe.top,Et=fe.bottom-re;if(Et<Ne&&be.scrollTop<be.scrollHeight-be.clientHeight){let Qt=Math.max(1,Math.round(ye*(1-Math.max(0,Et)/Ne))),ja=()=>{be.scrollTop+=Qt,H(),be.scrollTop<be.scrollHeight-be.clientHeight&&(xe.current=requestAnimationFrame(ja));};xe.current=requestAnimationFrame(ja);}else if(lt<Ne&&be.scrollTop>0){let Qt=Math.max(1,Math.round(ye*(1-Math.max(0,lt)/Ne))),ja=()=>{be.scrollTop-=Qt,H(),be.scrollTop>0&&(xe.current=requestAnimationFrame(ja));};xe.current=requestAnimationFrame(ja);}},Te=fe=>{re=fe.clientY,H(),Z();},gt=fe=>{window.removeEventListener("mousemove",Te),window.removeEventListener("mouseup",gt),S(),document.body.style.cursor="",document.body.style.userSelect="",j(null);let Ne=B(fe.clientY),ye=Ht.find(Er=>Er.task.id===me)?.task;if(!ye)return;let lt=Qe(ye,q),Et=Math.min(pe,Ne),Qt=Math.max(pe,Ne),ja=[];for(let Er=Et;Er<=Qt;Er++){if(Er===pe)continue;let _a=Ht[Er]?.task;!_a||_a.subtasks&&_a.subtasks.length>0||ja.push(_a.id);}ja.length!==0&&b?.(ja,q,lt);};window.addEventListener("mousemove",Te),window.addEventListener("mouseup",gt);},Tt=se=>{if(!I)return false;let me=Math.min(I.sourceIndex,I.targetIndex),q=Math.max(I.sourceIndex,I.targetIndex);return se>=me&&se<=q},Ft=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,kt=se=>{we(se.id),Ve(se.name),wt(true);},Da=se=>{G.trim()&&G!==e.find(me=>me.id===se)?.name&&O?.(se,G.trim()),we(null),Ve(""),wt(false);},aa=()=>{we(null),Ve(""),wt(false);},cr=(se,me)=>{me.stopPropagation(),D?.(se.id);},Xe=(se,me)=>{me.preventDefault(),Ee.current=me.clientY,ot(se),ht.current=false,J(false),dt({x:me.clientX,y:me.clientY});},et=se=>{if(!Ae||(Math.abs(se.clientY-Ee.current)>Dt&&!ht.current&&(ht.current=true,J(true)),dt({x:se.clientX,y:se.clientY}),!ht.current))return;if(Y?.current){let B=Y.current,re=B.getBoundingClientRect(),be=60,S=12;xe.current&&(cancelAnimationFrame(xe.current),xe.current=null);let H=se.clientY-re.top,Z=re.bottom-se.clientY;if(H<be&&B.scrollTop>0){let Te=Math.round(S*(1-H/be)),gt=()=>{B.scrollTop-=Te,ht.current&&B.scrollTop>0&&(xe.current=requestAnimationFrame(gt));};xe.current=requestAnimationFrame(gt);}else if(Z<be&&B.scrollTop<B.scrollHeight-B.clientHeight){let Te=Math.round(S*(1-Z/be)),gt=()=>{B.scrollTop+=Te,ht.current&&B.scrollTop<B.scrollHeight-B.clientHeight&&(xe.current=requestAnimationFrame(gt));};xe.current=requestAnimationFrame(gt);}}let q=document.querySelectorAll("[data-task-row]"),pe=null,ce=null;q.forEach(B=>{let re=B.getBoundingClientRect(),be=B.getAttribute("data-task-row");if(be&&be!==Ae&&se.clientY>=re.top&&se.clientY<=re.bottom){pe=be;let S=se.clientY-re.top,H=re.height;S<H*.25?ce="above":S>H*.75?ce="below":ce="child";}}),zt(pe),bt(ce);},Sa=()=>{if(ht.current&&Ae&&Ie&&st){if(st==="child")z?.(Ae,Ie);else if(st==="above"||st==="below"){let se=(B,re,be=null)=>{for(let S of B){if(S.id===re)return be;if(S.subtasks){let H=se(S.subtasks,re,S.id);if(H!==void 0)return H}}},me=$&&$.length>0?$:e,q=se(me,Ae,null),pe=se(me,Ie,null),ce=(B,re,be,S)=>{let H=B.findIndex(gt=>gt.id===re),Z=S?B.findIndex(gt=>gt.id===be):-1,Te=st==="below"?H+1:H;return S&&Z!==-1&&Z<H&&(Te-=1),Math.max(0,Te)};if(pe===null){let re=ce(me,Ie,Ae,q===null);z?.(Ae,null,re);}else {let B=xs(me,pe);if(B?.subtasks){let re=q===pe,be=ce(B.subtasks,Ie,Ae,re);z?.(Ae,pe,be);}}}}xe.current&&(cancelAnimationFrame(xe.current),xe.current=null),ot(null),zt(null),bt(null),dt(null),ht.current=false,J(false);};useEffect(()=>{if(Ae)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",Sa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",Sa),document.body.style.cursor="",document.body.style.userSelect="";}},[Ae,Ie,st]);let Ia=(se,me,q)=>{let pe=me.subtasks&&me.subtasks.length>0;switch(se.id){case "name":let ce=R===me.id,B=W===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${q*20}px`},children:[z&&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:B?1:.3},onMouseDown:ye=>Xe(me.id,ye),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:ye=>{ye.stopPropagation(),p?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),ce?jsx("input",{ref:oe,type:"text",value:G,onChange:ye=>Ve(ye.target.value),onKeyDown:ye=>{ye.key==="Enter"?Da(me.id):ye.key==="Escape"&&aa();},onBlur:()=>Da(me.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ye=>ye.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),me.isHighlighted&&me.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name}),me.subtasks&&me.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(me.progress||0),"%"]}),A&&me.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),A&&me.cpmData&&jsxs("span",{style:{color:me.cpmData.totalFloat<=0?"#EF4444":me.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(me.cpmData.totalFloat),"d"]})]}),B&&!ce&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ye=>ye.stopPropagation(),children:[jsx("button",{onClick:ye=>cr(me,ye),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:ye=>{ye.stopPropagation(),kt(me);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let be=se.id==="startDate"?"startDate":"endDate",S=me[be],H=ke?.taskId===me.id&&ke?.field===be,Z=ye=>ye?(typeof ye=="string"?new Date(ye):ye).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ye=>ye.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:pe?.5:1,cursor:pe?"default":"pointer"},title:pe?"Auto-calculated from subtasks":void 0,onClick:ye=>{if(!pe)if(H)Ue(null);else {let lt=ye.currentTarget.getBoundingClientRect();Ue({taskId:me.id,field:be,month:S?typeof S=="string"?new Date(S):S:new Date,position:{top:lt.bottom+4,left:lt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Z(S)}),pe&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),H&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ue(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:ke?.position.top,left:ke?.position.left},onClick:ye=>ye.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ye=new Date,lt=new Date(ye);lt.setDate(ye.getDate()+1);let Et=new Date(ye);Et.setDate(ye.getDate()+7);let Qt=new Date(ye);return Qt.setDate(ye.getDate()+14),[{label:"Hoy",date:ye},{label:"Ma\xF1ana",date:lt},{label:"Pr\xF3xima semana",date:Et},{label:"2 semanas",date:Qt}].map((Er,_a)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Mr=>Mr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Mr=>Mr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(me.id,{[be]:Er.date}),Ue(null);},children:Er.label},_a))})(),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:ye=>ye.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(me.id,{[be]:void 0}),Ue(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:()=>Ue(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.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:ke?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Ue(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.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((ye,lt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ye},lt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ye=ke?.month||new Date,lt=ye.getFullYear(),Et=ye.getMonth(),Qt=new Date(lt,Et,1).getDay(),ja=new Date(lt,Et+1,0).getDate(),Er=new Date,_a=[];for(let xa=Qt-1;xa>=0;xa--)_a.push({day:new Date(lt,Et,-xa).getDate(),date:new Date(lt,Et-1,new Date(lt,Et,-xa).getDate()),isCurrentMonth:false});for(let xa=1;xa<=ja;xa++)_a.push({day:xa,date:new Date(lt,Et,xa),isCurrentMonth:true});let Mr=42-_a.length;for(let xa=1;xa<=Mr;xa++)_a.push({day:xa,date:new Date(lt,Et+1,xa),isCurrentMonth:false});return _a.map((xa,On)=>{let Vr=xa.date.toDateString()===Er.toDateString(),Xr=(S?typeof S=="string"?new Date(S):S:null)?.toDateString()===xa.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:xa.isCurrentMonth?Xr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Xr?"#00E5CC":"transparent",boxShadow:Vr&&!Xr?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(me.id,{[be]:xa.date}),Ue(null);},children:xa.day},On)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Ft(me)})});case "assignees":if(pe)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let Te=r.filter(ye=>me.assignees?.some(lt=>lt.id?lt.id===ye.id:lt.name===ye.name||lt.initials===ye.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsx(Fo,{assignedUsers:Te,availableUsers:r,onChange:ye=>{let lt=ye.map(Et=>({id:Et.id,name:Et.name,initials:Et.initials,color:Et.color}));v?.(me.id,{assignees:lt});}})});case "status":if(pe){let ye=me.progress===100?"\u2713":me.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ye})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsx(Mp,{status:me.status||"todo",onChange:ye=>{v?.(me.id,{status:ye,progress:ye==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:pe?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${me.progress}%`,backgroundColor:me.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[me.progress,"%"]})]});case "priority":let gt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},fe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ne=gt[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsx(Mo,{priority:Ne,onChange:ye=>{ye&&v?.(me.id,{priority:fe[ye]||"medium"});}})});default:return null}},dr=se=>[{id:"hide",label:"Hide Column",icon:ua.Hide,onClick:()=>m(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ua.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ua.SortDesc,onClick:()=>{}}],xr=se=>{let me=se.subtasks&&se.subtasks.length>0,q=Uo(e),pe=Ye.size>1&&Ye.has(se.id),ce=pe?q.filter(H=>Ye.has(H.id)):[se],B=ce.map(H=>H.id),re=ce.filter(H=>!(H.subtasks&&H.subtasks.length>0)),be=pe?` (${B.length})`:"",S=()=>{N?N(B,se.name):w?.(B);};return me?[{id:"addSubtask",label:Se?.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{D?.(se.id);}},{id:"duplicate",label:(Se?.contextMenu?.duplicateTask||"Duplicate Task")+be,icon:ua.Duplicate,onClick:()=>{C?.(B);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(Se?.contextMenu?.deleteTask||"Delete Task")+be,icon:ua.Delete,onClick:S}]:[{id:"edit",label:Se?.contextMenu?.editTask||"Edit Task",icon:ua.Pencil,onClick:()=>{c?.(se);}},{id:"addSubtask",label:Se?.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{D?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(Se?.contextMenu?.markIncomplete||"Mark Incomplete")+be,icon:ua.MarkIncomplete,onClick:()=>{re.forEach(H=>v?.(H.id,{status:"todo",progress:0}));},disabled:re.length===0||re.every(H=>H.status==="todo")},{id:"setInProgress",label:(Se?.contextMenu?.setInProgress||"Set In Progress")+be,icon:ua.SetInProgress,onClick:()=>{re.forEach(H=>v?.(H.id,{status:"in-progress"}));},disabled:re.length===0||re.every(H=>H.status==="in-progress")},{id:"markComplete",label:(Se?.contextMenu?.markComplete||"Mark Complete")+be,icon:ua.MarkComplete,onClick:()=>{re.forEach(H=>v?.(H.id,{status:"completed",progress:100}));},disabled:re.length===0||re.every(H=>H.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(Se?.contextMenu?.duplicateTask||"Duplicate Task")+be,icon:ua.Duplicate,onClick:()=>{C?.(B);}},{id:"split",label:Se?.contextMenu?.splitTask||"Split Task",icon:ua.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(Se?.contextMenu?.deleteTask||"Delete Task")+be,icon:ua.Delete,onClick:S}]},Ra=d.filter(se=>se.visible),Ja=Ra.reduce((se,me)=>se+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ja},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${he}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ra.map((se,me)=>{let q=me===Ra.length-1,pe=se.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${pe?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(pe?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:pe&&Ra.length===1?1:0,flexGrow:pe&&Ra.length===1?1:0,borderRight:q?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ce=>{ce.preventDefault(),ee({isOpen:true,x:ce.clientX,y:ce.clientY,type:"header",columnId:se.id});},onMouseEnter:ce=>{ce.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:se.label,children:se.label}),se.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:Be===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ce=>{ce.preventDefault(),ce.stopPropagation(),le(se.id),$e(ce.clientX),je(se.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:Be===se.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(fl,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>at(!ue),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"})}),ue&&jsxs("div",{ref:yt,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>at(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"})]})]})]})]})]})]})]}),jsxs("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Fe},children:[Ht.map(({task:se,level:me},q)=>{let pe=Xt(se.id),ce=Tt(q),B=Ie===se.id,re=B&&st==="above",be=B&&st==="below",S=B&&st==="child",H={};return S&&(H.backgroundColor=`${t.accent}15`,H.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${Ae===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:pe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:pe?t.accentLight:S?`${t.accent}15`:q%2===0?t.bgPrimary:t.bgGrid,opacity:A?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...H},onMouseEnter:()=>Ce(se.id),onMouseLeave:()=>Ce(null),onClick:Z=>{let gt=Uo(e).map(ye=>ye.id),Ne=navigator.platform.toUpperCase().indexOf("MAC")>=0?Z.metaKey:Z.ctrlKey;vt(se.id,gt,Ne,Z.shiftKey),o?.(se.id),!Ne&&!Z.shiftKey&&s?.(se);},onDoubleClick:Z=>{Z.stopPropagation(),c?.(se);},onContextMenu:Z=>{Z.preventDefault(),ee({isOpen:true,x:Z.clientX,y:Z.clientY,type:"task",task:se}),l?.(se,Z);},whileHover:{backgroundColor:pe?t.accentLight:t.hoverBg},children:[re&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),be&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ra.map((Z,Te)=>{let gt=Te===Ra.length-1,fe=Z.id==="name",Ne=!!(se.subtasks&&se.subtasks.length>0),ye=Z.id==="assignees"||Z.id==="startDate"||Z.id==="endDate"?Z.id:null,Et=!!ye&&!Ne&&W===se.id&&!I,Qt=ce&&!!I&&I.column===Z.id;return jsxs("div",{className:`px-4 flex items-center ${fe?"justify-start":"justify-center"}`,style:{position:"relative",width:`${Z.width}px`,minWidth:`${Z.minWidth??(fe?200:60)}px`,maxWidth:`${Z.maxWidth??2e3}px`,flexShrink:fe&&Ra.length===1?1:0,flexGrow:fe&&Ra.length===1?1:0,borderRight:gt?"none":`1px solid ${W===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Qt?`${t.accent}22`:void 0,boxShadow:Qt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Ia(Z,se,fe?me:0),Et&&ye&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:ja=>rt(ja,se.id,ye,q),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${se.id}-${Z.id}`)})]},se.id)}),T&&jsxs("button",{type:"button","data-anadir-tarea":true,onClick:T.onClick,className:"w-full flex items-center gap-2 px-3 text-left text-[13px] transition-colors",style:{height:`${a}px`,color:t.textTertiary,borderBottom:`1px solid ${t.borderLight}`},onMouseEnter:se=>{se.currentTarget.style.color=t.textPrimary;},onMouseLeave:se=>{se.currentTarget.style.color=t.textTertiary;},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),T.label]})]}),jsx(ys,{isOpen:tt.isOpen,x:tt.x,y:tt.y,items:tt.type==="header"&&tt.columnId?dr(tt.columnId):tt.type==="task"&&tt.task?xr(tt.task):[],onClose:()=>ee({...tt,isOpen:false}),theme:t}),L&&_e&&Ae&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:_e.x+12,top:_e.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Ht.find(me=>me.task.id===Ae)?.task;return se?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function ug(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,i]=useState(e),[c,l]=useState(t),[p,u]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[b,h]=useState(null),[y,x]=useState(0),[w,C]=useState(0),[P,O]=useState(null),[T,D]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:u,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:b,setDraggedSegmentIndex:h,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:P,setHoveredSegmentIndex:O,isHovered:T,setIsHovered:D,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,A)=>{r("none"),u(null),m(null),i(Y),l(A),C(0),h(null),x(0);}}}function yl({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:u,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:b,showTaskBarLabels:h=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let C=ug(t,r),P=useRef(null),O=useRef(false),T=useRef(null),D=useRef(null),{dragMode:M,setDragMode:N,dragOffset:z,setDragOffset:$,ghostX:Y,setGhostX:A,ghostWidth:Se,setGhostWidth:W,connectionLine:Ce,setConnectionLine:R,hoveredTaskId:we,setHoveredTaskId:G,activeZone:Ve,setActiveZone:oe,draggedSegmentIndex:Be,setDraggedSegmentIndex:le,draggedSegmentStartX:He,setDraggedSegmentStartX:$e,segmentDragOffsetX:Pe,setSegmentDragOffsetX:je,hoveredSegmentIndex:tt,setHoveredSegmentIndex:ee,isHovered:Ae,setIsHovered:ot,isDragging:Ie,isResizing:zt,isConnecting:st,resetDragState:bt}=C,Ee=18,Dt=!!n.executionBarBg,ht=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",_e=Dt?3:6,dt=e.subtasks&&e.subtasks.length>0,L=useRef(null),[J,xe]=(()=>{let q=useRef(null),[,pe]=useState(0);return [q.current,ce=>{q.current=ce,pe(B=>B+1);}]})(),I=!!w&&!x&&!dt&&!e.segments&&!!e.startDate&&!!e.endDate,j=e.endDate&&(()=>{let q=new Date;q.setHours(0,0,0,0);let pe=new Date(e.endDate);return pe.setHours(0,0,0,0),pe<q})()&&e.progress<100,ke=y&&e.isCriticalPath,Ue=n.name==="neutral"||n.today==="#1C1917",ue=e.status==="completed"||e.progress===100,at={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ye=y&&e.isCriticalPath||j?"#EF4444":e.color?e.color:e.priority&&at[e.priority]?at[e.priority]:n.taskBarPrimary,vt=x?"default":Ie?st?"crosshair":zt?"ew-resize":"grabbing":"grab",Xt=x?"default":"ew-resize",Ut=(q=>q>=80?20:q>=60?15:q>=50?12:10)(r),Ht=r<50,he=r<40;useEffect(()=>{v&&(!Ae||Ie||e.segments)&&v(null);},[Ae,Ie,e.segments,v]);let Fe=q=>q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Qe=()=>{let q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${q} day${q!==1?"s":""}`},rt=q=>Math.round(q/s)*s,Tt=q=>{let pe=Math.round(q/s),ce=new Date(o);return ce.setDate(ce.getDate()+pe),ce},Ft=(q,pe)=>{for(let ce of m){if(ce.id===e.id)continue;let B=5;if(q>=ce.x-B&&q<=ce.x+ce.width+B&&pe>=ce.y-B&&pe<=ce.y+ce.height+B)return ce.id}return null},kt=useCallback((q,pe,ce)=>{if(x)return;q.preventDefault(),q.stopPropagation();let B=P.current?.ownerSVGElement;if(!B)return;let re=B.createSVGPoint();re.x=q.clientX,re.y=q.clientY;let be=re.matrixTransform(B.getScreenCTM()?.inverse()),S=ce!==void 0?ce:t,H=pe;if(!H){let Z=be.x-S;q.shiftKey?(H="connect",R({x:t+r,y:a+Ee/2})):q.ctrlKey||q.metaKey?H="move":q.altKey?H=Z<r/2?"resize-start":"resize-end":he?Z<r/2?H="move":H="resize-end":Ht?Z<=Ut/2?H="resize-start":Z>=r-Ut/2?H="resize-end":H="move":Z<=Ut?H="resize-start":Z>=r-Ut?H="resize-end":H="move";}O.current=false,N(H),ot(false),oe(null),H==="move"?$(be.x-S):H==="connect"?R({x:t+r,y:a+Ee/2}):$(0),A(S),W(r);},[t,r,a,Ee,x]),Da=useCallback(q=>{let pe=P.current?.ownerSVGElement;if(!pe)return;let ce=pe.closest(".gantt-timeline-scroll");if(!ce)return;let B=ce.getBoundingClientRect(),re=60,be=15,S=0;if(q.clientX<B.left+re){let H=B.left+re-q.clientX;S=-Math.min(be,H/2);}else if(q.clientX>B.right-re){let H=q.clientX-(B.right-re);S=Math.min(be,H/2);}return S!==0&&(ce.scrollLeft+=S),S!==0},[]),aa=useCallback(q=>{if(M==="none")return;O.current=true,D.current=q;let pe=P.current?.ownerSVGElement;if(!pe)return;if(M==="move"||M==="resize-start"||M==="resize-end"){let re=Da(q);re&&!T.current?T.current=window.setInterval(()=>{D.current&&(Da(D.current),aa(D.current));},16):!re&&T.current&&(window.clearInterval(T.current),T.current=null);}let ce=pe.createSVGPoint();ce.x=q.clientX,ce.y=q.clientY;let B=ce.matrixTransform(pe.getScreenCTM()?.inverse());if(M==="connect"){R({x:B.x,y:B.y});let re=Ft(B.x,B.y);G(re);}else if(M==="move"){let re=B.x-z,be=rt(re);A(be),W(r);let S=Math.round((be-t)/s);if(f?.(e.id,S,true),e.segments&&e.segments.length>0&&Be!==null){let H=be-He;je(H);}}else if(M==="resize-start"){let re=B.x,be=rt(re),S=t+r-be;S>=s&&(A(be),W(S));}else if(M==="resize-end"){let re=B.x,S=rt(re)-t;S>=s&&W(S);}},[M,t,r,s,z,e,rt,Be,He,Ft,G,R,A,W,je,f,Da]),cr=useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),D.current=null,M!=="none"){if(M==="connect")we&&d&&d(e,we),R(null),G(null);else {let q=e.endDate.getTime()-e.startDate.getTime(),pe,ce,B=true;if(M==="move"){if(pe=Tt(Y),ce=new Date(pe.getTime()+q),e.segments&&e.segments.length>0&&Be!==null){let re=Math.round(Pe/s),be=e.segments.map((Te,gt)=>{if(gt===Be){let fe=new Date(Te.startDate),Ne=new Date(Te.endDate);return fe.setDate(fe.getDate()+re),Ne.setDate(Ne.getDate()+re),{startDate:fe,endDate:Ne}}return Te}),S=be.flatMap(Te=>[Te.startDate,Te.endDate]),H=new Date(Math.min(...S.map(Te=>Te.getTime()))),Z=new Date(Math.max(...S.map(Te=>Te.getTime())));u?.({...e,segments:be},H,Z),bt(t,r);return}}else M==="resize-start"?(pe=Tt(Y),ce=e.endDate,pe>ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),B=false)):M==="resize-end"?(pe=e.startDate,ce=Tt(Y+Se),ce.setDate(ce.getDate()-1),ce<pe&&(console.warn("Invalid date range: end date must be after or equal to start date"),B=false)):B=false;B&&pe&&ce&&(ce.getTime()<pe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):u?.(e,pe,ce));}f?.(e.id,0,false),bt(t,r);}},[M,Y,Se,e,u,we,d,t,r,s,Tt,Pe,Be,bt,f]);useEffect(()=>{if(M==="none")return;let q=ce=>{aa(ce);},pe=()=>{cr();};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",pe),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",pe),T.current&&(window.clearInterval(T.current),T.current=null);}},[M,aa,cr]);let Xe=Ie&&!st?Y:t,et=Ie&&!st?Se:r,Sa=i.taskClass(e),Ia=24,dr=y?e.isCriticalPath?1:.25:1,xr=useCallback(q=>{if(!I)return;q.stopPropagation(),q.preventDefault();let ce=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:ce,initialPct:e.progress||0},q.currentTarget.setPointerCapture(q.pointerId),xe(e.progress||0);},[I,e.progress,xe]),Ra=useCallback(q=>{let pe=L.current;if(!pe)return;let B=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??pe.barRect;if(!B||B.width<=0)return;let re=(q.clientX-B.left)/B.width,be=Math.round(Math.max(0,Math.min(1,re))*100);q.shiftKey&&(be=Math.round(be/25)*25),xe(be);},[xe]),Ja=useCallback(q=>{let pe=L.current;if(!pe)return;q.stopPropagation(),q.preventDefault();try{q.currentTarget.releasePointerCapture(q.pointerId);}catch{}let ce=J;L.current=null,xe(null),ce!=null&&ce!==pe.initialPct&&w&&w(e,ce);},[J,w,e,xe]),se=useCallback(q=>{q.stopPropagation(),q.preventDefault();},[]),me=J??(e.progress||0);return jsxs("g",{ref:P,"data-task-bar":"true","data-estado":ue?"completed":j?"overdue":"planned","data-resumen":dt?"true":void 0,style:{opacity:dr,transition:"opacity 300ms ease"},onClick:()=>{!Ie&&!O.current&&c?.(e),O.current=false;},onDoubleClick:q=>{!Ie&&!O.current&&(q.stopPropagation(),l?.(e));},onContextMenu:q=>{q.preventDefault(),p?.(e,q);},onMouseEnter:()=>!Ie&&ot(true),onMouseMove:q=>{v&&Ae&&!Ie&&!e.segments&&v({task:e,x:t,y:a,width:r,height:Ee,showBelow:false,mouseX:q.clientX,mouseY:q.clientY});},onMouseLeave:()=>{Ie||(ot(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+Ia,height:Ee,fill:"transparent",style:{pointerEvents:"all"}}),Ae&&!Ie&&!Ht&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ut,height:Ee,fill:Ve==="resize-start"?n.accent:"transparent",opacity:Ve==="resize-start"?.15:0,style:{cursor:Xt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:q=>kt(q,"resize-start")}),jsx("rect",{x:t+Ut,y:a,width:r-Ut*2,height:Ee,fill:Ve==="move"?n.accent:"transparent",opacity:Ve==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:q=>kt(q,"move")}),jsx("rect",{x:t+r-Ut,y:a,width:Ut,height:Ee,fill:Ve==="resize-end"?n.accent:"transparent",opacity:Ve==="resize-end"?.15:0,style:{cursor:Xt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:q=>kt(q,"resize-end")})]}),Ae&&!Ie&&he&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Ee,fill:Ve==="move"?n.accent:"transparent",opacity:Ve==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:q=>kt(q,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ee,fill:Ve==="resize-end"?n.accent:"transparent",opacity:Ve==="resize-end"?.2:0,style:{cursor:Xt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:q=>kt(q,"resize-end")}),Ae&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ee-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!st&&!e.segments&&jsx(motion.rect,{x:Y,y:a,width:Se,height:Ee,rx:_e,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),b&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let q=e.baselineStartDate.getTime(),pe=e.baselineEndDate.getTime(),ce=o.getTime(),B=864e5,re=(q-ce)/B,be=(pe-q)/B,S=re*s,H=Math.max(be*s,s),Z=Xe+et,Te=S+H,gt=e.endDate?.getTime()??0,fe=Math.ceil((gt-pe)/B),Ne=fe>0,ye=fe<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:S,y:a,width:H,height:Ee,rx:_e,fill:"none",stroke:ht?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ne&&Z>Te&&jsx("rect",{x:Te,y:a,width:Z-Te,height:Ee,rx:0,fill:"#EF4444",opacity:.2}),Ne&&jsxs("text",{x:Math.max(Z,Te)+6,y:a+Ee/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",fe,"d"]}),ye&&jsxs("text",{x:Z+6,y:a+Ee/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[fe,"d"]})]})})(),!e.segments&&Dt&&dt&&(()=>{let pe=a+(Ee-8)/2,ce=4,B=e.progress||0,re=new Date;re.setHours(0,0,0,0);let be=e.startDate&&re>=e.startDate,S=e.endDate&&(()=>{let Ne=new Date(e.endDate);return Ne.setHours(0,0,0,0),re>Ne})(),H=e.startDate&&re<e.startDate,Z=1;if(be&&e.startDate&&e.endDate&&!H){let Ne=new Date(e.startDate);Ne.setHours(0,0,0,0);let ye=new Date(e.endDate);ye.setHours(0,0,0,0);let lt=Math.max(1,(ye.getTime()-Ne.getTime())/(1e3*60*60*24)),Qt=Math.min((re.getTime()-Ne.getTime())/(1e3*60*60*24),lt)/lt*100;Z=Qt>0?B/Qt:1;}let Te;B>=100?Te="#00E5CC":H?Te="#4B5563":S&&B<100?Te="#EF4444":Z>=.95?Te="#22C55E":Z>=.8?Te="#F59E0B":Te="#EF4444";let gt=Math.max(B/100*et,B>0?ce*2:0),fe=et>100&&B>0;return jsxs("g",{"data-task-class":Sa,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:Xe,y:pe,width:et,height:8,rx:ce,fill:"rgba(255,255,255,0.10)"}),B>0&&jsx("rect",{"data-parte":"avance",x:Xe,y:pe,width:gt,height:8,rx:ce,fill:Te}),fe&&jsxs("text",{x:Xe+gt+6,y:pe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(B),"%"]})]})})(),!e.segments&&Dt&&!dt&&jsx(motion.rect,{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Sa,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!st?.15:e.parentId?.6:1,scale:Ae&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:q=>kt(q),style:{cursor:vt,pointerEvents:"all"}}),!e.segments&&!Dt&&jsx(motion.rect,{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:Ye,"data-task-class":Sa,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!st?.15:e.parentId?.6:Ae?.9:.8,scale:Ae&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:dt?void 0:q=>kt(q),style:{cursor:dt?"default":vt,pointerEvents:"all"}}),Dt&&(j||ke)&&!e.segments&&jsx("rect",{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),j&&!ue&&!e.segments&&!dt&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Xe+et+4}, ${a+Ee/2-6})`,children:[jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!e.segments&&me>0&&!dt&&jsx("rect",{x:Xe,y:a,width:Math.max(et*(me/100),_e*2),height:Ee,rx:_e,fill:Ye,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!dt&&e.progress<100&&(()=>{let q=e.progress>0?et*(e.progress/100):0,pe=Xe+q,ce=et-q,B=e.progress===0?_e:0,re=e.progress===0?Xe:pe,be=e.progress===0?et:ce;return jsxs(Fragment,{children:[jsx("rect",{x:re,y:a,width:be,height:Ee,rx:B,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:re,y:a,width:be,height:Ee,rx:B,fill:"none",stroke:Ye,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),Dt&&!e.segments&&e.progress>0&&e.progress<100&&!dt&&!Ie&&J===null&&(()=>{let q=Xe+et*(e.progress/100),pe=8,ce=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:q,cy:a+Ee/2,r:pe,fill:ce?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:q,y:a+Ee/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ce?.initials||ce?.name?.charAt(0)?.toUpperCase()||""})]})})(),I&&!Ie&&et>=40&&(J!==null||me<88)&&(()=>{let q=Xe+et*(me/100),pe=a+Ee/2,ce=J!==null,B=ce?7:Ae?6:5,re=ce||Ae?1:.35,be=Xe+et-q,S=Math.max(4,Math.min(12,be-10)),H=12;return jsxs("g",{children:[jsx("rect",{x:q-H,y:pe-12,width:H+S,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:xr,onPointerMove:Ra,onPointerUp:Ja,onPointerCancel:Ja,onClick:se,onDoubleClick:se,onMouseDown:Z=>Z.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:q,cy:pe,r:B,fill:"#FFFFFF",stroke:Ye,strokeWidth:2,opacity:re,style:{pointerEvents:"none",filter:ce?`drop-shadow(0 0 4px ${Ye})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:q-20,y:pe-28,width:40,height:18,rx:4,fill:ht?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ye,strokeWidth:1}),jsxs("text",{x:q,y:pe-16,textAnchor:"middle",dominantBaseline:"central",fill:ht?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[J,"%"]})]})]})})(),e.segments&&e.segments.map((q,pe)=>{let ce=(q.startDate.getTime()-o.getTime())/864e5*s,re=(q.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ce+s,be=Ie&&M==="move"&&Be===pe,S=tt===pe,H=be?ce+Pe:ce;return jsxs("g",{onMouseEnter:()=>!Ie&&ee(pe),onMouseLeave:()=>!Ie&&ee(null),children:[jsx(motion.rect,{x:H,y:a,width:re,height:Ee,rx:_e,fill:Ye,initial:{opacity:0,scale:.95},animate:{opacity:be||e.parentId?.6:S?.9:.8,scale:S&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>{Z.stopPropagation(),le(pe),$e(ce),kt(Z,void 0,ce);},style:{cursor:vt,pointerEvents:"all"}}),jsx("rect",{x:H,y:a,width:re*(e.progress/100),height:Ee,rx:_e,fill:Ye,opacity:1,style:{pointerEvents:"none"}})]},`segment-${pe}`)}),Ue&&(j||ke)&&!e.segments&&jsxs(Fragment,{children:[ke&&!j&&jsx("rect",{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),j&&jsx("rect",{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),h&&et>60&&!e.segments&&!(Dt&&dt)&&(()=>{let q=i.taskLabel(e),pe=typeof q=="string"?q:e.name,ce=pe.length>Math.floor(et/8)?`${pe.substring(0,Math.floor(et/8))}...`:pe;return jsx("text",{"data-parte":"etiqueta",x:Xe+8,y:a+Ee/2,dominantBaseline:"middle",fill:ue?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ue?"line-through":"none"},children:ce})})(),!Ie&&!e.segments&&!dt&&e.progress>0&&e.progress<100&&(Dt?jsxs("text",{x:Xe+et+6,y:a+Ee/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):et>100?jsxs("text",{x:Xe+et-12,y:a+Ee/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&et>80&&!Ie&&!e.segments&&!(Dt&&dt)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Xe+et-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Xe+et-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ae||zt)&&!st&&!e.segments&&!dt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Xe-2,y:a,width:16,height:Ee,fill:"transparent",style:{cursor:Xt},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:q=>{q.stopPropagation(),kt(q,"resize-start");}}),jsx(motion.rect,{x:Xe+4,y:a+8,width:3,height:Ee-16,rx:1.5,fill:Ve==="resize-start"||M==="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:Xe+et-14,y:a,width:16,height:Ee,fill:"transparent",style:{cursor:Xt},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:q=>{q.stopPropagation(),kt(q,"resize-end");}}),jsx(motion.rect,{x:Xe+et-7,y:a+8,width:3,height:Ee-16,rx:1.5,fill:Ve==="resize-end"||M==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ae&&!Ie&&!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+Ee/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:q=>{q.stopPropagation(),kt(q,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Ee/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ve==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),st&&Ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Ee/2,x2:Ce.x,y2:Ce.y,stroke:we?n.statusCompleted:n.accent,strokeWidth:we?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:we?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Ce.x,cy:Ce.y,r:we?8:6,fill:we?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),we&&jsx(motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(Ae||Ie)&&!st&&!e.segments&&jsx(motion.rect,{x:Xe-1,y:a-1,width:et+2,height:Ee+2,rx:_e+1,fill:"none",stroke:Ie?n.accent:Dt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:Dt?1:2,opacity:Ie||Dt?.6:.4,initial:{opacity:0},animate:{opacity:Ie||Dt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),zt&&jsxs(Fragment,{children:[jsx("line",{x1:Y,y1:0,x2:Y,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:Y+Se,y1:0,x2:Y+Se,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ae&&!Ie&&!e.segments&&!v&&(()=>{let ce=a<100,B=ce?a+Ee+13:a-82-13,re=ce?`M ${Xe+et/2-6} ${a+Ee+3} L ${Xe+et/2} ${a+Ee+13} L ${Xe+et/2+6} ${a+Ee+3}`:`M ${Xe+et/2-6} ${a-13} L ${Xe+et/2} ${a-3} L ${Xe+et/2+6} ${a-13}`,be=B+22,S=B+40,H=B+55,Z=B+70,Te=ce?B+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:re,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Xe+et/2-120,y:B,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Xe+et/2,y:be,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Xe+et/2-110,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Xe+et/2-70,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe(e.startDate)}),jsx("text",{x:Xe+et/2-110,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Xe+et/2-70,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe(e.endDate)}),jsx("text",{x:Xe+et/2+10,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Xe+et/2+65,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qe()}),jsx("text",{x:Xe+et/2+10,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Xe+et/2+65,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Xe+et/2-110,y:Z,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Xe+et/2-50,y:Z,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(gt=>gt.name).join(", ").substring(0,30),e.assignees.map(gt=>gt.name).join(", ").length>30?"...":""]})]}),!ce&&jsx("text",{x:Xe+et/2,y:Te,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:he?"Left: move \u2022 Right: resize":Ht?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Ld=260,ws=8,gg=16,Sw=-12;function fg({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:C}=e,P=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,O=x.lastActivity!=null,T=(P?155:105)+(O?28:0),D=w+gg,M=C+Sw-T;D+Ld>window.innerWidth-ws&&(D=w-Ld-gg),D<ws&&(D=ws);let N=M<ws;N&&(M=C+20),M+T>window.innerHeight-ws&&(M=window.innerHeight-ws-T),s({left:D,top:M,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,i=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},l=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),p=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let M=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${M} d\xEDa${M!==1?"s":""}`:`${M} day${M!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),C=M=>`${M.getFullYear()}-${String(M.getMonth()+1).padStart(2,"0")}-${String(M.getDate()).padStart(2,"0")}`,P=0,O=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;O.getTime()<=T.getTime();){let M=O.getDay();x[M]&&!w.has(C(O))&&P++,O.setDate(O.getDate()+1);}let D=Math.max(0,P);return a==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`},u=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),C=x%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",b=t.bgSecondary||"#1F2937",h=t.border||"#374151",y=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Ld,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(xl,{label:c.start,value:o.startDate?l(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(xl,{label:c.duration,value:p(),labelColor:d,valueColor:m}),jsx(xl,{label:c.end,value:o.endDate?l(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(xl,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.id))})]}),i&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:u(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ou({templates:e,onSelectTemplate:t,className:a}){let[n,r]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&r(false);}if(n)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]);let i=l=>{t(l),r(false);},c=e.reduce((l,u)=>{let p=u.category||"Other";return l[p]||(l[p]=[]),l[p].push(u),l},{});return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>r(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",n&&"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"})})]}),n&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:u.map(p=>jsxs("button",{onClick:()=>i(p),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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:p.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:p.name}),p.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.id))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function iu({board:e,isOpen:t,onClose:a,onImport:n,boardElementRef:r,className:s}){let[o,i]=useState("export"),[c,l]=useState("json"),[u,p]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=r?.current||void 0,b=await Sm(e,c,v);Em(b,c);},f=async v=>{let b=v.target.files?.[0];if(b){try{let w=await Fm(b),h=b.name.endsWith(".json")?"json":"csv",x=Pm(w,h);p(x),x.success&&n&&n(x,w);}catch(w){p({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="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(v=>jsxs("button",{onClick:()=>l(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"border-[#00E5CC] bg-[#00E5CC]/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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="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:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:g("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,b)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},b))})]})]})]})]})]})}var jw=["URGENT","HIGH","MEDIUM","LOW"],Vw=[{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"}],Gw=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function lu({filters:e,sort:t,onFiltersChange:a,onSortChange:n,onReset:r,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,b]=useState(true),w=useCallback(M=>{a({search:M.target.value});},[a]),h=useCallback(M=>{a({dateFilter:M.target.value});},[a]),x=useCallback(M=>{n({by:M.target.value});},[n]),y=useCallback(()=>{n({order:t.order==="asc"?"desc":"asc"});},[t.order,n]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>b(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[p&&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"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:w,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:M=>{let z=M.target.value;a({priorities:z==="all"?[]:[z]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),jw.map(M=>jsx("option",{value:M,children:M},M))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let z=M.target.value;a({assignees:z==="all"?[]:[z]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(M=>jsx("option",{value:M.id,children:M.name},M.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let z=M.target.value;a({labels:z==="all"?[]:[z]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(M=>jsx("option",{value:M,children:M},M))]})}),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:x,className:"filter-bar__select filter-bar__select--sm",children:Vw.map(M=>jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gw.map(M=>jsx("option",{value:M.value,children:M.label},M.value))})}),k&&jsx("button",{onClick:r,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function cu({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:n,viewMode:r="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,u]=useState(false),p=useRef(null);useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return l&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[l]);let d=m=>{m(),u(false);};return jsxs("div",{className:g("relative",n),ref:p,children:[jsxs("button",{onClick:()=>u(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[r==="kanban"?jsxs("button",{onClick:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(async()=>await o?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 du={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:"#00E5CC",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"}},uu={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:"#00E5CC",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"}},pu={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"}},ys={dark:du,light:uu,neutral:pu},ec="dark";var tc=createContext(void 0),t1="asakaa-theme";function cf({children:e,defaultTheme:t=ec,storageKey:a=t1}){let[n,r]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{r(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=ys[n];Object.entries(c.colors).forEach(([u,p])=>{p&&i.style.setProperty(`--theme-${a1(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let d=c.colors[u];d&&i.style.setProperty(p,d);}),i.setAttribute("data-theme",n),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${n}`);},[n]);let o={theme:n,setTheme:s,themes:ys};return jsx(tc.Provider,{value:o,children:e})}function Js(){let e=useContext(tc);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function a1(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function mu({isOpen:e,onClose:t,className:a}){let{theme:n,setTheme:r}=Js();return e?jsxs("div",{className:g("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(ys).map(([s,o])=>jsxs("button",{onClick:()=>{r(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",n===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:n===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.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"]})]}),n===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}var Et={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",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:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function df(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Et[e]||Et.dark;let t=document.documentElement,a=getComputedStyle(t),n=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:n("--theme-bg-primary",Et[e].bgPrimary),bgSecondary:n("--theme-bg-secondary",Et[e].bgSecondary),bgGrid:n("--theme-bg-card",Et[e].bgGrid),bgWeekend:n("--theme-bg-hover",Et[e].bgWeekend),border:n("--theme-border-primary",Et[e].border),borderLight:n("--theme-border-subtle",Et[e].borderLight),textPrimary:n("--theme-text-primary",Et[e].textPrimary),textSecondary:n("--theme-text-secondary",Et[e].textSecondary),textTertiary:n("--theme-text-tertiary",Et[e].textTertiary),accent:n("--theme-accent-primary",Et[e].accent),accentHover:n("--theme-accent-hover",Et[e].accentHover),accentLight:n("--theme-accent-primary",Et[e].accentLight),taskBarPrimary:n("--theme-accent-primary",Et[e].taskBarPrimary),taskBarProgress:n("--theme-accent-hover",Et[e].taskBarProgress),taskBarHandle:n("--theme-text-inverse",Et[e].taskBarHandle||"#FFFFFF"),dependency:n("--theme-border-secondary",Et[e].dependency),dependencyHover:n("--theme-border-secondary",Et[e].dependencyHover),criticalPath:n("--theme-error",Et[e].criticalPath),criticalPathLight:n("--theme-error",Et[e].criticalPathLight),today:e==="light"?n("--theme-accent-primary",Et[e].today):e==="neutral"?n("--theme-text-primary",Et[e].today):n("--theme-error",Et[e].today),todayLight:e==="light"?n("--theme-accent-primary",Et[e].todayLight):e==="neutral"?n("--theme-text-primary",Et[e].todayLight):n("--theme-error",Et[e].todayLight),milestone:n("--theme-warning",Et[e].milestone),milestoneLight:n("--theme-warning",Et[e].milestoneLight),statusTodo:n("--theme-text-tertiary",Et[e].statusTodo),statusInProgress:n("--theme-accent-primary",Et[e].statusInProgress),statusCompleted:n("--theme-success",Et[e].statusCompleted),hoverBg:n("--theme-bg-hover",Et[e].hoverBg),focusRing:n("--theme-accent-primary",Et[e].focusRing),...Et[e].dotGrid&&{dotGrid:Et[e].dotGrid},...Et[e].glassHeader&&{glassHeader:Et[e].glassHeader},...Et[e].glassToolbar&&{glassToolbar:Et[e].glassToolbar},...Et[e].forecastHud&&{forecastHud:Et[e].forecastHud},...Et[e].neonRedGlow&&{neonRedGlow:Et[e].neonRedGlow},...Et[e].executionBarBg&&{executionBarBg:Et[e].executionBarBg}}}function Yi(e,t,a="left",n=208){let[r,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),i=o.bottom+4,c;a==="right"?c=o.right-n:c=o.left;let l=8;c+n>window.innerWidth-l&&(c=window.innerWidth-l-n),c<l&&(c=l),s({top:i,left:c});},[t,a,e,n]),r}function vf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:n,onExportCSV:r,onExportJSON:s,onExportMSProject:o}){let[i,c]=useState(false),[l,u]=useState(null),p=useRef(null),d=useRef(null),m=Un(),f=Yi(p,i,"right",176);if(useEffect(()=>{if(!i)return;let h=x=>{let y=x.target;p.current&&!p.current.contains(y)&&d.current&&!d.current.contains(y)&&c(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]),!(t||a||n||r||s||o))return null;let b=[{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:n},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{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:o}].filter(h=>h.handler),w=async(h,x)=>{if(x){u(h);try{await x();}catch(y){console.error(`Export ${h} failed:`,y);}finally{u(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:p,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:b.map((h,x)=>jsxs(motion.button,{onClick:()=>w(h.id,h.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<b.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function gu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:n,onExportMSProject:r,onCopySnapshotLink:s}){let[o,i]=useState(false),[c,l]=useState(null),[u,p]=useState(false),d=useRef(null),m=useRef(null),f=Un(),v=Yi(d,o,"right",224),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",w=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let k=M=>{let z=M.target;d.current&&!d.current.contains(z)&&m.current&&!m.current.contains(z)&&i(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:n},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:r}].filter(k=>k.handler),x=async(k,M)=>{if(M){l(k);try{await M();}catch(z){console.error(`Export ${k} failed:`,z);}finally{l(null),i(false);}}},y=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>i(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:w?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((k,M)=>jsxs(motion.button,{onClick:()=>x(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:w?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function T1({options:e,value:t,onChange:a,theme:n,layoutId:r="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:n.bgSecondary,border:`1px solid ${n.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?n.textPrimary:n.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:r,className:"absolute inset-0 rounded-md",style:{backgroundColor:n.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:o?"#FFFFFF":n.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":n.textTertiary},children:s.label})]},s.value)})})}function D1({options:e,value:t,onChange:a,theme:n}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(r=>{let s=t===r.value;return jsxs(motion.button,{onClick:()=>a(r.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?n.accent:n.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?n.accent:n.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:r.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:n.accent},transition:{type:"spring",stiffness:400,damping:30}})]},r.value)})})}function fu({theme:e,value:t,onChange:a,maxDepth:n}){let[r,s]=useState(false),o=useRef(null),i=useRef(null),c=Un(),l=Yi(o,r,"left");useEffect(()=>{if(!r)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&i.current&&!i.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(n,5)},(d,m)=>({value:m+1,label:c.toolbar.wbsLevel==="Nivel"?`Nivel ${m+1}`:`L${m+1}`}))],p=t==="all"?c.toolbar.wbsAllLevels||"All":c.toolbar.wbsLevel==="Nivel"?`Nivel ${t}`:`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!r),className:"flex items-center gap-1.5 px-2 py-1.5 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:`${c.toolbar.wbsLevel||"Level"}: ${p}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:p})]}),createPortal(jsx(AnimatePresence,{children:r&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{a(d.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function bu({theme:e,value:t,onChange:a,hideCompleted:n=false,onHideCompletedChange:r}){let[s,o]=useState(false),i=useRef(null),c=useRef(null),l=Un(),u=Yi(i,s,"left");useEffect(()=>{if(!s)return;let v=setTimeout(()=>{let b=h=>{let x=h.target;i.current&&!i.current.contains(x)&&c.current&&!c.current.contains(x)&&o(false);},w=h=>{h.key==="Escape"&&o(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",w),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||n,m=(t!=="all"?1:0)+(n?1:0),f=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:v=>{v.stopPropagation(),o(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?f?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?f?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#00E5CC":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===0?l.toolbar.filter||"Filters":[t!=="all"?p.find(v=>v.value===t)?.label:null,n?l.toolbar.visibility==="Visibilidad"?"sin completadas":"no completed":null].filter(Boolean).join(" \xB7 ")})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${f?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:p.map(v=>{let b=t===v.value&&!n,w=()=>v.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):v.icon;return jsxs(motion.button,{onClick:()=>{a(v.value),r&&r(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?v.color:"text-gray-400"} flex-shrink-0`,children:w()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:v.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},v.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),r&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{r(!n),n||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:n?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:n?"#00E5CC":f?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),n&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function pf({value:e,onChange:t,theme:a}){let n=Un(),r=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=n.toolbar.visibility==="Visibilidad",o=[{value:"compact",label:n.toolbar.compact||"Compact",Icono:Rows4},{value:"comfortable",label:n.toolbar.normal||"Normal",Icono:Rows3},{value:"spacious",label:n.toolbar.spacious||"Spacious",Icono:Rows2}];return jsx("div",{role:"group","aria-label":s?"Densidad de las filas":"Row density","data-densidad-a-la-vista":true,className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:r?"#000000":a.bgSecondary,border:`1px solid ${r?"rgba(255,255,255,0.1)":a.border}`},children:o.map(({value:i,label:c,Icono:l})=>{let u=e===i;return jsx("button",{type:"button",onClick:()=>t(i),"aria-pressed":u,"aria-label":(s?"Densidad: ":"Density: ")+c,title:(s?"Densidad: ":"Density: ")+c,className:"relative px-2 py-1 rounded-full transition-colors",style:{color:u?r?"#FFFFFF":a.textPrimary:a.textTertiary,backgroundColor:u?r?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},children:jsx(l,{className:"w-3.5 h-3.5"})},i)})})}function mf({value:e,onChange:t,theme:a}){let n=Un(),r=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:n.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:n.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:n.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:r?"#000000":a.bgSecondary,border:`1px solid ${r?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let i=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?r?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?r?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:r?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function N1({theme:e,forecast:t,currencyCode:a}){let n=Un(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",s=n.toolbar.visibility==="Visibilidad"?"es":"en",o=t?.expectedFinish?Jn(t.expectedFinish,s):"\u2014",i=t?.delayDays,c=i!=null,l=i!=null?i>0?`+${i}d ${n.toolbar.delayLabel}`:i<0?`${i}d ${n.toolbar.earlyLabel}`:n.toolbar.onTimeLabel:null,u=i!=null&&i>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:i!=null&&i<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},p=t?.confidencePercent,d=p!=null?p>=75?"#22C55E":p>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,f=t?.currency||"$",v=m!=null?(()=>{let y=nn(m,a,s,{compacto:true});return f!=="$"?y.replace("$",f):y})():"\u2014",b=t?.budgetVariancePercent,w=b!=null&&b!==0,h=b!=null?b>0?`+${Xn(b,s)} ${n.toolbar.budgetOver}`:`${Xn(b,s)} ${n.toolbar.budgetUnder}`:null,x=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:n.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[n.toolbar.expectedFinish,": ",o]}),c&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:u.bg,color:u.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[n.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:p!=null?Xn(p,s):"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[n.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:v}),w&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:x.bg,color:x.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}var ac={width:22,height:10,borderRadius:2,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},S1=[{es:"Festivo (el d\xEDa en \xE1mbar)",en:"Holiday (amber day)",muestra:{...ac,color:"#F59E0B",fontSize:10,fontWeight:700},texto:"12"},{es:"Vencida o en ruta cr\xEDtica",en:"Overdue or on the critical path",muestra:{...ac,background:"#EF4444"}},{es:"Fin de semana o d\xEDa no laborable",en:"Weekend or non-working day",muestra:{...ac,background:"repeating-linear-gradient(45deg, rgba(148,163,184,0.45) 0 2px, transparent 2px 5px)"}},{es:"Parte de la barra sin avanzar",en:"Unfinished part of the bar",muestra:{...ac,background:"repeating-linear-gradient(45deg, rgba(0,229,204,0.55) 0 3px, rgba(148,163,184,0.25) 3px 6px)"}}];function gf({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:n,onShowBaselineChange:r,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),b=Un(),w=Yi(f,d,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let M=L=>{let N=L.target;f.current&&!f.current.contains(N)&&v.current&&!v.current.contains(N)&&m(false);},z=L=>{L.key==="Escape"&&m(false);};return document.addEventListener("mousedown",M),document.addEventListener("keydown",z),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",z);}},[d]);let x=b.toolbar.visibility==="Visibilidad",y=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!p,tooltip:p?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:n,onChange:r},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],k=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsxs(motion.button,{ref:f,onClick:()=>m(!d),className:"flex items-center gap-1.5 h-8 px-2.5 rounded-lg text-xs font-medium",style:{color:d?e.accent:e.textSecondary,backgroundColor:d?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:x?"Opciones de vista, densidad y leyenda":"Display options, density and legend","aria-haspopup":"menu","aria-expanded":d,children:[jsx(Eye,{className:"w-4 h-4"}),jsx("span",{children:x?"Vista":"View"}),jsx(ChevronDown,{className:"w-3 h-3"})]}),createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:w.top,left:w.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:y.map((M,z)=>{let L=M.icon,N=M.disabled,D=M.tooltip;return jsxs(motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:z*.03},title:D,children:[jsx(L,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?h?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,z)=>{let L=l===M.value;return jsxs(motion.button,{onClick:()=>u(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(y.length+z)*.03},children:[jsx("span",{style:{color:L?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),L&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]}),jsxs("div",{className:"py-0.5",style:{borderTop:`1px solid ${h?"rgba(255,255,255,0.06)":e.border||"#E2E8F0"}`},children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:x?"LEYENDA":"LEGEND"})}),S1.map(M=>jsxs("div",{className:"flex items-center gap-2.5 px-3 py-1.5 text-[11px]",style:{color:h?"rgba(255,255,255,0.75)":e.textSecondary},children:[jsx("span",{"aria-hidden":true,style:M.muestra,children:M.texto??null}),jsx("span",{children:x?M.es:M.en})]},M.es))]})]})}),document.body)]})}function E1({theme:e,etiqueta:t,children:a}){let[n,r]=useState(false),s=useRef(null);return useEffect(()=>{if(!n)return;let o=c=>{s.current&&!s.current.contains(c.target)&&r(false);},i=c=>{c.key==="Escape"&&r(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i);}},[n]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>r(o=>!o),"aria-label":t,"aria-expanded":n,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),n&&jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:a})]})}function nc({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:n,zoom:r,onZoomChange:s,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:w,toolbarRightContent:h,wbsLevel:x,onWbsLevelChange:y,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:z,projectForecast:L,hideForecastHud:N,currencyCode:D,onExportPNG:S,onExportPDF:V,onExportExcel:U,onExportCSV:W,onExportJSON:E,onExportMSProject:Pe,showCriticalPath:J=true,onShowCriticalPathChange:de,showDependencies:R=true,onShowDependenciesChange:Ae,highlightWeekends:nt=true,onHighlightWeekendsChange:Ge,showBaseline:B=false,onShowBaselineChange:ce,onCopySnapshotLink:oe,hasDependencies:gt=true}){let Je=Un(),ct=S||V||U||W||E||Pe,ft=!!t.glassToolbar,ut=[{value:"day",label:Je.toolbar.day},{value:"week",label:Je.toolbar.week},{value:"month",label:Je.toolbar.month}],Rt=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}],lt=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(mf,{value:a,onChange:n,theme:t}),jsx(pf,{value:c,onChange:l,theme:t}),v&&jsx(bu,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:w}),h,jsx(gf,{theme:t,showCriticalPath:J,onShowCriticalPathChange:de,showBaseline:B,onShowBaselineChange:ce,highlightWeekends:nt,onHighlightWeekendsChange:Ge,showDependencies:R,onShowDependenciesChange:Ae,rowDensity:c,onRowDensityChange:l,hasDependencies:gt}),jsx(gu,{theme:t,onExportPNG:S,onExportPDF:V,onExportExcel:U,onExportMSProject:Pe,onCopySnapshotLink:oe}),(z||y)&&jsxs(E1,{theme:t,etiqueta:Je.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[z&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(vt=>jsxs("button",{type:"button",onClick:()=>z(vt),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:M===vt?lt?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[vt==="execution"?Je.toolbar.viewExecution:Je.toolbar.viewOracle,M===vt&&jsx(Check,{className:"w-3.5 h-3.5"})]},vt))}),y&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(fu,{theme:t,value:x??"all",onChange:y,maxDepth:k})})]})]});if(ft){let vt=lt?"rgba(255,255,255,0.08)":t.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:z&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:lt?"#000000":t.bgSecondary,border:`1px solid ${lt?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>z("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?lt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:M==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="execution"?{color:t.textSecondary}:{},children:Je.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>z("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?lt?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:M==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="oracle"?{color:t.textSecondary}:{},children:Je.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(mf,{value:a,onChange:n,theme:t}),jsx(pf,{value:c,onChange:l,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:vt}}),y&&jsx(fu,{theme:t,value:x??"all",onChange:y,maxDepth:k}),v&&jsx(bu,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:w}),h&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:vt}}),h]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:vt}}),jsx(gf,{theme:t,showCriticalPath:J,onShowCriticalPathChange:de,showBaseline:B,onShowBaselineChange:ce,highlightWeekends:nt,onHighlightWeekendsChange:Ge,showDependencies:R,onShowDependenciesChange:Ae,rowDensity:c,onRowDensityChange:l,hasDependencies:gt}),jsx(gu,{theme:t,onExportPNG:S,onExportPDF:V,onExportExcel:U,onExportMSProject:Pe,onCopySnapshotLink:oe}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${lt?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${lt?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Je.toolbar.createTask})]})]})]}),L&&!N&&jsx(N1,{theme:t,forecast:L,currencyCode:D})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(D1,{options:ut,value:a,onChange:vt=>n(vt),theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>s(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>s(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.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:t.borderLight}}),y&&jsx(fu,{theme:t,value:x??"all",onChange:y,maxDepth:k}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(bu,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:w})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[h&&jsxs(Fragment,{children:[h,jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Je.toolbar.createTask})]}),(ct||u)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(gu,{theme:t,onExportPNG:S,onExportPDF:V,onExportExcel:U,onExportMSProject:Pe,onCopySnapshotLink:oe}),u&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsx(T1,{options:Rt,value:o,onChange:vt=>i(vt),theme:t})]})]})}var va={texto:"var(--v6-texto, #0E1114)",texto2:"var(--v6-texto-2, #4D5761)",tenue:"var(--v6-tenue, #5F6972)",borde:"var(--v6-borde, #E2E5E9)",tarjeta:"var(--v6-tarjeta, #FFFFFF)",neutroFondo:"var(--v6-neutro-fondo, #E1E4E8)",segmentado:"var(--v6-segmentado, #E9ECEF)",acento:"var(--v6-acento, #0FA392)",acentoTexto:"var(--v6-acento-texto, #066A5F)",acentoFondo2:"var(--v6-acento-fondo-2, rgba(15,163,146,0.14))",acentoBordeSuave:"var(--v6-acento-borde-suave, rgba(8,127,114,0.55))",sobreAcento:"var(--v6-sobre-acento, #03231F)"},O1="'JetBrains Mono', ui-monospace, Menlo, monospace";function xu({boton:e,children:t,alinear:a="izquierda",ancho:n=220}){let[r,s]=useState(false),o=useRef(null),i=useRef(null),[c,l]=useState({top:0,left:0});return useEffect(()=>{if(!r||!o.current)return;let u=o.current.getBoundingClientRect(),p=a==="derecha"?Math.max(8,u.right-n):Math.min(u.left,window.innerWidth-n-8);l({top:u.bottom+6,left:p});let d=f=>{let v=f.target;!o.current?.contains(v)&&!i.current?.contains(v)&&s(false);},m=f=>{f.key==="Escape"&&(s(false),o.current?.focus());};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[r,a,n]),jsxs(Fragment,{children:[e(()=>s(u=>!u),r,o),r&&createPortal(jsx("div",{ref:i,role:"menu","data-menu-v6":true,style:{position:"fixed",top:c.top,left:c.left,width:n,zIndex:99999,padding:6,borderRadius:12,background:va.tarjeta,border:`1px solid ${va.borde}`,boxShadow:"0 12px 32px -8px rgba(14,17,20,0.25)",color:va.texto,fontSize:13},children:t(()=>s(false))}),document.body)]})}function Nr({children:e,marcada:t,alPulsar:a,icono:n}){return jsxs("button",{type:"button",role:t===void 0?"menuitem":"menuitemcheckbox","aria-checked":t,onClick:a,className:"w-full flex items-center text-left",style:{gap:8,height:32,padding:"0 8px",borderRadius:8,background:"transparent",border:0,color:va.texto,font:"inherit",cursor:"pointer"},onMouseEnter:r=>{r.currentTarget.style.background=va.segmentado;},onMouseLeave:r=>{r.currentTarget.style.background="transparent";},children:[n&&jsx("span",{"aria-hidden":true,className:"flex items-center",style:{color:va.texto2},children:n}),jsx("span",{className:"flex-1",children:e}),t&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:va.acentoTexto},"aria-hidden":true})]})}function Zs({children:e}){return jsx("div",{style:{padding:"6px 8px 4px",fontSize:11,fontWeight:500,color:va.tenue},children:e})}function ei(){return jsx("div",{"aria-hidden":true,style:{height:1,margin:"4px 2px",background:va.borde}})}var rc={height:36,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,borderRadius:10,font:"inherit",fontWeight:500,cursor:"pointer",whiteSpace:"nowrap"};function Cf(e){let t=Un(),a=t.toolbar.today==="Hoy",n=(l,u)=>a?l:u,r=[{valor:"all",etiqueta:n("Todas","All")},{valor:"incomplete",etiqueta:n("Por hacer","To do")},{valor:"in_progress",etiqueta:n("En progreso","In progress")},{valor:"completed",etiqueta:n("Completadas","Completed")},{valor:"overdue",etiqueta:n("Vencidas","Overdue")}],s=e.taskFilter!=="all"?1:0,o=[{valor:"compact",etiqueta:n("Compacta","Compact")},{valor:"comfortable",etiqueta:n("Normal","Normal")},{valor:"spacious",etiqueta:n("C\xF3moda","Comfortable")}],i=o.find(l=>l.valor===e.rowDensity)??o[1],c=[e.onExportPNG&&{id:"png",etiqueta:n("Exportar imagen (PNG)","Export image (PNG)"),f:e.onExportPNG},e.onExportPDF&&{id:"pdf",etiqueta:n("Exportar PDF","Export PDF"),f:e.onExportPDF},e.onExportExcel&&{id:"xlsx",etiqueta:n("Exportar Excel","Export Excel"),f:e.onExportExcel},e.onExportMSProject&&{id:"msp",etiqueta:n("Exportar a MS Project","Export to MS Project"),f:e.onExportMSProject}].filter(Boolean);return jsxs("div",{"data-barra-v6":true,className:"flex flex-wrap items-center min-w-0",style:{gap:8,flex:"1 1 auto",fontSize:13,color:va.texto},children:[e.onTaskFilterChange&&jsx(xu,{boton:(l,u,p)=>jsxs("button",{ref:p,type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:l,style:{...rc,padding:"0 8px 0 10px",background:va.tarjeta,color:va.texto,border:`1px solid ${s?va.acentoBordeSuave:va.borde}`},children:[jsx(Filter,{className:"w-[15px] h-[15px]",style:{color:s?va.acentoTexto:va.texto2},"aria-hidden":true}),n("Filtros","Filters"),s>0&&jsx("span",{style:{fontFamily:O1,fontSize:11,fontWeight:500,color:va.acentoTexto,padding:"1px 6px",borderRadius:6,background:va.acentoFondo2},children:s})]}),children:l=>jsxs(Fragment,{children:[jsx(Zs,{children:n("Estado de la tarea","Task status")}),r.map(u=>jsx(Nr,{marcada:e.taskFilter===u.valor&&!e.hideCompleted,alPulsar:()=>{e.onTaskFilterChange?.(u.valor),e.onHideCompletedChange?.(false),l();},children:u.etiqueta},u.valor))]})}),e.taskFilter!=="all"&&jsx(H1,{texto:r.find(l=>l.valor===e.taskFilter)?.etiqueta??e.taskFilter,quitar:n("Quitar filtro","Remove filter"),alQuitar:()=>e.onTaskFilterChange?.("all")}),jsx("div",{"aria-hidden":true,style:{flex:"1 1 0",minWidth:0}}),jsx("div",{role:"group","aria-label":n("Escala de tiempo","Time scale"),className:"flex items-center",style:{height:36,boxSizing:"border-box",gap:2,padding:"0 2px",border:`1px solid ${va.borde}`,borderRadius:10,background:va.segmentado},children:[["day",n("D","D"),n("D\xEDa","Day")],["week",n("S","W"),n("Semana","Week")],["month",n("M","M"),n("Mes","Month")]].map(([l,u,p])=>{let d=e.timeScale===l;return jsx("button",{type:"button","aria-pressed":d,"aria-label":p,title:p,"data-escala-v6":l,onClick:()=>e.onTimeScaleChange(l),style:{width:32,height:30,padding:0,border:0,borderRadius:8,font:"inherit",fontWeight:500,cursor:"pointer",background:d?"var(--v6-escala-activa, #FFFFFF)":"transparent",boxShadow:d?"var(--v6-escala-sombra, 0 1px 2px rgba(14,17,20,0.14))":"none",color:d?va.texto:va.texto2},children:u},l)})}),e.toolbarRightContent,jsx(xu,{alinear:"derecha",ancho:264,boton:(l,u,p)=>jsxs("button",{ref:p,type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:l,"data-menu-vista-v6":true,"aria-label":`${n("Vista","View")}: ${i.etiqueta}`,style:{...rc,padding:"0 8px 0 10px",border:0,background:"transparent",color:va.texto},children:[jsx(Rows3,{className:"w-[15px] h-[15px]",style:{color:va.texto2},"aria-hidden":true}),n("Vista","View"),jsx(ChevronDown,{className:"w-3.5 h-3.5",style:{color:va.tenue},"aria-hidden":true})]}),children:l=>jsxs(Fragment,{children:[jsx(Zs,{children:n("Densidad de filas","Row density")}),o.map(u=>jsx(Nr,{marcada:e.rowDensity===u.valor,alPulsar:()=>{e.onRowDensityChange(u.valor),l();},children:u.etiqueta},u.valor)),e.contenidoDeVista&&jsxs(Fragment,{children:[jsx(ei,{}),e.contenidoDeVista(l)]}),(e.onHideCompletedChange||e.onLeyendaVisibleChange)&&jsxs(Fragment,{children:[jsx(ei,{}),jsx(Zs,{children:n("Mostrar","Show")}),e.onHideCompletedChange&&jsx(Nr,{marcada:e.hideCompleted,alPulsar:()=>{let u=!e.hideCompleted;e.onHideCompletedChange?.(u),u&&e.onTaskFilterChange?.("all"),l();},children:n("Ocultar completadas","Hide completed")}),e.onLeyendaVisibleChange&&jsx(Nr,{marcada:!!e.leyendaVisible,alPulsar:()=>{e.onLeyendaVisibleChange?.(!e.leyendaVisible),l();},children:n("Leyenda","Legend")})]})]})}),jsx(xu,{alinear:"derecha",ancho:248,boton:(l,u,p)=>jsx("button",{ref:p,type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:l,"aria-label":n("M\xE1s opciones: vista, exportar, compartir","More options: view, export, share"),title:n("M\xE1s opciones","More options"),style:{...rc,width:36,justifyContent:"center",padding:0,border:0,background:"transparent",color:va.texto2},children:jsx(MoreHorizontal,{className:"w-4 h-4","aria-hidden":true})}),children:l=>jsxs(Fragment,{children:[jsx(Zs,{children:n("Ver","Show")}),e.onShowCriticalPathChange&&jsx(Nr,{marcada:e.showCriticalPath,alPulsar:()=>e.onShowCriticalPathChange?.(!e.showCriticalPath),children:n("Ruta cr\xEDtica","Critical path")}),e.onHighlightWeekendsChange&&jsx(Nr,{marcada:e.highlightWeekends,alPulsar:()=>e.onHighlightWeekendsChange?.(!e.highlightWeekends),children:n("Fines de semana y festivos","Weekends and holidays")}),e.onShowDependenciesChange&&e.hasDependencies!==false&&jsx(Nr,{marcada:e.showDependencies,alPulsar:()=>e.onShowDependenciesChange?.(!e.showDependencies),children:n("Dependencias","Dependencies")}),e.onWbsLevelChange&&jsxs(Fragment,{children:[jsx(ei,{}),jsx(Zs,{children:n("Nivel de la estructura","Structure level")}),["all",...Array.from({length:Math.max(1,e.maxWbsDepth??4)},(u,p)=>p+1)].map(u=>jsx(Nr,{marcada:(e.wbsLevel??"all")===u,alPulsar:()=>{e.onWbsLevelChange?.(u),l();},children:u==="all"?n("Todos los niveles","All levels"):`${n("Hasta el nivel","Up to level")} ${u}`},String(u)))]}),e.onViewModeChange&&jsxs(Fragment,{children:[jsx(ei,{}),jsx(Zs,{children:n("Modo","Mode")}),["execution","oracle"].map(u=>jsx(Nr,{marcada:e.viewMode===u,alPulsar:()=>{e.onViewModeChange?.(u),l();},children:u==="execution"?t.toolbar.viewExecution:t.toolbar.viewOracle},u))]}),(c.length>0||e.onCopySnapshotLink)&&jsx(ei,{}),c.map(u=>jsx(Nr,{alPulsar:()=>{l(),u.f();},children:u.etiqueta},u.id)),e.onCopySnapshotLink&&jsx(Nr,{alPulsar:()=>{l(),e.onCopySnapshotLink?.();},children:n("Copiar enlace","Copy link")}),(e.masOpciones?.length??0)>0&&jsx(ei,{}),e.masOpciones?.map(u=>jsx(Nr,{icono:u.icono,alPulsar:()=>{l(),u.alPulsar();},children:u.etiqueta},u.id))]})}),e.showCreateTaskButton&&e.onCreateTask&&jsxs("button",{type:"button","data-nueva-tarea-v6":true,onClick:e.onCreateTask,style:{...rc,padding:"0 14px 0 11px",border:0,background:va.acento,color:va.sobreAcento,fontWeight:600},children:[jsx(Plus,{className:"w-[15px] h-[15px]",strokeWidth:2.2,"aria-hidden":true}),e.createTaskLabel||n("Nueva tarea","New task")]})]})}function H1({texto:e,quitar:t,alQuitar:a}){return jsxs("span",{"data-filtro-activo-v6":true,className:"flex items-center whitespace-nowrap",style:{height:28,boxSizing:"border-box",gap:2,padding:"0 3px 0 10px",borderRadius:8,background:va.neutroFondo,color:va.texto2,fontSize:12},children:[e,jsx("button",{type:"button","aria-label":`${t} ${e}`,onClick:a,className:"flex items-center justify-center",style:{width:22,height:22,padding:0,border:0,borderRadius:6,background:"transparent",color:va.tenue,cursor:"pointer"},children:jsx(X,{className:"w-3 h-3",strokeWidth:2,"aria-hidden":true})})]})}function Tf(e,t=24){let a=e.trim();if(a.length<=28)return {comienzo:a,cola:""};let n=a.split(/(\s+)/),r="";for(let s=n.length-1;s>0;s--){let o=n[s]+r;if(o.trim().length>t&&r.trim().length>=6||(r=o,r.trim().length>=12&&/\s/.test(n[s-1]??"")&&((n[s-2]??"")+(n[s-1]??"")+r).trim().length>t))break}return !r.trim()||r.trim().length>=a.length-4?{comienzo:a,cola:""}:{comienzo:a.slice(0,a.length-r.length),cola:r}}function Df(e,t){return [...e.map(a=>a.wbsCode?`${a.wbsCode} ${a.name}`:a.name),t].join(" \u203A ")}var W1=["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],z1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jn(e,t,a=new Date){let n=e.getFullYear()!==a.getFullYear();return !t||t.toLowerCase().startsWith("es")?`${e.getDate()} ${W1[e.getMonth()]}${n?` ${e.getFullYear()}`:""}`:`${z1[e.getMonth()]} ${e.getDate()}${n?`, ${e.getFullYear()}`:""}`}function oc({columns:e,onToggleColumn:t,theme:a}){let n=Un(),[r,s]=useState(false),[o,i]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!r)return;let p=d=>{c.current&&!c.current.contains(d.target)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let u=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!r&&l.current){let p=l.current.getBoundingClientRect();i({x:p.left,y:p.bottom+4});}s(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",title:n.toolbar.columns||"Columns","aria-label":n.toolbar.columns||"Columns",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Columns3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Fa,{children:jsx(motion.div,{ref:c,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:`${o.x}px`,top:`${o.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"}),u.map(p=>jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:p.label}),p.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function ti({isOpen:e,x:t,y:a,items:n,onClose:r,theme:s}){let o=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,p=n.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,b=a;t+u+d>m&&(v=t-u,v<d&&(v=d)),a+p+d>f&&(b=f-p-d,b<d&&(b=d)),c({x:v,y:b});},[e,t,a,n.length]),useEffect(()=>{if(!e)return;let u=d=>{o.current&&!o.current.contains(d.target)&&r();},p=d=>{d.key==="Escape"&&r();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,r]),!e)return null;let l=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:n.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),r());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ga={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),Milestone:jsx(Diamond,{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 Lf({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:n,onTaskDelete:r,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let y=[],k=M=>{for(let z of M)y.push(z),z.subtasks&&z.subtasks.length>0&&z.isExpanded&&k(z.subtasks);};return k(x),y},[]),b=useCallback(()=>{let x=v(e);for(let y of x)if(t.has(y.id))return y;return null},[e,t,v]),w=useCallback((x,y)=>{let k=v(e);if(k.length===0)return;let M=b();if(!M){a(k[0].id,false);return}let z=k.findIndex(D=>D.id===M.id);if(z===-1)return;let L=x==="up"?z-1:z+1;if(L<0||L>=k.length)return;let N=k[L];a(N.id,y);},[e,b,v,a]),h=useCallback(x=>{if(!d)return;let y=x.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||m.current){x.key==="Escape"&&(y.blur(),m.current=false);return}let z=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,L=Array.from(t),N=b();if(x.key==="ArrowUp"){x.preventDefault(),w("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),w("down",x.shiftKey);return}if(N&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!N.isExpanded||x.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){L.length>0&&(x.preventDefault(),o(L,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){L.length>0&&(x.preventDefault(),i(L));return}if(x.key==="Tab"&&x.shiftKey){L.length>0&&(x.preventDefault(),c(L));return}if(x.key==="Enter"&&!x.shiftKey&&!z){N&&(x.preventDefault(),n(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!z){N&&(x.preventDefault(),n(N.id,"above"));return}if(x.key==="Enter"&&z){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),l(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&z){L.length>0&&(x.preventDefault(),r(L));return}if(x.key==="d"&&z&&!x.shiftKey){L.length>0&&(x.preventDefault(),s(L));return}},[d,t,b,w,n,r,s,o,i,c,l,u,p]);return useEffect(()=>{if(d)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[d,h]),{setIsEditing:f}}function If(e){let[t,a]=useState(new Set),[n,r]=useState(null);useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),r(d=>d===e?d:e));},[e]);let s=useCallback(d=>{a(new Set([d])),r(d);},[]),o=useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),i=useCallback((d,m)=>{if(!n){s(d);return}let f=m.indexOf(n),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let b=Math.min(f,v),w=Math.max(f,v),h=m.slice(b,w+1);a(new Set(h)),r(d);},[n,s]),c=useCallback((d,m,f,v)=>{v?i(d,m):f?o(d):s(d);},[s,o,i]),l=useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=useCallback(()=>{a(new Set),r(null);},[]),p=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:u,isTaskSelected:p}}function Ji(e){if(e.length===0)return 0;let t=e.filter(s=>(s.weight||0)>0),a=t.reduce((s,o)=>s+o.weight,0);if(a>=99&&t.length/e.length>=.95)return Math.round(t.reduce((s,o)=>s+(o.progress||0)*o.weight,0)/a);let n=s=>s.effort_minutes??s.sold_effort_minutes??60,r=e.reduce((s,o)=>s+n(o),0);return r>0?Math.round(e.reduce((s,o)=>s+(o.progress||0)*n(o),0)/r):0}function ks(e,t=[]){for(let a of e)if(a.subtasks&&a.subtasks.length>0)ks(a.subtasks,t);else {let n=a;t.push({progress:a.progress||0,weight:n.weight||0,effort_minutes:n.effort_minutes??n.effortMinutes??null,sold_effort_minutes:n.sold_effort_minutes??n.soldEffortMinutes??null});}return t}function ku(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?ku(t.subtasks):t.subtasks}))}function Cs(e){let t=[],a=(n,r,s=0)=>{let o=[...n].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<o.length;i++){let c={...o[i],parentId:r,level:s,position:o[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ai(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let n=ai(a.subtasks,t);if(n)return n}}return null}function wu(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(r=>r.id===t))return a;let n=wu(a.subtasks,t);if(n)return n}return null}function Cu(e,t){if(t.length===0)return e;let a=Cs(e),n=t[0],r=a.findIndex(d=>d.id===n);if(r<=0)return e;let s=a[r-1],o=(d,m)=>{let f=[];return {tasks:d.filter(b=>{if(m.has(b.id))return f.push(b),false;if(b.subtasks){let w=o(b.subtasks,m);b.subtasks=w.tasks,f.push(...w.removed);}return true}),removed:f}},i=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:i(v.subtasks,m,f)}:v),c=new Set(t),{tasks:l,removed:u}=o(e,c),p=i(l,s.id,u);return ku(p)}function Tu(e,t){if(t.length===0)return e;let a=[...e];for(let n of t){let r=wu(a,n);if(!r)continue;let s=wu(a,r.id),o=(l,u,p)=>{for(let d=0;d<l.length;d++){let m=l[d];if(m.id===u&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===p);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,u,p);if(f)return f}}return null},i=(l,u,p)=>{let d=l.findIndex(m=>m.id===u);if(d!==-1)return l.splice(d+1,0,p),l;for(let m of l)m.subtasks&&i(m.subtasks,u,p);return l},c=o(a,r.id,n);c&&(s&&s.subtasks?i(s.subtasks,r.id,c):i(a,r.id,c));}return ku(a)}function Du(e,t,a){if(t.length===0)return e;let n=[...e],r=t[0],s=(o,i,c)=>{let l=o.findIndex(p=>p.id===i);if(l===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,i,c))return true;return false}let u=c==="up"?l-1:l+1;return u<0||u>=o.length?false:([o[l],o[u]]=[o[u],o[l]],o[l]={...o[l],position:l},o[u]={...o[u],position:u},true)};return s(n,r,a),n}function Nu(e,t){let a=new Set(t),n=r=>r.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:n(s.subtasks)}:s);return n(e)}function Qi(e,t){let a=[...e],n=[];for(let r of t){let s=(c,l)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:l,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let l=c.findIndex(m=>m.id===r);if(l===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[l],p=`${u.id}-copy-${Date.now()}`,d={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return c.splice(l+1,0,d),d},i=o(a);i&&n.push(i);}return {tasks:a,duplicatedTasks:n}}function Rf(e,t,a){let n=[...e],r=new Date,s=new Date(r);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:r,endDate:s,color:"#00E5CC"},i=c=>{let l=c.findIndex(p=>p.id===t);if(l===-1){for(let p of c)if(p.subtasks&&i(p.subtasks))return true;return false}let u=a==="above"?l:l+1;return c.splice(u,0,o),true};return i(n),{tasks:n,newTask:o}}function Su(e,t,a){return e.map(n=>n.id===t?{...n,name:a}:n.subtasks?{...n,subtasks:Su(n.subtasks,t,a)}:n)}function Eu(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Eu(a.subtasks,t)}:a)}function Mu(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},n=a(e),r=new Date,s=new Date(r);s.setDate(s.getDate()+7);let o=n?.startDate||r,i=n?.endDate||s,c=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},l=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(i),color:n?.color||"#00E5CC",position:l,parentId:t},p=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,u],isExpanded:true}}return m.subtasks?{...m,subtasks:p(m.subtasks)}:m});return {tasks:p(e),newTask:u}}function Bf(e,t,a,n){if(t===a)return e;let r=ai(e,t);if(!r)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===l||i(u,l))return true;return false};if(i(r,a))return e}let s=i=>{let c=i.filter(u=>u.id!==t),l=c.length<i.length;return c.map((u,p)=>{let d=l?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let i=n!==void 0?n:o.length;o.splice(i,0,{...r,parentId:void 0}),o=o.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let u=l.subtasks||[],p=n!==void 0?n:u.length,d=[...u];d.splice(p,0,{...r,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...l,subtasks:m,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});o=i(o);}return o}function Sr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Sr(t.subtasks),n=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),r=n.starts.length>0?new Date(Math.min(...n.starts)):t.startDate,s=n.ends.length>0?new Date(Math.max(...n.ends)):t.endDate,o=n.progresses.length>0?Ji(ks(a)):t.progress;return {...t,subtasks:a,startDate:r,endDate:s,progress:o}})}function lc({tasks:e,theme:t,rowHeight:a,availableUsers:n=[],templates:r,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:i,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:b,onTaskIndent:w,onTaskOutdent:h,onTaskMove:x,onMultiTaskDelete:y,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:z,addTaskRow:L,onCreateSubtask:N,onTaskDependencies:D,onOpenTaskModal:S,onDeleteRequest:V,onTaskReparent:U,allTasks:W,scrollContainerRef:E,showCriticalPath:Pe=false,v6:J=false,resumenV6:de,onContraerTodo:R,onMostrarOcultas:Ae,filasVisibles:nt=null,avisoVencidas:Ge,onVerVencidas:B}){let ce=vo(),oe=useContext(gs),[gt,Je]=useState(null),[ct,ft]=useState(null),[ut,Rt]=useState(""),lt=useRef(null),[vt,Mt]=useState(null),[Pt,zt]=useState(0),[Ne,Ot]=useState(0),[wt,Ut]=useState({isOpen:false,x:0,y:0,type:"header"}),[Ye,qe]=useState(null),[_,he]=useState(null),[Z,ze]=useState(null),Me=useRef(0),Ve=5,O=useRef(false),[xe,Be]=useState(null),[Qe,Ft]=useState(false),Xe=useRef(null),[Tt,it]=useState(null),[ba,Jt]=useState(null),[Ht,we]=useState(false),Te=useRef(null);useEffect(()=>{function I(H){Te.current&&!Te.current.contains(H.target)&&we(false);}if(Ht)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[Ht]),useEffect(()=>{ct&<.current&&(lt.current.focus(),lt.current.select());},[ct]),useEffect(()=>{if(!vt)return;let I=fe=>{let me=fe.clientX-Pt,ge=Ne+me;f?.(vt,ge);},H=()=>{Mt(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",I),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[vt,Pt,Ne,f]);let{selectedTaskIds:dt,handleTaskClick:ht,isTaskSelected:jt}=If(i),{setIsEditing:Dt}=Lf({tasks:e,selectedTaskIds:dt,onTaskSelect:(I,H)=>{let me=Cs(e).map(ge=>ge.id);ht(I,me,H||false,false),o?.(I);},onTaskCreate:M||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:w||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:I=>{let H=Cs(e).find(fe=>fe.id===I);H&&vn(H);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:I=>{let H=Cs(e).find(fe=>fe.id===I);H&&S&&S(H);},enableKeyboard:true}),la=(I,H=0,fe="")=>{let me=[],ge=[...I].sort((pe,Ce)=>(pe.position??0)-(Ce.position??0));for(let pe=0;pe<ge.length;pe++){let Ce=ge[pe],Se=pe+1,st=fe?`${fe}.${Se}`:`${Se}.0`,et=Ce.wbsCode||st;if(Ce.wbsCode=et,me.push({task:Ce,level:H}),Ce.subtasks&&Ce.subtasks.length>0&&Ce.isExpanded){let tt=Ce.wbsCode?.replace(/\.0$/,"")||(fe?`${fe}.${Se}`:`${Se}`);me.push(...la(Ce.subtasks,H+1,tt));}}return me},ha=la(e),Ha=J?60:48,Zt=Math.max(ha.length*a,600-Ha),Wa=(I,H)=>H==="assignees"?I.assignees:H==="startDate"?I.startDate:I.endDate,Va=(I,H,fe,me)=>{I.preventDefault(),I.stopPropagation(),it({sourceTaskId:H,column:fe,sourceIndex:me,targetIndex:me}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ge=I.currentTarget.closest("[data-grid-body]"),pe=Ma=>{let ka=ge?.getBoundingClientRect().top??0,Le=Math.floor((Ma-ka)/a);return Le=Math.max(0,Math.min(ha.length-1,Le)),Le<me&&(Le=me),Le},Ce=I.clientY,Se=E?.current??null,st=()=>{Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null);},et=()=>{let Ma=pe(Ce);it(ka=>ka&&{...ka,targetIndex:Ma});},ke=()=>{if(st(),!Se)return;let Ma=Se.getBoundingClientRect(),ka=60,Le=12,na=Ce-Ma.top,Ra=Ma.bottom-Ce;if(Ra<ka&&Se.scrollTop<Se.scrollHeight-Se.clientHeight){let Sn=Math.max(1,Math.round(Le*(1-Math.max(0,Ra)/ka))),Xa=()=>{Se.scrollTop+=Sn,et(),Se.scrollTop<Se.scrollHeight-Se.clientHeight&&(Xe.current=requestAnimationFrame(Xa));};Xe.current=requestAnimationFrame(Xa);}else if(na<ka&&Se.scrollTop>0){let Sn=Math.max(1,Math.round(Le*(1-Math.max(0,na)/ka))),Xa=()=>{Se.scrollTop-=Sn,et(),Se.scrollTop>0&&(Xe.current=requestAnimationFrame(Xa));};Xe.current=requestAnimationFrame(Xa);}},tt=Ma=>{Ce=Ma.clientY,et(),ke();},Ia=Ma=>{window.removeEventListener("mousemove",tt),window.removeEventListener("mouseup",Ia),st(),document.body.style.cursor="",document.body.style.userSelect="",it(null);let ka=pe(Ma.clientY),Le=ha.find(Kn=>Kn.task.id===H)?.task;if(!Le)return;let na=Wa(Le,fe),Ra=Math.min(me,ka),Sn=Math.max(me,ka),Xa=[];for(let Kn=Ra;Kn<=Sn;Kn++){if(Kn===me)continue;let En=ha[Kn]?.task;!En||En.subtasks&&En.subtasks.length>0||Xa.push(En.id);}Xa.length!==0&&b?.(Xa,fe,na);};window.addEventListener("mousemove",tt),window.addEventListener("mouseup",Ia);},xn=I=>{if(!Tt)return false;let H=Math.min(Tt.sourceIndex,Tt.targetIndex),fe=Math.max(Tt.sourceIndex,Tt.targetIndex);return I>=H&&I<=fe},ia=I=>!I.startDate||!I.endDate?"-":`${Math.ceil((I.endDate.getTime()-I.startDate.getTime())/(1e3*60*60*24))}d`,vn=I=>{ft(I.id),Rt(I.name),Dt(true);},A=I=>{ut.trim()&&ut!==e.find(H=>H.id===I)?.name&&z?.(I,ut.trim()),ft(null),Rt(""),Dt(false);},Y=()=>{ft(null),Rt(""),Dt(false);},ee=(I,H)=>{H.stopPropagation(),N?.(I.id);},q=(I,H)=>{H.preventDefault(),Me.current=H.clientY,qe(I),O.current=false,Ft(false),Be({x:H.clientX,y:H.clientY});},He=I=>{if(!Ye||(Math.abs(I.clientY-Me.current)>Ve&&!O.current&&(O.current=true,Ft(true)),Be({x:I.clientX,y:I.clientY}),!O.current))return;if(E?.current){let pe=E.current,Ce=pe.getBoundingClientRect(),Se=60,st=12;Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null);let et=I.clientY-Ce.top,ke=Ce.bottom-I.clientY;if(et<Se&&pe.scrollTop>0){let tt=Math.round(st*(1-et/Se)),Ia=()=>{pe.scrollTop-=tt,O.current&&pe.scrollTop>0&&(Xe.current=requestAnimationFrame(Ia));};Xe.current=requestAnimationFrame(Ia);}else if(ke<Se&&pe.scrollTop<pe.scrollHeight-pe.clientHeight){let tt=Math.round(st*(1-ke/Se)),Ia=()=>{pe.scrollTop+=tt,O.current&&pe.scrollTop<pe.scrollHeight-pe.clientHeight&&(Xe.current=requestAnimationFrame(Ia));};Xe.current=requestAnimationFrame(Ia);}}let fe=document.querySelectorAll("[data-task-row]"),me=null,ge=null;fe.forEach(pe=>{let Ce=pe.getBoundingClientRect(),Se=pe.getAttribute("data-task-row");if(Se&&Se!==Ye&&I.clientY>=Ce.top&&I.clientY<=Ce.bottom){me=Se;let st=I.clientY-Ce.top,et=Ce.height;st<et*.25?ge="above":st>et*.75?ge="below":ge="child";}}),he(me),ze(ge);},Ze=()=>{if(O.current&&Ye&&_&&Z){if(Z==="child")U?.(Ye,_);else if(Z==="above"||Z==="below"){let I=(pe,Ce,Se=null)=>{for(let st of pe){if(st.id===Ce)return Se;if(st.subtasks){let et=I(st.subtasks,Ce,st.id);if(et!==void 0)return et}}},H=W&&W.length>0?W:e,fe=I(H,Ye,null),me=I(H,_,null),ge=(pe,Ce,Se,st)=>{let et=pe.findIndex(Ia=>Ia.id===Ce),ke=st?pe.findIndex(Ia=>Ia.id===Se):-1,tt=Z==="below"?et+1:et;return st&&ke!==-1&&ke<et&&(tt-=1),Math.max(0,tt)};if(me===null){let Ce=ge(H,_,Ye,fe===null);U?.(Ye,null,Ce);}else {let pe=ai(H,me);if(pe?.subtasks){let Ce=fe===me,Se=ge(pe.subtasks,_,Ye,Ce);U?.(Ye,me,Se);}}}}Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null),qe(null),he(null),ze(null),Be(null),O.current=false,Ft(false);};useEffect(()=>{if(Ye)return document.addEventListener("mousemove",He),document.addEventListener("mouseup",Ze),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",Ze),document.body.style.cursor="",document.body.style.userSelect="";}},[Ye,_,Z]);let $e=useMemo(()=>{let I=new Map,H=(fe,me)=>{for(let ge of fe)I.set(ge.id,me),ge.subtasks?.length&&H(ge.subtasks,[...me,{name:ge.name,wbsCode:ge.wbsCode}]);};return H(e,[]),I},[e]),Q=12,Ie=(I,H,fe,me)=>{if(I.id==="name"){let ge=ct===H.id,pe=gt===H.id;return jsxs("div",{"data-celda-nombre-v6":true,className:"flex items-center min-w-0 relative",style:{gap:6,alignSelf:"stretch",width:"100%",paddingLeft:`${fe*Q}px`},children:[Array.from({length:fe},(Ce,Se)=>jsx("span",{"aria-hidden":true,style:{position:"absolute",left:8+Se*Q,top:0,bottom:0,width:1,background:"var(--v6-separador, #CDD2D8)"}},Se)),U&&pe&&!ge&&jsx("div",{className:"cursor-grab active:cursor-grabbing flex items-center",style:{position:"absolute",left:-10,top:0,bottom:0,width:10,color:"var(--v6-tenue, #5F6972)"},onMouseDown:Ce=>q(H.id,Ce),title:ce?"Arrastrar para mover la tarea":"Drag to move the task",children:jsx(GripVertical,{style:{width:10,height:14}})}),me?jsx("button",{type:"button",onClick:Ce=>{Ce.stopPropagation(),u?.(H.id);},"aria-label":ce?H.isExpanded?`Contraer ${H.name}`:`Desplegar ${H.name}`:H.isExpanded?`Collapse ${H.name}`:`Expand ${H.name}`,"aria-expanded":!!H.isExpanded,style:{flex:"none",width:18,height:18,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:H.isExpanded?jsx(ChevronDown,{style:{width:14,height:14},strokeWidth:2}):jsx(ChevronRight,{style:{width:14,height:14},strokeWidth:2})}):jsx("span",{"aria-hidden":true,style:{flex:"none",width:18}}),H.wbsCode&&jsx("span",{style:{flex:"none",minWidth:28,textAlign:"right",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontVariantNumeric:"tabular-nums",fontSize:11,color:"var(--v6-tenue, #5F6972)"},children:H.wbsCode}),ge?jsx("input",{ref:lt,type:"text",value:ut,onChange:Ce=>Rt(Ce.target.value),onKeyDown:Ce=>{Ce.key==="Enter"?A(H.id):Ce.key==="Escape"&&Y();},onBlur:()=>A(H.id),className:"flex-1 min-w-0 px-2 py-1 rounded border outline-none",style:{background:"var(--v6-tarjeta, #fff)",borderColor:"var(--v6-acento, #0FA392)",color:"var(--v6-texto, #0E1114)",font:"inherit",fontSize:13},onClick:Ce=>Ce.stopPropagation()}):(()=>{let{comienzo:Ce,cola:Se}=Tf(H.name),st=$e.get(H.id)??[];return jsxs("span",{title:st.length?Df(st,H.name):H.name,"data-nombre-v6":true,style:{marginLeft:2,flex:"1 1 auto",minWidth:0,display:"flex",whiteSpace:"nowrap",fontSize:13,fontWeight:me||H.isMilestone?600:500,color:"var(--v6-texto, #0E1114)"},children:[jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",flex:"0 1 auto"},children:Ce}),Se&&jsx("span",{style:{flex:"none",whiteSpace:"pre"},children:Se})]})})(),Pe&&H.isCriticalPath&&jsx("span",{"aria-label":ce?"En la ruta cr\xEDtica":"On the critical path",style:{flex:"none",width:6,height:6,borderRadius:"50%",background:"var(--v6-rojo-punto, #D13A40)"}}),pe&&!ge&&jsxs("div",{className:"flex items-center",style:{gap:2,flex:"none"},onClick:Ce=>Ce.stopPropagation(),children:[jsx("button",{type:"button",onClick:Ce=>ee(H,Ce),"aria-label":ce?"Crear subtarea":"Create subtask",title:ce?"Crear subtarea":"Create subtask",style:{width:20,height:20,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:jsx(Plus,{style:{width:13,height:13}})}),jsx("button",{type:"button",onClick:Ce=>{Ce.stopPropagation(),vn(H);},"aria-label":ce?"Renombrar (F2)":"Rename (F2)",title:ce?"Renombrar (F2)":"Rename (F2)",style:{width:20,height:20,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:jsx(Edit3,{style:{width:13,height:13}})})]})]})}if(I.id==="assignees"){if(me)return jsx("span",{"aria-hidden":true});let ge=n.filter(pe=>H.assignees?.some(Ce=>Ce.id?Ce.id===pe.id:Ce.name===pe.name||Ce.initials===pe.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:pe=>pe.stopPropagation(),children:jsx(Bo,{variante:"v6",es:ce,nombreDeLaTarea:H.name,assignedUsers:ge,availableUsers:n,onChange:pe=>v?.(H.id,{assignees:pe.map(Ce=>({id:Ce.id,name:Ce.name,initials:Ce.initials,color:Ce.color}))})})})}if(I.id==="progress"){let ge=Math.round(H.progress||0),pe=!me&&ge>0&&ge<100;return jsxs("div",{className:"w-full",style:{textAlign:"right",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:me||pe?500:400,color:pe?"var(--v6-acento-texto, #066A5F)":ge===0?"var(--v6-tenue, #5F6972)":"var(--v6-texto, #0E1114)"},children:[ge,"%"]})}},pt=(I,H,fe)=>{let me=H.subtasks&&H.subtasks.length>0;if(J){let ge=Ie(I,H,fe,!!me);if(ge!==void 0)return ge}switch(I.id){case "name":let ge=ct===H.id,pe=gt===H.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${fe*20}px`},children:[U&&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:pe?1:.3},onMouseDown:Le=>q(H.id,Le),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsx("button",{onClick:Le=>{Le.stopPropagation(),u?.(H.id);},"aria-label":ce?H.isExpanded?`Contraer ${H.name}`:`Desplegar ${H.name}`:H.isExpanded?`Collapse ${H.name}`:`Expand ${H.name}`,"aria-expanded":!!H.isExpanded,className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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"}),ge?jsx("input",{ref:lt,type:"text",value:ut,onChange:Le=>Rt(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"?A(H.id):Le.key==="Escape"&&Y();},onBlur:()=>A(H.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:Le=>Le.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:[H.wbsCode&&jsx("span",{style:{color:`var(--pj-texto-tenue, ${t.textTertiary})`,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,flexShrink:0},children:H.wbsCode}),H.isHighlighted&&H.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H.name}),H.subtasks&&H.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(H.progress||0),"%"]}),Pe&&H.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),Pe&&H.cpmData&&jsx("span",{title:ce?"D\xEDas que la tarea puede retrasarse sin mover el fin del proyecto":"Total float: days the task can slip without moving the project end",style:{color:H.cpmData.totalFloat<=0?"#EF4444":H.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:ce?`Holgura: ${Math.round(H.cpmData.totalFloat)} d`:`TF: ${Math.round(H.cpmData.totalFloat)}d`})]}),pe&&!ge&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Le=>Le.stopPropagation(),children:[jsx("button",{onClick:Le=>ee(H,Le),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:Le=>{Le.stopPropagation(),vn(H);},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 Se=I.id==="startDate"?"startDate":"endDate",st=H[Se],et=ba?.taskId===H.id&&ba?.field===Se,ke=Le=>{if(!Le)return J?"\u2014":"-";let na=typeof Le=="string"?new Date(Le):Le;return J?jn(na,ce?"es":"en"):na.toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})};return jsxs("div",{className:`flex items-center w-full relative ${J?"justify-start":"justify-center"}`,onClick:Le=>Le.stopPropagation(),children:[jsxs("button",{type:"button",className:J?"flex items-center rounded":"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:J?{whiteSpace:"nowrap",padding:0,border:0,background:"transparent",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontVariantNumeric:"tabular-nums",fontSize:11,color:"var(--v6-texto-2, #4D5761)",cursor:me?"default":"pointer"}:{color:t.textSecondary,opacity:me?.5:1,cursor:me?"default":"pointer"},title:me?"Auto-calculated from subtasks":void 0,onClick:Le=>{if(!me)if(et)Jt(null);else {let na=Le.currentTarget.getBoundingClientRect();Jt({taskId:H.id,field:Se,month:st?typeof st=="string"?new Date(st):st:new Date,position:{top:na.bottom+4,left:na.left}});}},children:[!J&&jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:ke(st)}),me&&!J&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),et&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Jt(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:ba?.position.top,left:ba?.position.left},onClick:Le=>Le.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Le=new Date,na=new Date(Le);na.setDate(Le.getDate()+1);let Ra=new Date(Le);Ra.setDate(Le.getDate()+7);let Sn=new Date(Le);return Sn.setDate(Le.getDate()+14),[{label:"Hoy",date:Le},{label:"Ma\xF1ana",date:na},{label:"Pr\xF3xima semana",date:Ra},{label:"2 semanas",date:Sn}].map((Kn,En)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:An=>An.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:An=>An.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(H.id,{[Se]:Kn.date}),Jt(null);},children:Kn.label},En))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(H.id,{[Se]:void 0}),Jt(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:()=>Jt(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ba?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Jt(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["L","M","X","J","V","S","D"].map((Le,na)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Le},na))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Le=ba?.month||new Date,na=Le.getFullYear(),Ra=Le.getMonth(),Sn=(new Date(na,Ra,1).getDay()+6)%7,Xa=new Date(na,Ra+1,0).getDate(),Kn=new Date,En=[];for(let Pa=Sn-1;Pa>=0;Pa--)En.push({day:new Date(na,Ra,-Pa).getDate(),date:new Date(na,Ra-1,new Date(na,Ra,-Pa).getDate()),isCurrentMonth:false});for(let Pa=1;Pa<=Xa;Pa++)En.push({day:Pa,date:new Date(na,Ra,Pa),isCurrentMonth:true});let An=42-En.length;for(let Pa=1;Pa<=An;Pa++)En.push({day:Pa,date:new Date(na,Ra+1,Pa),isCurrentMonth:false});return En.map((Pa,Ir)=>{let Rr=Pa.date.toDateString()===Kn.toDateString(),Io=(st?typeof st=="string"?new Date(st):st:null)?.toDateString()===Pa.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:Pa.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#00E5CC":"transparent",boxShadow:Rr&&!Io?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(H.id,{[Se]:Pa.date}),Jt(null);},children:Pa.day},Ir)})})()})]})]})]}),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:ia(H)})});case "assignees":if(me)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let tt=n.filter(Le=>H.assignees?.some(na=>na.id?na.id===Le.id:na.name===Le.name||na.initials===Le.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(Bo,{assignedUsers:tt,availableUsers:n,onChange:Le=>{let na=Le.map(Ra=>({id:Ra.id,name:Ra.name,initials:Ra.initials,color:Ra.color}));v?.(H.id,{assignees:na});}})});case "status":if(me){let Le=H.progress===100?"\u2713":H.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:Le})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(Zm,{status:H.status||"todo",onChange:Le=>{v?.(H.id,{status:Le,progress:Le==="completed"?100:H.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:me?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});case "priority":let Ia={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ma={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ka=Ia[H.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(us,{priority:ka,onChange:Le=>{Le&&v?.(H.id,{priority:Ma[Le]||"medium"});}})});default:return null}},P=I=>[{id:"hide",label:"Hide Column",icon:ga.Hide,onClick:()=>m(I),disabled:I==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ga.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ga.SortDesc,onClick:()=>{}}],ie=I=>{let H=I.subtasks&&I.subtasks.length>0,fe=Cs(e),me=dt.size>1&&dt.has(I.id),ge=me?fe.filter(et=>dt.has(et.id)):[I],pe=ge.map(et=>et.id),Ce=ge.filter(et=>!(et.subtasks&&et.subtasks.length>0)),Se=me?` (${pe.length})`:"",st=()=>{V?V(pe,I.name):y?.(pe);};return H?[{id:"addSubtask",label:oe?.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{N?.(I.id);}},{id:"duplicate",label:(oe?.contextMenu?.duplicateTask||"Duplicate Task")+Se,icon:ga.Duplicate,onClick:()=>{k?.(pe);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(oe?.contextMenu?.deleteTask||"Delete Task")+Se,icon:ga.Delete,onClick:st}]:[{id:"edit",label:oe?.contextMenu?.editTask||"Edit Task",icon:ga.Pencil,onClick:()=>{c?.(I);}},{id:"addSubtask",label:oe?.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{N?.(I.id);}},...D?[{id:"dependencies",label:oe?.contextMenu?.dependencies||"Dependencies\u2026",icon:ga.Link,onClick:()=>D(I)}]:[],...v&&!(I.subtasks&&I.subtasks.length>0)?[{id:"milestone",label:I.isMilestone?ce?"Quitar hito":"Remove milestone":ce?"Convertir en hito":"Convert to milestone",icon:ga.Milestone,onClick:()=>v(I.id,{isMilestone:!I.isMilestone})}]:[],{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(oe?.contextMenu?.markIncomplete||"Mark Incomplete")+Se,icon:ga.MarkIncomplete,onClick:()=>{Ce.forEach(et=>v?.(et.id,{status:"todo",progress:0}));},disabled:Ce.length===0||Ce.every(et=>et.status==="todo")},{id:"setInProgress",label:(oe?.contextMenu?.setInProgress||"Set In Progress")+Se,icon:ga.SetInProgress,onClick:()=>{Ce.forEach(et=>v?.(et.id,{status:"in-progress"}));},disabled:Ce.length===0||Ce.every(et=>et.status==="in-progress")},{id:"markComplete",label:(oe?.contextMenu?.markComplete||"Mark Complete")+Se,icon:ga.MarkComplete,onClick:()=>{Ce.forEach(et=>v?.(et.id,{status:"completed",progress:100}));},disabled:Ce.length===0||Ce.every(et=>et.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(oe?.contextMenu?.duplicateTask||"Duplicate Task")+Se,icon:ga.Duplicate,onClick:()=>{k?.(pe);}},{id:"split",label:oe?.contextMenu?.splitTask||"Split Task",icon:ga.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(oe?.contextMenu?.deleteTask||"Delete Task")+Se,icon:ga.Delete,onClick:st}]},$=d.filter(I=>I.visible),te=$.reduce((I,H)=>I+H.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:te},children:[J?jsxs("div",{"data-cabecera-tabla-v6":true,className:"sticky top-0 z-10 flex flex-col",style:{height:`${Ha}px`,boxSizing:"border-box",background:"var(--v6-tarjeta, #FFFFFF)",borderBottom:"1px solid var(--v6-borde, #E2E5E9)"},children:[jsxs("div",{style:{height:24,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 10px 0 14px",borderBottom:"1px solid var(--v6-linea, #EEF0F2)",fontSize:11,color:"var(--v6-tenue, #5F6972)"},children:[jsxs("span",{className:"truncate","data-resumen-v6":true,children:[de,Ae&&jsxs(Fragment,{children:[" \xB7 ",jsx("button",{type:"button",onClick:Ae,"data-mostrar-ocultas":true,style:{border:0,padding:0,background:"transparent",font:"inherit",color:"var(--v6-acento-texto, #087F72)",fontWeight:500,cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:ce?"Mostrar":"Show"})]}),Ge&&B&&jsxs(Fragment,{children:[" \xB7 ",jsx("span",{"data-aviso-vencidas":true,style:{color:"var(--v6-rojo, #B02A33)",fontWeight:500},children:Ge})," \xB7 ",jsx("button",{type:"button",onClick:B,"data-ver-vencidas":true,style:{border:0,padding:0,background:"transparent",font:"inherit",color:"var(--v6-acento-texto, #087F72)",fontWeight:500,cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:ce?"Ver":"View"})]})]}),R&&jsx("button",{type:"button",onClick:R,"aria-label":ce?"Contraer todos los grupos":"Collapse all groups",title:ce?"Contraer todos los grupos":"Collapse all groups",style:{width:20,height:20,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:jsx(ChevronsDownUp,{style:{width:13,height:13},strokeWidth:2})})]}),jsx("div",{style:{flex:1,display:"flex",alignItems:"center",gap:10,padding:"0 14px 0 10px",fontSize:11,fontWeight:500,color:"var(--v6-tenue, #5F6972)"},children:$.map(I=>jsx("div",{style:{width:I.id==="name"?void 0:I.width,flex:I.id==="name"?"1 1 0":"0 0 auto",minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textAlign:I.id==="assignees"?"center":I.id==="progress"?"right":"left",paddingLeft:I.id==="name"?60:0},title:I.id==="assignees"?I.label:void 0,children:I.id==="assignees"&&(I.width??0)<=40?jsx("span",{role:"img","aria-label":I.label,"data-encabezado-responsable":true,style:{display:"inline-flex",justifyContent:"center",width:"100%"},children:jsx(User,{"aria-hidden":true,style:{width:13,height:13},strokeWidth:2})}):I.label},I.id))})]}):jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ha}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:$.map((I,H)=>{let fe=H===$.length-1,me=I.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${me?"":"justify-center"}`,style:{width:`${I.width}px`,minWidth:`${I.minWidth??(me?200:60)}px`,maxWidth:`${I.maxWidth??2e3}px`,flexShrink:me&&$.length===1?1:0,flexGrow:me&&$.length===1?1:0,borderRight:fe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ge=>{ge.preventDefault(),Ut({isOpen:true,x:ge.clientX,y:ge.clientY,type:"header",columnId:I.id});},onMouseEnter:ge=>{ge.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ge=>{ge.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:I.label,children:I.label}),I.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:vt===I.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ge=>{ge.preventDefault(),ge.stopPropagation(),Mt(I.id),zt(ge.clientX),Ot(I.width);},title:ce?"Arrastra para cambiar el ancho":"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:vt===I.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},I.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(oc,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>we(!Ht),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"})}),Ht&&jsxs("div",{ref:Te,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:I=>I.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:()=>we(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"})]})]})]})]})]})]})]}),jsxs("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Zt},children:[nt&&nt.desde>0&&jsx("div",{"aria-hidden":true,"data-relleno-arriba":true,style:{height:nt.desde*a}}),ha.map(({task:I,level:H},fe)=>{if(nt&&(fe<nt.desde||fe>nt.hasta))return null;let me=jt(I.id),ge=xn(fe),pe=_===I.id,Ce=pe&&Z==="above",Se=pe&&Z==="below",st=pe&&Z==="child",et={};return st&&(et.backgroundColor=`${t.accent}15`,et.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":I.id,className:`flex items-center cursor-pointer group ${Ye===I.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,...J?{boxSizing:"border-box",padding:"0 14px 0 10px",gap:10,borderBottom:"1px solid var(--v6-linea, #EEF0F2)",boxShadow:me?"inset 2px 0 0 var(--v6-acento, #0FA392)":void 0,backgroundColor:me?"var(--v6-fila-seleccionada, rgba(15,163,146,0.08))":st?`${t.accent}15`:"transparent"}:{borderLeft:me?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:me?t.accentLight:st?`${t.accent}15`:fe%2===0?t.bgPrimary:t.bgGrid},opacity:Pe?I.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...et},onMouseEnter:()=>Je(I.id),onMouseLeave:()=>Je(null),onClick:ke=>{let Ia=Cs(e).map(Le=>Le.id),ka=navigator.platform.toUpperCase().indexOf("MAC")>=0?ke.metaKey:ke.ctrlKey;ht(I.id,Ia,ka,ke.shiftKey),o?.(I.id),!ka&&!ke.shiftKey&&s?.(I);},onDoubleClick:ke=>{ke.stopPropagation(),c?.(I);},onContextMenu:ke=>{ke.preventDefault(),Ut({isOpen:true,x:ke.clientX,y:ke.clientY,type:"task",task:I}),l?.(I,ke);},whileHover:{backgroundColor:J?me?"var(--v6-fila-seleccionada, rgba(15,163,146,0.08))":"var(--v6-fila-hover, rgba(14,17,20,0.025))":me?t.accentLight:t.hoverBg},children:[Ce&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),$.map((ke,tt)=>{let Ia=tt===$.length-1,Ma=ke.id==="name",ka=!!(I.subtasks&&I.subtasks.length>0),Le=ke.id==="assignees"||ke.id==="startDate"||ke.id==="endDate"?ke.id:null,Ra=!!Le&&!ka&>===I.id&&!Tt,Sn=ge&&!!Tt&&Tt.column===ke.id;return jsxs("div",{className:J?"flex items-center":`px-4 flex items-center ${Ma?"justify-start":"justify-center"}`,style:J?{position:"relative",width:Ma?void 0:`${ke.width}px`,flex:Ma?"1 1 0":"0 0 auto",minWidth:0,height:"100%",alignItems:"center",overflow:"visible",backgroundColor:Sn?`${t.accent}22`:void 0}:{position:"relative",width:`${ke.width}px`,minWidth:`${ke.minWidth??(Ma?200:60)}px`,maxWidth:`${ke.maxWidth??2e3}px`,flexShrink:Ma&&$.length===1?1:0,flexGrow:Ma&&$.length===1?1:0,borderRight:Ia?"none":`1px solid ${gt===I.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Sn?`${t.accent}22`:void 0,boxShadow:Sn?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[pt(ke,I,Ma?H:0),Ra&&Le&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Xa=>Va(Xa,I.id,Le,fe),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${I.id}-${ke.id}`)})]},I.id)}),nt&&nt.hasta<ha.length-1&&jsx("div",{"aria-hidden":true,"data-relleno-abajo":true,style:{height:(ha.length-1-nt.hasta)*a}}),L&&jsxs("button",{type:"button","data-anadir-tarea":true,onClick:L.onClick,className:J?"w-full flex items-center text-left":"w-full flex items-center gap-2 px-3 text-left text-[13px] transition-colors",style:J?{height:36,gap:8,padding:"0 14px 0 34px",border:0,background:"transparent",color:"var(--v6-tenue, #5F6972)",font:"inherit",fontSize:13,cursor:"pointer"}:{height:`${a}px`,color:t.textTertiary,borderBottom:`1px solid ${t.borderLight}`},onMouseEnter:I=>{I.currentTarget.style.color=J?"var(--v6-texto, #0E1114)":t.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.color=J?"var(--v6-tenue, #5F6972)":t.textTertiary;},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),L.label]})]}),jsx(ti,{isOpen:wt.isOpen,x:wt.x,y:wt.y,items:wt.type==="header"&&wt.columnId?P(wt.columnId):wt.type==="task"&&wt.task?ie(wt.task):[],onClose:()=>Ut({...wt,isOpen:false}),theme:t}),Qe&&xe&&Ye&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:xe.x+12,top:xe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let I=ha.find(H=>H.task.id===Ye)?.task;return I?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:I.name})}):null})()}),document.body)]})}function Uf(e,t){let[a,n]=useState("none"),[r,s]=useState(0),[o,i]=useState(e),[c,l]=useState(t),[u,p]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[b,w]=useState(null),[h,x]=useState(0),[y,k]=useState(0),[M,z]=useState(null),[L,N]=useState(false);return {dragMode:a,setDragMode:n,dragOffset:r,setDragOffset:s,ghostX:o,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:b,setDraggedSegmentIndex:w,draggedSegmentStartX:h,setDraggedSegmentStartX:x,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:z,isHovered:L,setIsHovered:N,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(W,E)=>{n("none"),p(null),m(null),i(W),l(E),k(0),w(null),x(0);}}}function cc({task:e,x:t,y:a,width:n,theme:r,dayWidth:s,startDate:o,templates:i,onClick:c,onDoubleClick:l,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:b,showTaskBarLabels:w=true,showCriticalPath:h=true,readOnly:x=false,onProgressChange:y,v6:k=false,alturaBarra:M,duracionV6:z,transversal:L=false}){let N=vo(),D=Uf(t,n),S=useRef(null),V=useRef(false),U=vo(),W=useRef(false),E=useRef(null),Pe=useRef(null),{dragMode:J,setDragMode:de,dragOffset:R,setDragOffset:Ae,ghostX:nt,setGhostX:Ge,ghostWidth:B,setGhostWidth:ce,connectionLine:oe,setConnectionLine:gt,hoveredTaskId:Je,setHoveredTaskId:ct,activeZone:ft,setActiveZone:ut,draggedSegmentIndex:Rt,setDraggedSegmentIndex:lt,draggedSegmentStartX:vt,setDraggedSegmentStartX:Mt,segmentDragOffsetX:Pt,setSegmentDragOffsetX:zt,hoveredSegmentIndex:Ne,setHoveredSegmentIndex:Ot,isHovered:wt,setIsHovered:Ut,isDragging:Ye,isResizing:qe,isConnecting:_,resetDragState:he}=D,Z=M??18,ze=!!r.executionBarBg,Me=r.textPrimary==="#FFFFFF"||r.bgPrimary==="#050505",Ve=ze?3:6,O=e.subtasks&&e.subtasks.length>0,xe=useRef(null),[Be,Qe]=(()=>{let $=useRef(null),[,te]=useState(0);return [$.current,I=>{$.current=I,te(H=>H+1);}]})(),Ft=!!y&&!x&&!O&&!e.segments&&!!e.startDate&&!!e.endDate,Xe=e.endDate&&(()=>{let $=new Date;$.setHours(0,0,0,0);let te=new Date(e.endDate);return te.setHours(0,0,0,0),te<$})()&&e.progress<100,Tt=h&&e.isCriticalPath,it=r.name==="neutral"||r.today==="#1C1917",ba=e.status==="completed"||e.progress===100,Jt={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},we=h&&e.isCriticalPath||Xe?"#EF4444":e.color?e.color:e.priority&&Jt[e.priority]?Jt[e.priority]:r.taskBarPrimary,Te=x?"default":Ye?_?"crosshair":qe?"ew-resize":"grabbing":"grab",dt=x?"default":"ew-resize",jt=($=>$>=80?20:$>=60?15:$>=50?12:10)(n),Dt=n<50,la=n<40;useEffect(()=>{v&&(!wt||Ye||e.segments)&&v(null);},[wt,Ye,e.segments,v]);let ha=$=>$.toLocaleDateString(N?"es-CO":"en-US",{month:"short",day:"numeric",year:"numeric"}),Ha=()=>{let $=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return N?`${$} d\xEDa${$!==1?"s":""}`:`${$} day${$!==1?"s":""}`},Zt=$=>Math.round($/s)*s,Wa=$=>{let te=Math.round($/s),I=new Date(o);return I.setDate(I.getDate()+te),I},Va=$=>{let te=m.find(H=>H.id===$),I=!!te&&!!oe&&oe.x>te.x+te.width/2;return V.current?I?"SF":"SS":I?"FF":"FS"},xn=($,te)=>{for(let I of m){if(I.id===e.id)continue;let H=5;if($>=I.x-H&&$<=I.x+I.width+H&&te>=I.y-H&&te<=I.y+I.height+H)return I.id}return null},ia=useCallback(($,te,I)=>{if(x)return;$.preventDefault(),$.stopPropagation();let H=S.current?.ownerSVGElement;if(!H)return;let fe=H.createSVGPoint();fe.x=$.clientX,fe.y=$.clientY;let me=fe.matrixTransform(H.getScreenCTM()?.inverse()),ge=I!==void 0?I:t,pe=te;if(!pe){let Ce=me.x-ge;$.shiftKey?(pe="connect",V.current=false,gt({x:t+n,y:a+Z/2})):$.ctrlKey||$.metaKey?pe="move":$.altKey?pe=Ce<n/2?"resize-start":"resize-end":la?Ce<n/2?pe="move":pe="resize-end":Dt?Ce<=jt/2?pe="resize-start":Ce>=n-jt/2?pe="resize-end":pe="move":Ce<=jt?pe="resize-start":Ce>=n-jt?pe="resize-end":pe="move";}W.current=false,de(pe),Ut(false),ut(null),pe==="move"?Ae(me.x-ge):pe==="connect"?gt({x:V.current?t:t+n,y:a+Z/2}):Ae(0),Ge(ge),ce(n);},[t,n,a,Z,x]),vn=useCallback($=>{let te=S.current?.ownerSVGElement;if(!te)return;let I=te.closest(".gantt-timeline-scroll");if(!I)return;let H=I.getBoundingClientRect(),fe=60,me=15,ge=0;if($.clientX<H.left+fe){let pe=H.left+fe-$.clientX;ge=-Math.min(me,pe/2);}else if($.clientX>H.right-fe){let pe=$.clientX-(H.right-fe);ge=Math.min(me,pe/2);}return ge!==0&&(I.scrollLeft+=ge),ge!==0},[]),A=useCallback($=>{if(J==="none")return;W.current=true,Pe.current=$;let te=S.current?.ownerSVGElement;if(!te)return;if(J==="move"||J==="resize-start"||J==="resize-end"){let fe=vn($);fe&&!E.current?E.current=window.setInterval(()=>{Pe.current&&(vn(Pe.current),A(Pe.current));},16):!fe&&E.current&&(window.clearInterval(E.current),E.current=null);}let I=te.createSVGPoint();I.x=$.clientX,I.y=$.clientY;let H=I.matrixTransform(te.getScreenCTM()?.inverse());if(J==="connect"){gt({x:H.x,y:H.y});let fe=xn(H.x,H.y);ct(fe);}else if(J==="move"){let fe=H.x-R,me=Zt(fe);Ge(me),ce(n);let ge=Math.round((me-t)/s);if(f?.(e.id,ge,true),e.segments&&e.segments.length>0&&Rt!==null){let pe=me-vt;zt(pe);}}else if(J==="resize-start"){let fe=H.x,me=Zt(fe),ge=t+n-me;ge>=s&&(Ge(me),ce(ge));}else if(J==="resize-end"){let fe=H.x,ge=Zt(fe)-t;ge>=s&&ce(ge);}},[J,t,n,s,R,e,Zt,Rt,vt,xn,ct,gt,Ge,ce,zt,f,vn]),Y=useCallback(()=>{if(E.current&&(window.clearInterval(E.current),E.current=null),Pe.current=null,J!=="none"){if(J==="connect")Je&&d&&d(e,Je,Va(Je)),gt(null),ct(null);else {let $=e.endDate.getTime()-e.startDate.getTime(),te,I,H=true;if(J==="move"){if(te=Wa(nt),I=new Date(te.getTime()+$),e.segments&&e.segments.length>0&&Rt!==null){let fe=Math.round(Pt/s),me=e.segments.map((Se,st)=>{if(st===Rt){let et=new Date(Se.startDate),ke=new Date(Se.endDate);return et.setDate(et.getDate()+fe),ke.setDate(ke.getDate()+fe),{startDate:et,endDate:ke}}return Se}),ge=me.flatMap(Se=>[Se.startDate,Se.endDate]),pe=new Date(Math.min(...ge.map(Se=>Se.getTime()))),Ce=new Date(Math.max(...ge.map(Se=>Se.getTime())));p?.({...e,segments:me},pe,Ce),he(t,n);return}}else J==="resize-start"?(te=Wa(nt),I=e.endDate,te>I&&(console.warn("Invalid date range: start date must be before or equal to end date"),H=false)):J==="resize-end"?(te=e.startDate,I=Wa(nt+B),I.setDate(I.getDate()-1),I<te&&(console.warn("Invalid date range: end date must be after or equal to start date"),H=false)):H=false;H&&te&&I&&(I.getTime()<te.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,te,I));}f?.(e.id,0,false),he(t,n);}},[J,nt,B,e,p,Je,d,t,n,s,Wa,Pt,Rt,he,f]);useEffect(()=>{if(J==="none")return;let $=I=>{A(I);},te=()=>{Y();};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",te),E.current&&(window.clearInterval(E.current),E.current=null);}},[J,A,Y]);let ee=Ye&&!_?nt:t,q=Ye&&!_?B:n,He=i.taskClass(e),Ze=24,$e=h?e.isCriticalPath?1:.25:1,Q=useCallback($=>{if(!Ft)return;$.stopPropagation(),$.preventDefault();let I=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;xe.current={barRect:I,initialPct:e.progress||0},$.currentTarget.setPointerCapture($.pointerId),Qe(e.progress||0);},[Ft,e.progress,Qe]),Ie=useCallback($=>{let te=xe.current;if(!te)return;let H=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??te.barRect;if(!H||H.width<=0)return;let fe=($.clientX-H.left)/H.width,me=Math.round(Math.max(0,Math.min(1,fe))*100);$.shiftKey&&(me=Math.round(me/25)*25),Qe(me);},[Qe]),pt=useCallback($=>{let te=xe.current;if(!te)return;$.stopPropagation(),$.preventDefault();try{$.currentTarget.releasePointerCapture($.pointerId);}catch{}let I=Be;xe.current=null,Qe(null),I!=null&&I!==te.initialPct&&y&&y(e,I);},[Be,y,e,Qe]),P=useCallback($=>{$.stopPropagation(),$.preventDefault();},[]),ie=Be??(e.progress||0);return jsxs("g",{ref:S,"data-task-bar":"true","data-estado":ba?"completed":Xe?"overdue":"planned","data-resumen":O?"true":void 0,style:{opacity:$e,transition:"opacity 300ms ease"},onClick:()=>{!Ye&&!W.current&&c?.(e),W.current=false;},onDoubleClick:$=>{!Ye&&!W.current&&($.stopPropagation(),l?.(e));},onContextMenu:$=>{$.preventDefault(),u?.(e,$);},onMouseEnter:()=>!Ye&&Ut(true),onMouseMove:$=>{v&&wt&&!Ye&&!e.segments&&v({task:e,x:t,y:a,width:n,height:Z,showBelow:false,mouseX:$.clientX,mouseY:$.clientY});},onMouseLeave:()=>{Ye||(Ut(false),ut(null));},children:[jsx("rect",{x:t,y:a,width:n+Ze,height:Z,fill:"transparent",style:{pointerEvents:"all"}}),wt&&!Ye&&!Dt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:jt,height:Z,fill:ft==="resize-start"?r.accent:"transparent",opacity:ft==="resize-start"?.15:0,style:{cursor:dt,pointerEvents:"all"},onMouseEnter:()=>ut("resize-start"),onMouseDown:$=>ia($,"resize-start")}),jsx("rect",{x:t+jt,y:a,width:n-jt*2,height:Z,fill:ft==="move"?r.accent:"transparent",opacity:ft==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ut("move"),onMouseDown:$=>ia($,"move")}),jsx("rect",{x:t+n-jt,y:a,width:jt,height:Z,fill:ft==="resize-end"?r.accent:"transparent",opacity:ft==="resize-end"?.15:0,style:{cursor:dt,pointerEvents:"all"},onMouseEnter:()=>ut("resize-end"),onMouseDown:$=>ia($,"resize-end")})]}),wt&&!Ye&&la&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:n/2,height:Z,fill:ft==="move"?r.accent:"transparent",opacity:ft==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ut("move"),onMouseDown:$=>ia($,"move")}),jsx("rect",{x:t+n/2,y:a,width:n/2,height:Z,fill:ft==="resize-end"?r.accent:"transparent",opacity:ft==="resize-end"?.2:0,style:{cursor:dt,pointerEvents:"all"},onMouseEnter:()=>ut("resize-end"),onMouseDown:$=>ia($,"resize-end")}),wt&&jsx(motion.line,{x1:t+n/2,y1:a+4,x2:t+n/2,y2:a+Z-4,stroke:r.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ye&&!_&&!e.segments&&jsx(motion.rect,{x:nt,y:a,width:B,height:Z,rx:Ve,fill:r.accent,opacity:.15,stroke:r.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),b&&e.baselineStartDate&&e.baselineEndDate&&!Ye&&(()=>{let $=e.baselineStartDate.getTime(),te=e.baselineEndDate.getTime(),I=o.getTime(),H=864e5,fe=($-I)/H,me=(te-$)/H,ge=fe*s,pe=Math.max(me*s,s),Ce=ee+q,Se=ge+pe,st=e.endDate?.getTime()??0,et=Math.ceil((st-te)/H),ke=et>0,tt=et<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:ge,y:a,width:pe,height:Z,rx:Ve,fill:"none",stroke:Me?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ke&&Ce>Se&&jsx("rect",{x:Se,y:a,width:Ce-Se,height:Z,rx:0,fill:"#EF4444",opacity:.2}),ke&&jsxs("text",{x:Math.max(Ce,Se)+6,y:a+Z/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",et,"d"]}),tt&&jsxs("text",{x:Ce+6,y:a+Z/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[et,"d"]})]})})(),!e.segments&&ze&&O&&(()=>{let te=a+(Z-8)/2,I=4,H=e.progress||0,fe=new Date;fe.setHours(0,0,0,0);let me=e.startDate&&fe>=e.startDate,ge=e.endDate&&(()=>{let ke=new Date(e.endDate);return ke.setHours(0,0,0,0),fe>ke})(),pe=e.startDate&&fe<e.startDate,Ce=1;if(me&&e.startDate&&e.endDate&&!pe){let ke=new Date(e.startDate);ke.setHours(0,0,0,0);let tt=new Date(e.endDate);tt.setHours(0,0,0,0);let Ia=Math.max(1,(tt.getTime()-ke.getTime())/(1e3*60*60*24)),ka=Math.min((fe.getTime()-ke.getTime())/(1e3*60*60*24),Ia)/Ia*100;Ce=ka>0?H/ka:1;}let Se;H>=100?Se="#00E5CC":pe?Se="#4B5563":ge&&H<100?Se="#EF4444":Ce>=.95?Se="#22C55E":Ce>=.8?Se="#F59E0B":Se="#EF4444";let st=Math.max(H/100*q,H>0?I*2:0),et=q>100&&H>0;return jsxs("g",{"data-task-class":He,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:ee,y:te,width:q,height:8,rx:I,fill:"rgba(255,255,255,0.10)"}),H>0&&jsx("rect",{"data-parte":"avance",x:ee,y:te,width:st,height:8,rx:I,fill:Se}),et&&jsxs("text",{x:ee+st+6,y:te+8/2,dominantBaseline:"central",fill:r.textSecondary,fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(H),"%"]})]})})(),k&&!e.segments&&!O&&(()=>{let $=`v6-barra-${String(e.id).replace(/[^A-Za-z0-9_-]/g,"")}`,te=!!Xe&&!ba,I=Math.max(0,Math.min(100,ie));if(L){let H=Math.round(a+Z/2),fe=Math.round(ee),me=Math.round(ee+q);return jsxs("g",{"data-transversal":"",children:[jsx("rect",{x:ee,y:a,width:q,height:Z,fill:"transparent","data-parte":"pista","data-bar-background":"true",onMouseDown:ge=>ia(ge),style:{cursor:Te,pointerEvents:"all"}}),jsx("line",{x1:fe,y1:H,x2:me,y2:H,stroke:"var(--v6-acento-borde, rgba(8,127,114,0.85))",strokeWidth:2,style:{pointerEvents:"none",opacity:Ye&&!_?.25:1}}),I>0&&jsx("line",{x1:fe,y1:H,x2:fe+(me-fe)*(I/100),y2:H,stroke:"var(--v6-acento, #0FA392)",strokeWidth:2,"data-parte":"avance",style:{pointerEvents:"none"}}),jsx("line",{x1:fe+1,y1:H-5,x2:fe+1,y2:H+5,stroke:"var(--v6-acento-borde, rgba(8,127,114,0.85))",strokeWidth:2,style:{pointerEvents:"none"}}),jsx("line",{x1:me-1,y1:H-5,x2:me-1,y2:H+5,stroke:"var(--v6-acento-borde, rgba(8,127,114,0.85))",strokeWidth:2,style:{pointerEvents:"none"}}),z&&!Ye&&jsx("text",{x:ee+q+6,y:a+Z/2,dominantBaseline:"middle",fill:"var(--v6-tenue, #5F6972)",fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace",style:{fontVariantNumeric:"tabular-nums",pointerEvents:"none",userSelect:"none"},children:z})]})}return jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:$,children:jsx("rect",{x:ee,y:a,width:q,height:Z,rx:6})})}),jsx("rect",{x:Math.round(ee)+.5,y:Math.round(a)+.5,width:Math.max(0,Math.round(ee+q)-Math.round(ee)-1),height:Math.round(Z)-1,rx:6,shapeRendering:"geometricPrecision","data-parte":"pista","data-bar-background":"true","data-task-class":He,fill:I>0?"var(--v6-acento-fondo-3, rgba(15,163,146,0.16))":"var(--v6-acento-fondo, rgba(15,163,146,0.1))",stroke:"var(--v6-acento-borde, rgba(8,127,114,0.85))","data-v6-vencida":te?"":void 0,strokeWidth:1,onMouseDown:H=>ia(H),style:{cursor:Te,pointerEvents:"all",opacity:Ye&&!_?.25:1}}),I>0&&jsx("rect",{x:ee,y:a,width:q*(I/100),height:Z,clipPath:`url(#${$})`,"data-parte":"avance",fill:"var(--v6-acento, #0FA392)",style:{pointerEvents:"none"}}),Tt&&jsx("rect",{x:ee,y:a,width:q,height:Z,rx:6,fill:"none",stroke:"var(--v6-ambar-punto, #D9870B)",strokeWidth:1.5,"data-parte":"alerta",style:{pointerEvents:"none"}}),z&&!Ye&&jsx("text",{x:ee+q+6,y:a+Z/2,dominantBaseline:"middle",fill:"var(--v6-tenue, #5F6972)",fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace",style:{fontVariantNumeric:"tabular-nums",pointerEvents:"none",userSelect:"none"},children:z})]})})(),!k&&!e.segments&&ze&&!O&&jsx(motion.rect,{x:ee,y:a,width:q,height:Z,rx:Ve,fill:r.executionBarBg||"rgba(255,255,255,0.06)",stroke:r.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":He,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ye&&!_?.15:e.parentId?.6:1,scale:wt&&!Ye?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$=>ia($),style:{cursor:Te,pointerEvents:"all"}}),!k&&!e.segments&&!ze&&jsx(motion.rect,{x:ee,y:a,width:q,height:Z,rx:Ve,fill:we,"data-task-class":He,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ye&&!_?.15:e.parentId?.6:wt?.9:.8,scale:wt&&!Ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:O?void 0:$=>ia($),style:{cursor:O?"default":Te,pointerEvents:"all"}}),!k&&ze&&(Xe||Tt)&&!e.segments&&jsx("rect",{x:ee,y:a,width:q,height:Z,rx:Ve,fill:"none",stroke:r.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${r.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),Xe&&!ba&&!e.segments&&!O&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${ee+q+4}, ${a+Z/2-6})`,children:[jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!k&&!e.segments&&ie>0&&!O&&jsx("rect",{x:ee,y:a,width:Math.max(q*(ie/100),Ve*2),height:Z,rx:Ve,fill:we,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!k&&!e.segments&&!O&&e.progress<100&&(()=>{let $=e.progress>0?q*(e.progress/100):0,te=ee+$,I=q-$,H=e.progress===0?Ve:0,fe=e.progress===0?ee:te,me=e.progress===0?q:I;return jsxs(Fragment,{children:[jsx("rect",{x:fe,y:a,width:me,height:Z,rx:H,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:fe,y:a,width:me,height:Z,rx:H,fill:"none",stroke:we,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),!k&&ze&&!e.segments&&e.progress>0&&e.progress<100&&!O&&!Ye&&Be===null&&(()=>{let $=ee+q*(e.progress/100),te=8,I=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:$,cy:a+Z/2,r:te,fill:I?.color||r.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:$,y:a+Z/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:I?.initials||(I?.name?ma(I.name):"")})]})})(),Ft&&!Ye&&q>=40&&(Be!==null||ie<88)&&(()=>{let $=ee+q*(ie/100),te=a+Z/2,I=Be!==null,H=I?7:wt?6:5,fe=I||wt?1:k?0:.35,me=ee+q-$,ge=Math.max(4,Math.min(12,me-10)),pe=12;return jsxs("g",{children:[jsx("rect",{x:$-pe,y:te-12,width:pe+ge,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Q,onPointerMove:Ie,onPointerUp:pt,onPointerCancel:pt,onClick:P,onDoubleClick:P,onMouseDown:Ce=>Ce.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:$,cy:te,r:H,fill:"#FFFFFF",stroke:we,strokeWidth:2,opacity:fe,style:{pointerEvents:"none",filter:I?`drop-shadow(0 0 4px ${we})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),I&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:$-20,y:te-28,width:40,height:18,rx:4,fill:Me?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:we,strokeWidth:1}),jsxs("text",{x:$,y:te-16,textAnchor:"middle",dominantBaseline:"central",fill:Me?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[Be,"%"]})]})]})})(),e.segments&&e.segments.map(($,te)=>{let I=($.startDate.getTime()-o.getTime())/864e5*s,fe=($.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-I+s,me=Ye&&J==="move"&&Rt===te,ge=Ne===te,pe=me?I+Pt:I;return jsxs("g",{onMouseEnter:()=>!Ye&&Ot(te),onMouseLeave:()=>!Ye&&Ot(null),children:[jsx(motion.rect,{x:pe,y:a,width:fe,height:Z,rx:Ve,fill:we,initial:{opacity:0,scale:.95},animate:{opacity:me||e.parentId?.6:ge?.9:.8,scale:ge&&!Ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ce=>{Ce.stopPropagation(),lt(te),Mt(I),ia(Ce,void 0,I);},style:{cursor:Te,pointerEvents:"all"}}),jsx("rect",{x:pe,y:a,width:fe*(e.progress/100),height:Z,rx:Ve,fill:we,opacity:1,style:{pointerEvents:"none"}})]},`segment-${te}`)}),it&&(Xe||Tt)&&!e.segments&&jsxs(Fragment,{children:[Tt&&!Xe&&jsx("rect",{x:ee,y:a,width:q,height:Z,rx:Ve,fill:"none",stroke:r.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Xe&&jsx("rect",{x:ee,y:a,width:q,height:Z,rx:Ve,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),!k&&w&&q>60&&!e.segments&&!(ze&&O)&&(()=>{let $=i.taskLabel(e),te=typeof $=="string"?$:e.name,I=te.length>Math.floor(q/8)?`${te.substring(0,Math.floor(q/8))}...`:te;return jsx("text",{"data-parte":"etiqueta",x:ee+8,y:a+Z/2,dominantBaseline:"middle",fill:ba?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ba?"line-through":"none"},children:I})})(),!k&&!Ye&&!e.segments&&!O&&e.progress>0&&e.progress<100&&(ze?jsxs("text",{x:ee+q+6,y:a+Z/2,dominantBaseline:"middle",fill:r.textSecondary,fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):q>100?jsxs("text",{x:ee+q-12,y:a+Z/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),!k&&e.status&&q>80&&!Ye&&!e.segments&&!(ze&&O)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:ee+q-8,cy:a+8,r:4,fill:r.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:ee+q-8,cy:a+8,r:4,fill:r.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(wt||qe)&&!_&&!e.segments&&!O&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:ee-2,y:a,width:16,height:Z,fill:"transparent",style:{cursor:dt},onMouseEnter:()=>ut("resize-start"),onMouseLeave:()=>ut(null),onMouseDown:$=>{$.stopPropagation(),ia($,"resize-start");}}),jsx(motion.rect,{x:ee+4,y:a+8,width:3,height:Z-16,rx:1.5,fill:ft==="resize-start"||J==="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:ee+q-14,y:a,width:16,height:Z,fill:"transparent",style:{cursor:dt},onMouseEnter:()=>ut("resize-end"),onMouseLeave:()=>ut(null),onMouseDown:$=>{$.stopPropagation(),ia($,"resize-end");}}),jsx(motion.rect,{x:ee+q-7,y:a+8,width:3,height:Z-16,rx:1.5,fill:ft==="resize-end"||J==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:wt&&!Ye&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t-10,cy:a+Z/2,r:10,fill:"transparent",style:{cursor:"crosshair"},"data-conectar-desde":"inicio",onMouseEnter:()=>ut("connect-start"),onMouseLeave:()=>ut(null),onMouseDown:$=>{$.stopPropagation(),V.current=true,ia($,"connect");}}),jsx(motion.circle,{cx:t-10,cy:a+Z/2,r:4,fill:r.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ft==="connect-start"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsx("circle",{cx:t+n+10,cy:a+Z/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ut("connect"),onMouseLeave:()=>ut(null),"data-conectar-desde":"fin",onMouseDown:$=>{$.stopPropagation(),V.current=false,ia($,"connect");}}),jsx(motion.circle,{cx:t+n+10,cy:a+Z/2,r:4,fill:r.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ft==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),_&&oe&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:V.current?t:t+n,y1:a+Z/2,x2:oe.x,y2:oe.y,stroke:Je?r.statusCompleted:r.accent,strokeWidth:Je?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Je?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:oe.x,cy:oe.y,r:Je?8:6,fill:Je?r.statusCompleted:r.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Je&&jsx(motion.text,{x:oe.x+15,y:oe.y,dominantBaseline:"middle",fill:r.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:oe.x+10},animate:{opacity:1,x:oe.x+15},transition:{duration:.2},children:(()=>{let $=U;return {FS:$?"Fin \u2192 Comienzo":"Finish \u2192 Start",SS:$?"Comienzo \u2192 Comienzo":"Start \u2192 Start",FF:$?"Fin \u2192 Fin":"Finish \u2192 Finish",SF:$?"Comienzo \u2192 Fin":"Start \u2192 Finish"}[Va(Je)]})()})]}),(wt||Ye)&&!_&&!e.segments&&jsx(motion.rect,{x:ee-1,y:a-1,width:q+2,height:Z+2,rx:Ve+1,fill:"none",stroke:Ye?r.accent:ze?"rgba(255,255,255,0.2)":r.taskBarPrimary,strokeWidth:ze?1:2,opacity:Ye||ze?.6:.4,initial:{opacity:0},animate:{opacity:Ye||ze?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),qe&&jsxs(Fragment,{children:[jsx("line",{x1:nt,y1:0,x2:nt,y2:1e3,stroke:r.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:nt+B,y1:0,x2:nt+B,y2:1e3,stroke:r.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:wt&&!Ye&&!e.segments&&!v&&(()=>{let I=a<100,H=I?a+Z+13:a-82-13,fe=I?`M ${ee+q/2-6} ${a+Z+3} L ${ee+q/2} ${a+Z+13} L ${ee+q/2+6} ${a+Z+3}`:`M ${ee+q/2-6} ${a-13} L ${ee+q/2} ${a-3} L ${ee+q/2+6} ${a-13}`,me=H+22,ge=H+40,pe=H+55,Ce=H+70,Se=I?H+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:I?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:I?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:fe,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:ee+q/2-120,y:H,width:240,height:82,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:ee+q/2,y:me,textAnchor:"middle",fill:r.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:ee+q/2-110,y:ge,fill:r.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:N?"Inicio:":"Start:"}),jsx("text",{x:ee+q/2-70,y:ge,fill:r.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ha(e.startDate)}),jsx("text",{x:ee+q/2-110,y:pe,fill:r.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:N?"Fin:":"End:"}),jsx("text",{x:ee+q/2-70,y:pe,fill:r.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ha(e.endDate)}),jsx("text",{x:ee+q/2+10,y:ge,fill:r.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:N?"Duraci\xF3n:":"Duration:"}),jsx("text",{x:ee+q/2+65,y:ge,fill:r.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ha()}),jsx("text",{x:ee+q/2+10,y:pe,fill:r.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:N?"Avance:":"Progress:"}),jsxs("text",{x:ee+q/2+65,y:pe,fill:r.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:ee+q/2-110,y:Ce,fill:r.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:N?"Responsables:":"Assignees:"}),jsxs("text",{x:ee+q/2-50,y:Ce,fill:r.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(st=>st.name).join(", ").substring(0,30),e.assignees.map(st=>st.name).join(", ").length>30?"...":""]})]}),!I&&jsx("text",{x:ee+q/2,y:Se,textAnchor:"middle",fill:r.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:la?N?"Izquierda: mover \u2022 Derecha: cambiar tama\xF1o":"Left: move \u2022 Right: resize":Dt?N?"Arrastra para mover \u2022 ALT + arrastrar el borde para cambiar tama\xF1o":"Drag to move \u2022 Hold ALT + drag edge to resize":N?"Arrastra los bordes para cambiar tama\xF1o \u2022 el centro para mover \u2022 \u26AB para enlazar":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function dc(e,t=new Date){return !e.endDate||e.status==="completed"||(e.progress??0)>=100?false:new Date(e.endDate.getFullYear(),e.endDate.getMonth(),e.endDate.getDate()).getTime()<new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}function Gf(e,t=new Date){let a=0,n=r=>{for(let s of r??[])s.subtasks?.length?n(s.subtasks):dc(s,t)&&a++;};return n(e.subtasks),a}var Lu=260,ni=8,_f=16,Pk=-12;function Kf({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:n}){let[r,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:y,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,z=x.lastActivity!=null,L=(M?155:105)+(z?28:0),N=y+_f,D=k+Pk-L;N+Lu>window.innerWidth-ni&&(N=y-Lu-_f),N<ni&&(N=ni);let S=D<ni;S&&(D=k+20),D+L>window.innerHeight-ni&&(D=window.innerHeight-ni-L),s({left:N,top:D,showBelow:S});},[e]),!e||!r)return null;let{task:o}=e,i=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},l=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!n?.enabledWeekdays){let D=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`}let x=n.enabledWeekdays,y=n.holidayDates instanceof Set?n.holidayDates:new Set(n.holidayDates??[]),k=D=>`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}-${String(D.getDate()).padStart(2,"0")}`,M=0,z=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),L=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;z.getTime()<=L.getTime();){let D=z.getDay();x[D]&&!y.has(k(z))&&M++,z.setDate(z.getDate()+1);}let N=Math.max(0,M);return a==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let y=Math.floor(x/60),k=x%60;return y===0?`${k}m`:k===0?`${y}h`:`${y}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",b=t.bgSecondary||"#1F2937",w=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Lu,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${w}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(uc,{label:c.start,value:o.startDate?l(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(uc,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsx(uc,{label:c.end,value:o.endDate?l(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(uc,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.id))})]}),i&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:p(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
|
-
from { opacity: 0; transform: translateY(${
|
|
127
|
+
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(y,document.body)}function xl({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function ui({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:p,strokeWidthOverride:u,glowFilter:d}){let[,m]=useState(false),[f,v]=useState(null),b=r-t,h=b>0,y=Math.abs(b)<5,x=20,w=!y&&a<=e,C,P,O=a-e,T=e+O/2;P=T;let D=8;if(o==="squared")if(y)C=`M ${e} ${t} L ${a} ${r}`;else if(w){let $e=e+15,Pe=a-x,je=h?t+20:t-20;P=Pe;let tt=h?1:-1;C=`M ${e} ${t} L ${$e-D} ${t} Q ${$e} ${t} ${$e} ${t+tt*D} L ${$e} ${je-tt*D} Q ${$e} ${je} ${$e-D} ${je} L ${Pe+D} ${je} Q ${Pe} ${je} ${Pe} ${je+tt*D} L ${Pe} ${r-tt*D} Q ${Pe} ${r} ${Pe+D} ${r} L ${a} ${r}`;}else {P=a-x;let He=h?1:-1;C=`M ${e} ${t} L ${P-D} ${t} Q ${P} ${t} ${P} ${t+He*D} L ${P} ${r-He*D} Q ${P} ${r} ${P+D} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let M=6,N=5,z=`M ${a} ${r} L ${a-M} ${r-N/2} L ${a-M} ${r+N/2} Z`,$=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),Y=p||($?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),A=u||1,Se=n.dependencyHover||($?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),W="#f87171",Ce="rgba(248, 113, 113, 0.15)",R=P,we=(t+r)/2;if(f)if(o==="squared")if(y)R=Math.max(e+10,Math.min(a-10,f.x)),we=t;else if(w){let He=e+15,$e=a-x,Pe=h?t+20:t-20,je=[[e,t,He,t],[He,t,He,Pe],[He,Pe,$e,Pe],[$e,Pe,$e,r],[$e,r,a,r]],tt=1/0,ee={x:R,y:we};for(let Ae of je){let ot=G(f.x,f.y,Ae[0],Ae[1],Ae[2],Ae[3]),Ie=Math.hypot(f.x-ot.x,f.y-ot.y);Ie<tt&&(tt=Ie,ee=ot);}R=ee.x,we=ee.y;}else {let He=[[e,t,P,t],[P,t,P,r],[P,r,a,r]],$e=1/0,Pe={x:R,y:we};for(let je of He){let tt=G(f.x,f.y,je[0],je[1],je[2],je[3]),ee=Math.hypot(f.x-tt.x,f.y-tt.y);ee<$e&&($e=ee,Pe=tt);}R=Pe.x,we=Pe.y;}else {let He=T,$e=t,Pe=T,je=r,tt=1/0,ee=R,Ae=we;for(let ot=0;ot<=1;ot+=.02){let Ie=1-ot,zt=Ie*Ie*Ie*e+3*Ie*Ie*ot*He+3*Ie*ot*ot*Pe+ot*ot*ot*a,st=Ie*Ie*Ie*t+3*Ie*Ie*ot*$e+3*Ie*ot*ot*je+ot*ot*ot*r,bt=Math.hypot(f.x-zt,f.y-st);bt<tt&&(tt=bt,ee=zt,Ae=st);}R=ee,we=Ae;}function G(He,$e,Pe,je,tt,ee){let Ae=tt-Pe,ot=ee-je,Ie=Ae*Ae+ot*ot;if(Ie===0)return {x:Pe,y:je};let zt=((He-Pe)*Ae+($e-je)*ot)/Ie;return zt=Math.max(0,Math.min(1,zt)),{x:Pe+zt*Ae,y:je+zt*ot}}let Ve=He=>{let $e=He.currentTarget.ownerSVGElement;if(!$e)return;let Pe=$e.getScreenCTM();if(!Pe)return;let je=Pe.inverse();v({x:je.a*He.clientX+je.c*He.clientY+je.e,y:je.b*He.clientX+je.d*He.clientY+je.f});},oe=()=>{m(false),v(null),c?.(false);},Be=()=>{m(true),c?.(true);},le=He=>s?jsxs(motion.g,{initial:He,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:$e=>{$e.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:we,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:we,r:9,fill:Ce,stroke:W,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:we-3,x2:R+3,y2:we+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:we-3,x2:R-3,y2:we+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxs("g",{"data-dependency-line":"true",onMouseLeave:oe,onMouseMove:Ve,children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:z,fill:Se,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Se,opacity:.9,style:{pointerEvents:"none"}}),le({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Be,onMouseLeave:oe,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:z,fill:Se,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Se,style:{pointerEvents:"none"}}),le({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:Be,onMouseLeave:oe,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:C,fill:"none",stroke:Y,strokeWidth:A,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:d||"none"}}),jsx(motion.path,{d:z,fill:Y,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:Y,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Cl({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{"data-parte":"rombo",x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Me={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==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 n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=l=>{l.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&n(p.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,i=new Set,c=l=>{if(!o.has(l)){o.add(l),i.add(l);let p=r.get(l)||[];for(let u of p){if(!o.has(u)&&c(u))return true;if(i.has(u))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Me.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Me.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),
|
|
130
|
+
`})]});return createPortal(h,document.body)}function uc({label:e,value:t,labelColor:a,valueColor:n}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:n,fontWeight:500},children:t})]})}function el({x1:e,y1:t,x2:a,y2:n,theme:r,onDelete:s,lineStyle:o="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:u,strokeWidthOverride:p,glowFilter:d,salidaPorInicio:m=false,entradaPorFin:f=false,etiqueta:v,discontinua:b=false,titulo:w,atenuada:h=false,corregir:x}){let[,y]=useState(false),[k,M]=useState(null),z=n-t,L=z>0,N=Math.abs(z)<5,D=20,S=!N&&a<=e,V,U,W=a-e,E=e+W/2;U=E;let Pe=8,J=E,de=t,R=E,Ae=n,nt=null,Ge=m||f,B=m?-1:1,ce=f?-1:1;if(Ge)if(o==="squared"){let qe=e+B*15,_=a-ce*D,he=N?t-16:(t+n)/2;nt=[[e,t,qe,t],[qe,t,qe,he],[qe,he,_,he],[_,he,_,n],[_,n,a,n]],V=`M ${e} ${t} L ${qe} ${t} L ${qe} ${he} L ${_} ${he} L ${_} ${n} L ${a} ${n}`,U=_;}else {let qe=Math.max(40,Math.abs(W)/2);J=e+B*qe,R=a-ce*qe,V=`M ${e} ${t} C ${J} ${de}, ${R} ${Ae}, ${a} ${n}`;}else if(o==="squared")if(N)V=`M ${e} ${t} L ${a} ${n}`;else if(S){let _=e+15,he=a-D,Z=L?n-20:n+20;U=he;let ze=L?1:-1;V=`M ${e} ${t} L ${_-Pe} ${t} Q ${_} ${t} ${_} ${t+ze*Pe} L ${_} ${Z-ze*Pe} Q ${_} ${Z} ${_-Pe} ${Z} L ${he+Pe} ${Z} Q ${he} ${Z} ${he} ${Z+ze*Pe} L ${he} ${n-ze*Pe} Q ${he} ${n} ${he+Pe} ${n} L ${a} ${n}`;}else {U=a-D;let qe=L?1:-1;V=`M ${e} ${t} L ${U-Pe} ${t} Q ${U} ${t} ${U} ${t+qe*Pe} L ${U} ${n-qe*Pe} Q ${U} ${n} ${U+Pe} ${n} L ${a} ${n}`;}else V=`M ${e} ${t} C ${E} ${t}, ${E} ${n}, ${a} ${n}`;let oe=6,gt=5,Je=`M ${a} ${n} L ${a-ce*oe} ${n-gt/2} L ${a-ce*oe} ${n+gt/2} Z`,ct=!r.bgPrimary||r.bgPrimary.startsWith("#0")||r.bgPrimary.startsWith("#1"),ft=u||(ct?"rgba(255,255,255,0.55)":"rgba(15,23,42,0.45)"),ut=p||1.5,Rt=r.dependencyHover||(ct?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),lt="#f87171",vt="rgba(248, 113, 113, 0.15)",Mt=U,Pt=(t+n)/2;if(k)if(nt){let qe=1/0;for(let _ of nt){let he=zt(k.x,k.y,_[0],_[1],_[2],_[3]),Z=Math.hypot(k.x-he.x,k.y-he.y);Z<qe&&(qe=Z,Mt=he.x,Pt=he.y);}}else if(o==="squared")if(N)Mt=Math.max(e+10,Math.min(a-10,k.x)),Pt=t;else if(S){let qe=e+15,_=a-D,he=L?t+20:t-20,Z=[[e,t,qe,t],[qe,t,qe,he],[qe,he,_,he],[_,he,_,n],[_,n,a,n]],ze=1/0,Me={x:Mt,y:Pt};for(let Ve of Z){let O=zt(k.x,k.y,Ve[0],Ve[1],Ve[2],Ve[3]),xe=Math.hypot(k.x-O.x,k.y-O.y);xe<ze&&(ze=xe,Me=O);}Mt=Me.x,Pt=Me.y;}else {let qe=[[e,t,U,t],[U,t,U,n],[U,n,a,n]],_=1/0,he={x:Mt,y:Pt};for(let Z of qe){let ze=zt(k.x,k.y,Z[0],Z[1],Z[2],Z[3]),Me=Math.hypot(k.x-ze.x,k.y-ze.y);Me<_&&(_=Me,he=ze);}Mt=he.x,Pt=he.y;}else {let qe=1/0,_=Mt,he=Pt;for(let Z=0;Z<=1;Z+=.02){let ze=1-Z,Me=ze*ze*ze*e+3*ze*ze*Z*J+3*ze*Z*Z*R+Z*Z*Z*a,Ve=ze*ze*ze*t+3*ze*ze*Z*de+3*ze*Z*Z*Ae+Z*Z*Z*n,O=Math.hypot(k.x-Me,k.y-Ve);O<qe&&(qe=O,_=Me,he=Ve);}Mt=_,Pt=he;}function zt(qe,_,he,Z,ze,Me){let Ve=ze-he,O=Me-Z,xe=Ve*Ve+O*O;if(xe===0)return {x:he,y:Z};let Be=((qe-he)*Ve+(_-Z)*O)/xe;return Be=Math.max(0,Math.min(1,Be)),{x:he+Be*Ve,y:Z+Be*O}}let Ne=qe=>{let _=qe.currentTarget.ownerSVGElement;if(!_)return;let he=_.getScreenCTM();if(!he)return;let Z=he.inverse();M({x:Z.a*qe.clientX+Z.c*qe.clientY+Z.e,y:Z.b*qe.clientX+Z.d*qe.clientY+Z.f});},Ot=()=>{y(false),M(null),c?.(false);},wt=()=>{y(true),c?.(true);},Ut=qe=>s?jsxs(motion.g,{initial:qe,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:_=>{_.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:Mt,cy:Pt,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:Mt,cy:Pt,r:9,fill:vt,stroke:lt,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:Mt-3,y1:Pt-3,x2:Mt+3,y2:Pt+3,stroke:lt,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:Mt+3,y1:Pt-3,x2:Mt-3,y2:Pt+3,stroke:lt,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null,Ye=()=>{if(!x)return null;let qe=Math.round(x.texto.length*6.4+20),_=f?a+6:a-qe-6,he=n-32;return jsxs(Fragment,{children:[jsx("rect",{x:Math.min(_,a),y:he,width:qe+6,height:n+8-he,fill:"transparent",style:{pointerEvents:"all"}}),jsxs("g",{"data-corregir-conflicto":"",role:"button",onClick:Z=>{Z.stopPropagation(),x.onClick();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("title",{children:x.titulo}),jsx("rect",{x:_,y:he,width:qe,height:22,rx:11,strokeWidth:1,style:{fill:"var(--v6-ambar-fondo, #FDF3E1)",stroke:"var(--v6-ambar, #F59E0B)"}}),jsx("text",{x:_+qe/2,y:he+11.5,textAnchor:"middle",dominantBaseline:"middle",style:{fill:"var(--v6-texto, #1F2933)",fontSize:11,fontWeight:600,fontFamily:"inherit",userSelect:"none"},children:x.texto})]})]})};return i?jsxs("g",{"data-dependency-line":"true",onMouseLeave:Ot,onMouseMove:Ne,children:[jsx("path",{d:V,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:V,fill:"none",stroke:Rt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:V,fill:"none",stroke:Rt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:Je,fill:Rt,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:n,r:4,fill:Rt,opacity:.9,style:{pointerEvents:"none"}}),Ut({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:wt,onMouseLeave:Ot,onMouseMove:Ne,style:{cursor:s?"pointer":"default"},children:[w&&jsx("title",{children:w}),jsx("path",{d:V,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:V,fill:"none",stroke:r.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:V,fill:"none",stroke:Rt,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:V,fill:"none",stroke:Rt,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:Je,fill:Rt,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:n,r:3.5,fill:Rt,style:{pointerEvents:"none"}}),Ut({opacity:0,scale:0}),Ye()]}):jsxs("g",{"data-dependency-line":"true","data-atenuada":h?"":void 0,onMouseEnter:wt,onMouseLeave:Ot,onMouseMove:Ne,style:{cursor:s?"pointer":"default",opacity:h?.25:1,transition:"opacity .15s ease-out"},children:[jsx("path",{d:V,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),w&&jsx("title",{children:w}),b?jsx("path",{d:V,fill:"none",stroke:ft,strokeWidth:ut,strokeLinecap:"round",strokeDasharray:"4 3","data-enlace-en-conflicto":true,style:{pointerEvents:"none",filter:d||"none"}}):jsx(motion.path,{d:V,fill:"none",stroke:ft,strokeWidth:ut,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:d||"none"}}),jsx(motion.path,{d:Je,fill:ft,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),v&&jsx("text",{x:a-ce*10,y:n-7,textAnchor:ce>0?"end":"start",fontSize:9,fontWeight:600,fill:ft,style:{pointerEvents:"none",fontFamily:"JetBrains Mono, monospace"},"data-etiqueta-de-enlace":true,children:v}),jsx(motion.circle,{cx:a,cy:n,r:3,fill:ft,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function gc({task:e,x:t,y:a,theme:n,locale:r="en",onClick:s}){let[o,i]=useState(false),c=16,l=u=>u.toLocaleDateString(r,{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>s?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:n.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{"data-parte":"rombo",x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?n.criticalPath:n.milestone,stroke:n.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsx(motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?n.criticalPath:n.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:o&&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:n.bgSecondary,stroke:n.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:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?n.criticalPath:n.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:n.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:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.endDate??e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:n.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:n.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Re={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,n=new Date(e);for(;n<=t;){let r=n.getDay();r!==0&&r!==6&&a++,n.setDate(n.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),n=0;for(;n<t;){a.setDate(a.getDate()+1);let r=a.getDay();r!==0&&r!==6&&n++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let n=new Map,r=l=>{l.forEach(u=>{u.dependencies&&n.set(u.id,u.dependencies),u.subtasks&&r(u.subtasks);});};r(e);let s=n.get(a)||[];n.set(a,[...s,t]);let o=new Set,i=new Set,c=l=>{if(!o.has(l)){o.add(l),i.add(l);let u=n.get(l)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(i.has(p))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=n=>{[...n].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let n=Re.findTaskById(a.subtasks,t);if(n)return n}}},getParentTasks:(e,t)=>{let a=[],n=Re.findTaskById(e,t);if(!n||!n.parentId)return a;let r=n.parentId;for(;r;){let s=Re.findTaskById(e,r);if(s)a.unshift(s),r=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,n)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${n}: 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=Re.flattenTasks(e),n=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(r=>{let s=[r.id,`"${r.name.replace(/"/g,'""')}"`,r.startDate?r.startDate.toISOString().split("T")[0]:"",r.endDate?r.endDate.toISOString().split("T")[0]:"",r.progress.toString(),r.status||"",r.dependencies?.join(";")||""];n.push(s.join(","));}),n.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${n}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Re.flattenTasks(e).filter(n=>n.startDate);return a.length===0?null:new Date(Math.min(...a.map(n=>n.startDate.getTime())))},getLatestEndDate:e=>{let a=Re.flattenTasks(e).filter(n=>n.endDate);return a.length===0?null:new Date(Math.max(...a.map(n=>n.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)=>Re.flattenTasks(e).filter(n=>n.dependencies&&n.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Re.findTaskById(e,t);return !a||!a.dependencies?[]:Re.flattenTasks(e).filter(r=>a.dependencies.includes(r.id))},filterByStatus:(e,t)=>Re.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Re.flattenTasks(e).filter(n=>!n.startDate||!n.endDate?false:n.startDate<=a&&n.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,n)=>{if(!a.startDate||!n.startDate)return 0;let r=a.startDate.getTime()-n.startDate.getTime();return t?r:-r}),sortByEndDate:(e,t=true)=>[...e].sort((a,n)=>{if(!a.endDate||!n.endDate)return 0;let r=a.endDate.getTime()-n.endDate.getTime();return t?r:-r}),sortByProgress:(e,t=true)=>[...e].sort((a,n)=>{let r=a.progress-n.progress;return t?r:-r}),calculateTotalProgress:e=>{let t=Re.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((n,r)=>n+r.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,n;for(let r=0;r<t.length;r++){let s=t[r];if(!a||s===void 0||s>=a.length||(n=a[s],!n))return;r<t.length-1&&(a=n.subtasks||[]);}return n},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Re.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:n}=await import('jspdf-autotable'),r=new a,s=Re.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}r.setFontSize(16),r.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Re.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Jn(c.startDate,"en"):"N/A",c.endDate?Jn(c.endDate,"en"):"N/A",l>0?`${Ho(l,"en")} days`:"N/A",Xn(c.progress??0,"en"),c.status||"N/A"]});n(r,{head:o,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),r.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let n=await import('xlsx'),r=Re.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,i=b=>{if(!s||!b.assignees||b.assignees.length===0)return o;let w=b.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return w.length===0?o:w.reduce((h,x)=>h+x,0)/w.length},c=new Map,l=(b,w="")=>{[...b].sort((x,y)=>(x.position??0)-(y.position??0)).forEach((x,y)=>{let k=w?`${w}.${y+1}`:`${y+1}`;c.set(x.id,k),x.subtasks?.length&&l(x.subtasks,k);});};l(e);let u=s&&Object.keys(s).length>0||r.some(b=>b._costRate>0),p=r.map(b=>{let w=b.startDate&&b.endDate?Re.calculateDuration(b.startDate,b.endDate):0,h=b.effortMinutes,x=b.timeLoggedMinutes,y=b.soldEffortMinutes,k=typeof h=="number"?+(h/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,z=typeof y=="number"?+(y/60).toFixed(1):0,L=b._costRate>0?b._costRate:i(b),N={WBS:c.get(b.id)||"","Task Name":b.name,"Start Date":b.startDate?Re.formatDate(b.startDate):"","End Date":b.endDate?Re.formatDate(b.endDate):"","Duration (days)":w>0?w:"","Progress (%)":b.progress,Status:b.status||"",Assignees:b.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":z||""};u&&(N["$ Estimated"]=k>0&&L>0?Math.round(k*L):"",N["$ Executed"]=M>0&&L>0?Math.round(M*L):"",N["$ Quoted"]=z>0&&L>0?Math.round(z*L):"",N["Rate ($/h)"]=L>0?L:"");let D=b.weight;return N["Weight (%)"]=typeof D=="number"&&D>0?D:"",N["Is Milestone"]=b.isMilestone?"Yes":"No",N}),d=a?.projectName||"";if(d||p.length>0){let b=0,w=0,h=0,x=0,y=0,k=0,M=0,z=0,L=r.filter(S=>S.startDate).map(S=>S.startDate.getTime()),N=r.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of p)typeof S["Estimated (h)"]=="number"&&(b+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(w+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(h+=S["Quoted (h)"]),u&&(typeof S["$ Estimated"]=="number"&&(x+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(y+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(k+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(M+=S["Progress (%)"],z++);let D={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":L.length>0?Re.formatDate(new Date(Math.min(...L))):"","End Date":N.length>0?Re.formatDate(new Date(Math.max(...N))):"","Duration (days)":L.length>0&&N.length>0?Re.calculateDuration(new Date(Math.min(...L)),new Date(Math.max(...N))):"","Progress (%)":z>0?Math.round(M/z):0,Status:"",Assignees:"","Estimated (h)":+b.toFixed(1)||"","Logged (h)":+w.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};u&&(D["$ Estimated"]=x||"",D["$ Executed"]=y||"",D["$ Quoted"]=k||"",D["Rate ($/h)"]=""),D["Is Milestone"]="No",p.unshift(D);}let m=n.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let v=n.utils.book_new();if(n.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let b=new Date,w=x=>String(x).padStart(2,"0");t=`Project_${`${b.getFullYear()}-${w(b.getMonth()+1)}-${w(b.getDate())}_${w(b.getHours())}${w(b.getMinutes())}`}.xlsx`;}n.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let n=Re.flattenTasks(e),r=new Map;n.forEach((d,m)=>{r.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=Re.getEarliestStartDate(e)||new Date,i=Re.getLatestEndDate(e)||new Date,c=n.map((d,m)=>{let f=r.get(d.id),v=d.startDate&&d.endDate?Re.calculateDuration(d.startDate,d.endDate):0,b=(d.dependencies||[]).filter(w=>r.has(w)).map(w=>{let h=d.dependencyLinks?.find(x=>x.id===w);return `
|
|
132
132
|
<PredecessorLink>
|
|
133
|
-
<PredecessorUID>${
|
|
134
|
-
<Type
|
|
133
|
+
<PredecessorUID>${r.get(w)}</PredecessorUID>
|
|
134
|
+
<Type>${{FF:0,FS:1,SF:2,SS:3}[h?.type??"FS"]}</Type>
|
|
135
135
|
<CrossProject>0</CrossProject>
|
|
136
|
-
<LinkLag
|
|
136
|
+
<LinkLag>${Math.round((h?.lag??0)*4800)}</LinkLag>
|
|
137
137
|
<LagFormat>7</LagFormat>
|
|
138
|
-
</PredecessorLink>`).join("");return `
|
|
138
|
+
</PredecessorLink>`}).join("");return `
|
|
139
139
|
<Task>
|
|
140
140
|
<UID>${f}</UID>
|
|
141
141
|
<ID>${m+1}</ID>
|
|
142
|
-
<Name>${d.name.replace(/[<>&'"]/g,
|
|
142
|
+
<Name>${d.name.replace(/[<>&'"]/g,w=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[w]||w)}</Name>
|
|
143
143
|
<Type>0</Type>
|
|
144
144
|
<IsNull>0</IsNull>
|
|
145
145
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,p=new Blob([l],{type:"application/xml;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(p),u.download=a,u.click(),URL.revokeObjectURL(u.href);},calculateCriticalPath:e=>{let t=Me.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,n=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Me.calculateDuration(l.startDate,l.endDate):0,u=0;if(l.dependencies&&l.dependencies.length>0)for(let m of l.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;u=Math.max(u,v);}}let d=u+p;r.set(l.id,{es:u,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),o=new Map,i=l=>{if(o.has(l.id))return;let p=l.startDate&&l.endDate?Me.calculateDuration(l.startDate,l.endDate):0,u=t.filter(f=>f.dependencies&&f.dependencies.includes(l.id)),d=s;if(u.length>0)for(let f of u){i(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-p;o.set(l.id,{ls:m,lf:d});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),u=o.get(l.id);if(p&&u){let d=u.ls-p.es;Math.abs(d)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Me.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let i=new Map,c=[],l=[];for(let d of r)(o.get(d.id)||0)===0&&l.push(d.id);for(;l.length>0;){let d=l.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Me.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let h of m.dependencies){let y=i.get(h);y&&(v=Math.max(v,y.ef));}i.set(d,{es:v,ef:v+f});let b=s.get(d)||[];for(let h of b){let y=(o.get(h)||1)-1;o.set(h,y),y===0&&l.push(h);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(d=>d.ef)),u=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=Me.calculateDuration(f.startDate,f.endDate),b=s.get(m)||[],h=p;if(b.length>0)for(let y of b){let x=u.get(y);x&&(h=Math.min(h,x.ls));}u.set(m,{ls:h-v,lf:h});}for(let d of c){let m=i.get(d),f=u.get(d),v=f.ls-m.es,b=s.get(d)||[],h;b.length>0?h=Math.min(...b.map(y=>i.get(y).es))-m.ef:h=p-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(h*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Me.calculateCriticalPath(e).includes(t))return 0;let n=Me.getDependentTasks(e,t);if(n.length===0){let i=Me.getLatestEndDate(e);if(!i)return null;let c=Me.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=n.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let o=Me.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Me.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Me.getDependentTasks(e,t);if(o.length===0)return e;let i=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let l=Me.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),p<f&&(p=f);}let u=Me.calculateEndDate(p,l),d=m=>m.map(f=>f.id===c.id?{...f,startDate:p,endDate:u}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);i=d(i),i=Me.autoScheduleDependents(i,c.id,a,n);}return i},calculateCascadePreview:(e,t,a,r,n,s,o,i)=>{if(a===0)return [];let c=[],l=n.getTime(),p=1e3*60*60*24,u=Me.findTaskById(e,t);if(!u||!u.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let b=Me.getDependentTasks(e,m);for(let h of b){if(!h.startDate||!h.endDate)continue;let y=r.findIndex(N=>N.id===h.id);if(y===-1)continue;let x=h.startDate.getTime(),C=(h.endDate.getTime()-x)/p,O=(x-l)/p*s,T=O+f*s,D=Math.max(C*s,s),M=i+y*o+(o-18)/2;c.push({taskId:h.id,taskName:h.name,originalX:O,previewX:T,width:D,y:M,rowIndex:y,daysDelta:f,color:h.color}),d(h.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=Me.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.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 o=new Date(a);o.setDate(o.getDate()+r);let i=new Date(n.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:i}],l=p=>p.map(u=>u.id===n.id?{...u,endDate:i,segments:c}:u.subtasks?{...u,subtasks:l(u.subtasks)}:u);return l(e)}};function Tl({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:u,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:b,showBaseline:h,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:C="number",canEditTask:P,onTaskProgressDrag:O,workingDaysConfig:T}){let M=Ur(),N=useRef(null),[z,$]=useState([]),[Y,A]=useState(null),[Se,W]=useState(null),[Ce,R]=useState(null),we=useRef(false),[G,Ve]=useState(new Set),[oe,Be]=useState(null),le=useCallback(I=>{if(Ce&&!we.current){let j=I.target,ke=false;for(;j&&j!==I.currentTarget;){if(j.getAttribute?.("data-dependency-line")==="true"||j.getAttribute?.("data-dependency-hover-overlay")==="true"){ke=true;break}j=j.parentElement;}ke||R(null);}},[Ce]),He=useCallback(I=>{W(I);},[]),$e=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Pe=r==="day"?60:r==="week"?20:8,je=$e*Pe*o,tt=I=>{let j=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),ke=j.getUTCDay()||7;j.setUTCDate(j.getUTCDate()+4-ke);let Ue=new Date(Date.UTC(j.getUTCFullYear(),0,1));return Math.ceil(((j.getTime()-Ue.getTime())/864e5+1)/7)},ee=I=>{let j=I.getDay();return j===0||j===6},Ae=useMemo(()=>{let I=T?.holidayDates;return I?I instanceof Set?I:new Set(I):null},[T?.holidayDates]),ot=I=>{if(!Ae)return false;let j=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-${String(I.getDate()).padStart(2,"0")}`;return Ae.has(j)},Ie=useCallback(I=>{let j=Math.round(I/(Pe*o)),ke=new Date(n);return ke.setDate(ke.getDate()+j),ke},[n,Pe,o]),zt=useCallback((I,j)=>{if(j.startDate&&j.endDate)return;let ke=I.currentTarget.ownerSVGElement;if(!ke)return;let Ue=ke.createSVGPoint();Ue.x=I.clientX,Ue.y=I.clientY;let ue=Ue.matrixTransform(ke.getScreenCTM()?.inverse()),at=Ie(ue.x),yt=new Date(at);yt.setDate(yt.getDate()+1),Be(null),f?.(j,at,yt);},[Ie,f]),st=useCallback((I,j,ke)=>{let Ue=I.currentTarget.ownerSVGElement;if(!Ue)return;let ue=Ue.createSVGPoint();ue.x=I.clientX,ue.y=I.clientY;let at=ue.matrixTransform(Ue.getScreenCTM()?.inverse()),yt=Ie(at.x),vt=Math.round(at.x/(Pe*o))*Pe*o;Be({taskId:j.id,x:vt,y:ke*a+a/2,date:yt});},[Ie,Pe,o,a]),bt=useCallback(()=>{Be(null);},[]),Ee=useMemo(()=>{let I=ue=>ue.map(at=>{if(at.subtasks&&at.subtasks.length>0){let yt=I(at.subtasks),Ye=yt.filter(vt=>vt.startDate&&vt.endDate);if(Ye.length>0){let vt=Ye.map(Ht=>Ht.startDate.getTime()),Xt=Ye.map(Ht=>Ht.endDate.getTime()),wt=new Date(Math.min(...vt)),Ut=new Date(Math.max(...Xt));return {...at,subtasks:yt,startDate:wt,endDate:Ut}}return {...at,subtasks:yt}}return at}),j=(ue,at=[])=>{let yt=[...ue].sort((Ye,vt)=>(Ye.position??0)-(vt.position??0));for(let Ye of yt)at.push(Ye),Ye.subtasks&&Ye.subtasks.length>0&&(Ye.isExpanded===void 0||Ye.isExpanded)&&j(Ye.subtasks,at);return at},ke=I(e);return j(ke)},[e]),Dt=useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let j=I.startDate.getTime(),ke=I.endDate.getTime(),Ue=n.getTime(),ue=(j-Ue)/(1e3*60*60*24),at=(ke-j)/(1e3*60*60*24)+1,yt=ue*Pe*o,Ye=Math.max(Pe*o,40),vt=Math.max(at*Pe*o,Ye);return {x:yt,width:vt}},[n,Pe,o]),ht=useMemo(()=>Ee.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:j,width:ke}=Dt(I),ue=Ee.findIndex(at=>at.id===I.id)*a+(a-18)/2;return {id:I.id,x:j,y:ue,width:ke,height:18}}),[Ee,Dt]),_e=useCallback((I,j,ke)=>{if(!ke){$([]),A(null);return}if(A({taskId:I,daysDelta:j}),j===0){$([]);return}let Ue=Me.calculateCascadePreview(e,I,j,Ee,n,Pe*o,a,48);$(Ue);},[e,Ee,n,Pe,o,a,48]),dt=useCallback((I,j)=>{if(!Y)return j;let ke=Pe*o,Ue=Y.daysDelta*ke;if(I===Y.taskId)return {x:j.x+Ue,width:j.width};let ue=z.find(at=>at.taskId===I);return ue?{x:ue.previewX,width:ue.width}:j},[Y,z,Pe,o]),L=useMemo(()=>{let I=[],j=new Date(n);for(;j<=s;){let ue=(j.getTime()-n.getTime())/864e5*Pe*o;if(r==="day")I.push({date:new Date(j),label:j.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ue}),j.setDate(j.getDate()+1);else if(r==="week"){let at=tt(j);I.push({date:new Date(j),label:C==="range"?(()=>{let yt=new Date(j);yt.setDate(yt.getDate()+6);let Ye=vt=>vt.toLocaleDateString(i,{month:"short"});return Ye(j)===Ye(yt)?`${Ye(j)} ${j.getDate()}\u2013${yt.getDate()}`:`${Ye(j)} ${j.getDate()}\u2013${Ye(yt)} ${yt.getDate()}`})():`${M.labels.week} ${at}`,x:ue}),j.setDate(j.getDate()+7);}else I.push({date:new Date(j),label:j.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ue}),j.setMonth(j.getMonth()+1);}return I},[n,s,r,Pe,o,i,M.labels.week,C]),J=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Pe*o,[n,Pe,o]),xe=Math.max(Ee.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(je,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(je,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),L.map((I,j)=>jsxs("g",{children:[j>0&&jsx("line",{x1:I.x,y1:0,x2:I.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:I.x+8,y:48/2,fill:r==="day"&&!ee(I.date)&&ot(I.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${j}`)),J>=0&&J<=je&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:J,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:J,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${J-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:M.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:N,width:Math.max(je,1e3),height:xe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:le,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(je,1e3),height:xe,fill:t.bgPrimary}),Ee.map((I,j)=>jsx("rect",{x:0,y:j*a,width:Math.max(je,1e3),height:a,fill:j%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${I.id}`)),L.map((I,j)=>j>0?jsx("line",{x1:I.x,y1:0,x2:I.x,y2:Ee.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${j}`):null),L.map((I,j)=>{let ke=L[j+1]?.x||je,Ue=w&&ee(I.date),ue=r==="day"&&!ee(I.date)&&ot(I.date);return Ue||ue?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:I.x,y:0,width:ke-I.x,height:Ee.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:I.x,y:0,width:ke-I.x,height:Ee.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${j}`):null}),Ee.map((I,j)=>{let ke=I.startDate&&I.endDate;return jsx("g",{children:!ke&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:j*a,width:je,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ue=>zt(Ue,I),onMouseMove:Ue=>st(Ue,I,j),onMouseLeave:()=>{bt();}},`clickable-${I.id}`),oe&&oe.taskId===I.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:oe.x,y1:j*a+4,x2:oe.x,y2:j*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:oe.x,cy:oe.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:oe.x,cy:oe.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${oe.x}, ${j*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:oe.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!oe||oe.taskId!==I.id)&&jsx("text",{x:J>0?J:100,y:j*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:M.labels.clickToSetDates},`placeholder-${I.id}`)]})},`row-group-${I.id}`)}),Ee.map((I,j)=>{if(!I.startDate||!I.endDate)return null;let{x:ke,width:Ue}=Dt(I),ue=j*a+(a-18)/2,at=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;if(I.isMilestone)return jsx(Cl,{task:I,x:ke+Ue/2,y:ue+12,theme:t,onClick:u},I.id);if(at){let yt=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ye=8,vt=ue+(a-18)/2+(18-Ye)/2,Xt=4,wt=I.progress||0,Ut=new Date;Ut.setHours(0,0,0,0);let Ht=I.startDate&&Ut>=I.startDate,he=I.endDate&&(()=>{let aa=new Date(I.endDate);return aa.setHours(0,0,0,0),Ut>aa})(),Fe=I.startDate&&Ut<I.startDate,Qe=1;if(Ht&&I.startDate&&I.endDate&&!Fe){let aa=new Date(I.startDate);aa.setHours(0,0,0,0);let cr=new Date(I.endDate);cr.setHours(0,0,0,0);let Xe=Math.max(1,(cr.getTime()-aa.getTime())/(1e3*60*60*24)),Sa=Math.min((Ut.getTime()-aa.getTime())/(1e3*60*60*24),Xe)/Xe*100;Qe=Sa>0?wt/Sa:1;}let rt;wt>=100?rt="#00E5CC":Fe?rt="#4B5563":he&&wt<100?rt="#EF4444":Qe>=.95?rt="#22C55E":Qe>=.8?rt="#F59E0B":rt="#EF4444";let Tt=Math.max(wt/100*Ue,wt>0?Xt*2:0),Ft=Ue>100&&wt>0,kt=I.isCriticalPath;return jsxs("g",{onClick:()=>u?.(I),onContextMenu:aa=>{aa.preventDefault(),aa.stopPropagation(),m?.(I,aa);},onMouseMove:aa=>{He({task:I,x:ke,y:vt,width:Ue,height:Ye,showBelow:vt<100,mouseX:aa.clientX,mouseY:aa.clientY});},onMouseLeave:()=>He(null),style:{cursor:"default",opacity:y?kt?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":wt>=100?"completed":he?"overdue":"planned",children:[jsx("rect",{x:ke,y:ue,width:Ue,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:ke,y:vt,width:Ue,height:Ye,rx:Xt,fill:yt?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),wt>0&&jsx("rect",{x:ke,y:vt,width:Tt,height:Ye,rx:Xt,fill:rt,"data-parte":"avance"}),y&&kt&&jsx("rect",{x:ke,y:vt,width:Ue,height:Ye,rx:Xt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ft&&jsxs("text",{x:ke+Tt+6,y:vt+Ye/2,dominantBaseline:"central",fill:yt?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(wt),"%"]})]},I.id)}return jsx(yl,{task:I,x:ke,y:ue,width:Ue,theme:t,dayWidth:Pe*o,startDate:n,templates:c,onClick:u,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:ht,onDragMove:_e,onHoverChange:He,showBaseline:h,showTaskBarLabels:p,showCriticalPath:y,readOnly:P?!P(I):false,onProgressChange:O},I.id)}),x&&Ee.map((I,j)=>!I.dependencies||I.dependencies.length===0||!I.startDate||!I.endDate?null:I.dependencies.map(ke=>{let Ue=Ee.find(rt=>rt.id===ke);if(!Ue||!Ue.startDate||!Ue.endDate)return null;let ue=Ee.findIndex(rt=>rt.id===ke),at=dt(Ue.id,Dt(Ue)),yt=dt(I.id,Dt(I)),Ye=at.x+at.width,vt=ue*a+26,Xt=yt.x,wt=j*a+26,Ut=`dep-${ke}-${I.id}`;if(G.has(Ut))return null;let Ht=y&&I.isCriticalPath&&Ue.isCriticalPath;return jsx(ui,{x1:Ye,y1:vt,x2:Xt,y2:wt,theme:t,lineStyle:l,colorOverride:y?Ht?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Ht?2:1:void 0,glowFilter:Ht?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>b?.(I.id,ke),onHoverChange:rt=>{we.current=rt,rt&&R({key:Ut,fromId:ke,toId:I.id,exitX:Ye,exitY:vt,enterX:Xt,enterY:wt});}},Ut)})),z.map(I=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:I.previewX,y:I.y-48,width:I.width,height:18,rx:6,fill:I.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(I.daysDelta)>0&&jsx("text",{x:I.previewX+I.width/2,y:I.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:I.daysDelta>0?`+${I.daysDelta}d`:`${I.daysDelta}d`})]},`cascade-preview-${I.taskId}`)),x&&Ce&&jsx(ui,{x1:Ce.exitX,y1:Ce.exitY,x2:Ce.enterX,y2:Ce.enterY,theme:t,lineStyle:l,onDelete:()=>{let I=Ce.key;R(null),we.current=false,Ve(j=>new Set(j).add(I)),b?.(Ce.toId,Ce.fromId);},hoverOverlayOnly:true,onHoverChange:I=>{we.current=I,I||R(null);}},`${Ce.key}-hover-overlay`),J>=0&&J<=je&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:J,y1:0,x2:J,y2:xe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:J,y1:0,x2:J,y2:xe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Se&&jsx(fg,{tooltipData:Se,theme:t,locale:i==="es"?"es":"en",workingDaysConfig:T})]})}var Fw=['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"'],yg=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Lw=()=>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"})}),Aw=()=>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"})}),Iw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Rw=()=>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 Sl({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=useState(false),[u,d]=useState(false),[m,f]=useState([]),[v,b]=useState(""),[h,y]=useState(false),[x,w]=useState(true),[C,P]=useState(""),[O,T]=useState(-1),[D,M]=useState(false),[N,z]=useState(0),$=useRef(null),Y=useRef(null),A=useRef(null),Se=useRef(null),{enabled:W=true,placeholder:Ce='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:we,suggestions:G=Fw,maxHistory:Ve=50,persistHistory:oe,mentionableUsers:Be=[]}=a,le=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",He=le?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",$e=le?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Pe=le?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",je=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",tt=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ee=le?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ae=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",ot=le?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ie=le?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",zt=le?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",st=le?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",bt=le?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ee=le?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",Dt=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ht=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",_e=le?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",dt=le?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=le?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",J=le?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",xe=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",I="rgba(0, 229, 204, 0.04)",j=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ke=le?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=le?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ue=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",at=le?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",yt=le?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ye=le?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",vt=le?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Xt="rgba(0, 229, 204, 0.06)",wt=le?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ut=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Ht=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",he=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Fe=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Qe=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",rt=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Tt=le?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ft=le?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",kt=le?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Da=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",aa=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",cr=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Xe=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",et=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Sa=oe?.storageKey||"gantt-ai-history",Ia=oe?.maxMessages??5,dr=Be.filter(B=>{if(!C)return true;let re=C.toLowerCase();return B.name.toLowerCase().includes(re)||B.email&&B.email.toLowerCase().includes(re)}).slice(0,5),xr=useCallback(B=>{if(b(B),Be.length===0)return;let re=$.current;if(!re)return;let be=re.selectionStart||B.length,S=B.slice(0,be),H=S.lastIndexOf("@");if(H>=0&&((H>0?S[H-1]:" ")===" "||H===0)){let Te=S.slice(H+1);if(Te.length<=40){P(Te),T(H),M(true),z(0);return}}M(false),P(""),T(-1);},[Be.length]),Ra=useCallback(B=>{let re=v.slice(0,O),be=v.slice(O+1+C.length),S=`${re}@${B.name} ${be}`;b(S),M(false),P(""),T(-1),setTimeout(()=>$.current?.focus(),0);},[v,O,C]),Ja=useCallback(B=>{if(!D||dr.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),z(re=>re<dr.length-1?re+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),z(re=>re>0?re-1:dr.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let re=dr[N];return re&&Ra(re),true}return B.key==="Escape"?(M(false),true):false},[D,dr,N,Ra]);useEffect(()=>{if(oe?.enabled)try{let B=localStorage.getItem(Sa);if(B){let be=JSON.parse(B).map(S=>({...S,timestamp:new Date(S.timestamp)}));f(be.slice(-Ia));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[oe?.enabled,Sa,Ia]),useEffect(()=>{if(oe?.enabled&&m.length>0)try{let B=m.filter(re=>!re.isLoading).slice(-Ia);localStorage.setItem(Sa,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[m,oe?.enabled,Sa,Ia]),useEffect(()=>{Y.current&&Y.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{l&&!u&&$.current&&setTimeout(()=>$.current?.focus(),100);},[l,u]);let se=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&&n?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&o?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[n,s,o,i,c]),me=useCallback(async B=>{if(!B.trim()||h)return;let re={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};f(S=>[...S.slice(-(Ve-1)),re]),b(""),w(false),y(true);let be={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(S=>[...S,be]);try{if(we){let S=m.filter(Z=>!Z.isLoading&&Z.content).slice(-6).map(Z=>({role:Z.role,content:Z.content})),H=await we(B,e,S);f(Z=>{let Te=Z.filter(fe=>!fe.isLoading),gt={id:`assistant-${Date.now()}`,role:"assistant",content:H.message,timestamp:new Date,command:H};return [...Te,gt]}),se(H);}else f(S=>[...S.filter(Z=>!Z.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(S){f(H=>[...H.filter(Te=>!Te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[h,Ve,we,e,se]),q=B=>{B.preventDefault(),me(v);},pe=B=>{b(B),$.current?.focus();};if(useEffect(()=>{let B=re=>{(re.metaKey||re.ctrlKey)&&re.key==="k"&&(re.preventDefault(),p(be=>!be),l||d(false)),re.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),useEffect(()=>{if(!l)return;let B=be=>{let S=be.target;A.current&&!A.current.contains(S)&&p(false);},re=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(re),document.removeEventListener("mousedown",B);}},[l]),!W)return null;let ce={"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(ga,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ce[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:He,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${$e}`,color:"#00E5CC",cursor:"pointer",boxShadow:Pe,overflow:"visible"},onClick:()=>p(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${je}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${tt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(yg,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:ot,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ae}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([l],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Re.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let n=new Map,r=l=>{if(n.has(l.id))return;let u=l.startDate&&l.endDate?Re.calculateDuration(l.startDate,l.endDate):0,p=0;if(l.dependencies&&l.dependencies.length>0)for(let m of l.dependencies){let f=t.find(v=>v.id===m);if(f){r(f);let v=n.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;n.set(l.id,{es:p,ef:d});};a.forEach(r);let s=Math.max(...Array.from(n.values()).map(l=>l.ef)),o=new Map,i=l=>{if(o.has(l.id))return;let u=l.startDate&&l.endDate?Re.calculateDuration(l.startDate,l.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(l.id)),d=s;if(p.length>0)for(let f of p){i(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(l.id,{ls:m,lf:d});};a.forEach(i);let c=[];for(let l of a){let u=n.get(l.id),p=o.get(l.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,n=Re.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(n.length===0)return t;let r=new Map(n.map(d=>[d.id,d])),s=new Map;for(let d of n)s.has(d.id)||s.set(d.id,[]);for(let d of n)if(d.dependencies){for(let m of d.dependencies)if(r.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of n)o.set(d.id,0);for(let d of n)if(d.dependencies)for(let m of d.dependencies)r.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let i=new Map,c=[],l=[];for(let d of n)(o.get(d.id)||0)===0&&l.push(d.id);for(;l.length>0;){let d=l.shift();c.push(d);let m=r.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Re.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let w of m.dependencies){let h=i.get(w);h&&(v=Math.max(v,h.ef));}i.set(d,{es:v,ef:v+f});let b=s.get(d)||[];for(let w of b){let h=(o.get(w)||1)-1;o.set(w,h),h===0&&l.push(w);}}if(c.length<n.length)return t;let u=Math.max(...Array.from(i.values()).map(d=>d.ef)),p=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=r.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=Re.calculateDuration(f.startDate,f.endDate),b=s.get(m)||[],w=u;if(b.length>0)for(let h of b){let x=p.get(h);x&&(w=Math.min(w,x.ls));}p.set(m,{ls:w-v,lf:w});}for(let d of c){let m=i.get(d),f=p.get(d),v=f.ls-m.es,b=s.get(d)||[],w;b.length>0?w=Math.min(...b.map(h=>i.get(h).es))-m.ef:w=u-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(w*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Re.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Re.calculateCriticalPath(e).includes(t))return 0;let r=Re.getDependentTasks(e,t);if(r.length===0){let i=Re.getLatestEndDate(e);if(!i)return null;let c=Re.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=r.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let o=Re.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Re.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,n)=>{let r=n||new Set;if(r.has(t))return e;r.add(t);let s=Re.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Re.getDependentTasks(e,t);if(o.length===0)return e;let i=[...e];for(let c of o){if(r.has(c.id)||!c.startDate||!c.endDate)continue;let l=Re.calculateDuration(c.startDate,c.endDate),u;if(a!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Re.calculateEndDate(u,l),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);i=d(i),i=Re.autoScheduleDependents(i,c.id,a,r);}return i},calculateCascadePreview:(e,t,a,n,r,s,o,i)=>{if(a===0)return [];let c=[],l=r.getTime(),u=1e3*60*60*24,p=Re.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let b=Re.getDependentTasks(e,m);for(let w of b){if(!w.startDate||!w.endDate)continue;let h=n.findIndex(S=>S.id===w.id);if(h===-1)continue;let x=w.startDate.getTime(),k=(w.endDate.getTime()-x)/u,z=(x-l)/u*s,L=z+f*s,N=Math.max(k*s,s),D=i+h*o+(o-18)/2;c.push({taskId:w.id,taskName:w.name,originalX:z,previewX:L,width:N,y:D,rowIndex:h,daysDelta:f,color:w.color}),d(w.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,n=3)=>{let r=Re.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return e;if(a<=r.startDate||a>=r.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 o=new Date(a);o.setDate(o.getDate()+n);let i=new Date(r.endDate);i.setDate(i.getDate()+n);let c=[{startDate:new Date(r.startDate),endDate:s},{startDate:o,endDate:i}],l=u=>u.map(p=>p.id===r.id?{...p,endDate:i,segments:c}:p.subtasks?{...p,subtasks:l(p.subtasks)}:p);return l(e)}};var To=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Ik=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,Iu=(e,t)=>{let a=To(e);return a.setDate(a.getDate()+t),a},oi=(e,t)=>To(e).getTime()<To(t).getTime(),fc={esHabil:()=>true};function Do(e){if(!e)return fc;let t=e.enabledWeekdays&&e.enabledWeekdays.length===7?e.enabledWeekdays:null,a=e.holidayDates?e.holidayDates instanceof Set?e.holidayDates:new Set(e.holidayDates):null;return t&&!t.some(Boolean)?fc:{esHabil:n=>(!t||!!t[n.getDay()])&&!(a&&a.has(Ik(n)))}}function si(e,t,a=false){let n=To(e);for(let r=0;r<3660&&!t.esHabil(n);r++)n=Iu(n,a?-1:1);return n}function Zo(e,t,a){if(t===0)return si(e,a);let n=To(e),r=t>0?1:-1,s=Math.abs(t);for(let o=0;o<36600&&s>0;o++)n=Iu(n,r),a.esHabil(n)&&s--;return n}function Ds(e,t,a){let n=To(e),r=To(t);if(r.getTime()<n.getTime())return 1;let s=0;for(let o=n;o.getTime()<=r.getTime();o=Iu(o,1))a.esHabil(o)&&s++;return Math.max(1,s)}function bc(e,t,a){return Zo(si(e,a),Math.max(1,t)-1,a)}function Ns(e){let t=new Map((e.dependencyLinks??[]).map(n=>[n.id,n]));return [...new Set([...e.dependencies??[],...t.keys()])].map(n=>t.get(n)??{id:n,type:"FS",lag:0})}function hc(e,t=new Map){for(let a of e)t.set(a.id,a),a.subtasks?.length&&hc(a.subtasks,t);return t}function yc(e,t,a){if(!t.startDate||!t.endDate)return null;switch(e.type){case "FS":return {inicioMin:Zo(t.endDate,1+e.lag,a),enlace:e,predecesora:t};case "SS":return {inicioMin:Zo(t.startDate,e.lag,a),enlace:e,predecesora:t};case "FF":return {finMin:Zo(t.endDate,e.lag,a),enlace:e,predecesora:t};case "SF":return {finMin:Zo(t.startDate,e.lag,a),enlace:e,predecesora:t}}}function Ss(e,t,a,n,r){let s=n instanceof Map?n:hc(n),o=e.isMilestone?1:Ds(t,a,r),i=e.isMilestone?To(a):To(t),c=null;for(let l=0;l<8;l++){let u=false,p=e.isMilestone?i:bc(i,o,r);for(let d of Ns(e)){let m=s.get(d.id);if(!m||m.id===e.id)continue;let f=yc(d,m,r);f&&(f.inicioMin&&oi(i,f.inicioMin)?(i=si(f.inicioMin,r),c=f,u=true):f.finMin&&oi(p,f.finMin)&&(i=e.isMilestone?si(f.finMin,r):Zo(f.finMin,-(o-1),r),c=f,u=true));}if(!u)break}return c?{inicio:i,fin:e.isMilestone?i:bc(i,o,r),porQue:c}:{inicio:t,fin:a,porQue:null}}function ii(e,t,a){let n=hc(e),r=new Map;for(let c of n.values())for(let l of Ns(c)){let u=r.get(l.id)??[];u.push(c.id),r.set(l.id,u);}let s=[...t],o=new Map,i=0;for(;s.length>0&&i++<2e4;){let c=s.shift();for(let l of r.get(c)??[]){let u=n.get(l);if(!u?.startDate||!u.endDate)continue;let p=Ss(u,u.startDate,u.endDate,n,a);if(!p.porQue)continue;let d={...u,startDate:p.inicio,endDate:p.fin};n.set(l,d),o.set(l,{id:l,startDate:p.inicio,endDate:p.fin,porQue:p.porQue}),s.push(l);}}return [...o.values()]}function xc(e,t){let a=hc(e),n=[];for(let r of a.values())if(!(!r.startDate||!r.endDate))for(let s of Ns(r)){let o=a.get(s.id);if(!o)continue;let i=yc(s,o,t);if(!i)continue;let c=r.isMilestone?r.startDate:r.endDate,l=0;i.inicioMin&&oi(r.startDate,i.inicioMin)?l=Ds(r.startDate,i.inicioMin,t)-1:i.finMin&&oi(c,i.finMin)&&(l=Ds(c,i.finMin,t)-1),(l>0||i.inicioMin&&oi(r.startDate,i.inicioMin)||i.finMin&&oi(c,i.finMin))&&n.push({sucesora:r,predecesora:o,enlace:s,dias:Math.max(1,l)});}return n}function io(e){return e==="day"?60:e==="week"?20:8}function Ru(e,t){let a=new Date(e.getFullYear(),e.getMonth(),e.getDate());if(t==="week"){let n=(a.getDay()+6)%7;a.setDate(a.getDate()-n);}else t==="month"&&a.setDate(1);return a}function Yf(e,t,a){return {inicio:a<e?new Date(a):e,fin:a>t?new Date(a):t}}function Xf(e,t,a,n){if(!e||!t)return a;let r=n&&n>t?n:t;return a>=e&&a<=r?a:a<e?e:r}var Bu=1/3;function Jf(e,t,a,n){return t<a?"left":e>n?"right":null}function Qf(e,t,a){return e<t?"left":e>a?"right":null}function e0(e,t,a){let n=a.startsWith("es"),r=e==="FS"?"":n?{SS:"CC",FF:"FF",SF:"CF"}[e]:e,s=t===0?"":`${t>0?"+":"\u2212"}${Math.abs(t)}`;return [r,s].filter(Boolean).join(" ")||void 0}function vc({tasks:e,theme:t,rowHeight:a,timeScale:n,startDate:r,endDate:s,zoom:o,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:b,showBaseline:w,showCriticalPath:h=true,showDependencies:x=true,highlightWeekends:y=true,weekHeaderFormat:k="number",canEditTask:M,onTaskProgressDrag:z,workingDaysConfig:L,ventanaVisible:N,filasVisibles:D=null,onIrAFecha:S,finPlaneado:V,finPrevisto:U,alturaCabecera:W,v6:E=false,tareaEnFoco:Pe=null,alturaBarra:J}){let de=J??18,R=W??48,Ae=Un(),nt=useRef(null),[Ge,B]=useState(0);useEffect(()=>{let A=nt.current;if(!A||typeof ResizeObserver>"u")return;let Y=A.parentElement;for(;Y&&!/(auto|scroll)/.test(getComputedStyle(Y).overflowY);)Y=Y.parentElement;if(!Y)return;let ee=Y,q=()=>B(ee.clientHeight);q();let He=new ResizeObserver(q);return He.observe(ee),()=>He.disconnect()},[]);let[ce,oe]=useState([]),[gt,Je]=useState(null),[ct,ft]=useState(null),[ut,Rt]=useState(null),lt=useMemo(()=>new Map(xc(e,Do(L)).map(A=>[`${A.predecesora.id}>${A.sucesora.id}`,A])),[e,L]),vt=A=>{let Y=q=>q?jn(q,i):"\u2014",ee=A.enlace.type??"FS";return ee==="FS"?i==="es"?`Empieza ${Y(A.sucesora.startDate)}, antes de que termine ${A.predecesora.name} (${Y(A.predecesora.endDate)})`:`Starts ${Y(A.sucesora.startDate)}, before ${A.predecesora.name} finishes (${Y(A.predecesora.endDate)})`:i==="es"?`No cumple su enlace ${ee} con ${A.predecesora.name}`:`Does not meet its ${ee} link with ${A.predecesora.name}`},Mt=(A,Y)=>{let ee=lt.get(`${A}>${Y}`),q=ee?.sucesora;if(!ee||!q?.startDate||!q.endDate||!f||M&&!M(q))return;let He=Ss(q,q.startDate,q.endDate,e,Do(L));if(!He.porQue)return;let Ze=i==="es";return {texto:Ze?`Corregir \u2192 ${jn(He.inicio,i)}`:`Fix \u2192 ${jn(He.inicio,i)}`,titulo:Ze?`Mover \xAB${q.name}\xBB al ${jn(He.inicio,i)} (termina ${jn(He.fin,i)}) para que cumpla su enlace con \xAB${ee.predecesora.name}\xBB. Las que dependen de ella se corren lo justo.`:`Move "${q.name}" to ${jn(He.inicio,i)} (ends ${jn(He.fin,i)}) so it meets its link with "${ee.predecesora.name}". Its successors shift only as needed.`,onClick:()=>{Rt(null),Pt.current=false,f(q,q.startDate,q.endDate);}}},Pt=useRef(false),[zt,Ne]=useState(new Set),[Ot,wt]=useState(null),Ut=useCallback(A=>{if(ut&&!Pt.current){let Y=A.target,ee=false;for(;Y&&Y!==A.currentTarget;){if(Y.getAttribute?.("data-dependency-line")==="true"||Y.getAttribute?.("data-dependency-hover-overlay")==="true"){ee=true;break}Y=Y.parentElement;}ee||Rt(null);}},[ut]),Ye=useCallback(A=>{ft(A);},[]),qe=Math.ceil((s.getTime()-r.getTime())/(1e3*60*60*24)),_=io(n),he=qe*_*o,Z=A=>{let Y=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),ee=Y.getUTCDay()||7;Y.setUTCDate(Y.getUTCDate()+4-ee);let q=new Date(Date.UTC(Y.getUTCFullYear(),0,1));return Math.ceil(((Y.getTime()-q.getTime())/864e5+1)/7)},ze=A=>{let Y=A.getDay();return Y===0||Y===6},Me=useMemo(()=>{let A=L?.holidayDates;return A?A instanceof Set?A:new Set(A):null},[L?.holidayDates]),Ve=A=>{if(!Me)return false;let Y=`${A.getFullYear()}-${String(A.getMonth()+1).padStart(2,"0")}-${String(A.getDate()).padStart(2,"0")}`;return Me.has(Y)},O=useMemo(()=>Do(L??null),[L]),xe=A=>A.startDate&&A.endDate?Ds(A.startDate,A.endDate,O):0,Be=useCallback(A=>{let Y=Math.round(A/(_*o)),ee=new Date(r);return ee.setDate(ee.getDate()+Y),ee},[r,_,o]),Qe=useCallback((A,Y)=>{if(Y.startDate&&Y.endDate)return;let ee=A.currentTarget.ownerSVGElement;if(!ee)return;let q=ee.createSVGPoint();q.x=A.clientX,q.y=A.clientY;let He=q.matrixTransform(ee.getScreenCTM()?.inverse()),Ze=Be(He.x),$e=new Date(Ze);$e.setDate($e.getDate()+1),wt(null),f?.(Y,Ze,$e);},[Be,f]),Ft=useCallback((A,Y,ee)=>{let q=A.currentTarget.ownerSVGElement;if(!q)return;let He=q.createSVGPoint();He.x=A.clientX,He.y=A.clientY;let Ze=He.matrixTransform(q.getScreenCTM()?.inverse()),$e=Be(Ze.x),Ie=Math.round(Ze.x/(_*o))*_*o;wt({taskId:Y.id,x:Ie,y:ee*a+a/2,date:$e});},[Be,_,o,a]),Xe=useCallback(()=>{wt(null);},[]),Tt=useMemo(()=>{let A=He=>He.map(Ze=>{if(Ze.subtasks&&Ze.subtasks.length>0){let $e=A(Ze.subtasks),Q=$e.filter(pt=>pt.startDate&&pt.endDate),Ie=!!(Ze.startDate&&Ze.endDate);if(Q.length>0&&!Ie){let pt=Q.map(te=>te.startDate.getTime()),P=Q.map(te=>te.endDate.getTime()),ie=new Date(Math.min(...pt)),$=new Date(Math.max(...P));return {...Ze,subtasks:$e,startDate:ie,endDate:$}}return {...Ze,subtasks:$e}}return Ze}),Y=(He,Ze=[])=>{let $e=[...He].sort((Q,Ie)=>(Q.position??0)-(Ie.position??0));for(let Q of $e)Ze.push(Q),Q.subtasks&&Q.subtasks.length>0&&(Q.isExpanded===void 0||Q.isExpanded)&&Y(Q.subtasks,Ze);return Ze},ee=A(e);return Y(ee)},[e]),it=useCallback(A=>{if(!A.startDate||!A.endDate)return {x:0,width:0};let Y=A.startDate.getTime(),ee=A.endDate.getTime(),q=r.getTime(),He=(Y-q)/(1e3*60*60*24),Ze=(ee-Y)/(1e3*60*60*24)+1,$e=He*_*o,Q=Math.max(_*o,40),Ie=Math.max(Ze*_*o,Q);return {x:$e,width:Ie}},[r,_,o]),ba=useMemo(()=>Tt.filter(A=>A.startDate&&A.endDate).map(A=>{let{x:Y,width:ee}=it(A),He=Tt.findIndex(Ze=>Ze.id===A.id)*a+(a-de)/2;return {id:A.id,x:Y,y:He,width:ee,height:18}}),[Tt,it]),Jt=useCallback((A,Y,ee)=>{if(!ee){oe([]),Je(null);return}if(Je({taskId:A,daysDelta:Y}),Y===0){oe([]);return}let q=Re.findTaskById(e,A);if(!q?.startDate||!q.endDate){oe([]);return}let He=$=>{let te=new Date($);return te.setDate(te.getDate()+Y),te},Ze=He(q.startDate),$e=He(q.endDate),Q=$=>$.map(te=>te.id===A?{...te,startDate:Ze,endDate:$e}:te.subtasks?{...te,subtasks:Q(te.subtasks)}:te),Ie=ii(Q(e),[A],Do(L)),pt=1e3*60*60*24,P=_*o,ie=Ie.flatMap($=>{let te=Tt.findIndex(H=>H.id===$.id),I=Tt[te];return te===-1||!I?.startDate?[]:[{taskId:$.id,taskName:I.name,originalX:(I.startDate.getTime()-r.getTime())/pt*P,previewX:($.startDate.getTime()-r.getTime())/pt*P,width:Math.max(($.endDate.getTime()-$.startDate.getTime())/pt*P,P),y:R+te*a+(a-de)/2,rowIndex:te,daysDelta:Math.round(($.startDate.getTime()-I.startDate.getTime())/pt),color:I.color}]});oe(ie);},[e,Tt,r,_,o,a,R,L]),Ht=useCallback((A,Y)=>{if(!gt)return Y;let ee=_*o,q=gt.daysDelta*ee;if(A===gt.taskId)return {x:Y.x+q,width:Y.width};let He=ce.find(Ze=>Ze.taskId===A);return He?{x:He.previewX,width:He.width}:Y},[gt,ce,_,o]),we=useMemo(()=>{let A=[],Y=new Date(r);for(;Y<=s;){let He=(Y.getTime()-r.getTime())/864e5*_*o;if(n==="day")A.push({date:new Date(Y),label:Y.toLocaleDateString(i,{day:"numeric",month:"short"}),x:He}),Y.setDate(Y.getDate()+1);else if(n==="week"){let Ze=Z(Y);A.push({date:new Date(Y),label:E?(()=>{let $e=new Date(Y);$e.setDate($e.getDate()+6);let Q=String(i).startsWith("es"),Ie=P=>P.toLocaleDateString(Q?"es-CO":"en-US",{month:"short"}).replace(".",""),pt=Q?Ie(Y)===Ie($e)?`${Y.getDate()}\u2013${$e.getDate()} ${Ie($e)}`:`${Y.getDate()} ${Ie(Y)}\u2013${$e.getDate()} ${Ie($e)}`:Ie(Y)===Ie($e)?`${Ie(Y)} ${Y.getDate()}\u2013${$e.getDate()}`:`${Ie(Y)} ${Y.getDate()}\u2013${Ie($e)} ${$e.getDate()}`;return `${Q?"Sem":"Wk"} ${Ze} \xB7 ${pt}`})():k==="range"?(()=>{let $e=new Date(Y);$e.setDate($e.getDate()+6);let Q=Ie=>Ie.toLocaleDateString(i,{month:"short"});return Q(Y)===Q($e)?`${Q(Y)} ${Y.getDate()}\u2013${$e.getDate()}`:`${Q(Y)} ${Y.getDate()}\u2013${Q($e)} ${$e.getDate()}`})():`${Ae.labels.week} ${Ze}`,x:He}),Y.setDate(Y.getDate()+7);}else A.push({date:new Date(Y),label:Y.toLocaleDateString(i,{month:"short",year:"numeric"}),x:He}),Y.setMonth(Y.getMonth()+1);}return A},[r,s,n,_,o,i,Ae.labels.week,k,E]),Te=useMemo(()=>(new Date().getTime()-r.getTime())/(1e3*60*60*24)*_*o,[r,_,o]),dt=E&&n==="day",ht=_*o,jt=(A,Y)=>!!A&&!!Y&&A.getFullYear()===Y.getFullYear()&&A.getMonth()===Y.getMonth()&&A.getDate()===Y.getDate(),Dt=A=>A.toLocaleDateString(i,{month:"short"}).replace(".",""),la=useMemo(()=>{if(!dt)return [];let A=[];return we.forEach((Y,ee)=>{let q=Y.date;if(ee!==0&&q.getDay()!==1)return;let He=new Date(q);He.setDate(q.getDate()-(q.getDay()+6)%7);let Ze=new Date(He);Ze.setDate(He.getDate()+6);let $e=He.getMonth()===Ze.getMonth()?`${He.getDate()} \u2013 ${Ze.getDate()} ${Dt(Ze)}`:`${He.getDate()} ${Dt(He)} \u2013 ${Ze.getDate()} ${Dt(Ze)}`;A.push({x:Y.x,etiqueta:$e,num:Z(He)});}),A},[dt,we,i]),ha=i==="es"?["D","L","M","X","J","V","S"]:["S","M","T","W","T","F","S"],Ha=new Date,Zt={texto:"var(--v6-texto, #0E1114)",texto2:"var(--v6-texto-2, #4D5761)",tenue:"var(--v6-tenue, #5F6972)",borde:"var(--v6-borde, #E2E5E9)",linea:"var(--v6-linea, #EEF0F2)",tarjeta:"var(--v6-tarjeta, #FFFFFF)"},Wa=Math.max(Tt.length*a,600-R,Ge-R-2),Va=A=>!D||A>=D.desde&&A<=D.hasta,xn=useMemo(()=>{let A=1/0,Y=-1/0;for(let ee of Tt)ee.startDate&&(A=Math.min(A,ee.startDate.getTime())),ee.endDate&&(Y=Math.max(Y,ee.endDate.getTime()));return Y>A?Y-A:0},[Tt]),ia=A=>{if(!E||A.subtasks?.length||A.isMilestone||!A.startDate||!A.endDate||!xn)return false;let Y=A.endDate.getTime()-A.startDate.getTime();return Y>=90*864e5&&Y>=.6*xn},vn=(A,Y=0)=>!D||!N||A+Y>=N.izq-800&&A<=N.der+800;return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":n,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:E?Zt.tarjeta:t.glassHeader||t.bgSecondary,flexShrink:0,height:`${R}px`,borderBottom:E?`1px solid ${Zt.borde}`:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(he,1e3),height:R-1,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(he,1e3),height:R,fill:t.glassHeader||t.bgSecondary,style:E?{fill:Zt.tarjeta}:void 0}),dt&&jsxs("g",{"data-escala-v6":"dia",children:[la.map((A,Y)=>jsxs("g",{children:[A.x>0&&jsx("line",{x1:A.x,y1:0,x2:A.x,y2:R,style:{stroke:Zt.borde},strokeWidth:1,shapeRendering:"crispEdges"}),jsxs("text",{x:(()=>{let ee=N?.izq??0,q=la[Y+1]?.x??1/0;return A.x<ee&&ee+140<q?ee+8:A.x+8})(),y:12,dominantBaseline:"middle",style:{fill:Zt.texto2,fontSize:12,fontWeight:500},children:[A.etiqueta,jsx("tspan",{dx:7,style:{fill:Zt.tenue,fontSize:11,fontWeight:400,fontFamily:"'JetBrains Mono', ui-monospace, monospace"},children:`${i==="es"?"S":"W"}${A.num}`})]})]},`sem-${Y}`)),jsx("line",{x1:0,y1:24.5,x2:Math.max(he,1e3),y2:24.5,style:{stroke:Zt.linea},strokeWidth:1}),we.map((A,Y)=>{if(!vn(A.x,ht))return null;let ee=A.x+ht/2,q=ze(A.date),He=!q&&Ve(A.date),Ze=jt(A.date,U),$e=jt(A.date,Ha),Q=String(A.date.getDate());return jsxs("g",{"data-dia-v6":He?"festivo":q?"finde":void 0,children:[He&&jsx("title",{children:i==="es"?"Festivo":"Holiday"}),jsx("text",{x:ee,y:35,textAnchor:"middle",dominantBaseline:"middle",style:{fill:Zt.tenue,fontSize:11},children:ha[A.date.getDay()]}),$e&&jsx("rect",{x:ee-12,y:41,width:24,height:17,rx:8.5,style:{fill:"var(--v6-hoy-fondo, #0E1114)"}}),Ze&&!$e&&jsx("rect",{x:ee-(Q.length>1?11:8),y:24+17.5,width:Q.length>1?22:16,height:16,rx:8,style:{fill:"none",stroke:Zt.texto2},strokeWidth:1}),jsx("text",{x:ee,y:50,textAnchor:"middle",dominantBaseline:"middle",style:{fill:$e?"var(--v6-hoy-texto, #FFFFFF)":q||He?Zt.tenue:Zt.texto,fontSize:12,fontWeight:500,fontVariantNumeric:"tabular-nums"},children:Q}),He&&jsx("line",{x1:ee-7,y1:58,x2:ee+7,y2:58,style:{stroke:Zt.texto2},strokeWidth:1.25,strokeDasharray:"2 2","data-subrayado-festivo":true})]},`dia-${Y}`)})]}),!dt&&we.map((A,Y)=>jsxs("g",{children:[Y>0&&jsx("line",{x1:A.x,y1:0,x2:A.x,y2:R,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:A.x+8,y:R/2,fill:n==="day"&&!ze(A.date)&&Ve(A.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:A.label})]},`header-${Y}`)),!E&&Te>=0&&Te<=he&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:Te,cy:R-10,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:Te,cy:R-10,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${Te-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:t.today}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:"#FFFFFF",fontSize:"8",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:Ae.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:nt,width:Math.max(he,1e3),height:Wa,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ut,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"festivo-v6",width:"6",height:"6",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"6",style:{stroke:"var(--v6-festivo-trama, rgba(14,17,20,0.09))"},strokeWidth:"1"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(he,1e3),height:Wa,fill:t.bgPrimary,style:E?{fill:Zt.tarjeta}:void 0}),Tt.map((A,Y)=>Va(Y)?jsx("rect",{x:0,y:Y*a,width:Math.max(he,1e3),height:a,fill:Y%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:E?{pointerEvents:"none",fill:Zt.tarjeta}:{pointerEvents:"none"}},`row-bg-${A.id}`):null),E&&Tt.map((A,Y)=>Va(Y)?jsx("line",{x1:0,y1:(Y+1)*a-.5,x2:Math.max(he,1e3),y2:(Y+1)*a-.5,style:{stroke:Zt.linea,pointerEvents:"none"},strokeWidth:1},`linea-fila-${Y}`):null),dt&&la.filter(A=>A.x>0).map((A,Y)=>jsx("line",{x1:A.x,y1:0,x2:A.x,y2:Wa,style:{stroke:Zt.borde,pointerEvents:"none"},strokeWidth:1,shapeRendering:"crispEdges"},`vsem-${Y}`)),!dt&&we.map((A,Y)=>Y>0?jsx("line",{x1:A.x,y1:0,x2:A.x,y2:Tt.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${Y}`):null),we.map((A,Y)=>{if(!vn(A.x,_*o*31))return null;let ee=we[Y+1]?.x||he,q=n==="day"&&y&&ze(A.date),He=n==="day"&&!ze(A.date)&&Ve(A.date),Ze=q||He;if(E&&Ze){let $e=ee-A.x;return jsxs("g",{"data-finde":"true",style:{pointerEvents:"none"},children:[jsx("rect",{x:A.x,y:0,width:$e,height:Wa,style:{fill:"var(--v6-finde, rgba(14,17,20,0.04))"}}),He&&jsx("rect",{x:A.x,y:0,width:$e,height:Wa,fill:"url(#festivo-v6)"})]},`we-overlay-${Y}`)}return Ze?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:A.x,y:0,width:ee-A.x,height:Tt.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:A.x,y:0,width:ee-A.x,height:Tt.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${Y}`):null}),Tt.map((A,Y)=>{if(!Va(Y))return null;let ee=A.startDate&&A.endDate;return jsx("g",{children:!ee&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:Y*a,width:he,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>Qe(q,A),onMouseMove:q=>Ft(q,A,Y),onMouseLeave:()=>{Xe();}},`clickable-${A.id}`),Ot&&Ot.taskId===A.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:Ot.x,y1:Y*a+4,x2:Ot.x,y2:Y*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:Ot.x,cy:Ot.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:Ot.x,cy:Ot.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${Ot.x}, ${Y*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:jn(Ot.date,i)})]})]}),(!Ot||Ot.taskId!==A.id)&&jsx("text",{x:Te>0?Te:100,y:Y*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:Ae.labels.clickToSetDates},`placeholder-${A.id}`)]})},`row-group-${A.id}`)}),Tt.map((A,Y)=>{if(!Va(Y)||!A.startDate||!A.endDate)return null;let{x:ee,width:q}=it(A),He=Y*a+(a-de)/2,Ze=A.subtasks&&A.subtasks.length>0&&!A.isMilestone;if(A.isMilestone){let $e=((A.endDate.getTime()-r.getTime())/864e5+.5)*_*o;return jsx(gc,{task:A,x:$e,y:He+de/2-16,theme:t,locale:i,onClick:p},A.id)}if(Ze&&E){let $e=Y*a+a/2,Q=N?.izq??-1/0,Ie=ee<Q&&ee+q>Q,pt=Ie?Q+18:ee,P=ee+q,ie=(A.progress??0)<100&&A.endDate.getTime()<new Date(new Date().toDateString()).getTime();return jsxs("g",{"data-barra-resumen":"true","data-estado":(A.progress??0)>=100?"completed":ie?"overdue":"planned",onClick:()=>p?.(A),onContextMenu:$=>{$.preventDefault(),$.stopPropagation(),m?.(A,$);},onMouseMove:$=>Ye({task:A,x:ee,y:$e-2,width:q,height:4,showBelow:$e<100,mouseX:$.clientX,mouseY:$.clientY}),onMouseLeave:()=>Ye(null),style:{cursor:"default",opacity:h&&!A.isCriticalPath?.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:ee,y:Y*a,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),Ie&&jsx("path",{d:`M ${Q+11} ${$e-4} l -4 4 l 4 4`,fill:"none",stroke:"var(--v6-texto-2, #4D5761)",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round"}),P-2>pt&&jsx("rect",{x:pt,y:$e-2,width:P-2-pt,height:4,rx:2,"data-parte":"pista",fill:"var(--v6-grupo, #8A939C)"}),jsx("rect",{x:P-2,y:$e-5,width:2,height:10,rx:1,"data-parte":"remate",fill:"var(--v6-grupo-remate, #3A434C)"}),h&&A.isCriticalPath&&jsx("rect",{x:pt,y:$e-3,width:Math.max(0,P-pt),height:6,rx:3,fill:"none",stroke:"var(--v6-rojo-punto, #D13A40)",strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("text",{x:P+6,y:$e,dominantBaseline:"middle",fill:"var(--v6-tenue, #5F6972)",fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace",style:{fontVariantNumeric:"tabular-nums",pointerEvents:"none",userSelect:"none"},children:`${xe(A)} d`})]},A.id)}if(Ze){let $e=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Q=8,Ie=He+(a-18)/2+(18-Q)/2,pt=4,P=A.progress||0,ie=new Date;ie.setHours(0,0,0,0);let $=A.startDate&&ie>=A.startDate,te=A.endDate&&(()=>{let Se=new Date(A.endDate);return Se.setHours(0,0,0,0),ie>Se})(),I=A.startDate&&ie<A.startDate,H=1;if($&&A.startDate&&A.endDate&&!I){let Se=new Date(A.startDate);Se.setHours(0,0,0,0);let st=new Date(A.endDate);st.setHours(0,0,0,0);let et=Math.max(1,(st.getTime()-Se.getTime())/(1e3*60*60*24)),tt=Math.min((ie.getTime()-Se.getTime())/(1e3*60*60*24),et)/et*100;H=tt>0?P/tt:1;}let fe;P>=100?fe="#00E5CC":I?fe="#4B5563":te&&P<100?fe="#EF4444":H>=.95?fe="#22C55E":H>=.8?fe="#F59E0B":fe="#EF4444";let me=Math.max(P/100*q,P>0?pt*2:0),ge=q>100&&P>0,pe=A.isCriticalPath;return jsxs("g",{onClick:()=>p?.(A),onContextMenu:Se=>{Se.preventDefault(),Se.stopPropagation(),m?.(A,Se);},onMouseMove:Se=>{Ye({task:A,x:ee,y:Ie,width:q,height:Q,showBelow:Ie<100,mouseX:Se.clientX,mouseY:Se.clientY});},onMouseLeave:()=>Ye(null),style:{cursor:"default",opacity:h?pe?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":P>=100?"completed":te?"overdue":"planned",children:[jsx("rect",{x:ee,y:He,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:ee,y:Ie,width:q,height:Q,rx:pt,fill:$e?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),P>0&&jsx("rect",{x:ee,y:Ie,width:me,height:Q,rx:pt,fill:fe,"data-parte":"avance"}),h&&pe&&jsx("rect",{x:ee,y:Ie,width:q,height:Q,rx:pt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),ge&&jsxs("text",{x:ee+me+6,y:Ie+Q/2,dominantBaseline:"central",fill:$e?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(P),"%"]})]},A.id)}return jsx(cc,{task:A,x:ee,y:He,width:q,theme:t,dayWidth:_*o,startDate:r,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:ba,onDragMove:Jt,onHoverChange:Ye,showBaseline:w,showTaskBarLabels:u,showCriticalPath:h,readOnly:M?!M(A):false,onProgressChange:z,v6:E,alturaBarra:de,duracionV6:E?`${xe(A)} d`:void 0,transversal:ia(A)},A.id)}),x&&Tt.map((A,Y)=>{let ee=Ns(A);return ee.length===0||!A.startDate||!A.endDate?null:ee.map(({id:q,type:He,lag:Ze})=>{let $e=Tt.find(et=>et.id===q);if(!$e||!$e.startDate||!$e.endDate)return null;let Q=Tt.findIndex(et=>et.id===q);if(D&&!Va(Q)&&!Va(Y)&&!(Math.min(Q,Y)<D.desde&&Math.max(Q,Y)>D.hasta))return null;let Ie=Ht($e.id,it($e)),pt=Ht(A.id,it(A)),P=He==="SS"||He==="SF",ie=He==="FF"||He==="SF",$=P?Ie.x:Ie.x+Ie.width,te=E?Q*a+a/2:Q*a+26,I=ie?pt.x+pt.width:pt.x,H=E?Y*a+a/2:Y*a+26,fe=`dep-${q}-${A.id}`;if(zt.has(fe))return null;let me=h&&A.isCriticalPath&&$e.isCriticalPath,ge=lt.get(`${q}>${A.id}`),pe=!!ge;return jsx(el,{x1:$,y1:te,x2:I,y2:H,theme:t,lineStyle:l,colorOverride:(pe?"var(--v6-ambar, #F59E0B)":h?me?"#EF4444":"rgba(255,255,255,0.10)":void 0)??(E?"var(--v6-dependencia, #8A939C)":void 0),strokeWidthOverride:(h?me?2:1:void 0)??(E?1:void 0),glowFilter:me?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,salidaPorInicio:P,entradaPorFin:ie,etiqueta:pe?`\u26A0 ${e0(He,Ze,i)??""}`.trim():e0(He,Ze,i),discontinua:pe,titulo:ge?vt(ge):void 0,atenuada:n==="month"&&!pe&&Math.abs(I-$)>240&&![Pe,ct?.task.id].some(et=>et!=null&&(et===q||et===A.id)),onDelete:()=>b?.(A.id,q),onHoverChange:et=>{Pt.current=et,et&&Rt({key:fe,fromId:q,toId:A.id,exitX:$,exitY:te,enterX:I,enterY:H,salidaPorInicio:P,entradaPorFin:ie});}},fe)})}),ce.map(A=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:A.previewX,y:A.y-R,width:A.width,height:18,rx:6,fill:A.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(A.daysDelta)>0&&jsx("text",{x:A.previewX+A.width/2,y:A.y-R+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:A.daysDelta>0?`+${A.daysDelta}d`:`${A.daysDelta}d`})]},`cascade-preview-${A.taskId}`)),x&&ut&&jsx(el,{x1:ut.exitX,y1:ut.exitY,x2:ut.enterX,y2:ut.enterY,theme:t,lineStyle:l,salidaPorInicio:ut.salidaPorInicio,entradaPorFin:ut.entradaPorFin,titulo:(()=>{let A=lt.get(`${ut.fromId}>${ut.toId}`);return A?vt(A):void 0})(),corregir:Mt(ut.fromId,ut.toId),onDelete:()=>{let A=ut.key;Rt(null),Pt.current=false,Ne(Y=>new Set(Y).add(A)),b?.(ut.toId,ut.fromId);},hoverOverlayOnly:true,onHoverChange:A=>{Pt.current=A,A||Rt(null);}},`${ut.key}-hover-overlay`),Te>=0&&Te<=he&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&!E&&jsx("line",{x1:Te,y1:0,x2:Te,y2:Wa,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:Te,y1:0,x2:Te,y2:Wa,stroke:t.today,strokeWidth:1,opacity:1})]}),[{fecha:V,clave:"planeado",texto:i==="es"?"Fin planeado":"Planned end",color:t.textTertiary||"#94A3B8"},{fecha:U,clave:"previsto",texto:i==="es"?"Fin previsto":"Expected end",color:"#F59E0B"}].map((A,Y,ee)=>{if(!A.fecha)return null;let q=((A.fecha.getTime()-r.getTime())/(1e3*60*60*24)+1)*_*o;if(q<0||q>he)return null;let He=ee[0]?.fecha,$e=4+(Y===1&&!!He&&Math.abs(He.getTime()-A.fecha.getTime())<864e5?16:0);return E?jsx("g",{"data-fin":A.clave,style:{pointerEvents:"none"},children:jsx("line",{x1:q,y1:0,x2:q,y2:Wa,style:{stroke:A.clave==="previsto"?Zt.tenue:"var(--v6-separador, #CDD2D8)"},strokeWidth:1,strokeDasharray:"4 3"})},A.clave):jsxs("g",{"data-fin":A.clave,style:{pointerEvents:"none"},children:[jsx("line",{x1:q,y1:0,x2:q,y2:Wa,stroke:A.color,strokeWidth:1.5,strokeDasharray:"5 4",opacity:.9}),jsx("rect",{x:q+3,y:$e,width:A.texto.length*5.6+10,height:14,rx:3,fill:t.bgPrimary||"#0F1115",opacity:.9}),jsx("text",{x:q+8,y:$e+10,fontSize:9,fontWeight:600,fill:A.color,style:{fontFamily:"Inter, sans-serif"},children:A.texto})]},A.clave)}),N&&Tt.map((A,Y)=>{if(!Va(Y)||!A.startDate||!A.endDate)return null;let ee=it(A),q=Jf(ee.x,ee.x+ee.width,N.izq,N.der),He=E&&A.subtasks?.length&&A.isExpanded===false?Gf(A):0;if(He>0){let P=`${q==="left"?"\u2039 ":""}${He} ${i==="es"?He===1?"vencida":"vencidas":"overdue"}${q==="right"?" \u203A":""}`,ie=P.length*6.6+16,$=q==="left"?N.izq+4:q==="right"?N.der-ie-4:ee.x+ee.width+8,te=Y*a+a/2-11;return jsxs("g",{"data-vencidas-del-grupo":He,style:{pointerEvents:q?"auto":"none",cursor:q&&S?"pointer":"default"},onClick:()=>{q&&S?.(A.startDate);},children:[jsx("title",{children:i==="es"?`${He} ${He===1?"tarea vencida":"tareas vencidas"} en \xAB${A.name}\xBB`:`${He} overdue in "${A.name}"`}),jsx("rect",{x:$,y:te,width:ie,height:22,rx:6,strokeWidth:1,style:{fill:"var(--v6-rojo-fondo, #FBE9EA)",stroke:"var(--v6-rojo-borde, rgba(192,48,58,0.75))"}}),jsx("text",{x:$+ie/2,y:te+11.5,textAnchor:"middle",dominantBaseline:"middle",style:{fill:"var(--v6-rojo, #B02A33)",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', ui-monospace, monospace"},children:P})]},`vencidas-${A.id}`)}if(!q)return null;let Ze=q==="left"?A.endDate:A.startDate,$e=q==="left"?`\u25C0 ${jn(Ze,i)}`:`${jn(Ze,i)} \u25B6`,Q=$e.length*5.8+10,Ie=q==="left"?N.izq+4:N.der-Q-4,pt=Y*a+a/2-8;if(E){let P=A.status!=="completed"&&(A.progress??0)<100&&A.endDate.getTime()<new Date(new Date().toDateString()).getTime(),ie=q==="left"?`\u2039 ${jn(Ze,i)}`:`${jn(Ze,i)} \u203A`,$=ie.length*6.6+16,te=q==="left"?N.izq+4:N.der-$-4,I=Y*a+a/2-11;return jsxs("g",{"data-fuera-de-vista":q,"data-vencida":P||void 0,role:"button",style:{cursor:S?"pointer":"default"},onClick:()=>S?.(A.startDate),children:[jsx("title",{children:i==="es"?`Ir a \xAB${A.name}\xBB${P?`, venci\xF3 el ${jn(Ze,i)}`:""}`:`Go to "${A.name}"`}),jsx("rect",{x:te,y:I,width:$,height:22,rx:6,strokeWidth:1,style:{fill:P?"var(--v6-rojo-fondo, #FBE9EA)":Zt.tarjeta,stroke:P?"var(--v6-rojo-borde, rgba(192,48,58,0.75))":Zt.borde}}),jsx("text",{x:te+$/2,y:I+11.5,textAnchor:"middle",dominantBaseline:"middle",style:{fill:P?"var(--v6-rojo, #B02A33)":Zt.texto2,fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', ui-monospace, monospace"},children:ie})]},`fuera-${A.id}`)}return jsxs("g",{"data-fuera-de-vista":q,style:{cursor:S?"pointer":"default"},onClick:()=>S?.(A.startDate),children:[jsx("title",{children:i==="es"?`\xAB${A.name}\xBB est\xE1 fuera de la vista: clic para ir`:`"${A.name}" is out of view: click to go`}),jsx("rect",{x:Ie,y:pt,width:Q,height:16,rx:8,fill:t.bgSecondary||"#1A1D21",stroke:t.border||"rgba(148,163,184,0.4)",strokeWidth:1,opacity:.95}),jsx("text",{x:Ie+Q/2,y:pt+11.5,fontSize:9.5,textAnchor:"middle",fill:t.textSecondary||"#94A3B8",style:{fontFamily:"Inter, sans-serif"},children:$e})]},`fuera-${A.id}`)})]}),E&&(()=>{let A=[U&&{clave:"previsto",fecha:U,texto:i==="es"?"Fin previsto":"Forecast finish"},V&&(!U||Math.abs(V.getTime()-U.getTime())>=864e5)&&{clave:"planeado",fecha:V,texto:i==="es"?"Fin planeado":"Planned finish"}].filter(Boolean);return A.length===0?null:jsx("div",{"aria-hidden":false,style:{position:"sticky",bottom:8,height:0,zIndex:6,pointerEvents:"none"},children:A.map((Y,ee)=>{let q=((Y.fecha.getTime()-r.getTime())/864e5+1)*_*o;return q<0||q>he?null:jsxs("div",{"data-bandera-fin":Y.clave,style:{position:"absolute",bottom:ee*28,left:q-8,transform:"translateX(-100%)",display:"flex",alignItems:"center",gap:6,padding:"3px 9px 3px 7px",border:"1px solid var(--v6-separador, #CDD2D8)",borderRadius:999,background:Zt.tarjeta,color:Zt.texto2,fontSize:11,fontWeight:500,whiteSpace:"nowrap"},children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",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("path",{d:"M4 22v-7"})]}),Y.texto," \xB7 ",jn(Y.fecha,i)]},Y.clave)})})})(),ct&&jsx(Kf,{tooltipData:ct,theme:t,locale:i==="es"?"es":"en",workingDaysConfig:L})]})}var $k=['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"'],t0=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Ok=()=>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"})}),Hk=()=>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"})}),Wk=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),zk=()=>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 Cc({tasks:e,theme:t,config:a,onTasksUpdate:n,onTaskUpdate:r,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:i,onDependencyDelete:c}){let[l,u]=useState(false),[p,d]=useState(false),[m,f]=useState([]),[v,b]=useState(""),[w,h]=useState(false),[x,y]=useState(true),[k,M]=useState(""),[z,L]=useState(-1),[N,D]=useState(false),[S,V]=useState(0),U=useRef(null),W=useRef(null),E=useRef(null),Pe=useRef(null),{enabled:J=true,placeholder:de='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:Ae,suggestions:nt=$k,maxHistory:Ge=50,persistHistory:B,mentionableUsers:ce=[]}=a,oe=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",gt=oe?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Je=oe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",ct=oe?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",ft=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ut=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Rt=oe?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",lt=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",vt=oe?"rgba(0, 229, 204, 0.9)":"#00E5CC",Mt=oe?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Pt=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",zt=oe?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",Ne=oe?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ot=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",wt=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Ut=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ye=oe?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",qe=oe?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",_=oe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",he=oe?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",Z=oe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",ze="rgba(0, 229, 204, 0.04)",Me=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",Ve=oe?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",O=oe?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",xe=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Be=oe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Qe=oe?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ft=oe?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Xe=oe?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Tt="rgba(0, 229, 204, 0.06)",it=oe?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",ba=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Jt=oe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ht=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",we=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Te=oe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",dt=oe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",ht=oe?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",jt=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Dt=oe?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",la=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ha=oe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ha=oe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Zt=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Wa=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Va=B?.storageKey||"gantt-ai-history",xn=B?.maxMessages??5,ia=ce.filter(Q=>{if(!k)return true;let Ie=k.toLowerCase();return Q.name.toLowerCase().includes(Ie)||Q.email&&Q.email.toLowerCase().includes(Ie)}).slice(0,5),vn=useCallback(Q=>{if(b(Q),ce.length===0)return;let Ie=U.current;if(!Ie)return;let pt=Ie.selectionStart||Q.length,P=Q.slice(0,pt),ie=P.lastIndexOf("@");if(ie>=0&&((ie>0?P[ie-1]:" ")===" "||ie===0)){let te=P.slice(ie+1);if(te.length<=40){M(te),L(ie),D(true),V(0);return}}D(false),M(""),L(-1);},[ce.length]),A=useCallback(Q=>{let Ie=v.slice(0,z),pt=v.slice(z+1+k.length),P=`${Ie}@${Q.name} ${pt}`;b(P),D(false),M(""),L(-1),setTimeout(()=>U.current?.focus(),0);},[v,z,k]),Y=useCallback(Q=>{if(!N||ia.length===0)return false;if(Q.key==="ArrowDown")return Q.preventDefault(),V(Ie=>Ie<ia.length-1?Ie+1:0),true;if(Q.key==="ArrowUp")return Q.preventDefault(),V(Ie=>Ie>0?Ie-1:ia.length-1),true;if(Q.key==="Enter"||Q.key==="Tab"){Q.preventDefault();let Ie=ia[S];return Ie&&A(Ie),true}return Q.key==="Escape"?(D(false),true):false},[N,ia,S,A]);useEffect(()=>{if(B?.enabled)try{let Q=localStorage.getItem(Va);if(Q){let pt=JSON.parse(Q).map(P=>({...P,timestamp:new Date(P.timestamp)}));f(pt.slice(-xn));}}catch(Q){console.warn("[GanttAIAssistant] Failed to load persisted history:",Q);}},[B?.enabled,Va,xn]),useEffect(()=>{if(B?.enabled&&m.length>0)try{let Q=m.filter(Ie=>!Ie.isLoading).slice(-xn);localStorage.setItem(Va,JSON.stringify(Q));}catch(Q){console.warn("[GanttAIAssistant] Failed to persist history:",Q);}},[m,B?.enabled,Va,xn]),useEffect(()=>{W.current&&W.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{l&&!p&&U.current&&setTimeout(()=>U.current?.focus(),100);},[l,p]);let ee=useCallback(Q=>{if(Q.success)switch(Q.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":Q.taskId&&Q.updates&&r?.(Q.taskId,Q.updates);break;case "create_task":Q.newTask&&s?.(Q.newTask);break;case "delete_task":Q.taskId&&o?.(Q.taskId);break;case "link_tasks":Q.dependencyFrom&&Q.dependencyTo&&i?.(Q.dependencyFrom,Q.dependencyTo);break;case "unlink_tasks":Q.taskId&&Q.dependencyFrom&&c?.(Q.taskId,Q.dependencyFrom);break}},[r,s,o,i,c]),q=useCallback(async Q=>{if(!Q.trim()||w)return;let Ie={id:`user-${Date.now()}`,role:"user",content:Q,timestamp:new Date};f(P=>[...P.slice(-(Ge-1)),Ie]),b(""),y(false),h(true);let pt={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(P=>[...P,pt]);try{if(Ae){let P=m.filter($=>!$.isLoading&&$.content).slice(-6).map($=>({role:$.role,content:$.content})),ie=await Ae(Q,e,P);f($=>{let te=$.filter(H=>!H.isLoading),I={id:`assistant-${Date.now()}`,role:"assistant",content:ie.message,timestamp:new Date,command:ie};return [...te,I]}),ee(ie);}else f(P=>[...P.filter($=>!$.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(P){f(ie=>[...ie.filter(te=>!te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[w,Ge,Ae,e,ee]),He=Q=>{Q.preventDefault(),q(v);},Ze=Q=>{b(Q),U.current?.focus();};if(useEffect(()=>{let Q=Ie=>{(Ie.metaKey||Ie.ctrlKey)&&Ie.key==="k"&&(Ie.preventDefault(),u(pt=>!pt),l||d(false)),Ie.key==="Escape"&&l&&u(false);};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[l]),useEffect(()=>{if(!l)return;let Q=pt=>{let P=pt.target;E.current&&!E.current.contains(P)&&u(false);},Ie=setTimeout(()=>{document.addEventListener("mousedown",Q);},100);return ()=>{clearTimeout(Ie),document.removeEventListener("mousedown",Q);}},[l]),!J)return null;let $e={"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(Fa,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${$e[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:gt,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Je}`,color:"#00E5CC",cursor:"pointer",boxShadow:ct,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${ft}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ut}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(t0,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:vt,background:Rt,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${lt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:u?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ce[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ie,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${zt}`,boxShadow:st},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:bt,borderBottom:`1px solid ${Ee}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Dt,border:`1px solid ${ht}`,color:"#00E5CC"},children:jsx(yg,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:_e},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=L;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=dt;},children:jsx(Iw,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=L;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=dt;},children:jsx(Aw,{})})]})]}),jsx(AnimatePresence,{children:!u&&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:[m.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:xe,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:G.slice(0,4).map((B,re)=>jsx("button",{onClick:()=>pe(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:I,color:ke,border:`1px solid ${j}`},onMouseEnter:be=>{be.currentTarget.style.borderColor=Ue,be.currentTarget.style.color="#00E5CC";},onMouseLeave:be=>{be.currentTarget.style.borderColor=j,be.currentTarget.style.color=ke;},children:B.length>30?B.slice(0,30)+"...":B},re))})]}),m.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"?ue:yt,color:B.role==="user"?"#00E5CC":vt,border:B.role==="user"?`1px solid ${at}`:`1px solid ${Ye}`},children:[B.isLoading?jsx(Rw,{}):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.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:Y})]}),jsxs("form",{onSubmit:B=>{if(D&&dr.length>0){B.preventDefault();return}q(B);},className:"p-3 relative",style:{borderTop:`1px solid ${Xt}`},children:[jsx(AnimatePresence,{children:D&&dr.length>0&&jsx(motion.div,{ref:Se,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Tt,border:`1px solid ${Ft}`,boxShadow:kt,backdropFilter:"blur(12px)"},children:dr.map((B,re)=>jsxs("button",{type:"button",onClick:()=>Ra(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:re===N?Da:"transparent",color:aa},onMouseEnter:()=>z(re),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Xe,border:`1px solid ${et}`,color:"#00E5CC"},children:B.name.split(" ").map(be=>be[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsx("div",{className:"text-xs truncate",style:{color:cr},children:B.email})]})]},B.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:wt,border:`1px solid ${Ut}`},children:[jsx("input",{ref:$,type:"text",value:v,onChange:B=>xr(B.target.value),onKeyDown:B=>{Ja(B);},placeholder:Ce,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Ht,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?he:"transparent",color:v.trim()?"#00E5CC":Qe,border:v.trim()?`1px solid ${Fe}`:"1px solid transparent"},children:jsx(Lw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:rt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function xg(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((l,p=true)=>{r(u=>{let d=typeof l=="function"?l(u.present):l;if(n.current)return {...u,present:d};if(!p)return {...u,present:d};let m=[...u.past,u.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],u=l.past.slice(0,l.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:u,present:p,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],u=l.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...l.past,l.present],present:p,future:u}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function vg({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!i&&c&&o.key==="y"){o.preventDefault(),t();return}if(i&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Hw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Me.formatDate(e.startDate)} - ${Me.formatDate(e.endDate)}`);let a=Me.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function wg(e){return {...Hw,...e}}var Kw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dg=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,onExportSuccess:p,projectName:u,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:b,persistColumns:h,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:C,showCreateTaskButton:P=false,createTaskLabel:O,onCreateTask:T,taskFilter:D,onTaskFilterChange:M,toolbarRightContent:N,toolbarContainer:z,hideWbsLevel:$,showBaseline:Y,viewMode:A,onViewModeChange:Se,projectForecast:W,hideForecastHud:Ce,onThemeChange:R,onTaskClick:we,onTaskSelectionChange:G,selectedTaskId:Ve,onTaskDblClick:oe,onTaskContextMenu:Be,onTaskUpdate:le,onDependentTasksScheduled:He,onProgressChange:$e,onTaskEdit:Pe,onTaskAddSubtask:je,onTaskMarkIncomplete:tt,onTaskSetInProgress:ee,onDependencyCreate:Ae,onDependencyDelete:ot,onBeforeTaskAdd:Ie,onAfterTaskAdd:zt,onBeforeTaskUpdate:st,onAfterTaskUpdate:bt,onBeforeTaskDelete:Ee,onAfterTaskDelete:Dt,permissions:ht,onCopySnapshotLink:_e}=a,L=useContext(pl)?.theme,[J,xe]=useState(L||s||"dark"),[I,j]=useState(o),[ke,Ue]=useState(i),[ue,at]=useState(1),[yt,Ye]=useState("all"),[vt,Xt]=useState(A||"execution"),wt=A??vt,Ut=useCallback(E=>{Xt(E),Se?.(E);},[Se]),Ht=Y??wt==="oracle",[he,Fe]=useState(a.showCriticalPath!==false),[Qe,rt]=useState(a.showDependencies!==false),[Tt,Ft]=useState(a.highlightWeekends!==false),kt=useCallback(E=>{Fe(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),Da=useCallback(E=>{rt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),aa=useCallback(E=>{Ft(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(I);},[I]),useEffect(()=>{a.onZoomChange?.(ue);},[ue]);let cr=useRef(a.onDateRangeChange);cr.current=a.onDateRangeChange;let Xe=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[et,Sa]=useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let U=JSON.parse(F);if(U.taskFilter)return U.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Ia=D??et,dr=M??Sa,[xr,Ra]=useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let U=JSON.parse(F);if(typeof U.hideCompleted=="boolean")return U.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=Xe();if(E)try{let F={taskFilter:Ia,hideCompleted:xr};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[Ia,xr,Xe]);let Ja=useRef(y);useEffect(()=>{if(Ja.current!==y&&y!==void 0){Sa("all"),Ra(false);let E=Xe();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}Ja.current=y;},[y,Xe]);let[se,me]=useState(0),[q,pe]=useState(false),[ce,B]=useState(null),[re,be]=useState({isOpen:false,x:0,y:0,task:null}),[S,H]=useState(null),[Z,Te]=useState(null);useEffect(()=>{L&&L!==J&&xe(L);},[L]),useEffect(()=>{s&&s!==J&&xe(s);},[s]);let gt=useCallback(E=>{xe(E),R?.(E);},[R]),{state:fe,setState:Ne,undo:ye,redo:lt,canUndo:Et,canRedo:Qt,clearHistory:ja}=xg(t,50),Er=useMemo(()=>{let E=(F,U=0)=>{let K=U;for(let ie of F)ie.subtasks?.length&&(K=Math.max(K,E(ie.subtasks,U+1)));return K};return E(fe)+1},[fe]),_a=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),Mr=useRef(new Map),xa=useRef(false);if(!xa.current&&v){xa.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let U=JSON.parse(F);Array.isArray(U)&&(Mr.current=new Map(U));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let On=useCallback(()=>{let E=_a();if(E)try{let F=Array.from(Mr.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[_a]),Vr=useRef(0),Rs=useRef(fe);useEffect(()=>{Rs.current=fe;},[fe]);let Xr=useRef(false),Pi=useCallback(E=>{Ye(E),Vr.current+=1,Ne(F=>{let U=(ie,ge=0)=>ie.map(Ge=>{let ze=E==="all"||ge<E-1;return Ge.subtasks?.length&&Mr.current.set(Ge.id,ze),{...Ge,isExpanded:ze,subtasks:Ge.subtasks?U(Ge.subtasks,ge+1):void 0}}),K=U(F);return On(),K});},[Ne,On]);useEffect(()=>{if(Vr.current>0){Vr.current-=1;return}let E=U=>{let K=new Map;for(let ie of U){let ge=ie.id;K.get(ge)||K.set(ge,ie);}return Array.from(K.values())},F=U=>U.map(K=>{let ie=Mr.current.get(K.id),ge=ie!==void 0?{...K,isExpanded:ie}:K;if(ge.subtasks?.length){let Ge=E(ge.subtasks);return {...ge,subtasks:F(Ge)}}return ge});if(Mr.current.size>0)Ne(tn(F(t)));else {let U=K=>K.map(ie=>ie.subtasks?.length?{...ie,subtasks:E(U(ie.subtasks))}:ie);Ne(tn(U(t)));}},[t,Ne]);let Qo=useRef(t),Fi=useRef(true);useEffect(()=>{if(Fi.current){Fi.current=false,Qo.current=fe;return}if(Xr.current){Xr.current=false,Qo.current=fe;return}if(!r)return;let E=JSON.stringify(Qo.current),F=JSON.stringify(fe);E!==F&&(Qo.current=fe,r(fe));},[fe,r]);let Qa=useMemo(()=>bd(w,C),[w,C]),Bs=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),eo=a.defaultVisibleColumns,$s=useCallback(E=>eo?E.map(F=>F.id==="name"?F:{...F,visible:eo.includes(F.id)}):E,[eo]),vr=useMemo(()=>h?typeof h=="string"?h:"gantt-columns-state":null,[h]),[Jr,Hn]=useState(()=>{let E=$s(Bs(Qa));if(!h)return E;try{let F=typeof h=="string"?h:"gantt-columns-state",U=localStorage.getItem(F);if(!U)return E;let K=JSON.parse(U),ie=new Map(K.map(ge=>[ge.id,ge]));return E.map(ge=>{let Ge=ie.get(ge.id);return Ge?{...ge,visible:Ge.visible??ge.visible,width:Ge.width??ge.width}:ge})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Os=useRef(vr);useEffect(()=>{if(Os.current===vr)return;Os.current=vr;let E=$s(Bs(Qa));if(!vr){Hn(E);return}try{let F=localStorage.getItem(vr);if(!F){Hn(E);return}let U=JSON.parse(F),K=new Map(U.map(ie=>[ie.id,ie]));Hn(E.map(ie=>{let ge=K.get(ie.id);return ge?{...ie,visible:ge.visible??ie.visible,width:ge.width??ie.width}:ie}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),Hn(E);}},[vr,Bs,Qa]),useEffect(()=>{if(vr&&Os.current===vr)try{let E=Jr.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(vr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Jr,vr]),useEffect(()=>{Hn(E=>E.map(F=>({...F,label:Qa.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Qa]);let cn=useMemo(()=>Jr.filter(F=>F.visible).reduce((F,U)=>F+U.width,0),[Jr]),Hs=useRef(Jr.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=Jr.filter(K=>K.visible),F=E.map(K=>K.id).join(","),U=Hs.current;if(F!==U){let K=E.some(ge=>ge.id!=="name"),ie=U.includes(",");K?!ie&&K&&B(null):B(null),Hs.current=F;}},[Jr]);let Li=60,Un=.6,Ai=useMemo(()=>{let F=cn+Li,U=typeof window<"u"?window.innerWidth*Un:800,K=Math.max(F,U);return ce!==null?Math.max(200,Math.min(ce,K)):Math.max(200,F)},[ce,cn]),$r=useRef(null),Zo=useRef(null),wr=useRef(null),No=useRef(null),Do=useRef(null),oa=useMemo(()=>Om(J),[J]),dc=useMemo(()=>({theme:oa,themeName:J}),[oa,J]),Us=useMemo(()=>wg(m),[m]),es=useMemo(()=>{if(!f||!he)return fe;let E=Me.calculateCriticalPathFull(fe),F=U=>U.map(K=>{let ie=E.get(K.id),ge=K.subtasks?F(K.subtasks):void 0,Ge=ge?.some(It=>It.isCriticalPath||It.subtasks&&It.subtasks.some(Gt=>Gt.isCriticalPath))||false,ze=ie?ie.isCritical:Ge;return {...K,isCriticalPath:ze,cpmData:ie||void 0,subtasks:ge}});return F(fe)},[fe,f,he]),Ws=useMemo(()=>Me.flattenTasks(fe).some(F=>F.dependencies&&F.dependencies.length>0),[fe]),Wn=useMemo(()=>{let E=(F,U="")=>[...F].sort((ie,ge)=>(ie.position??0)-(ge.position??0)).map((ie,ge)=>{let Ge=ge+1,ze=U?`${U}.${Ge}`:`${Ge}.0`,It=U?`${U}.${Ge}`:`${Ge}`;return {...ie,wbsCode:ze,subtasks:ie.subtasks?.length?E(ie.subtasks,It):ie.subtasks}});return E(es)},[es]),k=(a.searchQuery??"").trim(),_=useMemo(()=>{let E=ie();if(!k)return E;let F=ge=>ge.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),U=F(k),K=ge=>{let Ge=[];for(let ze of ge){if(F(ze.name||"").includes(U)){Ge.push(ze);continue}let It=ze.subtasks?.length?K(ze.subtasks):[];It.length&&Ge.push({...ze,subtasks:It});}return Ge};return K(E);function ie(){if(Ia==="all"&&!xr)return Wn;let ge=Ge=>{let ze=[];for(let It of Ge){let Gt=It.subtasks?.length?ge(It.subtasks):void 0,qt=false;if(xr)qt=It.progress<100&&It.status!=="completed";else switch(Ia){case "all":qt=true;break;case "incomplete":qt=It.progress<100;break;case "in_progress":qt=It.progress>0&&It.progress<100;break;case "completed":qt=It.progress===100;break}(qt||Gt&&Gt.length>0)&&ze.push({...It,subtasks:Gt});}return ze};return ge(Wn)}},[Wn,Ia,xr,k]),X=Kw(ke);vg({undo:ye,redo:lt,canUndo:Et,canRedo:Qt,enabled:true});let ne=useRef(null),de=(E,F="start")=>{let U=wr.current,K=Do.current;if(!U||!K)return;let ie=(E.getTime()-K.startDate.getTime())/(1e3*60*60*24),ge=K.timeScale==="day"?60:K.timeScale==="week"?20:8,Ge=ie*ge*K.zoom,ze=F==="center"?Ge-U.clientWidth/2:Ge-ge*K.zoom*2;U.scrollTo({left:Math.max(0,ze),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:E=>Me.findTaskById(fe,E),addTask:(E,F)=>{Ne(U=>{if(!F)return [...U,{...E,level:0}];let K=ie=>ie.map(ge=>ge.id===F?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:F,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(U)});},updateTask:(E,F)=>{Ne(U=>{let K=ie=>ie.map(ge=>ge.id===E?{...ge,...F}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(U)});},deleteTask:E=>{Ne(F=>{let U=K=>K.filter(ie=>ie.id===E?false:(ie.subtasks&&(ie.subtasks=U(ie.subtasks)),true));return U(F)});},deleteTasks:E=>{Ne(F=>Ed(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=Me.findTaskById(fe,E);F&&a.onTaskDuplicate(F);}else Ne(F=>ci(F,[E]).tasks);},splitTask:(E,F,U=3)=>{Ne(K=>Me.splitTask(K,E,F,U));},calculateEndDate:Me.calculateEndDate,calculateDuration:Me.calculateDuration,validateDependency:(E,F)=>!Me.validateDependencies(fe,E,F),getAllTasks:()=>Me.flattenTasks(fe),getTasksByStatus:E=>Me.flattenTasks(fe).filter(F=>F.status===E),getTasksByParent:E=>E?Me.findTaskById(fe,E)?.subtasks||[]:fe.filter(U=>!U.parentId),getCriticalPath:()=>Me.flattenTasks(fe).filter(E=>E.isCriticalPath),indentTask:E=>{Ne(F=>tn(Nd(F,[E])));},outdentTask:E=>{Ne(F=>tn(Dd(F,[E])));},moveTask:(E,F)=>{Ne(U=>Sd(U,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:U}=Fd(fe,E);if(Ie){let K=Ie({...U,parentId:E});if((K instanceof Promise?await K:K)===false)return}Ne(tn(F)),zt&&zt({...U,parentId:E});},scrollToTask:E=>{let U=Me.flattenTasks(fe).findIndex(K=>K.id===E);if(U!==-1&&$r.current){let K=U*X;$r.current.scrollTo({top:K,behavior:"smooth"}),wr.current&&wr.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{Ne(F=>{let U=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie);return U(F)});},collapseTask:E=>{Ne(F=>{let U=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie);return U(F)});},expandAll:()=>{Ne(E=>{let F=U=>U.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseAll:()=>{Ne(E=>{let F=U=>U.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{Pi(E);},undo:ye,redo:lt,canUndo:()=>Et,canRedo:()=>Qt,clearHistory:ja,exportToPNG:async()=>{if(!No.current||!$r.current||!wr.current)throw new Error("Gantt container not found");let E=No.current,F=$r.current,U=Zo.current||F.querySelector(".gantt-grid-scroll"),K=wr.current,ie=U?.scrollTop||0,ge=K.scrollTop,Ge=E.style.overflow,ze=E.style.height,It=F.style.overflow;try{let Gt=U?.querySelector(".gantt-taskgrid-content"),qt=K.querySelector("svg"),br=Gt?.scrollHeight||U?.scrollHeight||600,jr=qt?.getBoundingClientRect().height||K.scrollHeight,So=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(br,jr)+20;U&&(U.scrollTop=0),K.scrollTop=0,E.style.overflow="visible",E.style.height=`${So}px`,F.style.overflow="visible",await new Promise(ns=>setTimeout(ns,100));let En=await toPng(E,{backgroundColor:oa.bgPrimary,pixelRatio:2,filter:ns=>{if(!(ns instanceof Element))return !0;let Ii=window.getComputedStyle(ns),Gs=parseInt(Ii.zIndex,10);return (isNaN(Gs)||Gs<50)&&Ii.position!=="fixed"}});return await(await fetch(En)).blob()}finally{E.style.overflow=Ge,E.style.height=ze,F.style.overflow=It,U&&(U.scrollTop=ie),K.scrollTop=ge;}},exportToPDF:async E=>{await Me.exportToPDF(fe,E);},exportToExcel:async E=>{await Me.exportToExcel(fe,E,pc.current);},exportToJSON:()=>Me.exportToJSON(fe),exportToCSV:()=>Me.exportToCSV(fe),importFromJSON:E=>{let F=Me.importFromJSON(E);Ne(F);},getTasks:()=>fe,refresh:()=>{Ne(E=>[...E]);},clearAll:()=>{Ne([]);},scrollToDate:(E,F="start")=>de(E,F),fitToDates:(E,F)=>{let U=Math.max(1,(F.getTime()-E.getTime())/864e5),K=U<=21?"day":U<=122?"week":"month";ne.current=E,j(K),K===Do.current?.timeScale&&requestAnimationFrame(()=>{let ie=ne.current;ne.current=null,ie&&de(ie);});},scrollToToday:()=>{let E=wr.current,F=Do.current;if(!E||!F)return;let K=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),ie=F.timeScale==="day"?60:F.timeScale==="week"?20:8,ge=K*ie*F.zoom,Ge=E.clientWidth,ze=Math.max(0,ge-Ge/2);E.scrollTo({left:ze,behavior:"smooth"});}}),[fe,ye,lt,Et,Qt,ja,oa,X]);let We=useCallback(E=>{Hn(F=>F.map(U=>U.id===E?{...U,visible:!U.visible}:U));},[]),Q=useCallback((E,F)=>{Hn(U=>U.map(K=>{if(K.id!==E)return K;let ie=K.minWidth??100,ge=K.maxWidth??800,Ge=Math.max(ie,Math.min(ge,F));return {...K,width:Ge}}));},[]),De=useCallback(E=>{Ne(F=>{let U=Pd(F,E),K=ie=>{for(let ge of ie){if(ge.id===E){Mr.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&K(ge.subtasks);}};return K(U),On(),U}),a.onTaskToggleExpand?.(E);},[a,On]),Re=useCallback((E,F)=>{if(st&&st(E,F)===false)return;let K=Me.findTaskById(fe,E)?.progress,ie=Ge=>Ge.map(ze=>ze.id===E?{...ze,...F}:ze.subtasks?{...ze,subtasks:ie(ze.subtasks)}:ze);Ne(Ge=>ie(Ge));let ge=Me.findTaskById(ie(fe),E);ge&&(le?.(ge),bt?.(ge),F.progress!==void 0&&K!==void 0&&F.progress!==K&&$e?.(E,K,F.progress));},[fe,le,st,bt,$e]),Ke=useCallback((E,F,U)=>{if(E.length===0)return;let K=new Set(E),ie=ge=>ge.map(Ge=>{let ze=K.has(Ge.id)?{...Ge,[F]:U}:Ge;return ze.subtasks?{...ze,subtasks:ie(ze.subtasks)}:ze});Ne(ge=>{let Ge=ie(ge);return a.onBulkFill?.(E,F,U,Ge),Ge});},[a]),$t=useCallback(E=>{E.length!==0&&(Vr.current+=1,Xr.current=true,Ne(F=>tn(Nd(F,E))),a.onTaskIndent?.(E[0]));},[a]),ut=useCallback(E=>{E.length!==0&&(Vr.current+=1,Xr.current=true,Ne(F=>tn(Dd(F,E))),a.onTaskOutdent?.(E[0]));},[a]),ct=useCallback((E,F,U)=>{Vr.current+=1,Xr.current=true,Ne(K=>tn(og(K,E,F,U))),a.onTaskReparent?.(E,F,U);},[a]),Zt=useCallback((E,F)=>{E.length!==0&&(Vr.current+=1,Xr.current=true,Ne(U=>Sd(U,E,F)),a.onTaskMove?.(E[0],F));},[a]),it=useCallback(async E=>{let F=[];for(let U of E)Ee&&await Promise.resolve(Ee(U))===false||F.push(U);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Ne(U=>tn(Ed(U,F))),F.forEach(U=>a.onTaskDelete?.(U))),Dt&&F.forEach(U=>Dt(U)));},[a,Ee,Dt]),ea=useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let U=Me.findTaskById(fe,F);U&&a.onTaskDuplicate(U);}):Ne(F=>ci(F,E).tasks);},[a,fe]),xt=useCallback((E,F)=>{Ne(U=>{let{tasks:K,newTask:ie}=ng(U,E,F);return Ie&&Ie(ie)===false?U:(a.onTaskCreate?.(ie.parentId,ie.position||0),zt?.(ie),K)});},[a,Ie,zt]),Lt=useCallback((E,F)=>{Ne(U=>Md(U,E,F)),a.onTaskRename?.(E,F);},[a]),pt=useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let U=xs(fe,E);if(U){F(U);return}}Ne(U=>{let{tasks:K}=Fd(U,E);return a.onTaskCreate?.(E,0),K});},[a,fe]),At=useCallback((E,F)=>{let U=Math.max(0,Math.min(100,Math.round(F))),K={progress:U};U===100?K.status="completed":U>0?K.status="in-progress":K.status="todo",Re(E.id,K);},[Re]),Ba=useCallback((E,F,U)=>{let K=!E.startDate&&!E.endDate,ie=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=Gt=>Gt.map(qt=>qt.id===E.id?{...qt,startDate:F,endDate:U,...E.segments&&{segments:E.segments}}:qt.subtasks?{...qt,subtasks:ge(qt.subtasks)}:qt),Ge=ge(fe),ze=Ge;Ge=Me.autoScheduleDependents(Ge,E.id,ie),Ge=tn(Ge),Ne(Ge);let It={...E,startDate:F,endDate:U};if(K&&a?.onTaskDateChange?a.onTaskDateChange(E,F,U):le?.(It),He&&ie!==0){let Gt=Me.flattenTasks(ze),qt=Me.flattenTasks(Ge),br=[];for(let jr of qt){if(jr.id===E.id)continue;let ao=Gt.find(En=>En.id===jr.id);if(!ao)continue;let rs=jr.startDate?.getTime()!==ao.startDate?.getTime(),So=jr.endDate?.getTime()!==ao.endDate?.getTime();(rs||So)&&br.push(jr);}br.length>0&&He(br);}},[fe,le,He,a]),kr=useCallback((E,F)=>{Be?.(E,F),be({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Be]),Pr=useCallback((E,F)=>{let U=Me.splitTask(fe,E.id,F);Ne(U),be({isOpen:false,x:0,y:0,task:null});},[fe]),ur=useCallback(E=>{let F=Me.findTaskById(fe,E.id)||E;oe?.(F),Pe||H(F);},[fe,oe,Pe]),Ka=useCallback((E,F,U)=>{let K=new Map,ie=Gt=>{Gt.forEach(qt=>{qt.dependencies&&K.set(qt.id,qt.dependencies),qt.subtasks&&ie(qt.subtasks);});};ie(U);let ge=K.get(F)||[];K.set(F,[...ge,E]);let Ge=new Set,ze=new Set,It=Gt=>{if(!Ge.has(Gt)){Ge.add(Gt),ze.add(Gt);let qt=K.get(Gt)||[];for(let br of qt){if(!Ge.has(br)&&It(br))return true;if(ze.has(br))return true}}return ze.delete(Gt),false};return It(F)},[]),to=useCallback((E,F)=>{if(Ka(E.id,F,Rs.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:E,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${$e[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Mt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Pt}`,boxShadow:zt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ne,borderBottom:`1px solid ${Ot}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:wt,border:`1px solid ${Ut}`,color:"#00E5CC"},children:jsx(t0,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ye},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d(Q=>!Q),className:"p-1.5 rounded-lg transition-colors",style:{color:qe},onMouseEnter:Q=>{Q.currentTarget.style.background=he,Q.currentTarget.style.color=_;},onMouseLeave:Q=>{Q.currentTarget.style.background="transparent",Q.currentTarget.style.color=qe;},children:jsx(Wk,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:qe},onMouseEnter:Q=>{Q.currentTarget.style.background=he,Q.currentTarget.style.color=_;},onMouseLeave:Q=>{Q.currentTarget.style.background="transparent",Q.currentTarget.style.color=qe;},children:jsx(Hk,{})})]})]}),jsx(AnimatePresence,{children:!p&&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:[m.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:Z,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:nt.slice(0,4).map((Q,Ie)=>jsx("button",{onClick:()=>Ze(Q),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:ze,color:Ve,border:`1px solid ${Me}`},onMouseEnter:pt=>{pt.currentTarget.style.borderColor=O,pt.currentTarget.style.color="#00E5CC";},onMouseLeave:pt=>{pt.currentTarget.style.borderColor=Me,pt.currentTarget.style.color=Ve;},children:Q.length>30?Q.slice(0,30)+"...":Q},Ie))})]}),m.map(Q=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${Q.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${Q.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:Q.role==="user"?xe:Qe,color:Q.role==="user"?"#00E5CC":Xe,border:Q.role==="user"?`1px solid ${Be}`:`1px solid ${Ft}`},children:[Q.isLoading?jsx(zk,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:Q.content}),Q.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:Q.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:Q.command.success?"#10B981":"#EF4444",border:`1px solid ${Q.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[Q.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:Q.command.type.replace(/_/g," ")})]})]})},Q.id)),jsx("div",{ref:W})]}),jsxs("form",{onSubmit:Q=>{if(N&&ia.length>0){Q.preventDefault();return}He(Q);},className:"p-3 relative",style:{borderTop:`1px solid ${Tt}`},children:[jsx(AnimatePresence,{children:N&&ia.length>0&&jsx(motion.div,{ref:Pe,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:ht,border:`1px solid ${jt}`,boxShadow:Dt,backdropFilter:"blur(12px)"},children:ia.map((Q,Ie)=>jsxs("button",{type:"button",onClick:()=>A(Q),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Ie===S?la:"transparent",color:ha},onMouseEnter:()=>V(Ie),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Zt,border:`1px solid ${Wa}`,color:"#00E5CC"},children:ma(Q.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:Q.name}),Q.email&&jsx("div",{className:"text-xs truncate",style:{color:Ha},children:Q.email})]})]},Q.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:it,border:`1px solid ${ba}`},children:[jsx("input",{ref:U,type:"text",value:v,onChange:Q=>vn(Q.target.value),onKeyDown:Q=>{Y(Q);},placeholder:de,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Jt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?Ht:"transparent",color:v.trim()?"#00E5CC":Te,border:v.trim()?`1px solid ${we}`:"1px solid transparent"},children:jsx(Ok,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:dt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function a0(e,t=50){let[a,n]=useState({past:[],present:e,future:[]}),r=useRef(false),s=useCallback((l,u=true)=>{n(p=>{let d=typeof l=="function"?l(p.present):l;if(r.current)return {...p,present:d};if(!u)return {...p,present:d};let m=[...p.past,p.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=useCallback(()=>{n(l=>{if(l.past.length===0)return l;let u=l.past[l.past.length-1],p=l.past.slice(0,l.past.length-1);return r.current=true,setTimeout(()=>{r.current=false;},0),{past:p,present:u,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{n(l=>{if(l.future.length===0)return l;let u=l.future[0],p=l.future.slice(1);return r.current=true,setTimeout(()=>{r.current=false;},0),{past:[...l.past,l.present],present:u,future:p}});},[]),c=useCallback(()=>{n(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function n0({undo:e,redo:t,canUndo:a,canRedo:n,enabled:r=true}){useEffect(()=>{if(!r)return;let s=o=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(n){if(!i&&c&&o.key==="y"){o.preventDefault(),t();return}if(i&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,n,r]);}var Gk={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Re.formatDate(e.startDate)} - ${Re.formatDate(e.endDate)}`);let a=Re.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(n=>n.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=>Re.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function r0(e){return {...Gk,...e}}var Zk=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},l0=forwardRef(function({tasks:t,config:a={},onTasksChange:n},r){let{theme:s,timeScale:o="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:b,persistColumns:w,clearFiltersKey:h,aiAssistant:x,locale:y="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:z,onCreateTask:L,taskFilter:N,onTaskFilterChange:D,toolbarRightContent:S,toolbarContainer:V,hideWbsLevel:U,disenoV6:W,masOpcionesDeLaBarra:E,contenidoDeVista:Pe,leyendaVisible:J,onLeyendaVisibleChange:de,onRowDensityChange:R,showBaseline:Ae,onShowBaselineChange:nt,viewMode:Ge,onViewModeChange:B,projectForecast:ce,hideForecastHud:oe,currencyCode:gt,onThemeChange:Je,onTaskClick:ct,onTaskSelectionChange:ft,selectedTaskId:ut,onTaskDblClick:Rt,onTaskContextMenu:lt,onTaskUpdate:vt,onDependentTasksScheduled:Mt,onProgressChange:Pt,onTaskEdit:zt,onTaskAddSubtask:Ne,onTaskMarkIncomplete:Ot,onTaskSetInProgress:wt,onDependencyCreate:Ut,onDependencyDelete:Ye,onBeforeTaskAdd:qe,onAfterTaskAdd:_,onBeforeTaskUpdate:he,onAfterTaskUpdate:Z,onBeforeTaskDelete:ze,onAfterTaskDelete:Me,permissions:Ve,onCopySnapshotLink:O}=a,Be=useContext(tc)?.theme,[Qe,Ft]=useState(Be||s||"dark"),[Xe,Tt]=useState(o),[it,ba]=useState(i),Jt=useCallback(T=>{ba(T),R?.(T);},[R]),[Ht,we]=useState(1),[Te,dt]=useState("all"),[ht,jt]=useState(Ge||"execution"),Dt=Ge??ht,la=useCallback(T=>{jt(T),B?.(T);},[B]),ha=Ae??Dt==="oracle",[Ha,Zt]=useState(a.showCriticalPath!==false),[Wa,Va]=useState(a.showDependencies!==false),[xn,ia]=useState(a.highlightWeekends!==false),vn=useCallback(T=>{Zt(T),a.onShowCriticalPathChange?.(T);},[a.onShowCriticalPathChange]),A=useCallback(T=>{Va(T),a.onShowDependenciesChange?.(T);},[a.onShowDependenciesChange]),Y=useCallback(T=>{ia(T),a.onHighlightWeekendsChange?.(T);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Xe);},[Xe]),useEffect(()=>{a.onZoomChange?.(Ht);},[Ht]);let ee=useRef(a.onDateRangeChange);ee.current=a.onDateRangeChange;let q=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[He,Ze]=useState(()=>{if(!b)return "all";try{let T=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(T);if(F){let j=JSON.parse(F);if(j.taskFilter)return j.taskFilter}}catch(T){console.warn("[GanttBoard] Error loading filter state from localStorage:",T);}return "all"}),$e=N??He,Q=D??Ze,[Ie,pt]=useState(()=>{if(!b)return !!W;try{let T=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(T);if(F){let j=JSON.parse(F);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(T){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",T);}return !!W});useEffect(()=>{let T=q();if(T)try{let F={taskFilter:$e,hideCompleted:Ie};localStorage.setItem(T,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[$e,Ie,q]);let P=useRef(h);useEffect(()=>{if(P.current!==h&&h!==void 0){Ze("all"),pt(false);let T=q();if(T)try{localStorage.removeItem(T);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}P.current=h;},[h,q]);let[ie,$]=useState(0),[te,I]=useState(false),[H,fe]=useState(null),[me,ge]=useState({isOpen:false,x:0,y:0,task:null}),[pe,Ce]=useState(null),[Se,st]=useState(null);useEffect(()=>{Be&&Be!==Qe&&Ft(Be);},[Be]),useEffect(()=>{s&&s!==Qe&&Ft(s);},[s]);let et=useCallback(T=>{Ft(T),Je?.(T);},[Je]),{state:ke,setState:tt,undo:Ia,redo:Ma,canUndo:ka,canRedo:Le,clearHistory:na}=a0(t,50),Ra=useMemo(()=>{let T=(F,j=0)=>{let X=j;for(let ue of F)ue.subtasks?.length&&(X=Math.max(X,T(ue.subtasks,j+1)));return X};return T(ke)+1},[ke]),Sn=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),Xa=useRef(new Map),Kn=useRef(false);if(!Kn.current&&v){Kn.current=true;let T=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(T);if(F){let j=JSON.parse(F);Array.isArray(j)&&(Xa.current=new Map(j));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let En=useCallback(()=>{let T=Sn();if(T)try{let F=Array.from(Xa.current.entries());localStorage.setItem(T,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[Sn]),An=useRef(0),Pa=useRef(ke);useEffect(()=>{Pa.current=ke;},[ke]);let Ir=useRef(false),Rr=useCallback(T=>{dt(T),An.current+=1,tt(F=>{let j=(ue,ye=0)=>ue.map(_e=>{let Ee=T==="all"||ye<T-1;return _e.subtasks?.length&&Xa.current.set(_e.id,Ee),{..._e,isExpanded:Ee,subtasks:_e.subtasks?j(_e.subtasks,ye+1):void 0}}),X=j(F);return En(),X});},[tt,En]);useEffect(()=>{if(An.current>0){An.current-=1;return}let T=j=>{let X=new Map;for(let ue of j){let ye=ue.id;X.get(ye)||X.set(ye,ue);}return Array.from(X.values())},F=j=>j.map(X=>{let ue=Xa.current.get(X.id),ye=ue!==void 0?{...X,isExpanded:ue}:X;if(ye.subtasks?.length){let _e=T(ye.subtasks);return {...ye,subtasks:F(_e)}}return ye});if(Xa.current.size>0)tt(Sr(F(t)));else {let j=ue=>ue.map(ye=>ye.subtasks?.length?{...ye,subtasks:T(j(ye.subtasks))}:ye),X=Sr(j(t));if(W&&v){let ue=rt=>new Date(rt.getFullYear(),rt.getMonth(),rt.getDate()).getTime(),ye=ue(new Date),_e=rt=>!!rt.startDate&&!!rt.endDate&&ue(rt.startDate)<=ye&&ye<=ue(rt.endDate),Ee=rt=>rt.map(Nt=>{if(!Nt.subtasks?.length)return Nt;let Vt=_e(Nt);return Xa.current.set(Nt.id,Vt),{...Nt,isExpanded:Vt,subtasks:Ee(Nt.subtasks)}});tt(Ee(X));}else tt(X);}},[t,tt]);let go=useRef(t),Io=useRef(true);useEffect(()=>{if(Io.current){Io.current=false,go.current=ke;return}if(Ir.current){Ir.current=false,go.current=ke;return}if(!n)return;let T=JSON.stringify(go.current),F=JSON.stringify(ke);T!==F&&(go.current=ke,n(ke));},[ke,n]);let cn=useMemo(()=>Td(y,k),[y,k]),Ja=cn.toolbar.visibility==="Visibilidad",vl=useMemo(()=>W?[{id:"name",label:Ja?"Tarea":"Task",width:312,minWidth:120,visible:true,sortable:false,resizable:false},{id:"assignees",label:Ja?"Responsable":"Owner",width:28,visible:true,sortable:false,resizable:false},{id:"startDate",label:Ja?"Inicio":"Start",width:50,visible:true,sortable:false,resizable:false},{id:"endDate",label:Ja?"Fin":"End",width:50,visible:true,sortable:false,resizable:false},{id:"progress",label:"%",width:40,visible:true,sortable:false,resizable:false}]:null,[W,Ja]),wi=useCallback(T=>[{id:"name",label:T.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:T.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:T.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:T.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:T.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:T.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:T.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:T.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Zr=a.defaultVisibleColumns,ki=useCallback(T=>Zr?T.map(F=>F.id==="name"?F:{...F,visible:Zr.includes(F.id)}):T,[Zr]),qn=useMemo(()=>w?typeof w=="string"?w:"gantt-columns-state":null,[w]),[eo,fo]=useState(()=>{let T=ki(wi(cn));if(!w)return T;try{let F=typeof w=="string"?w:"gantt-columns-state",j=localStorage.getItem(F);if(!j)return T;let X=JSON.parse(j),ue=new Map(X.map(ye=>[ye.id,ye]));return T.map(ye=>{let _e=ue.get(ye.id);return _e?{...ye,visible:_e.visible??ye.visible,width:_e.width??ye.width}:ye})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),T}}),Ci=useRef(qn);useEffect(()=>{if(Ci.current===qn)return;Ci.current=qn;let T=ki(wi(cn));if(!qn){fo(T);return}try{let F=localStorage.getItem(qn);if(!F){fo(T);return}let j=JSON.parse(F),X=new Map(j.map(ue=>[ue.id,ue]));fo(T.map(ue=>{let ye=X.get(ue.id);return ye?{...ue,visible:ye.visible??ue.visible,width:ye.width??ue.width}:ue}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),fo(T);}},[qn,wi,cn]),useEffect(()=>{if(qn&&Ci.current===qn)try{let T=eo.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(qn,JSON.stringify(T));}catch(T){console.warn("[GanttBoard] Error saving columns state to localStorage:",T);}},[eo,qn]),useEffect(()=>{fo(T=>T.map(F=>({...F,label:cn.columns[F.id==="name"?"taskName":F.id]||F.label})));},[cn]);let Ws=useMemo(()=>eo.filter(F=>F.visible).reduce((F,j)=>F+j.width,0),[eo]),Ti=useRef(eo.filter(T=>T.visible).map(T=>T.id).join(","));useEffect(()=>{let T=eo.filter(X=>X.visible),F=T.map(X=>X.id).join(","),j=Ti.current;if(F!==j){let X=T.some(ye=>ye.id!=="name"),ue=j.includes(",");X?!ue&&X&&fe(null):fe(null),Ti.current=F;}},[eo]);let wl=60,Di=.6,Ni=useMemo(()=>{if(W&&H===null)return 544;let T=200,F=Ws+wl,j=typeof window<"u"?window.innerWidth*Di:800,X=Math.max(F,j);return H!==null?Math.max(T,Math.min(H,X)):Math.max(T,F)},[H,Ws,W]),vr=useRef(null),bo=useRef(null),dn=useRef(null),ls=useRef(null),C=useRef(null),G=useMemo(()=>df(Qe),[Qe]),ne=useMemo(()=>({theme:G,themeName:Qe}),[G,Qe]),le=useMemo(()=>r0(m),[m]),ve=useMemo(()=>{if(!f||!Ha)return ke;let T=Re.calculateCriticalPathFull(ke),F=j=>j.map(X=>{let ue=T.get(X.id),ye=X.subtasks?F(X.subtasks):void 0,_e=ye?.some(rt=>rt.isCriticalPath||rt.subtasks&&rt.subtasks.some(Nt=>Nt.isCriticalPath))||false,Ee=ue?ue.isCritical:_e;return {...X,isCriticalPath:Ee,cpmData:ue||void 0,subtasks:ye}});return F(ke)},[ke,f,Ha]),je=useMemo(()=>Re.flattenTasks(ke).some(F=>F.dependencies&&F.dependencies.length>0),[ke]),se=useMemo(()=>{let T=(F,j="")=>[...F].sort((ue,ye)=>(ue.position??0)-(ye.position??0)).map((ue,ye)=>{let _e=ye+1,Ee=j?`${j}.${_e}`:`${_e}.0`,rt=j?`${j}.${_e}`:`${_e}`;return {...ue,wbsCode:Ee,subtasks:ue.subtasks?.length?T(ue.subtasks,rt):ue.subtasks}});return T(ve)},[ve]),Fe=(a.searchQuery??"").trim(),Oe=useMemo(()=>{let T=ue();if(!Fe)return T;let F=ye=>ye.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),j=F(Fe),X=ye=>{let _e=[];for(let Ee of ye){if(F(Ee.name||"").includes(j)){_e.push(Ee);continue}let rt=Ee.subtasks?.length?X(Ee.subtasks):[];rt.length&&_e.push({...Ee,subtasks:rt});}return _e};return X(T);function ue(){if($e==="all"&&!Ie)return se;let ye=_e=>{let Ee=[];for(let rt of _e){let Nt=rt.subtasks?.length?ye(rt.subtasks):void 0,Vt=false;if(Ie)Vt=rt.progress<100&&rt.status!=="completed";else switch($e){case "all":Vt=true;break;case "incomplete":Vt=rt.progress<100;break;case "in_progress":Vt=rt.progress>0&&rt.progress<100;break;case "completed":Vt=rt.progress===100;break;case "overdue":Vt=dc(rt);break}(Vt||Nt&&Nt.length>0)&&Ee.push({...rt,subtasks:Nt});}return Ee};return ye(se)}},[se,$e,Ie,Fe]),We=useMemo(()=>Re.flattenTasks(se).filter(T=>!T.subtasks?.length&&dc(T)).length,[se]),Lt=useMemo(()=>{if(!Ie)return 0;let T=new Set(Re.flattenTasks(Oe).map(F=>F.id));return Re.flattenTasks(se).filter(F=>!T.has(F.id)&&((F.progress??0)>=100||F.status==="completed")).length},[Ie,Oe,se]),Ct=useMemo(()=>{if(!W)return;let T=Re.flattenTasks(Oe).length,F=Ja?`${T} ${T===1?"tarea":"tareas"}`:`${T} ${T===1?"task":"tasks"}`;return Ie&&Lt>0?`${F} \xB7 ${Lt} ${Ja?Lt===1?"completada oculta":"completadas ocultas":"completed hidden"}`:$e==="overdue"?`${F} \xB7 ${Ja?"solo vencidas":"overdue only"}`:$e!=="all"?`${F} \xB7 ${Ja?"filtradas":"filtered"}`:F},[W,Oe,Ie,Lt,$e,Ja]),St=W&&$e!=="overdue"&&We>0?Ja?`${We} ${We===1?"vencida":"vencidas"}`:`${We} overdue`:void 0,ea=useCallback(()=>{tt(T=>{let F=j=>j.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?F(X.subtasks):void 0}));return F(T)});},[]),bt={compact:{fila:32,barra:18},comfortable:{fila:40,barra:22},spacious:{fila:48,barra:26}},Kt=W?bt[it].fila:Zk(it);n0({undo:Ia,redo:Ma,canUndo:ka,canRedo:Le,enabled:true});let Qt=useRef(null),ra=(T,F="start")=>{let j=dn.current,X=C.current;if(!j||!X)return;let ue=(T.getTime()-X.startDate.getTime())/(1e3*60*60*24),ye=io(X.timeScale),_e=ue*ye*X.zoom,Ee=F==="center"?_e-j.clientWidth/2:_e-ye*X.zoom*2;j.scrollTo({left:Math.max(0,Ee),behavior:"auto"});};useImperativeHandle(r,()=>({getTask:T=>Re.findTaskById(ke,T),addTask:(T,F)=>{tt(j=>{if(!F)return [...j,{...T,level:0}];let X=ue=>ue.map(ye=>ye.id===F?{...ye,subtasks:[...ye.subtasks||[],{...T,parentId:F,level:(ye.level||0)+1}],isExpanded:true}:ye.subtasks?{...ye,subtasks:X(ye.subtasks)}:ye);return X(j)});},updateTask:(T,F)=>{tt(j=>{let X=ue=>ue.map(ye=>ye.id===T?{...ye,...F}:ye.subtasks?{...ye,subtasks:X(ye.subtasks)}:ye);return X(j)});},deleteTask:T=>{tt(F=>{let j=X=>X.filter(ue=>ue.id===T?false:(ue.subtasks&&(ue.subtasks=j(ue.subtasks)),true));return j(F)});},deleteTasks:T=>{tt(F=>Nu(F,T));},duplicateTask:T=>{if(a.onTaskDuplicate){let F=Re.findTaskById(ke,T);F&&a.onTaskDuplicate(F);}else tt(F=>Qi(F,[T]).tasks);},splitTask:(T,F,j=3)=>{tt(X=>Re.splitTask(X,T,F,j));},calculateEndDate:Re.calculateEndDate,calculateDuration:Re.calculateDuration,validateDependency:(T,F)=>!Re.validateDependencies(ke,T,F),getAllTasks:()=>Re.flattenTasks(ke),getTasksByStatus:T=>Re.flattenTasks(ke).filter(F=>F.status===T),getTasksByParent:T=>T?Re.findTaskById(ke,T)?.subtasks||[]:ke.filter(j=>!j.parentId),getCriticalPath:()=>Re.flattenTasks(ke).filter(T=>T.isCriticalPath),indentTask:T=>{tt(F=>Sr(Cu(F,[T])));},outdentTask:T=>{tt(F=>Sr(Tu(F,[T])));},moveTask:(T,F)=>{tt(j=>Du(j,[T],F));},createSubtask:async T=>{let{tasks:F,newTask:j}=Mu(ke,T);if(qe){let X=qe({...j,parentId:T});if((X instanceof Promise?await X:X)===false)return}tt(Sr(F)),_&&_({...j,parentId:T});},scrollToTask:T=>{let j=Re.flattenTasks(ke).findIndex(X=>X.id===T);if(j!==-1&&vr.current){let X=j*Kt;vr.current.scrollTo({top:X,behavior:"smooth"}),dn.current&&dn.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(T,F=2e3)=>{},expandTask:T=>{tt(F=>{let j=X=>X.map(ue=>ue.id===T?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:j(ue.subtasks)}:ue);return j(F)});},collapseTask:T=>{tt(F=>{let j=X=>X.map(ue=>ue.id===T?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:j(ue.subtasks)}:ue);return j(F)});},expandAll:()=>{tt(T=>{let F=j=>j.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?F(X.subtasks):void 0}));return F(T)});},collapseAll:()=>{tt(T=>{let F=j=>j.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?F(X.subtasks):void 0}));return F(T)});},collapseToLevel:T=>{Rr(T);},undo:Ia,redo:Ma,canUndo:()=>ka,canRedo:()=>Le,clearHistory:na,exportToPNG:async()=>{if(!ls.current||!vr.current||!dn.current)throw new Error("Gantt container not found");let T=ls.current,F=vr.current,j=bo.current||F.querySelector(".gantt-grid-scroll"),X=dn.current;bm(true),await new Promise(Nt=>setTimeout(Nt,50));let ue=j?.scrollTop||0,ye=X.scrollTop,_e=T.style.overflow,Ee=T.style.height,rt=F.style.overflow;try{let Nt=j?.querySelector(".gantt-taskgrid-content"),Vt=X.querySelector("svg"),Ga=Nt?.scrollHeight||j?.scrollHeight||600,Rn=Vt?.getBoundingClientRect().height||X.scrollHeight,kr=(T.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Ga,Rn)+20;j&&(j.scrollTop=0),X.scrollTop=0,T.style.overflow="visible",T.style.height=`${kr}px`,F.style.overflow="visible",await new Promise(Ro=>setTimeout(Ro,100));let to=await toPng(T,{backgroundColor:G.bgPrimary,pixelRatio:2,filter:Ro=>{if(!(Ro instanceof Element))return !0;let Cl=window.getComputedStyle(Ro),Mi=parseInt(Cl.zIndex,10);return (isNaN(Mi)||Mi<50)&&Cl.position!=="fixed"}});return await(await fetch(to)).blob()}finally{T.style.overflow=_e,T.style.height=Ee,F.style.overflow=rt,j&&(j.scrollTop=ue),X.scrollTop=ye,bm(false);}},exportToPDF:async T=>{await Re.exportToPDF(ke,T);},exportToExcel:async T=>{await Re.exportToExcel(ke,T,dd.current);},exportToJSON:()=>Re.exportToJSON(ke),exportToCSV:()=>Re.exportToCSV(ke),importFromJSON:T=>{let F=Re.importFromJSON(T);tt(F);},getTasks:()=>ke,refresh:()=>{tt(T=>[...T]);},clearAll:()=>{tt([]);},scrollToDate:(T,F="start")=>ra(T,F),fitToDates:(T,F)=>{let j=Math.max(1,(F.getTime()-T.getTime())/864e5),X=j<=21?"day":j<=122?"week":"month";Qt.current=T,Tt(X),X===C.current?.timeScale&&requestAnimationFrame(()=>{let ue=Qt.current;Qt.current=null,ue&&ra(ue);});},scrollToToday:()=>{let T=dn.current,F=C.current;if(!T||!F)return;let X=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),ue=io(F.timeScale),ye=X*ue*F.zoom,_e=T.clientWidth,Ee=Math.max(0,ye-_e*Bu);T.scrollTo({left:Ee,behavior:"smooth"});}}),[ke,Ia,Ma,ka,Le,na,G,Kt]);let At=useCallback(T=>{fo(F=>F.map(j=>j.id===T?{...j,visible:!j.visible}:j));},[]),It=useCallback((T,F)=>{fo(j=>j.map(X=>{if(X.id!==T)return X;let ue=X.minWidth??100,ye=X.maxWidth??800,_e=Math.max(ue,Math.min(ye,F));return {...X,width:_e}}));},[]),ca=useCallback(T=>{tt(F=>{let j=Eu(F,T),X=ue=>{for(let ye of ue){if(ye.id===T){Xa.current.set(T,ye.isExpanded??true);return}ye.subtasks?.length&&X(ye.subtasks);}};return X(j),En(),j}),a.onTaskToggleExpand?.(T);},[a,En]),ua=useCallback((T,F)=>{if(he&&he(T,F)===false)return;let X=Re.findTaskById(ke,T)?.progress,ue=_e=>_e.map(Ee=>Ee.id===T?{...Ee,...F}:Ee.subtasks?{...Ee,subtasks:ue(Ee.subtasks)}:Ee);tt(_e=>ue(_e));let ye=Re.findTaskById(ue(ke),T);ye&&(vt?.(ye),Z?.(ye),F.progress!==void 0&&X!==void 0&&F.progress!==X&&Pt?.(T,X,F.progress));},[ke,vt,he,Z,Pt]),Qa=useCallback((T,F,j)=>{if(T.length===0)return;let X=new Set(T),ue=ye=>ye.map(_e=>{let Ee=X.has(_e.id)?{..._e,[F]:j}:_e;return Ee.subtasks?{...Ee,subtasks:ue(Ee.subtasks)}:Ee});tt(ye=>{let _e=ue(ye);return a.onBulkFill?.(T,F,j,_e),_e});},[a]),fr=useCallback(T=>{T.length!==0&&(An.current+=1,Ir.current=true,tt(F=>Sr(Cu(F,T))),a.onTaskIndent?.(T[0]));},[a]),zn=useCallback(T=>{T.length!==0&&(An.current+=1,Ir.current=true,tt(F=>Sr(Tu(F,T))),a.onTaskOutdent?.(T[0]));},[a]),ho=useCallback((T,F,j)=>{An.current+=1,Ir.current=true,tt(X=>Sr(Bf(X,T,F,j))),a.onTaskReparent?.(T,F,j);},[a]),wr=useCallback((T,F)=>{T.length!==0&&(An.current+=1,Ir.current=true,tt(j=>Du(j,T,F)),a.onTaskMove?.(T[0],F));},[a]),Zn=useCallback(async T=>{let F=[];for(let j of T)ze&&await Promise.resolve(ze(j))===false||F.push(j);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(tt(j=>Sr(Nu(j,F))),F.forEach(j=>a.onTaskDelete?.(j))),Me&&F.forEach(j=>Me(j)));},[a,ze,Me]),ly=useCallback(T=>{a.onTaskDuplicate?T.forEach(F=>{let j=Re.findTaskById(ke,F);j&&a.onTaskDuplicate(j);}):tt(F=>Qi(F,T).tasks);},[a,ke]),cy=useCallback((T,F)=>{tt(j=>{let{tasks:X,newTask:ue}=Rf(j,T,F);return qe&&qe(ue)===false?j:(a.onTaskCreate?.(ue.parentId,ue.position||0),_?.(ue),X)});},[a,qe,_]),dy=useCallback((T,F)=>{tt(j=>Su(j,T,F)),a.onTaskRename?.(T,F);},[a]),ld=useCallback(T=>{let{onTaskAddSubtask:F}=a;if(F){let j=ai(ke,T);if(j){F(j);return}}tt(j=>{let{tasks:X}=Mu(j,T);return a.onTaskCreate?.(T,0),X});},[a,ke]),uy=useCallback((T,F)=>{let j=Math.max(0,Math.min(100,Math.round(F))),X={progress:j};j===100?X.status="completed":j>0?X.status="in-progress":X.status="todo",ua(T.id,X);},[ua]),py=useCallback((T,F,j)=>{let X=Do(a?.workingDaysConfig),ue=Ss(T,F,j,ke,X);ue.porQue&&(F=ue.inicio,j=ue.fin,a?.onDependencyConstraint?.({task:T,predecessor:ue.porQue.predecesora,earliestStart:ue.inicio}));let ye=!T.startDate&&!T.endDate,_e=Ga=>Ga.map(Rn=>Rn.id===T.id?{...Rn,startDate:F,endDate:j,...T.segments&&{segments:T.segments}}:Rn.subtasks?{...Rn,subtasks:_e(Rn.subtasks)}:Rn),Ee=_e(ke),rt=Ee,Nt=new Map(ii(Ee,[T.id],X).map(Ga=>[Ga.id,Ga]));if(Nt.size>0){let Ga=Rn=>Rn.map(lr=>{let cr=Nt.get(lr.id),kr=lr.subtasks?{...lr,subtasks:Ga(lr.subtasks)}:lr;return cr?{...kr,startDate:cr.startDate,endDate:cr.endDate}:kr});Ee=Ga(Ee);}Ee=Sr(Ee),tt(Ee);let Vt={...T,startDate:F,endDate:j};if(ye&&a?.onTaskDateChange?a.onTaskDateChange(T,F,j):vt?.(Vt),Mt&&Nt.size>0){let Ga=Re.flattenTasks(rt),Rn=Re.flattenTasks(Ee),lr=[];for(let cr of Rn){if(cr.id===T.id)continue;let kr=Ga.find(Ro=>Ro.id===cr.id);if(!kr)continue;let to=cr.startDate?.getTime()!==kr.startDate?.getTime(),Ei=cr.endDate?.getTime()!==kr.endDate?.getTime();(to||Ei)&&lr.push(cr);}lr.length>0&&Mt(lr);}},[ke,vt,Mt,a]),my=useCallback((T,F)=>{lt?.(T,F),ge({isOpen:true,x:F.clientX,y:F.clientY,task:T});},[lt]),gy=useCallback((T,F)=>{let j=Re.splitTask(ke,T.id,F);tt(j),ge({isOpen:false,x:0,y:0,task:null});},[ke]),em=useCallback(T=>{let F=Re.findTaskById(ke,T.id)||T;Rt?.(F),zt||Ce(F);},[ke,Rt,zt]),tm=useCallback((T,F,j)=>{let X=new Map,ue=Nt=>{Nt.forEach(Vt=>{Vt.dependencies&&X.set(Vt.id,Vt.dependencies),Vt.subtasks&&ue(Vt.subtasks);});};ue(j);let ye=X.get(F)||[];X.set(F,[...ye,T]);let _e=new Set,Ee=new Set,rt=Nt=>{if(!_e.has(Nt)){_e.add(Nt),Ee.add(Nt);let Vt=X.get(Nt)||[];for(let Ga of Vt){if(!_e.has(Ga)&&rt(Ga))return true;if(Ee.has(Ga))return true}}return Ee.delete(Nt),false};return rt(F)},[]),am=useCallback((T,F,j="FS")=>{if(tm(T.id,F,Pa.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let U=K=>K.map(ie=>{if(ie.id===F){let ge=ie.dependencies||[];if(!ge.includes(E.id))return {...ie,dependencies:[...ge,E.id]}}return ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie});Vr.current+=1,Ne(K=>U(K)),Ae?.(E.id,F);},[Ae,Ka]),ts=useCallback((E,F)=>{let U=K=>K.map(ie=>{if(ie.id===E&&ie.dependencies){let ge=ie.dependencies.filter(Ge=>Ge!==F);return {...ie,dependencies:ge}}return ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie});Vr.current+=1,Ne(K=>U(K)),ot?.(E,F);},[ot]),{startDate:Cr,endDate:uc}=useMemo(()=>{let E=fe.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,Ge=new Date(ge);Ge.setDate(Ge.getDate()-30);let ze=new Date(ge);return ze.setDate(ze.getDate()+60),{startDate:Ge,endDate:ze}}let F=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),U=new Date(Math.min(...F.map(ge=>ge.getTime()))),K=new Date(Math.max(...F.map(ge=>ge.getTime()))),ie=I==="day"?7:I==="week"?14:30;return U.setDate(U.getDate()-ie),K.setDate(K.getDate()+ie),{startDate:U,endDate:K}},[fe,I]);useEffect(()=>{cr.current?.(Cr,uc);},[Cr,uc]);let Lb=useCallback(async()=>{if(!No.current||!$r.current||!wr.current)return;await new Promise(So=>setTimeout(So,200));let E=No.current,F=$r.current,U=Zo.current||F.querySelector(".gantt-grid-scroll"),K=wr.current,ie=U?.scrollTop||0,ge=U?.scrollLeft||0,Ge=K.scrollTop,ze=K.scrollLeft,It=E.style.overflow,Gt=E.style.height,qt=U?.style.overflow||"",br=K.style.overflow,jr=F.style.overflow,ao=E.style.width,rs=K.style.width;try{let So=U?.querySelector(".gantt-taskgrid-content"),En=K.querySelector("svg"),fc=En?.getAttribute("height")?parseInt(En.getAttribute("height"),10):En?.getBoundingClientRect().height||0,ns=So?.scrollHeight||U?.scrollHeight||600,Ii=Math.max(fc,K.scrollHeight),Gs=En?.getAttribute("width")?parseInt(En.getAttribute("width"),10):En?.getBoundingClientRect().width||K.scrollWidth,Ub=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,bc=Math.max(ns,Ii,fc),Qu=Ub+bc+50,Zu=(U?.offsetWidth||F.offsetWidth||300)+Gs+10;U&&(U.scrollTop=0,U.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Qu}px`,E.style.width=`${Zu}px`,F.style.overflow="visible",U&&(U.style.overflow="visible",U.style.height=`${bc+50}px`),K.style.overflow="visible",K.style.height=`${bc+50}px`,K.style.width=`${Gs+10}px`,await new Promise(Ri=>setTimeout(Ri,150));let Wb=await toPng(E,{backgroundColor:oa.bgPrimary,pixelRatio:2,width:Zu,height:Qu,skipFonts:!1,filter:Ri=>{if(!(Ri instanceof Element))return !0;let ep=window.getComputedStyle(Ri),tp=parseInt(ep.zIndex,10);return !(!isNaN(tp)&&tp>=50||ep.position==="fixed")}}),hc=document.createElement("a");hc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,hc.href=Wb,hc.click();}finally{E.style.overflow=It,E.style.height=Gt,E.style.width=ao,F.style.overflow=jr,U&&(U.style.overflow=qt,U.style.height="",U.scrollTop=ie,U.scrollLeft=ge),K.style.overflow=br,K.style.height="",K.style.width=rs,K.scrollTop=Ge,K.scrollLeft=ze;}p?.("png");},[oa,p]),Ab=useCallback(async()=>{await Me.exportToPDF(fe),p?.("pdf");},[fe,p]),pc=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:u});pc.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:u};let Ib=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),p?.("excel");return}let E=new Date,F=ie=>String(ie).padStart(2,"0"),U=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,K=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Me.exportToExcel(fe,`${K}_${U}.xlsx`,pc.current),p?.("excel");},[fe,u,p,a.onExportExcel]),Rb=useCallback(()=>{let E=Me.exportToCSV(fe),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(F),U.download="gantt-chart.csv",U.click(),URL.revokeObjectURL(U.href),p?.("csv");},[fe,p]),Bb=useCallback(()=>{let E=Me.exportToJSON(fe),F=new Blob([E],{type:"application/json;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(F),U.download="gantt-chart.json",U.click(),URL.revokeObjectURL(U.href),p?.("json");},[fe,p]),$b=useCallback(()=>{Me.exportToMSProject(fe,"Gantt Project","project.xml"),p?.("msproject");},[fe,p]),Ob=E=>{E.preventDefault(),pe(true);},as=useRef(false),[mc,Yu]=useState(false),zs=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=wr.current,F=$r.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let U=()=>{if(as.current)return;as.current=true;let ze=E.scrollTop;me(ze),F.scrollTop=ze,requestAnimationFrame(()=>{as.current=false;});},K=()=>{if(as.current)return;as.current=true;let ze=F.scrollTop;me(ze),E.scrollTop=ze,requestAnimationFrame(()=>{as.current=false;});},ie=ze=>{if(q&&F){let Gt=F.parentElement?.getBoundingClientRect()?.left||0,qt=ze.clientX-Gt,br=200,jr=cn+Li,ao=window.innerWidth*Un,rs=Math.max(jr,ao);qt>=br&&qt<=rs&&B(qt);}if(mc&&E){let It=ze.clientX-zs.current.x,Gt=ze.clientY-zs.current.y;E.scrollLeft=zs.current.scrollLeft-It,E.scrollTop=zs.current.scrollTop-Gt;}},ge=()=>{pe(false),Yu(false);},Ge=ze=>{if(ze.button!==0)return;let It=ze.target;It.closest("[data-task-bar]")||It.closest("[data-dependency-line]")||It.closest("button")||It.closest('[role="button"]')||It.tagName==="rect"&&It.getAttribute("data-clickable")==="true"||(Yu(true),zs.current={x:ze.clientX,y:ze.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ze.preventDefault());};return E.addEventListener("scroll",U),F.addEventListener("scroll",K),E.addEventListener("mousedown",Ge),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",U),F.removeEventListener("scroll",K),E.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ge);}},[q,mc,cn]),Do.current={startDate:Cr,timeScale:I,zoom:ue};let gc=a.onTodayVisibilityChange,Xu=useRef(null);useEffect(()=>{if(!gc)return;let E=wr.current;if(!E)return;let F=I==="day"?60:I==="week"?20:8,U=()=>{let ge=(new Date().getTime()-Cr.getTime())/(1e3*60*60*24)*F*ue,Ge=E.scrollLeft,ze=Ge+E.clientWidth,It=ge>=Ge&&ge<=ze;Xu.current!==It&&(Xu.current=It,gc(It));};return U(),E.addEventListener("scroll",U,{passive:true}),window.addEventListener("resize",U),()=>{E.removeEventListener("scroll",U),window.removeEventListener("resize",U);}},[gc,Cr,I,ue]);let Ju=useRef(false),Hb=useRef(null);return useLayoutEffect(()=>{if(Ju.current||fe.length===0||!wr.current)return;Ju.current=true,Hb.current=Cr;let E=wr.current,F=new Date,U=I==="day"?60:I==="week"?20:8,K=(F.getTime()-Cr.getTime())/(1e3*60*60*24),ie=E.clientWidth,Ge=K*U*ue-ie/2;K>=0&&ie>0&&(E.scrollLeft=Math.max(0,Ge));},[fe.length,Cr,I,ue]),useLayoutEffect(()=>{let E=ne.current;!E||Do.current?.timeScale!==I||(ne.current=null,de(E));},[I,Cr,ue]),jsx(hs.Provider,{value:Qa,children:jsx(kc.Provider,{value:dc,children:jsxs("div",{ref:No,className:"flex flex-col h-full w-full",style:{backgroundColor:oa.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...oa.dotGrid&&{backgroundImage:`radial-gradient(circle, ${oa.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsx(gl,{enCabecera:!!z,theme:oa,timeScale:I,onTimeScaleChange:j,zoom:ue,onZoomChange:at,currentTheme:J,onThemeChange:gt,rowDensity:ke,onRowDensityChange:Ue,showThemeSelector:c,showCreateTaskButton:P&&ht?.canCreateTask!==false&&!ht?.canCreateSubtaskOnly,createTaskLabel:O,onCreateTask:T,taskFilter:Ia,onTaskFilterChange:dr,hideCompleted:xr,onHideCompletedChange:Ra,toolbarRightContent:N,wbsLevel:yt,onWbsLevelChange:$?void 0:Pi,maxWbsDepth:Er,viewMode:wt,onViewModeChange:Se?Ut:void 0,projectForecast:W,hideForecastHud:Ce,onExportPNG:l?Lb:void 0,onExportPDF:l?Ab:void 0,onExportExcel:l?Ib:void 0,onExportCSV:l?Rb:void 0,onExportJSON:l?Bb:void 0,onExportMSProject:l?$b:void 0,showCriticalPath:he,onShowCriticalPathChange:kt,showDependencies:Qe,onShowDependenciesChange:Da,highlightWeekends:Tt,onHighlightWeekendsChange:aa,showBaseline:Ht,onShowBaselineChange:F=>{F&&wt!=="oracle"&&Ut("oracle"),!F&&wt==="oracle"&&Ut("execution");},onCopySnapshotLink:_e,hasDependencies:Ws});return z?createPortal(E,z):jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxs("div",{ref:$r,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Zo,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ai,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(hl,{addTaskRow:a.addTaskRow,tasks:_,allTasks:Wn,theme:oa,rowHeight:X,availableUsers:d,templates:Us,showCriticalPath:he,onTaskClick:we,onTaskSelectionChange:G,selectedTaskId:Ve,onTaskDblClick:ur,onTaskContextMenu:Be,onTaskToggle:De,scrollTop:se,columns:Jr,onToggleColumn:We,onColumnResize:Q,onTaskUpdate:Re,onBulkFill:Ke,onTaskIndent:$t,onTaskOutdent:ut,onTaskMove:Zt,onMultiTaskDelete:it,onTaskDuplicate:ea,onTaskCreate:xt,onTaskRename:Lt,onCreateSubtask:pt,onOpenTaskModal:we?E=>we(E):void 0,onDeleteRequest:(E,F)=>Te({taskIds:E,taskName:F}),onTaskReparent:ct,scrollContainerRef:Zo})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:oa.border,zIndex:15},onMouseDown:Ob}),jsx("div",{ref:wr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:mc?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Tl,{tasks:_,theme:oa,rowHeight:X,timeScale:I,startDate:Cr,endDate:uc,zoom:ue,locale:w,templates:Us,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:we,onTaskDblClick:ur,onTaskContextMenu:kr,onTaskDateChange:Ba,onTaskProgressDrag:At,onDependencyCreate:to,onDependencyDelete:ts,showBaseline:Ht,showCriticalPath:he,showDependencies:Qe,highlightWeekends:Tt,weekHeaderFormat:a.weekHeaderFormat,canEditTask:ht?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),re.task&&jsx(ys,{isOpen:re.isOpen,x:re.x,y:re.y,theme:oa,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=re.task;if(!E)return [];let F=Me.findTaskById(fe,E.id)||E,U=F.subtasks&&F.subtasks.length>0,K=ht?.canCreateTask!==false,ie=ht?.canDeleteTask!==false;if(U){let Gt=[],qt=ht?.canDuplicateTask!==false;return K&&Gt.push({id:"addSubtask",label:Qa.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{je?je(F):pt(F.id);}}),qt&&Gt.push({id:"duplicate",label:Qa.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):Ne(br=>ci(br,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ie&&(Gt.length>0&&Gt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Gt.push({id:"delete",label:Qa.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{Te({taskIds:[F.id],taskName:F.name});}})),Gt}let ge=ht?.canUpdateTask!==false,Ge=ht?.canDuplicateTask!==false,ze=[];return ge&&ze.push({id:"edit",label:Qa.contextMenu?.editTask||"Edit Task",icon:ua.Pencil,onClick:()=>{Pe?Pe(F):H(F);}}),K&&ze.push({id:"addSubtask",label:Qa.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{je?je(F):pt(F.id);}}),ze.length>0&&ge&&ze.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(ze.push({id:"markIncomplete",label:Qa.contextMenu?.markIncomplete||"Mark Incomplete",icon:ua.MarkIncomplete,onClick:()=>{tt?tt(F):Re(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),ze.push({id:"setInProgress",label:Qa.contextMenu?.setInProgress||"Set In Progress",icon:ua.SetInProgress,onClick:()=>{ee?ee(F):Re(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),ze.push({id:"markComplete",label:Qa.contextMenu?.markComplete||"Mark Complete",icon:ua.MarkComplete,onClick:()=>{Re(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(Ge||ge&&F.startDate&&F.endDate)&&ze.length>0&&ze.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&ze.push({id:"duplicate",label:Qa.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):Ne(Gt=>ci(Gt,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ge&&F.startDate&&F.endDate&&ze.push({id:"split",label:Qa.contextMenu?.splitTask||"Split Task",icon:ua.Split,onClick:()=>{let Gt=F.startDate.getTime(),qt=F.endDate.getTime(),br=Gt+(qt-Gt)/2,jr=new Date(br);Pr(F,jr);}}),ie&&(ze.length>0&&ze.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ze.push({id:"delete",label:Qa.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{Te({taskIds:[F.id],taskName:F.name});}})),ze})()}),jsx(Io,{task:S,isOpen:!!S,onClose:()=>H(null),onTaskUpdate:E=>{S&&(Re(S.id,E),H(null));},theme:J==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Z&&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:()=>Te(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:oa.bgSecondary,border:`1px solid ${oa.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${oa.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:oa.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qa.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:oa.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:oa.textSecondary,fontFamily:"Inter, sans-serif"},children:Z.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:oa.textPrimary},children:[Z.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:oa.textPrimary},children:['"',Z.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:oa.bgPrimary,borderTop:`1px solid ${oa.border}`},children:[jsx("button",{onClick:()=>Te(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:oa.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=oa.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{it(Z.taskIds),Te(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(Sl,{tasks:fe,theme:oa,config:x,onTasksUpdate:Ne,onTaskUpdate:Re,onTaskCreate:E=>{Ne(F=>[...F,E]);},onTaskDelete:E=>{it([E]);},onDependencyCreate:(E,F)=>{let U=Me.findTaskById(fe,E);U&&to(U,F);},onDependencyDelete:ts})]})})})});function nk(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ok(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var Id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Rd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Mg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:u,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let b=[...Id,...l.filter(L=>!Id.some(J=>J.id===L.id))],h=ft[c]||ft.dark,[y,x]=useState(false),[w,C]=useState(false),[P,O]=useState(false),[T,D]=useState(false),[M,N]=useState({top:0,left:0}),[z,$]=useState(null),[Y,A]=useState(new Date),[Se,W]=useState({top:0,left:0}),[Ce,R]=useState(false),[we,G]=useState([]),[Ve,oe]=useState(false),[Be,le]=useState(""),He=useRef(null),$e=useRef(null),Pe=useRef(null),je=useRef(null),tt=useRef(null),[ee,Ae]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[ot,Ie]=useState({});useEffect(()=>{a?(Ae({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||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(Ae({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),G([]));},[a,e,v]),useEffect(()=>{let L=J=>{He.current&&!He.current.contains(J.target)&&x(false),$e.current&&!$e.current.contains(J.target)&&C(false),Pe.current&&!Pe.current.contains(J.target)&&O(false),je.current&&!je.current.contains(J.target)&&D(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let zt=()=>{let L={};return ee.name.trim()||(L.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie(L),Object.keys(L).length===0},st=async L=>{if(L.preventDefault(),!!zt())try{let J=i==="create"&&we.length>0?{...ee,pendingFiles:we}:ee;await s(J),G([]),t();}catch(J){console.error("Error submitting task:",J);}},bt=(L,J)=>{Ae(xe=>{let I={...xe,[L]:J};if(L==="status"){let j=J;j==="todo"?I.progress=0:j==="in-progress"?(xe.progress===0||xe.progress===100)&&(I.progress=50):j==="completed"||j==="closed"?I.progress=100:(j==="in-review"||j==="review")&&(I.progress=75);}if(L==="progress"){let j=typeof J=="number"?J:parseInt(J,10);j===100&&xe.status!=="completed"?I.status="completed":j>0&&j<100&&xe.status==="todo"?I.status="in-progress":j===0&&xe.status!=="todo"&&(I.status="todo");}return I}),ot[L]&&Ie(xe=>{let I={...xe};return delete I[L],I});},Ee=b.find(L=>L.id===ee.status)??Id[0],Dt=Rd.find(L=>L.id===ee.priority)??Rd[1],ht=Ao.find(L=>L.value===ee.color)??Ao[0],_e=c==="dark",dt={backgroundColor:_e?"#1d1f27":h.bgSecondary,border:`1px solid ${_e?"rgba(65,71,84,0.1)":h.borderLight}`,color:h.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:_e?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,border:`1px solid ${_e?"rgba(65,71,84,0.1)":h.border}`,boxShadow:_e?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:L=>L.stopPropagation(),children:jsxs("form",{onSubmit:st,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ee.name,onChange:L=>bt("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:h.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),ot.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),ot.name]}),jsx("textarea",{value:ee.description||"",onChange:L=>bt("description",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:h.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":h.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...dt,borderColor:Ee.color,backgroundColor:`${Ee.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ee.color}}),jsx("span",{style:{color:Ee.color},children:Ee.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ee.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:b.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{bt("status",L.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,ee.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},L.id))})})]}),jsxs("div",{ref:$e,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&C(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Dt.color}}),jsx("span",{children:Dt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Rd.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{bt("priority",L.id),C(false);},children:[jsx("span",{children:L.icon}),L.label,ee.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},L.id))})})]}),n.length>0&&jsxs("div",{ref:Pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&O(!P),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[ee.assignees&&ee.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((L,J)=>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||h.accent,borderColor:h.bgSecondary},children:L.initials},J))}),ee.assignees.length>3&&jsxs("span",{style:{color:h.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.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-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let J=ee.assignees?.some(xe=>xe.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:h.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=J?(ee.assignees||[]).filter(I=>I.name!==L.name):[...ee.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),color:h.accent}];bt("assignees",xe);},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:h.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:J&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},L.id)})})})]}),jsxs("div",{ref:je,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)D(false);else {if(je.current){let L=je.current.getBoundingClientRect(),J=window.innerHeight,xe=120,j=J-L.bottom<xe?L.top-xe-8:L.bottom+8;N({top:j,left:L.left});}D(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsx("span",{children:ht.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(ga,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(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:`${M.top}px`,left:`${M.left}px`,zIndex:99999,backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"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:Ao.slice(0,18).map(L=>{let J=ee.color===L.value;return jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),bt("color",L.value),D(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:J?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),p.length>0||u?jsx(ls,{selectedTags:ee.tags||[],availableTags:p,onChange:L=>bt("tags",L),onCreateTag:u,theme:h,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:h.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:_e?"#191b22":h.bgSecondary,borderRadius:8,border:`1px solid ${_e?"rgba(65,71,84,0.05)":h.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:tt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!ee.isMilestone)if(z==="start")$(null);else {if(tt.current){let L=tt.current.getBoundingClientRect();W({top:L.bottom+8,left:Math.max(16,L.left-40)});}$("start"),A(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:o||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!ee.isMilestone)if(z==="end")$(null);else {if(tt.current){let L=tt.current.getBoundingClientRect();W({top:L.bottom+8,left:Math.max(16,L.left-40)});}$("end"),A(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:o||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:z&&jsxs(ga,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Se.top}px`,left:`${Se.left}px`,zIndex:99999,backgroundColor:_e?"#0a0a0a":h.bgPrimary,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${_e?"#262626":h.border}`},children:[(()=>{let L=new Date,J=new Date(L);J.setDate(L.getDate()+1);let xe=new Date(L);xe.setDate(L.getDate()+7);let I=new Date(L);return I.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:I}].map((ke,Ue)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:ue=>ue.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{z==="start"?(bt("startDate",ke.date),(!ee.endDate||ke.date>ee.endDate)&&bt("endDate",ke.date),$("end")):(bt("endDate",ke.date),(!ee.startDate||ke.date<ee.startDate)&&bt("startDate",ke.date),$(null));},children:ke.label},Ue))})(),jsx("div",{style:{borderTop:`1px solid ${h.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=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{bt("startDate",void 0),bt("endDate",void 0),$(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>A(new Date(Y.getFullYear(),Y.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>A(new Date(Y.getFullYear(),Y.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,J)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:L},J))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=Y.getFullYear(),J=Y.getMonth(),xe=new Date(L,J,1).getDay(),I=new Date(L,J+1,0).getDate(),j=new Date,ke=[];for(let ue=xe-1;ue>=0;ue--)ke.push({day:new Date(L,J,-ue).getDate(),date:new Date(L,J-1,new Date(L,J,-ue).getDate()),isCurrentMonth:false});for(let ue=1;ue<=I;ue++)ke.push({day:ue,date:new Date(L,J,ue),isCurrentMonth:true});let Ue=42-ke.length;for(let ue=1;ue<=Ue;ue++)ke.push({day:ue,date:new Date(L,J+1,ue),isCurrentMonth:false});return ke.map((ue,at)=>{let yt=ue.date.toDateString()===j.toDateString(),Ye=ee.startDate?.toDateString()===ue.date.toDateString(),vt=ee.endDate?.toDateString()===ue.date.toDateString(),Xt=ee.startDate&&ee.endDate&&ue.date>=ee.startDate&&ue.date<=ee.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ue.isCurrentMonth?Ye||vt?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:Ye?h.accent:vt?"#7C3AED":Xt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:yt&&!Ye&&!vt?`inset 0 0 0 1px ${h.accent}`:"none"},onClick:()=>{z==="start"?(bt("startDate",ue.date),ee.endDate&&ue.date>ee.endDate&&bt("endDate",ue.date),$("end")):(bt("endDate",ue.date),ee.startDate&&ue.date<ee.startDate&&bt("startDate",ue.date),$(null));},children:ue.day},at)})})()})]})]})]})})]}),ot.endDate&&jsx("span",{className:"text-xs text-red-400",children:ot.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:h.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[ee.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:_e?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let J=L.currentTarget.getBoundingClientRect(),xe=Math.round((L.clientX-J.left)/J.width*100/5)*5;bt("progress",Math.max(0,Math.min(100,xe)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${_e?"rgba(65,71,84,0.05)":h.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!Ce),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:h.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Ce?"":"-rotate-90"}`,style:{color:h.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Ce&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?nk(ee.effortMinutes):"",onChange:L=>{let J=ok(L.target.value);bt("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ee.parentId||"",onChange:L=>bt("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(L=>L.id!==a?.id).map(L=>jsx("option",{value:L.id,children:L.name},L.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:L=>bt("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:L=>bt("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o})]})]}),(m||d.length>0||i==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.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:h.textTertiary},children:["Adjuntos ",i==="create"?we.length>0&&`(${we.length})`:d.length>0&&`(${d.length})`]})]}),i==="create"?jsx(ps,{cardId:"pending",attachments:we.map((L,J)=>({id:`pending-${J}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>G(J=>[...J,...L]),onDelete:L=>{let J=parseInt(L.replace("pending-",""),10);G(xe=>xe.filter((I,j)=>j!==J));},maxSizeMB:10,maxFiles:20}):jsx(ps,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?L=>m(a.id,L):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),i==="create"&&we.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[we.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:L=>bt("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:h.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:h.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(L=>{let J=r.find(xe=>xe.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${h.accent}20`,color:h.accent},children:[J?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let xe=(ee.dependencies||[]).filter(I=>I!==L);bt("dependencies",xe);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},L)})}),jsxs("button",{type:"button",onClick:()=>{oe(!Ve),le("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Ve&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{oe(false),le("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${h.border}`},children:jsx("input",{type:"text",value:Be,onChange:L=>le(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:h.bgSecondary,color:h.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(L=>L.id!==a?.id).filter(L=>Be===""||L.name.toLowerCase().includes(Be.toLowerCase())).map(L=>{let J=ee.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let xe=ee.dependencies||[],I;J?I=xe.filter(j=>j!==L.id):I=[...xe,L.id],bt("dependencies",I);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${h.accent}10`:"transparent"},onMouseEnter:xe=>{J||(xe.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:xe=>{xe.currentTarget.style.backgroundColor=J?`${h.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:J?h.accent:"transparent",borderColor:J?h.accent:h.borderLight},children:J&&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:h.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:h.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:h.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${_e?"rgba(65,71,84,0.1)":h.border}`,backgroundColor:_e?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:h.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=h.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=h.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:L=>!o&&(L.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:L=>!o&&(L.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Pg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let X=ue=>ue.map(ye=>{if(ye.id===F){let _e=ye.dependencies||[];if(!_e.includes(T.id)){let Ee=[...(ye.dependencyLinks??[]).filter(rt=>rt.id!==T.id),{id:T.id,type:j,lag:0}];return {...ye,dependencies:[..._e,T.id],dependencyLinks:Ee}}}return ye.subtasks?{...ye,subtasks:X(ye.subtasks)}:ye});An.current+=1,tt(ue=>X(ue)),Ut?.(T.id,F,j);},[Ut,tm]),nm=useCallback((T,F)=>{let j=X=>X.map(ue=>{if(ue.id===T&&ue.dependencies){let ye=ue.dependencies.filter(_e=>_e!==F);return {...ue,dependencies:ye}}return ue.subtasks?{...ue,subtasks:j(ue.subtasks)}:ue});An.current+=1,tt(X=>j(X)),Ye?.(T,F);},[Ye]),{startDate:In,endDate:cd,primeraTarea:rm,ultimaTarea:om}=useMemo(()=>{let T=ke.filter(rt=>rt.startDate&&rt.endDate);if(T.length===0){let rt=new Date,Nt=new Date(rt);Nt.setDate(Nt.getDate()-30);let Vt=new Date(rt);return Vt.setDate(Vt.getDate()+60),{startDate:Ru(Nt,Xe),endDate:Vt,primeraTarea:null,ultimaTarea:null}}let F=T.flatMap(rt=>[rt.startDate,rt.endDate]).filter(rt=>rt!==void 0),j=new Date(Math.min(...F.map(rt=>rt.getTime()))),X=new Date(Math.max(...F.map(rt=>rt.getTime()))),ue=new Date(j),ye=new Date(X),_e=Yf(j,X,new Date);j.setTime(_e.inicio.getTime()),X.setTime(_e.fin.getTime());let Ee=Xe==="day"?7:Xe==="week"?14:30;return j.setDate(j.getDate()-Ee),X.setDate(X.getDate()+Ee),{startDate:Ru(j,Xe),endDate:X,primeraTarea:ue,ultimaTarea:ye}},[ke,Xe]);useEffect(()=>{ee.current?.(In,cd);},[In,cd]);let sm=useCallback(async()=>{if(!ls.current||!vr.current||!dn.current)return;await new Promise(kr=>setTimeout(kr,200));let T=ls.current,F=vr.current,j=bo.current||F.querySelector(".gantt-grid-scroll"),X=dn.current,ue=j?.scrollTop||0,ye=j?.scrollLeft||0,_e=X.scrollTop,Ee=X.scrollLeft,rt=T.style.overflow,Nt=T.style.height,Vt=j?.style.overflow||"",Ga=X.style.overflow,Rn=F.style.overflow,lr=T.style.width,cr=X.style.width;try{let kr=j?.querySelector(".gantt-taskgrid-content"),to=X.querySelector("svg"),Ei=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,Ro=kr?.scrollHeight||j?.scrollHeight||600,Cl=Math.max(Ei,X.scrollHeight),Mi=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||X.scrollWidth,wy=T.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,md=Math.max(Ro,Cl,Ei),xm=wy+md+50,vm=(j?.offsetWidth||F.offsetWidth||300)+Mi+10;j&&(j.scrollTop=0,j.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,T.style.overflow="visible",T.style.height=`${xm}px`,T.style.width=`${vm}px`,F.style.overflow="visible",j&&(j.style.overflow="visible",j.style.height=`${md+50}px`),X.style.overflow="visible",X.style.height=`${md+50}px`,X.style.width=`${Mi+10}px`,await new Promise(Tl=>setTimeout(Tl,150));let ky=await toPng(T,{backgroundColor:G.bgPrimary,pixelRatio:2,width:vm,height:xm,skipFonts:!1,filter:Tl=>{if(!(Tl instanceof Element))return !0;let wm=window.getComputedStyle(Tl),km=parseInt(wm.zIndex,10);return !(!isNaN(km)&&km>=50||wm.position==="fixed")}}),gd=document.createElement("a");gd.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,gd.href=ky,gd.click();}finally{T.style.overflow=rt,T.style.height=Nt,T.style.width=lr,F.style.overflow=Rn,j&&(j.style.overflow=Vt,j.style.height="",j.scrollTop=ue,j.scrollLeft=ye),X.style.overflow=Ga,X.style.height="",X.style.width=cr,X.scrollTop=_e,X.scrollLeft=Ee;}u?.("png");},[G,u]),im=useCallback(async()=>{await Re.exportToPDF(ke),u?.("pdf");},[ke,u]),dd=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});dd.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let lm=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let T=new Date,F=ue=>String(ue).padStart(2,"0"),j=`${T.getFullYear()}-${F(T.getMonth()+1)}-${F(T.getDate())}_${F(T.getHours())}${F(T.getMinutes())}`,X=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Re.exportToExcel(ke,`${X}_${j}.xlsx`,dd.current),u?.("excel");},[ke,p,u,a.onExportExcel]),fy=useCallback(()=>{let T=Re.exportToCSV(ke),F=new Blob([T],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(F),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href),u?.("csv");},[ke,u]),by=useCallback(()=>{let T=Re.exportToJSON(ke),F=new Blob([T],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(F),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href),u?.("json");},[ke,u]),cm=useCallback(()=>{Re.exportToMSProject(ke,"Gantt Project","project.xml"),u?.("msproject");},[ke,u]),hy=T=>{T.preventDefault(),I(true);},zs=useRef(false),[ud,dm]=useState(false),Si=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let T=dn.current,F=vr.current?.querySelector(".gantt-grid-scroll");if(!T||!F)return;let j=()=>{if(zs.current)return;zs.current=true;let Ee=T.scrollTop;$(Ee),F.scrollTop=Ee,requestAnimationFrame(()=>{zs.current=false;});},X=()=>{if(zs.current)return;zs.current=true;let Ee=F.scrollTop;$(Ee),T.scrollTop=Ee,requestAnimationFrame(()=>{zs.current=false;});},ue=Ee=>{if(te&&F){let Nt=F.parentElement?.getBoundingClientRect()?.left||0,Vt=Ee.clientX-Nt,Ga=200,Rn=Ws+wl,lr=window.innerWidth*Di,cr=Math.max(Rn,lr);Vt>=Ga&&Vt<=cr&&fe(Vt);}if(ud&&T){let rt=Ee.clientX-Si.current.x,Nt=Ee.clientY-Si.current.y;T.scrollLeft=Si.current.scrollLeft-rt,T.scrollTop=Si.current.scrollTop-Nt;}},ye=()=>{I(false),dm(false);},_e=Ee=>{if(Ee.button!==0)return;let rt=Ee.target;rt.closest("[data-task-bar]")||rt.closest("[data-dependency-line]")||rt.closest("button")||rt.closest('[role="button"]')||rt.tagName==="rect"&&rt.getAttribute("data-clickable")==="true"||(dm(true),Si.current={x:Ee.clientX,y:Ee.clientY,scrollLeft:T.scrollLeft,scrollTop:T.scrollTop},Ee.preventDefault());};return T.addEventListener("scroll",j),F.addEventListener("scroll",X),T.addEventListener("mousedown",_e),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",ye),()=>{T.removeEventListener("scroll",j),F.removeEventListener("scroll",X),T.removeEventListener("mousedown",_e),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",ye);}},[te,ud,Ws]),C.current={startDate:In,timeScale:Xe,zoom:Ht};let pd=a.onTodayVisibilityChange,um=useRef(void 0);useEffect(()=>{if(!pd)return;let T=dn.current;if(!T)return;let F=io(Xe),j=()=>{let ye=(new Date().getTime()-In.getTime())/(1e3*60*60*24)*F*Ht,_e=T.scrollLeft,Ee=_e+T.clientWidth,rt=Qf(ye,_e,Ee);um.current!==rt&&(um.current=rt,pd(rt===null,rt));};return j(),T.addEventListener("scroll",j,{passive:true}),window.addEventListener("resize",j),()=>{T.removeEventListener("scroll",j),window.removeEventListener("resize",j);}},[pd,In,Xe,Ht]);let kl=useRef(false),[pm,yy]=useState(0),xy=useRef(null);useLayoutEffect(()=>{if(kl.current)return;let T=ke.length===0;if(!dn.current)return;if(dn.current.clientWidth===0){if(pm>120)return;let Vt=requestAnimationFrame(()=>yy(Ga=>Ga+1));return ()=>cancelAnimationFrame(Vt)}T||(kl.current=true,xy.current=In);let F=dn.current,j=[a?.projectForecast?.expectedFinish,a?.finPlaneado].filter(Vt=>Vt instanceof Date&&!isNaN(Vt.getTime())),X=j.length?new Date(Math.max(...j.map(Vt=>Vt.getTime()))):null,ue=T?new Date:Xf(rm,om,new Date,X),ye=io(Xe),_e=(ue.getTime()-In.getTime())/(1e3*60*60*24),Ee=F.clientWidth,Nt=_e*ye*Ht-Ee*Bu;_e>=0&&Ee>0&&(F.scrollLeft=Math.max(0,Nt));},[ke.length,In,Xe,Ht,pm,rm,om,a?.projectForecast?.expectedFinish,a?.finPlaneado]);let mm=useRef(null),gm=useRef(null);useLayoutEffect(()=>{let T=gm.current;if(gm.current={timeScale:Xe,zoom:Ht},!T||T.timeScale===Xe&&T.zoom===Ht)return;let F=dn.current,j=mm.current;if(!F||!j||F.clientWidth===0)return;let X=(j.getTime()-In.getTime())/864e5*io(Xe)*Ht;F.scrollLeft=Math.max(0,X-F.clientWidth/2);},[Xe,Ht,In]);let[cs,vy]=useState(null);useEffect(()=>{let T=dn.current;if(!T)return;let F=0,j=()=>{cancelAnimationFrame(F),F=requestAnimationFrame(()=>{let X=T.scrollLeft,ue=X+T.clientWidth,ye=T.scrollTop,_e=ye+T.clientHeight;if(vy(Ee=>Ee&&Ee.izq===X&&Ee.der===ue&&Ee.arriba===ye&&Ee.abajo===_e?Ee:{izq:X,der:ue,arriba:ye,abajo:_e}),kl.current&&T.clientWidth>0){let Ee=(X+T.clientWidth/2)/(io(Xe)*Ht);mm.current=new Date(In.getTime()+Ee*864e5);}});};return j(),T.addEventListener("scroll",j,{passive:true}),window.addEventListener("resize",j),()=>{cancelAnimationFrame(F),T.removeEventListener("scroll",j),window.removeEventListener("resize",j);}},[Xe,Ht,In]);let[fm,bm]=useState(false),hm=useMemo(()=>{if(fm||!cs||cs.abajo<=cs.arriba)return null;let T=10;return {desde:Math.max(0,Math.floor(cs.arriba/Kt)-T),hasta:Math.ceil(cs.abajo/Kt)+T}},[fm,cs,Kt]),ym=useRef(null);return useLayoutEffect(()=>{let T=ym.current;if(ym.current={t:In.getTime(),timeScale:Xe,zoom:Ht},!T||!kl.current||T.timeScale!==Xe||T.zoom!==Ht||T.t===In.getTime())return;let F=dn.current;if(!F)return;let j=io(Xe),X=(T.t-In.getTime())/(1e3*60*60*24);F.scrollLeft=Math.max(0,F.scrollLeft+X*j*Ht);},[In,Xe,Ht]),useLayoutEffect(()=>{let T=Qt.current;!T||C.current?.timeScale!==Xe||(Qt.current=null,ra(T));},[Xe,In,Ht]),jsx(gs.Provider,{value:cn,children:jsx(xd.Provider,{value:ne,children:jsxs("div",{ref:ls,className:"flex flex-col h-full w-full",style:{backgroundColor:G.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...G.dotGrid&&{backgroundImage:`radial-gradient(circle, ${G.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let T=W&&V?jsx(Cf,{timeScale:Xe,onTimeScaleChange:Tt,rowDensity:it,onRowDensityChange:Jt,taskFilter:$e,onTaskFilterChange:Q,hideCompleted:Ie,onHideCompletedChange:pt,toolbarRightContent:S,showCreateTaskButton:M&&Ve?.canCreateTask!==false&&!Ve?.canCreateSubtaskOnly,createTaskLabel:z,onCreateTask:L,wbsLevel:Te,onWbsLevelChange:U?void 0:Rr,maxWbsDepth:Ra,viewMode:Dt,onViewModeChange:B?la:void 0,showCriticalPath:Ha,onShowCriticalPathChange:vn,showDependencies:Wa,onShowDependenciesChange:A,highlightWeekends:xn,onHighlightWeekendsChange:Y,hasDependencies:je,onExportPNG:l?sm:void 0,onExportPDF:l?im:void 0,onExportExcel:l?lm:void 0,onExportMSProject:l?cm:void 0,onCopySnapshotLink:O,masOpciones:E,contenidoDeVista:Pe,leyendaVisible:J,onLeyendaVisibleChange:de}):jsx(nc,{enCabecera:!!V,theme:G,timeScale:Xe,onTimeScaleChange:Tt,zoom:Ht,onZoomChange:we,currentTheme:Qe,onThemeChange:et,rowDensity:it,onRowDensityChange:Jt,showThemeSelector:c,showCreateTaskButton:M&&Ve?.canCreateTask!==false&&!Ve?.canCreateSubtaskOnly,createTaskLabel:z,onCreateTask:L,taskFilter:$e,onTaskFilterChange:Q,hideCompleted:Ie,onHideCompletedChange:pt,toolbarRightContent:S,wbsLevel:Te,onWbsLevelChange:U?void 0:Rr,maxWbsDepth:Ra,viewMode:Dt,onViewModeChange:B?la:void 0,projectForecast:ce,hideForecastHud:oe,currencyCode:gt,onExportPNG:l?sm:void 0,onExportPDF:l?im:void 0,onExportExcel:l?lm:void 0,onExportCSV:l?fy:void 0,onExportJSON:l?by:void 0,onExportMSProject:l?cm:void 0,showCriticalPath:Ha,onShowCriticalPathChange:vn,showDependencies:Wa,onShowDependenciesChange:A,highlightWeekends:xn,onHighlightWeekendsChange:Y,showBaseline:ha,onShowBaselineChange:F=>{if(nt){nt(F);return}F&&Dt!=="oracle"&&la("oracle"),!F&&Dt==="oracle"&&la("execution");},onCopySnapshotLink:O,hasDependencies:je});return V?createPortal(T,V):jsx("div",{style:{position:"relative",zIndex:100},children:T})})(),jsxs("div",{ref:vr,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[ke.length===0&&L&&jsx("div",{"data-gantt-vacio":true,style:{position:"absolute",inset:0,zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:jsxs("div",{style:{pointerEvents:"auto",textAlign:"center",padding:"28px 32px",borderRadius:14,maxWidth:360,background:G.bgSecondary||G.bgPrimary,border:`1px solid ${G.border}`,boxShadow:"0 10px 30px rgba(0,0,0,0.10)"},children:[jsx("div",{style:{fontSize:15,fontWeight:600,color:G.textPrimary,marginBottom:6},children:Ja?"Este proyecto a\xFAn no tiene tareas":"This project has no tasks yet"}),jsx("div",{style:{fontSize:12.5,color:G.textSecondary,marginBottom:16,lineHeight:1.45},children:Ja?"Crea la primera y el cronograma empezar\xE1 a dibujarse desde hoy.":"Create the first one and the timeline starts from today."}),jsxs("button",{type:"button",onClick:L,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:8,border:"none",cursor:"pointer",background:G.accent||"#00E5CC",color:"#fff",fontSize:13,fontWeight:600},children:["+ ",Ja?"Crear la primera tarea":"Create the first task"]})]})}),jsx("div",{ref:bo,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ni,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(lc,{v6:!!W,resumenV6:Ct,onMostrarOcultas:W&&Lt>0?()=>pt(false):void 0,avisoVencidas:St,onVerVencidas:St?()=>{pt(false),Q("overdue");}:void 0,onContraerTodo:W?ea:void 0,addTaskRow:a.addTaskRow,tasks:Oe,allTasks:se,theme:G,rowHeight:Kt,filasVisibles:hm,availableUsers:d,templates:le,showCriticalPath:Ha,onTaskClick:ct,onTaskSelectionChange:ft,selectedTaskId:ut,onTaskDblClick:em,onTaskContextMenu:lt,onTaskToggle:ca,scrollTop:ie,columns:vl??eo,onToggleColumn:At,onColumnResize:It,onTaskUpdate:ua,onBulkFill:Qa,onTaskIndent:fr,onTaskOutdent:zn,onTaskMove:wr,onMultiTaskDelete:Zn,onTaskDuplicate:ly,onTaskCreate:cy,onTaskRename:dy,onCreateSubtask:ld,onTaskDependencies:a.onTaskDependencies,onOpenTaskModal:ct?T=>ct(T):void 0,onDeleteRequest:(T,F)=>st({taskIds:T,taskName:F}),onTaskReparent:ho,scrollContainerRef:bo})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:G.border,zIndex:15},onMouseDown:hy}),jsx("div",{ref:dn,className:"gantt-timeline-scroll flex-1",tabIndex:0,role:"region","aria-label":Ja?"Cronograma":"Timeline",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ud?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(vc,{filasVisibles:hm,v6:!!W,tareaEnFoco:ut??null,alturaCabecera:W?60:void 0,alturaBarra:W?bt[it].barra:void 0,tasks:Oe,theme:G,rowHeight:Kt,timeScale:Xe,startDate:In,endDate:cd,zoom:Ht,locale:y,templates:le,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:ct,onTaskDblClick:em,onTaskContextMenu:my,onTaskDateChange:py,onTaskProgressDrag:uy,onDependencyCreate:am,onDependencyDelete:nm,showBaseline:ha,showCriticalPath:Ha,showDependencies:Wa,highlightWeekends:xn,weekHeaderFormat:a.weekHeaderFormat,canEditTask:Ve?.canEditTask,workingDaysConfig:a?.workingDaysConfig,ventanaVisible:cs,onIrAFecha:T=>ra(T,"center"),finPlaneado:a?.finPlaneado??null,finPrevisto:a?.projectForecast?.expectedFinish??null})})]}),me.task&&jsx(ti,{isOpen:me.isOpen,x:me.x,y:me.y,theme:G,onClose:()=>ge({isOpen:false,x:0,y:0,task:null}),items:(()=>{let T=me.task;if(!T)return [];let F=Re.findTaskById(ke,T.id)||T,j=F.subtasks&&F.subtasks.length>0,X=Ve?.canCreateTask!==false,ue=Ve?.canDeleteTask!==false;if(j){let Nt=[],Vt=Ve?.canDuplicateTask!==false;return X&&Nt.push({id:"addSubtask",label:cn.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{Ne?Ne(F):ld(F.id);}}),Vt&&Nt.push({id:"duplicate",label:cn.contextMenu?.duplicateTask||"Duplicate Task",icon:ga.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):tt(Ga=>Qi(Ga,[F.id]).tasks),ge({isOpen:false,x:0,y:0,task:null});}}),ue&&(Nt.length>0&&Nt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Nt.push({id:"delete",label:cn.contextMenu?.deleteTask||"Delete Task",icon:ga.Delete,onClick:()=>{st({taskIds:[F.id],taskName:F.name});}})),Nt}let ye=Ve?.canUpdateTask!==false,_e=Ve?.canDuplicateTask!==false,Ee=[];return ye&&Ee.push({id:"edit",label:cn.contextMenu?.editTask||"Edit Task",icon:ga.Pencil,onClick:()=>{zt?zt(F):Ce(F);}}),X&&Ee.push({id:"addSubtask",label:cn.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{Ne?Ne(F):ld(F.id);}}),ye&&(a.onTaskDependencies||zt)&&Ee.push({id:"dependencies",label:cn.contextMenu?.dependencies||"Dependencies\u2026",icon:ga.Link,onClick:()=>{a.onTaskDependencies?a.onTaskDependencies(F):zt?.(F),ge({isOpen:false,x:0,y:0,task:null});}}),Ee.length>0&&ye&&Ee.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ye&&(Ee.push({id:"markIncomplete",label:cn.contextMenu?.markIncomplete||"Mark Incomplete",icon:ga.MarkIncomplete,onClick:()=>{Ot?Ot(F):ua(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),Ee.push({id:"setInProgress",label:cn.contextMenu?.setInProgress||"Set In Progress",icon:ga.SetInProgress,onClick:()=>{wt?wt(F):ua(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),Ee.push({id:"markComplete",label:cn.contextMenu?.markComplete||"Mark Complete",icon:ga.MarkComplete,onClick:()=>{ua(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(_e||ye&&F.startDate&&F.endDate)&&Ee.length>0&&Ee.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),_e&&Ee.push({id:"duplicate",label:cn.contextMenu?.duplicateTask||"Duplicate Task",icon:ga.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):tt(Nt=>Qi(Nt,[F.id]).tasks),ge({isOpen:false,x:0,y:0,task:null});}}),ye&&F.startDate&&F.endDate&&Ee.push({id:"split",label:cn.contextMenu?.splitTask||"Split Task",icon:ga.Split,onClick:()=>{let Nt=F.startDate.getTime(),Vt=F.endDate.getTime(),Ga=Nt+(Vt-Nt)/2,Rn=new Date(Ga);gy(F,Rn);}}),ue&&(Ee.length>0&&Ee.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ee.push({id:"delete",label:cn.contextMenu?.deleteTask||"Delete Task",icon:ga.Delete,onClick:()=>{st({taskIds:[F.id],taskName:F.name});}})),Ee})()}),jsx(bs,{task:pe,isOpen:!!pe,onClose:()=>Ce(null),onTaskUpdate:T=>{pe&&(ua(pe.id,T),Ce(null));},theme:Qe==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Se&&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:()=>st(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:T=>T.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:G.bgSecondary,border:`1px solid ${G.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${G.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:G.textPrimary,fontFamily:"Inter, sans-serif"},children:[cn.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:G.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:G.textSecondary,fontFamily:"Inter, sans-serif"},children:Se.taskIds.length>1?jsxs(Fragment,{children:[y==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:G.textPrimary},children:[Se.taskIds.length," ",y==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:G.textPrimary},children:['"',Se.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:G.bgPrimary,borderTop:`1px solid ${G.border}`},children:[jsx("button",{onClick:()=>st(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:G.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=G.hoverBg;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Zn(Se.taskIds),st(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:T=>{T.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(Cc,{tasks:ke,theme:G,config:x,onTasksUpdate:tt,onTaskUpdate:ua,onTaskCreate:T=>{tt(F=>[...F,T]);},onTaskDelete:T=>{Zn([T]);},onDependencyCreate:(T,F,j)=>{let X=Re.findTaskById(ke,T);X&&am(X,F,j);},onDependencyDelete:nm})]})})})});function dC(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function uC(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let n=t.match(/(\d+)h/);if(n&&n[1])return parseInt(n[1],10)*60;let r=t.match(/(\d+)m/);if(r&&r[1])return parseInt(r[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var Ec=[{id:"todo",title:"Por hacer",color:"#6B7280"},{id:"in-progress",title:"En progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],$u=[{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 d0({isOpen:e,onClose:t,task:a,availableTasks:n=[],availableUsers:r=[],onSubmit:s,isLoading:o=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let b=vo(),w={todo:"To do","in-progress":"In progress",completed:"Completed"},h=new Set(Ec.flatMap(O=>[O.title.toLowerCase(),(w[O.id]??"").toLowerCase(),"por hacer","en progreso","completada","completado","to do","in progress","completed","done"])),x=[...Ec.map(O=>b?O:{...O,title:w[O.id]??O.title}),...l.filter(O=>!Ec.some(xe=>xe.id===O.id)&&!h.has((O.title??"").trim().toLowerCase()))],y=Et[c]||Et.dark,[k,M]=useState(false),[z,L]=useState(false),[N,D]=useState(false),[S,V]=useState(false),[U,W]=useState({top:0,left:0}),[E,Pe]=useState(null),[J,de]=useState(new Date),[R,Ae]=useState({top:0,left:0}),[nt,Ge]=useState(false),[B,ce]=useState([]),[oe,gt]=useState(false),Je=k||z||N||S||E!==null||oe;useEffect(()=>{if(!e||Je)return;let O=xe=>{xe.key==="Escape"&&t();};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,Je,t]);let[ct,ft]=useState(""),ut=useRef(null),Rt=useRef(null);useEffect(()=>{if(!oe)return;let O=Be=>{let Qe=Be.target;ut.current?.contains(Qe)||Rt.current?.contains(Qe)||(gt(false),ft(""));},xe=Be=>{Be.key==="Escape"&&(Be.stopPropagation(),gt(false));};return document.addEventListener("mousedown",O),document.addEventListener("keydown",xe,true),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",xe,true);}},[oe]);let lt=useRef(null),vt=useRef(null),Mt=useRef(null),Pt=useRef(null),zt=useRef(null),[Ne,Ot]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[wt,Ut]=useState({});useEffect(()=>{a?(Ot({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||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ge(true)):(Ot({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),Ge(false),ce([]));},[a,e,v]),useEffect(()=>{let O=xe=>{lt.current&&!lt.current.contains(xe.target)&&M(false),vt.current&&!vt.current.contains(xe.target)&&L(false),Mt.current&&!Mt.current.contains(xe.target)&&D(false),Pt.current&&!Pt.current.contains(xe.target)&&V(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let Ye=()=>{let O={};return Ne.name.trim()||(O.name="El nombre es requerido"),Ne.startDate&&Ne.endDate&&Ne.startDate>Ne.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Ut(O),Object.keys(O).length===0},qe=async O=>{if(O.preventDefault(),!!Ye())try{let xe=i==="create"&&B.length>0?{...Ne,pendingFiles:B}:Ne;await s(xe),ce([]),t();}catch(xe){console.error("Error submitting task:",xe);}},_=(O,xe)=>{Ot(Be=>{let Qe={...Be,[O]:xe};if(O==="status"){let Ft=xe;Ft==="todo"?Qe.progress=0:Ft==="in-progress"?(Be.progress===0||Be.progress===100)&&(Qe.progress=50):Ft==="completed"||Ft==="closed"?Qe.progress=100:(Ft==="in-review"||Ft==="review")&&(Qe.progress=75);}if(O==="progress"){let Ft=typeof xe=="number"?xe:parseInt(xe,10);Ft===100&&Be.status!=="completed"?Qe.status="completed":Ft>0&&Ft<100&&Be.status==="todo"?Qe.status="in-progress":Ft===0&&Be.status!=="todo"&&(Qe.status="todo");}return Qe}),wt[O]&&Ut(Be=>{let Qe={...Be};return delete Qe[O],Qe});},he=x.find(O=>O.id===Ne.status)??Ec[0],Z=$u.find(O=>O.id===Ne.priority)??$u[1],ze=fs.find(O=>O.value===Ne.color)??fs[0],Me=c==="dark",Ve={backgroundColor:Me?"#1d1f27":y.bgSecondary,border:`1px solid ${Me?"rgba(65,71,84,0.1)":y.borderLight}`,color:y.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Me?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{role:"dialog","aria-modal":"true","aria-label":i==="create"?b?"Nueva tarea":"New task":b?"Editar tarea":"Edit task",className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Me?"#0a0a0a":y.bgPrimary,border:`1px solid ${Me?"rgba(65,71,84,0.1)":y.border}`,boxShadow:Me?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:O=>O.stopPropagation(),children:jsxs("form",{onSubmit:qe,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:Ne.name,"aria-label":b?"Nombre de la tarea":"Task name",onChange:O=>_("name",O.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:y.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),wt.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),wt.name]}),jsx("textarea",{value:Ne.description||"",onChange:O=>_("description",O.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:y.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":y.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:lt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&M(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ve,borderColor:he.color,backgroundColor:`${he.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:he.color}}),jsx("span",{style:{color:he.color},children:he.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:he.color}})]}),jsx(AnimatePresence,{children:k&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Me?"#0a0a0a":y.bgPrimary,backdropFilter:Me?"blur(16px)":void 0,border:`1px solid ${Me?"#262626":y.border}`,boxShadow:Me?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:x.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{_("status",O.id),M(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,Ne.status===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:y.accent}})]},O.id))})})]}),jsxs("div",{ref:vt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&L(!z),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ve,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Z.color}}),jsx("span",{children:Z.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsx(AnimatePresence,{children:z&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Me?"#0a0a0a":y.bgPrimary,backdropFilter:Me?"blur(16px)":void 0,border:`1px solid ${Me?"#262626":y.border}`,boxShadow:Me?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:$u.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{_("priority",O.id),L(false);},children:[jsx("span",{children:O.icon}),O.label,Ne.priority===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:y.accent}})]},O.id))})})]}),r.length>0&&jsxs("div",{ref:Mt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&D(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ve,disabled:o,children:[Ne.assignees&&Ne.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Ne.assignees.slice(0,3).map((O,xe)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||y.accent,borderColor:y.bgSecondary},children:O.initials},xe))}),Ne.assignees.length>3&&jsxs("span",{style:{color:y.textTertiary},children:["+",Ne.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:y.textTertiary}}),jsx("span",{style:{color:y.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Me?"#0a0a0a":y.bgPrimary,backdropFilter:Me?"blur(16px)":void 0,border:`1px solid ${Me?"#262626":y.border}`,boxShadow:Me?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:r.map(O=>{let xe=Ne.assignees?.some(Be=>Be.name===O.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:Be=>Be.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:Be=>Be.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Be=xe?(Ne.assignees||[]).filter(Qe=>Qe.name!==O.name):[...Ne.assignees||[],{name:O.name,avatar:O.avatar,initials:ma(O.name),color:y.accent}];_("assignees",Be);},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:y.accent},children:ma(O.name)}),jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:xe&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:y.accent}})})]},O.id)})})})]}),jsxs("div",{ref:Pt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(S)V(false);else {if(Pt.current){let O=Pt.current.getBoundingClientRect(),xe=window.innerHeight,Be=120,Ft=xe-O.bottom<Be?O.top-Be-8:O.bottom+8;W({top:Ft,left:O.left});}V(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ve,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Ne.color}}),jsx("span",{children:ze.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsx(AnimatePresence,{children:S&&jsxs(Fa,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>V(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:`${U.top}px`,left:`${U.left}px`,zIndex:99999,backgroundColor:Me?"#0a0a0a":y.bgPrimary,backdropFilter:Me?"blur(16px)":void 0,border:`1px solid ${Me?"#262626":y.border}`,boxShadow:Me?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:fs.slice(0,18).map(O=>{let xe=Ne.color===O.value;return jsx("button",{type:"button",onClick:Be=>{Be.preventDefault(),Be.stopPropagation(),_("color",O.value),V(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:xe?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||p?jsx(Vs,{selectedTags:Ne.tags||[],availableTags:u,onChange:O=>_("tags",O),onCreateTag:p,theme:y,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:y.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Me?"#191b22":y.bgSecondary,borderRadius:8,border:`1px solid ${Me?"rgba(65,71,84,0.05)":y.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:zt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!Ne.isMilestone)if(E==="start")Pe(null);else {if(zt.current){let O=zt.current.getBoundingClientRect();Ae({top:O.bottom+8,left:Math.max(16,O.left-40)});}Pe("start"),de(Ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ve,opacity:Ne.isMilestone?.5:1,cursor:Ne.isMilestone?"not-allowed":"pointer"},disabled:o||Ne.isMilestone,children:Ne.startDate?Ne.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:y.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!Ne.isMilestone)if(E==="end")Pe(null);else {if(zt.current){let O=zt.current.getBoundingClientRect();Ae({top:O.bottom+8,left:Math.max(16,O.left-40)});}Pe("end"),de(Ne.endDate||Ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ve,opacity:Ne.isMilestone?.5:1,cursor:Ne.isMilestone?"not-allowed":"pointer"},disabled:o||Ne.isMilestone,children:Ne.endDate?Ne.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:E&&jsxs(Fa,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>Pe(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:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:Me?"#0a0a0a":y.bgPrimary,border:`1px solid ${Me?"#262626":y.border}`,boxShadow:Me?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Me?"#262626":y.border}`},children:[(()=>{let O=new Date,xe=new Date(O);xe.setDate(O.getDate()+1);let Be=new Date(O);Be.setDate(O.getDate()+7);let Qe=new Date(O);return Qe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:xe},{label:"Pr\xF3xima semana",date:Be},{label:"2 semanas",date:Qe}].map((Xe,Tt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:y.textPrimary},onMouseEnter:it=>it.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",onClick:()=>{E==="start"?(_("startDate",Xe.date),(!Ne.endDate||Xe.date>Ne.endDate)&&_("endDate",Xe.date),Pe("end")):(_("endDate",Xe.date),(!Ne.startDate||Xe.date<Ne.startDate)&&_("startDate",Xe.date),Pe(null));},children:Xe.label},Tt))})(),jsx("div",{style:{borderTop:`1px solid ${y.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:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{_("startDate",void 0),_("endDate",void 0),Pe(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:()=>de(new Date(J.getFullYear(),J.getMonth()-1)),className:"p-1 rounded",onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:y.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:y.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:J.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>de(new Date(J.getFullYear(),J.getMonth()+1)),className:"p-1 rounded",onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:y.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["L","M","X","J","V","S","D"].map((O,xe)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:y.textTertiary},children:O},xe))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=J.getFullYear(),xe=J.getMonth(),Be=(new Date(O,xe,1).getDay()+6)%7,Qe=new Date(O,xe+1,0).getDate(),Ft=new Date,Xe=[];for(let it=Be-1;it>=0;it--)Xe.push({day:new Date(O,xe,-it).getDate(),date:new Date(O,xe-1,new Date(O,xe,-it).getDate()),isCurrentMonth:false});for(let it=1;it<=Qe;it++)Xe.push({day:it,date:new Date(O,xe,it),isCurrentMonth:true});let Tt=42-Xe.length;for(let it=1;it<=Tt;it++)Xe.push({day:it,date:new Date(O,xe+1,it),isCurrentMonth:false});return Xe.map((it,ba)=>{let Jt=it.date.toDateString()===Ft.toDateString(),Ht=Ne.startDate?.toDateString()===it.date.toDateString(),we=Ne.endDate?.toDateString()===it.date.toDateString(),Te=Ne.startDate&&Ne.endDate&&it.date>=Ne.startDate&&it.date<=Ne.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:it.isCurrentMonth?Ht||we?"#FFF":y.textPrimary:y.textTertiary,backgroundColor:Ht?y.accent:we?"#7C3AED":Te?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Jt&&!Ht&&!we?`inset 0 0 0 1px ${y.accent}`:"none"},onClick:()=>{E==="start"?(_("startDate",it.date),Ne.endDate&&it.date>Ne.endDate&&_("endDate",it.date),Pe("end")):(_("endDate",it.date),Ne.startDate&&it.date<Ne.startDate&&_("startDate",it.date),Pe(null));},children:it.day},ba)})})()})]})]})]})})]}),wt.endDate&&jsx("span",{className:"text-xs text-red-400",children:wt.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:y.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[Ne.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Me?"#33343c":"#E5E7EB"},onClick:O=>{if(o)return;let xe=O.currentTarget.getBoundingClientRect(),Be=Math.round((O.clientX-xe.left)/xe.width*100/5)*5;_("progress",Math.max(0,Math.min(100,Be)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ne.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Me?"rgba(65,71,84,0.05)":y.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>Ge(!nt),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:y.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${nt?"":"-rotate-90"}`,style:{color:y.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:nt&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:Ne.effortMinutes?dC(Ne.effortMinutes):"",onChange:O=>{let xe=uC(O.target.value);_("effortMinutes",xe);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`}})]}),n.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:Ne.parentId||"",onChange:O=>_("parentId",O.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),n.filter(O=>O.id!==a?.id).map(O=>jsx("option",{value:O.id,children:O.name},O.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:Ne.location||"",onChange:O=>_("location",O.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:Ne.equipment||"",onChange:O=>_("equipment",O.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`},disabled:o})]})]}),(m||d.length>0||i==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.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:y.textTertiary},children:["Adjuntos ",i==="create"?B.length>0&&`(${B.length})`:d.length>0&&`(${d.length})`]})]}),i==="create"?jsx(qs,{locale:b?"es":"en",cardId:"pending",attachments:B.map((O,xe)=>({id:`pending-${xe}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>ce(xe=>[...xe,...O]),onDelete:O=>{let xe=parseInt(O.replace("pending-",""),10);ce(Be=>Be.filter((Qe,Ft)=>Ft!==xe));},maxSizeMB:10,maxFiles:20}):jsx(qs,{locale:b?"es":"en",cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?O=>m(a.id,O):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),i==="create"&&B.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:y.textTertiary},children:[B.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:Ne.isMilestone,onChange:O=>_("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:y.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:y.textPrimary},children:"Marcar como hito"})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:y.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Ne.dependencies&&Ne.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Ne.dependencies.map(O=>{let xe=n.find(Be=>Be.id===O);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${y.accent}20`,color:y.accent},children:[xe?`${xe.wbsCode?xe.wbsCode+" \xB7 ":""}${xe.name}`:"\u2014",jsx("button",{type:"button",onClick:()=>{let Be=(Ne.dependencies||[]).filter(Qe=>Qe!==O);_("dependencies",Be);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},O)})}),jsxs("button",{ref:Rt,type:"button",onClick:()=>{gt(!oe),ft("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:oe&&jsx(Fragment,{children:jsxs(motion.div,{ref:ut,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Me?"#0a0a0a":y.bgPrimary,backdropFilter:Me?"blur(16px)":void 0,border:`1px solid ${Me?"#262626":y.border}`,boxShadow:Me?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${y.border}`},children:jsx("input",{type:"text",value:ct,onChange:O=>ft(O.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:y.bgSecondary,color:y.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[n.filter(O=>O.id!==a?.id).filter(O=>ct===""||O.name.toLowerCase().includes(ct.toLowerCase())).map(O=>{let xe=Ne.dependencies?.includes(O.id);return jsxs("button",{type:"button",onClick:()=>{let Be=Ne.dependencies||[],Qe;xe?Qe=Be.filter(Ft=>Ft!==O.id):Qe=[...Be,O.id],_("dependencies",Qe);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:xe?`${y.accent}10`:"transparent"},onMouseEnter:Be=>{xe||(Be.currentTarget.style.backgroundColor=y.hoverBg);},onMouseLeave:Be=>{Be.currentTarget.style.backgroundColor=xe?`${y.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:xe?y.accent:"transparent",borderColor:xe?y.accent:y.borderLight},children:xe&&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:y.textPrimary},children:O.name}),jsx("span",{className:"text-[10px]",style:{color:y.textTertiary},children:O.wbsCode??""})]})]},O.id)}),n.filter(O=>O.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:y.textTertiary},children:"No hay tareas disponibles"})]})]})})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Me?"rgba(65,71,84,0.1)":y.border}`,backgroundColor:Me?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:y.textTertiary},onMouseEnter:O=>O.currentTarget.style.color=y.textPrimary,onMouseLeave:O=>O.currentTarget.style.color=y.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:O=>!o&&(O.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:O=>!o&&(O.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var u0=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -406,40 +406,40 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
406
406
|
|
|
407
407
|
Always try to match task names case-insensitively and handle partial matches.
|
|
408
408
|
If you can't find a task by name, search through the provided task list.
|
|
409
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
410
|
-
${
|
|
409
|
+
If ambiguous, ask for clarification in the message field.`;function p0(e){return `CURRENT TASKS:
|
|
410
|
+
${m0(e).map(n=>{let r=n.startDate?n.startDate.toISOString().split("T")[0]:"no date",s=n.endDate?n.endDate.toISOString().split("T")[0]:"no date",o=n.dependencies?.length?`deps: [${n.dependencies.join(", ")}]`:"";return `- ${n.id}: "${n.name}" (${r} to ${s}, ${n.progress}%, ${n.status||"todo"}) ${o}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Lg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function qn(e,t){let a=Lg(e),r=t.toLowerCase().trim(),n=a.find(i=>i.name.toLowerCase()===r);if(n)return n;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return o.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={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}[n[1].toLowerCase()];if(m!==void 0){let f=new Date(r),v=f.getDay(),b=m-v;return b<=0&&(b+=7),f.setDate(f.getDate()+b),f}}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 d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let d=parseInt(i[1],10),m=parseInt(i[2],10)-1,f=parseInt(i[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),m=c[l[2].toLowerCase()],f=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,d)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},u=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(u&&u[1]&&u[2]){let d=p[u[1].toLowerCase()],m=parseInt(u[2],10),f=u[3]?parseInt(u[3],10):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function $d(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Ag(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 Ig(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),p=r[2].trim(),u=qn(t,l),d=Bd(p);if(!u)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:u.id,taskName:u.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=u.startDate&&u.endDate?Math.round((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:u.id,taskName:u.name,updates:{startDate:d,endDate:f},message:`Moved "${u.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),p=n[2].trim(),u=qn(t,l),d=$d(p);if(!u)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!u.endDate)return {type:"resize_task",taskId:u.id,taskName:u.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let m=new Date(u.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:u.id,taskName:u.name,updates:{endDate:m},message:`Extended "${u.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),u=qn(t,l),d=Od(p);return u?d===null?{type:"set_progress",taskId:u.id,taskName:u.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:u.id,taskName:u.name,updates:{progress:d},message:`Set "${u.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),u=qn(t,l);return u?{type:"rename_task",taskId:u.id,taskName:u.name,updates:{name:p},message:`Renamed "${u.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),u=qn(t,l),d=qn(t,p);return u?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:u.id,dependencyTo:d.id,message:`Linked "${u.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=qn(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Rg(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 sk(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 ik(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Pl(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let u=a.find(d=>d.id===p);return u?{name:u.name,initials:u.initials,color:u.color}:null}).filter(p=>p!==null),n=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Pl(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let o=p=>{if(p)return typeof p=="string"?new Date(p):p},i=o(e.startDate),c=o(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:sk(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Bg(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:ik(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $g(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Pl(r,e,t))}var Hd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ud={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Fl={en:Hd,es:Ud};function Wd(e){return Fl[e]||Fl.en}function Ll(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var zd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Og(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 Hg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Og(e),l=zd[0],p=zd.find(m=>m.value===c)??l,u=p.icon,d=m=>{switch(Og(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(u,{className:g("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(u,{className:g("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:zd.map(m=>{let f=m.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function xo(e,t,a=320){let[r,n]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,i=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!i&&c);},[t,a,e]),r}var Gd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Wg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),i=useRef(null),c=xo(i,s,180);useEffect(()=>{let u=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let l=Gd.find(u=>u.value===e)??Gd[4],p=r==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[p]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[p]}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gd.map(u=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(u.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[p]})]},u.value))})]})}function bi(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Vd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],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-[#00E5CC]"}function Rl({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,i]=useState(false),[c,l]=useState(""),p=useRef(null),u=useRef(null),d=xo(p,o);useEffect(()=>{let b=h=>{p.current&&!p.current.contains(h.target)&&(i(false),l(""));};return o&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{o&&u.current&&u.current.focus();},[o]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),f=b=>e.some(h=>h.name===b),v=b=>{if(a){if(f(b.name))a(e.filter(h=>h.name!==b.name));else {let h={name:b.name,initials:bi(b.name),color:b.color||Vd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:g("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,h)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:p,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),i(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,h)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:u,type:"text",value:c,onChange:b=>l(b.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${b.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let h=f(b.name);return jsxs("button",{onClick:y=>{y.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{h||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{h||(y.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):bi(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Kg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:i=false,placeholder:c}){let[l,p]=useState(false),[u,d]=useState(n),[m,f]=useState(()=>{let N=n==="start"?e:t;if(N){let z=N instanceof Date?N:new Date(N);return new Date(z.getFullYear(),z.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),b=useRef(null),h=useRef(null),[y,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let N=z=>{let $=z.target;v.current&&v.current.contains($)||h.current&&h.current.contains($)||p(false);};return l&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useLayoutEffect(()=>{if(!l){x(null);return}let N=()=>{let z=b.current?.getBoundingClientRect();if(!z)return;let $=520,Y=360,A=window.innerHeight-z.bottom,Se=A<Y&&z.top>A,W=Se?z.top-4:z.bottom+4,Ce=Math.min(Math.max(z.left,8),window.innerWidth-$-8);x({top:W,left:Ce,flipUp:Se});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[l]),useEffect(()=>{l&&d(r?n:"start");},[l,r,n]);let P=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",O=useCallback(()=>{let N=m.getFullYear(),z=m.getMonth(),$=new Date(N,z,1),A=new Date(N,z+1,0).getDate(),Se=$.getDay(),W=[],R=new Date(N,z,0).getDate();for(let G=Se-1;G>=0;G--)W.push({date:new Date(N,z-1,R-G),isCurrentMonth:false});for(let G=1;G<=A;G++)W.push({date:new Date(N,z,G),isCurrentMonth:true});let we=42-W.length;for(let G=1;G<=we;G++)W.push({date:new Date(N,z+1,G),isCurrentMonth:false});return W},[m]),T=N=>{if(r)n==="start"?a(N,C||void 0):a(w||void 0,N),p(false);else if(u==="start"){let z=C&&N>C?N:C;a(N,z||void 0),d("end");}else {let z=w&&N<w?N:w;a(z||void 0,N),p(false);}},D=()=>{let N=new Date,z=new Date(N);z.setDate(N.getDate()+1);let $=new Date(N);$.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let Y=new Date(N);Y.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let A=new Date(N);A.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let Se=new Date(N);Se.setDate(N.getDate()+14);let W=new Date(N);return W.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:z,display:z.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:A,display:A.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Se,display:Se.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let N=r&&n==="start"?w:C;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:P(N)})]})}let M=r&&n==="start"?w:C;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:b,onClick:N=>{N.stopPropagation(),p(!l);let z=n==="start"?w:C;z&&f(new Date(z.getFullYear(),z.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:P(M)})]}),l&&y&&createPortal(jsxs("div",{ref:h,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((N,z)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(N.date),children:[jsx("span",{children:N.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},z)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,C||void 0):a(w||void 0,void 0):a(void 0,void 0),p(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:u==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="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:g("font-medium",s?"text-white":"text-gray-900"),children:m.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:O().map((N,z)=>{let $=N.date.toDateString()===new Date().toDateString(),Y=w?.toDateString()===N.date.toDateString(),A=C?.toDateString()===N.date.toDateString(),Se=Y||A,W=!r&&w&&C&&N.date>=w&&N.date<=C;return jsx("button",{onClick:()=>T(new Date(N.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),$&&"ring-2 ring-[#00E5CC]",Y&&"bg-[#00E5CC] text-white",A&&!Y&&"bg-[#7C3AED] text-white",W&&!Se&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Se&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},z)})})]})]}),document.body)]})}function $l({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Kg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:i||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function Ds(e=600){let[t,a]=useState(false),r=useRef(null),n=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:n}}function Ol(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[i,c]=useState(false),l=useRef(e),p=useRef([]);return useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){o(e),l.current=e;return}let u=l.current??0,d=e,m=d-u,f=r/n;c(true);for(let v=1;v<=n;v++){let b=setTimeout(()=>{let h=v/n,y=1-Math.pow(1-h,3),x=Math.round(u+m*y);o(x),v===n&&(c(false),o(d));},f*v);p.current.push(b);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:i}}function qg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,i]=useState(0),c=useRef(null),l=useRef(null),p=useCallback(m=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(m),i(0);let f=Date.now();l.current=setInterval(()=>{let v=Date.now()-f,b=Math.min(v/a*100,100);i(b);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(m),s(null),i(0);},a);},[a,e]),u=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:p,cancelChange:u}}function Xg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,i]=useState(false),[c,l]=useState(""),p=useRef(null),{isFlashing:u,triggerFlash:d}=Ds(),{displayValue:m,isAnimating:f}=Ol(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),P=w.clientX-C.left,O=Math.round(P/C.width*100),T=Math.max(0,Math.min(100,O));T!==e&&(t(T),s&&d());},b=useCallback(w=>{r||!t||(w.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{o&&p.current&&(p.current.focus(),p.current.select());},[o]);let h=useCallback(()=>{i(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&d());}},[c,t,e,s,d]),y=useCallback(w=>{w.key==="Enter"&&h(),w.key==="Escape"&&i(false);},[h]),x=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",u&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:p,value:c,onChange:w=>l(w.target.value.replace(/[^0-9]/g,"")),onBlur:h,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:b,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Zg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),o(false);},u=d=>{d.key==="Enter"?p():d.key==="Escape"&&(c(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:d=>c(d.target.value),onBlur:p,onKeyDown:u,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:d=>{d.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function a0({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=useState(false),[u,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=Ds(),{displayValue:b,isAnimating:h}=Ol(e,{enabled:i&&!l});useEffect(()=>{l&&m.current&&(m.current.focus(),m.current.select());},[l]),useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(u);if(!isNaN(w)){let C=w;n!==void 0&&(C=Math.max(n,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&v());}p(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),p(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",h&&"font-medium"),children:b!==void 0?b:r}):l?jsx("input",{ref:m,type:"number",value:u,onChange:w=>d(w.target.value),onBlur:y,onKeyDown:x,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),p(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",b===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),h&&"font-medium scale-105"),children:b!==void 0?b:r})}function r0({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,i]=useState(false),c=useRef(null),l=xo(c,o,220);return useEffect(()=>{let p=u=>{c.current&&!c.current.contains(u.target)&&i(false);};return o&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),s||!a?jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),i(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(l?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(p=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(p),i(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:p}),e===p&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},p))})]})}function o0({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:i,progress:c,startChange:l,cancelChange:p}=qg(t,{delay:s}),u=m=>{m.stopPropagation(),!r&&t&&(n?i?p():l(!e):t(!e));},d=i?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:u,disabled:r||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&d&&"ring-green-500/50",i&&!d&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:m=>{m.stopPropagation(),p();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function s0({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:i=2}){let[c,l]=useState(false),p=useRef(null),u=xo(p,c,220);useEffect(()=>{let h=y=>{p.current&&!p.current.contains(y.target)&&l(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let d=e.slice(0,i),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=h=>{let y=e.includes(h),x=y?e.filter(w=>w!==h):[...e,h];!y&&o!=null&&e.length>=o||a(x);},b=o!=null&&e.length>=o;return jsxs("div",{ref:p,className:"relative",children:[jsxs("button",{onClick:h=>{h.stopPropagation(),l(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 left-0 "+(u?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let y=e.includes(h),x=!y&&b;return jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:h}),y&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Xk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function c0({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Xk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,i=o>0?`${s.name} +${o}`:s.name;return r?jsxs("button",{onClick:c=>{c.stopPropagation(),r(s);},title:n.map(c=>c.name).join(`
|
|
414
|
-
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:i})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),i]})}function p0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function Zk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function e1(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Gr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0,financialOverride:p}){let[u,d]=useState(false),[m,f]=useState(""),v=useRef(null),{isFlashing:b,triggerFlash:h}=Ds(),y=c==="financial"&&(l>0||p!=null),x=p??(e?e/60*l:0),w=y&&(p!=null?p>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Zk(e,r);useEffect(()=>{u&&v.current&&(v.current.focus(),v.current.select());},[u]),useEffect(()=>{if(e){let T=Math.floor(e/60),D=e%60;T>0&&D>0?f(`${T}h ${D}m`):T>0?f(`${T}h`):f(`${D}m`);}else f("");},[e,u]);let C=()=>{let T=e1(m);T!==e&&(t?.(T),o&&h()),d(false);},P=T=>{T.key==="Enter"?C():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let O=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(O,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):u?jsx("input",{ref:v,type:"text",value:m,onChange:T=>f(T.target.value),onBlur:C,onKeyDown:P,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(O,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function b0({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),i()]})}function y0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,u=W=>p?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[d,m]=useState(false),[f,v]=useState(false),[b,h]=useState(null),y=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(x/60*10)/10,O=Math.round(w/60*10)/10,T=w>0?x/w*100:0,D=T>100?Math.round((x-w)/60*10)/10:0,M=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!b)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(v(false),h(null));};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[f,b]);let N=W=>{if(W.stopPropagation(),r&&!n&&!s){h("log");return}if(r||n||s){v(Ce=>!Ce),h(null);return}o&&o(e);},z=W=>{v(false),h(W);},$=async(W,Ce)=>{b==="log"&&r&&W?r(e,W,Ce):b==="estimate"&&n?n(e,W):b==="quoted"&&s&&s(e,W),h(null);},Y=r||n||s||o,A=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(W=>W.show),Se=b==="estimate"?w:b==="quoted"?C:void 0;return w===0&&x===0&&C===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),d&&Y&&jsx("button",{onClick:N,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:A.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),z(W.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:b&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Pn,{mode:b,locale:a,isDark:t,currentValue:Se||void 0,onSave:$,onClose:()=>h(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let W=x===0,R=(w>0?x/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:u(P)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",u(O)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:R?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:R?"rgba(239,68,68,0.15)":"transparent"},children:["+",u(D)," ",l?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:M,borderRadius:2,transition:"width 0.3s"}})})]}),Y&&jsx("button",{onClick:N,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:d?1:0,pointerEvents:d?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:A.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),z(W.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:b&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Pn,{mode:b,locale:a,isDark:t,currentValue:Se||void 0,onSave:$,onClose:()=>h(null)})})})})]})}function i1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function l1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function x0({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function v0({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let p=i1(e);if(p.length===0)return null;let u=p.slice(0,3),d=p.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:u.map((m,f)=>jsx(x0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=o?.percentage??0,c=!!o&&i>0,l=c?l1(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(x0,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var c1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function k0({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",c1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function T1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function N1(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 M0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:u,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:b}){let h=useRef(null),y=r==="es"?N0.es:N0.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=h.current;if(!D)return;let M=D.getBoundingClientRect(),N=8,z=e.x,$=e.y;e.y+M.height>window.innerHeight-N&&($=Math.max(N,e.y-M.height)),e.x+M.width>window.innerWidth-N&&(z=Math.max(N,window.innerWidth-M.width-N)),(z!==e.x||$!==e.y)&&w({left:z,top:$});},[e.x,e.y,e.isOpen]),useEffect(()=>{let D=N=>{h.current&&!h.current.contains(N.target)&&t();},M=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",M);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let D=[];return n&&D.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),i&&(D.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&D.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(M=>({id:`assign-${M.id}`,label:M.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:M.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],$=N.some(Y=>Y.name===M.name)?N.filter(Y=>Y.name!==M.name):[...N,{name:M.name,initials:T1(M.name),color:M.color||N1(M.name),avatar:M.avatarUrl}];i({...e.task,assignees:$}),t();}}))})),u&&D.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),d&&D.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&D.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||b)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),f&&(D.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),D.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&D.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),b&&D.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{b(e.task.id),t();}})),o&&D.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),D},P=()=>{if(!e.columnId)return [];let D=[];return l&&(D.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),D},O=e.type==="task"?C():P(),T={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:h,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:O.map(D=>D.separator?jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsx(D1,{item:D,isDark:a},D.id):jsxs("button",{onClick:D.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:g(D.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function D1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var N0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var $0={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},G1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function H0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:i,locale:c}){let[l,p]=useState(""),[u,d]=useState(null),[m,f]=useState(null),v=useRef(null),b=c==="es"?O0.es:O0.en;useLayoutEffect(()=>{if(!e||!v.current)return;let D=()=>{if(!v.current)return;let M=v.current.parentElement;if(M){let Y=M.getBoundingClientRect();f({top:Y.bottom+4,right:window.innerWidth-Y.right});}let N=v.current.getBoundingClientRect(),$=window.innerHeight-N.top-20;d(Math.max(300,$));};return requestAnimationFrame(D),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[e]),useEffect(()=>{if(!e)return;let D=setTimeout(()=>{let M=z=>{v.current&&!v.current.contains(z.target)&&t();},N=z=>{z.key==="Escape"&&t();};document.addEventListener("mousedown",M),document.addEventListener("keydown",N),v._cleanup=()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(D),v._cleanup&&v._cleanup();}},[e,t]);let h=useMemo(()=>{let D=new Set([...G1]);return a.forEach(M=>{M.type&&M.type!=="assignees"&&D.add(M.type);}),Array.from(D)},[a]);if(!e)return null;let y=D=>{let M=b.columns[D];if(M)return M;let N=a.find(z=>z.type===D);return N?.label?N.label:D},x=D=>{if(D==="name")return;let M=a.map(N=>N.id===D?{...N,visible:!N.visible}:N);n(M);},w=(D,M)=>{let N=a.find($=>$.type===D&&(!M||$.customFieldId===M));if(N){x(N.id);return}let z={id:M||D,type:D,label:M?r.find($=>$.id===M)?.name||D:y(D),width:120,visible:true,sortable:true,resizable:true,customFieldId:M};n([...a,z]);},C=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],P=h.filter(D=>D!=="assignees"&&(o||!C.includes(D))&&y(D).toLowerCase().includes(l.toLowerCase())),O=r.filter(D=>D.name.toLowerCase().includes(l.toLowerCase())),T=i?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...u?{maxHeight:`${u}px`}:{},...m?{top:m.top,right:m.right}:{},background:i?"#111114":"#FFFFFF",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:i?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:i?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:b.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",D.currentTarget.style.color=i?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:i?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:D=>p(D.target.value),placeholder:b.searchPlaceholder,style:{fontSize:12,background:i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:i?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:D=>{D&&D.style.setProperty("--focus-border",T);},onFocus:D=>{D.currentTarget.style.borderColor=T,D.currentTarget.style.background=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:D=>{D.currentTarget.style.borderColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",D.currentTarget.style.background=i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:D=>D.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:b.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:P.map(D=>{let M=a.find($=>$.type===D&&!$.customFieldId),N=M?.visible??false,z=D==="name";return jsxs("button",{onClick:()=>{z||(M?x(M.id):w(D));},disabled:z,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:z?.4:1,cursor:z?"not-allowed":"pointer"},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:N?T:"transparent",border:N?`1.5px solid ${T}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${T}40`:"none"},children:N&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:N?T:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:$0[D]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:N?500:400,color:N?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(D),children:y(D)})]},D)})})]}),O.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:b.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:O.map(D=>{let N=a.find(z=>z.customFieldId===D.id)?.visible??false;return jsxs("button",{onClick:()=>w(D.type,D.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:z=>{z.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:N?T:"transparent",border:N?`1.5px solid ${T}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${T}40`:"none"},children:N&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:N?T:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:$0[D.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:D.name})]},D.id)})})]})]})]})}var O0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var Q1=[{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 z0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[i,c]=useState("text"),[l,p]=useState([""]),u=n==="es"?W0.es:W0.en;useEffect(()=>{e&&(o(""),c("text"),p([""]));},[e]),useEffect(()=>{let b=h=>{h.key==="Escape"&&t();};return e&&document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);let d=()=>{if(!s.trim())return;let b={name:s.trim(),type:i};i==="dropdown"&&(b.options=l.filter(h=>h.trim())),a(b),t();},m=()=>{p([...l,""]);},f=(b,h)=>{let y=[...l];y[b]=h,p(y);},v=b=>{l.length>1&&p(l.filter((h,y)=>y!==b));};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:g("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:u.title}),jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.fieldName}),jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),placeholder:u.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:Q1.map(b=>jsxs("button",{onClick:()=>c(b.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===b.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:b.icon}),jsx("span",{className:g("text-xs",i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:u.types[b.type]})]},b.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.options}),jsxs("div",{className:"space-y-2",children:[l.map((b,h)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:b,onChange:y=>f(h,y.target.value),placeholder:`${u.option} ${h+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>v(h),className:g("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},h)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),u.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:u.cancel}),jsx("button",{onClick:d,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:u.create})]})]})]}):null}var W0={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 j0={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 _0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,i]=useState(false),c=useRef(null),l=useRef(0),p=s==="es"?j0.es:j0.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-l.current<100||c.current&&!c.current.contains(v.target)&&i(false);},f=v=>{v.key==="Escape"&&i(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let u=[{value:"all",label:p.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:p.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(l.current=Date.now()),i(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",d&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),p.filters,d&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsx("div",{className:"py-2",children:u.map(m=>{let f=e===m.value&&!t,v=()=>m.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxs("button",{onClick:()=>{a(m.value),r(false),i(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let m=!t;r(m),m&&a("all"),i(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function K0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Co(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function q0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",i=n==="financial";return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:i?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),i&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,l=e.totalEstimated??0,p=e.totalExecuted??0,u=c-p,d=c>0?Math.round(u/c*100):0,m=c-l,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(p/c*100),120):0,b=p>c&&c>0,h=b?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Co(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=x>0||w>0,P=(O,T)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:O}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(T)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Co(l)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),p>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=x>0||w>0,P=(O,T)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:O}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(T)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",b?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Co(p)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(v,100)}%`,backgroundColor:h}})}),l>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[m>=0?"+":"",Co(m),c>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[u>=0?`+${Co(u)} ${o?"disponible (caja)":"available (cash)"}`:`${Co(Math.abs(u))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,l=e.totalHoursAllocatedMinutes??0,p=l>0?Math.min(Math.round(c/l*100),100):0,m=(l>0?c/l:0)>1.1?"#F87171":p>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:K0(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:K0(l)})]}),l>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${p}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,l=c>0,p=c<0,u=e.scheduleVarianceLabel||(l?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",l&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!l&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,l)=>{let p=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:p}})})]},`${c.name}-${l}`)})})]})]})}var gC=[{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 ef(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...ef(n.subtasks,t+1,s));}return r}function fC(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(p<=0)continue;let u=(s.progress||0)/p;r+=u,n++;}return n>0?r/n:null}function Fs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Fs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Ps(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function bC({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>o(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),n(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Z0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let i of e){let c=i.weight||0;c>0&&(t+=(i.progress||0)*c,a+=c,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((i,c)=>i+(c.effort_minutes||0),0)>0){let i=0,c=0;for(let l of e){let p=l.effort_minutes||60;i+=(l.progress||0)*p,c+=p;}return Math.round(i/c*10)/10}let o=e.reduce((i,c)=>i+(c.progress||0),0);return Math.round(o/e.length*10)/10}function uu(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uu(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function tf({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:i=[],customFields:c=[],toolbarRightContent:l,onColumnHeaderClick:p,columnsWithFilter:u,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:b=true,showHierarchy:h=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:C=true,allowColumnResize:P=true,enableContextMenu:O=true,showCreateTaskButton:T=false,onCreateTask:D,persistFilter:M=false,financialBlur:N,healthSidebar:z,lens:$="hours",hourlyRate:Y=0,rateMap:A,aggregateParentHours:Se=false,showProjectTotals:W=false,totalsDollarOverride:Ce}=t,R=t.rowDensity==="compact",we=Ll(f,v),G=m==="dark",Ve=k=>{if(!A||!k.assignees||k.assignees.length===0)return Y;let _=0,X=0;for(let de of k.assignees){let We=de.id?A[de.id]:void 0;if(We==null||We<=0)continue;let Q=typeof de.estimatedMinutes=="number"?de.estimatedMinutes:0;Q>0&&(_+=We*Q,X+=Q);}if(X>0)return _/X;let ne=k.assignees.map(de=>de.id?A[de.id]:void 0).filter(de=>de!=null&&de>0);return ne.length===0?Y:ne.reduce((de,We)=>de+We,0)/ne.length},oe=k=>{let _=0,X=0,ne=0,de=We=>{for(let Q of We)if(Q.subtasks&&Q.subtasks.length>0){let De={s:_,a:X,q:ne};if(de(Q.subtasks),_-De.s+(X-De.a)+(ne-De.q)===0){let Ke=Ve(Q);_+=(Q.timeLoggedMinutes??0)/60*Ke,X+=(Q.effortMinutes??0)/60*Ke,ne+=(Q.soldEffortMinutes??0)/60*Ke;}}else {let De=Ve(Q);_+=(Q.timeLoggedMinutes??0)/60*De,X+=(Q.effortMinutes??0)/60*De,ne+=(Q.soldEffortMinutes??0)/60*De;}};return k.subtasks&&de(k.subtasks),{dollarSpent:_,dollarAllocated:X,dollarQuoted:ne}},Be=useCallback(()=>{if(!M||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let k=localStorage.getItem(M);if(k){let _=JSON.parse(k);return {statusFilter:_.statusFilter||"all",hideCompleted:_.hideCompleted||!1}}}catch(k){console.error("Error loading persisted filter:",k);}return {statusFilter:"all",hideCompleted:false}},[M]),le=useMemo(()=>{function k(_){let X=0,ne=0,de=0,We=0,Q=0,De=0;for(let Re of _)if(Re.subtasks&&Re.subtasks.length>0){let Ke=k(Re.subtasks);if(Ke.spent+Ke.allocated+Ke.quoted>0)X+=Ke.spent,ne+=Ke.allocated,de+=Ke.quoted,We+=Ke.dollarSpent,Q+=Ke.dollarAllocated,De+=Ke.dollarQuoted;else {let ut=Re.timeLoggedMinutes??0,ct=Re.effortMinutes??0,Zt=Re.soldEffortMinutes??0;X+=ut,ne+=ct,de+=Zt;let it=Ve(Re);We+=ut/60*it,Q+=ct/60*it,De+=Zt/60*it;}}else {let Ke=Re.timeLoggedMinutes??0,$t=Re.effortMinutes??0,ut=Re.soldEffortMinutes??0;X+=Ke,ne+=$t,de+=ut;let ct=Ve(Re);We+=Ke/60*ct,Q+=$t/60*ct,De+=ut/60*ct;}return {spent:X,allocated:ne,quoted:de,dollarSpent:We,dollarAllocated:Q,dollarQuoted:De}}return k(e)},[e]),He=useMemo(()=>{let k=new Map;function _(X){let ne=0;for(let de of X)if(de.subtasks&&de.subtasks.length>0){let We=_(de.subtasks);k.set(de.id,We),ne+=We;}else ne+=de.weight||0;return ne}return _(e),k},[e]),$e=useMemo(()=>!z?.enabled||!z.data?z:{...z,data:{...z.data,totalHoursSpentMinutes:le.spent,totalHoursAllocatedMinutes:le.allocated}},[z,le]),[Pe,je]=useState(true),[tt,ee]=useState(null),[Ae,ot]=useState("position"),[Ie,zt]=useState("asc"),[st,bt]=useState(""),[Ee,Dt]=useState(()=>Be().statusFilter),[ht,_e]=useState(()=>Be().hideCompleted),[dt,L]=useState(y||gC),[J,xe]=useState(false),[I,j]=useState(false),[ke,Ue]=useState({isOpen:false,x:0,y:0,type:"task"}),[ue,at]=useState(null),[yt,Ye]=useState(false),[vt,Xt]=useState(null),[wt,Ut]=useState(null),[Ht,he]=useState(null),Fe=useRef(0),Qe=useRef(false),rt=!!(a.onTaskMove||a.onTaskReparent),[Tt,Ft]=useState(null),[kt,Da]=useState(null),aa=k=>{let _=k.type;return k.customFieldId?_==="file"?null:{kind:"customField",fieldId:k.customFieldId}:_==="assignees"||_==="teamLoad"?"assignees":_==="startDate"?"startDate":_==="endDate"?"endDate":null},cr=(k,_)=>typeof k=="string"||typeof _=="string"?k===_:k.fieldId===_.fieldId,Xe=useRef([]),et=useCallback((k,_)=>{rt&&(_.preventDefault(),Fe.current=_.clientY,at(k),Qe.current=false,Ye(false),he({x:_.clientX,y:_.clientY}));},[rt]),Sa=useCallback(k=>{if(!ue||(Math.abs(k.clientY-Fe.current)>5&&!Qe.current&&(Qe.current=true,Ye(true)),he({x:k.clientX,y:k.clientY}),!Qe.current))return;let X=document.querySelectorAll("[data-listview-row]"),ne=null,de=null;X.forEach(We=>{let Q=We.getBoundingClientRect(),De=We.getAttribute("data-listview-row");if(De&&De!==ue&&k.clientY>=Q.top&&k.clientY<=Q.bottom){ne=De;let Re=k.clientY-Q.top,Ke=Q.height;de=Re<Ke*.25?"above":Re>Ke*.75?"below":"child";}}),Xt(ne),Ut(de);},[ue]),Ia=useCallback(()=>{if(Qe.current&&ue&&vt&&wt){if(wt==="child"&&a.onTaskReparent)a.onTaskReparent(ue,vt);else if(wt==="above"||wt==="below"){let k=(ne,de,We=null)=>{for(let Q of ne){if(Q.id===de)return We;if(Q.subtasks){let De=k(Q.subtasks,de,Q.id);if(De!==void 0)return De}}},_=k(e,ue,null),X=k(e,vt,null);if(a.onTaskReparent){let ne=(Ke,$t)=>{if($t===null)return Ke;for(let ut of Ke){if(ut.id===$t)return ut.subtasks||[];if(ut.subtasks){let ct=ne(ut.subtasks,$t);if(ct.length>0||ut.subtasks.some(Zt=>Zt.id===$t))return ct}}return []},de=ne(e,X??null),We=de.findIndex(Ke=>Ke.id===vt),Q=_===X,De=Q?de.findIndex(Ke=>Ke.id===ue):-1,Re=wt==="below"?We+1:We;Q&&De!==-1&&De<We&&(Re-=1),a.onTaskReparent(ue,X??null,Math.max(0,Re));}}}at(null),Xt(null),Ut(null),he(null),Qe.current=false,Ye(false);},[ue,vt,wt,e,a]),dr=(k,_)=>typeof _!="string"?k.customFields?.find(ne=>ne.fieldId===_.fieldId)?.value:_==="assignees"?k.assignees:_==="startDate"?k.startDate:k.endDate,xr=(k,_,X,ne)=>{k.preventDefault(),k.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let de=Array.from(document.querySelectorAll("[data-listview-row]")),We=de.map(pt=>pt.getAttribute("data-listview-row")||""),Q=Math.max(0,We.indexOf(_)),De=pt=>We.slice(Q,pt+1);Da({sourceTaskId:_,column:X,sourceIndex:ne,targetIndex:ne,rangeIds:new Set([_])});let Ke=(pt=>{let At=pt?.parentElement??null;for(;At;){let Pr=window.getComputedStyle(At).overflowY;if((Pr==="auto"||Pr==="scroll")&&At.scrollHeight>At.clientHeight)return At;At=At.parentElement;}let Ba=document.scrollingElement;return Ba&&Ba.scrollHeight>Ba.clientHeight?Ba:null})(k.currentTarget),$t=pt=>{let At=Q,Ba=false;de.forEach((Pr,ur)=>{let Ka=Pr.getBoundingClientRect();pt>=Ka.top&&pt<=Ka.bottom&&(At=ur,Ba=true);});let kr=de[de.length-1];if(!Ba&&kr){let Pr=kr.getBoundingClientRect();pt>Pr.bottom&&(At=de.length-1);}return At<Q&&(At=Q),At},ut=k.clientY,ct=null,Zt=()=>{ct!==null&&(cancelAnimationFrame(ct),ct=null);},it=()=>{let pt=$t(ut),At=new Set(De(pt));Da(Ba=>Ba&&{...Ba,targetIndex:pt,rangeIds:At});},ea=()=>{if(Zt(),!Ke)return;let pt=Ke,Ba=pt===document.scrollingElement?{top:0,bottom:window.innerHeight}:pt.getBoundingClientRect(),kr=60,Pr=12,ur=ut-Ba.top,Ka=Ba.bottom-ut,to=pt.scrollHeight-pt.clientHeight;if(Ka<kr&&pt.scrollTop<to){let ts=Math.max(1,Math.round(Pr*(1-Math.max(0,Ka)/kr))),Cr=()=>{pt.scrollTop+=ts,it(),pt.scrollTop<pt.scrollHeight-pt.clientHeight&&(ct=requestAnimationFrame(Cr));};ct=requestAnimationFrame(Cr);}else if(ur<kr&&pt.scrollTop>0){let ts=Math.max(1,Math.round(Pr*(1-Math.max(0,ur)/kr))),Cr=()=>{pt.scrollTop-=ts,it(),pt.scrollTop>0&&(ct=requestAnimationFrame(Cr));};ct=requestAnimationFrame(Cr);}},xt=pt=>{ut=pt.clientY,it(),ea();},Lt=pt=>{window.removeEventListener("mousemove",xt),window.removeEventListener("mouseup",Lt),Zt(),document.body.style.cursor="",document.body.style.userSelect="",Da(null);let At=$t(pt.clientY),Ba=new Map(Xe.current.map(Ka=>[Ka.id,Ka])),kr=Ba.get(_);if(!kr)return;let Pr=dr(kr,X),ur=[];for(let Ka of De(At)){if(Ka===_)continue;let to=Ba.get(Ka);to&&(to.subtasks&&to.subtasks.length>0||ur.push(Ka));}ur.length>0&&a.onBulkFill?.(ur,X,Pr);};window.addEventListener("mousemove",xt),window.addEventListener("mouseup",Lt);},Ra=k=>kt?kt.rangeIds.has(k):false;useEffect(()=>{if(ue)return document.addEventListener("mousemove",Sa),document.addEventListener("mouseup",Ia),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Sa),document.removeEventListener("mouseup",Ia),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,Sa,Ia]);let[Ja,se]=useState("all"),[me,q]=useState(false),pe=useRef(null),ce=useRef(null),B=useMemo(()=>{let k=0;function _(X,ne){for(let de of X)ne>k&&(k=ne),de.subtasks?.length&&_(de.subtasks,ne+1);}return _(e,1),k},[e]);useEffect(()=>{if(!me)return;let k=_=>{pe.current?.contains(_.target)||ce.current?.contains(_.target)||q(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[me]),useEffect(()=>{if(Ja==="all"){let X=function(ne){for(let de of ne)de.subtasks?.length&&(de.isExpanded===false&&a.onTaskToggleExpand?.(de.id),X(de.subtasks));};X(e);}else {let X=function(ne,de){for(let We of ne)if(We.subtasks?.length){let Q=de<Ja,De=We.isExpanded!==false;Q!==De&&a.onTaskToggleExpand?.(We.id),X(We.subtasks,de+1);}};X(e,1);}},[Ja]);let[re,be]=useState(null),[S,H]=useState(0),[Z,Te]=useState(0),gt=useRef(null),[fe,Ne]=useState(null),[ye,lt]=useState(null);useEffect(()=>{y&&L(k=>{if(k.length===y.length){let _=true;for(let X=0;X<k.length;X++){let ne=k[X],de=y[X];if(!ne||!de||ne.id!==de.id||ne.visible!==de.visible||ne.width!==de.width||ne.label!==de.label){_=false;break}}if(_)return k}return y});},[y]),useEffect(()=>{if(!(!M||typeof window>"u"))try{localStorage.setItem(M,JSON.stringify({statusFilter:Ee,hideCompleted:ht}));}catch(k){console.error("Error persisting filter state:",k);}},[M,Ee,ht]);let Et=useMemo(()=>{let k=new Set;function _(X){for(let ne of X)ne.subtasks?.length&&(ne.isExpanded!==false&&k.add(ne.id),_(ne.subtasks));}return _(e),k},[e]),Qt=useMemo(()=>dt.filter(k=>k.visible),[dt]),ja=useCallback(k=>{a.onTaskToggleExpand?.(k);},[a]),Er=useCallback(k=>{Ae===k?zt(_=>_==="asc"?"desc":"asc"):(ot(k),zt("asc")),a.onSortChange?.({column:k,direction:Ie==="asc"?"desc":"asc"});},[Ae,Ie,a]),_a=useCallback(k=>{L(k),a.onColumnsChange?.(k);},[a]),Mr=useCallback(k=>{let _=dt.map(X=>X.id===k?{...X,visible:false}:X);_a(_);},[dt,_a]),xa=useCallback((k,_)=>{ot(k),zt(_);},[]),On=useCallback((k,_,X)=>{O&&(k.preventDefault(),Ue({isOpen:true,x:k.clientX,y:k.clientY,type:_?"task":"header",task:_,columnId:X}));},[O]),Vr=useCallback(()=>{Ue(k=>({...k,isOpen:false}));},[]),Rs=useCallback((k,_)=>{if(!P)return;k.preventDefault(),k.stopPropagation();let X=dt.find(ne=>ne.id===_);X&&(be(_),H(k.clientX),Te(X.width));},[dt,P]);useEffect(()=>{if(!re)return;let k=dt,_=ne=>{let de=ne.clientX-S,We=Math.max(50,Z+de);k=k.map(Q=>Q.id===re?{...Q,width:We}:Q),L(k);},X=()=>{a.onColumnsChange?.(k),be(null);};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",X),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",X);}},[re,S,Z,a]);let Xr=useCallback((k,_)=>{if(_==="name"){k.preventDefault();return}Ne(_),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("text/plain",_),k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="0.5");},[]),Pi=useCallback(k=>{k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="1"),Ne(null),lt(null);},[]),Qo=useCallback((k,_)=>{k.preventDefault(),_!=="name"&&(k.dataTransfer.dropEffect="move",lt(_));},[]),Fi=useCallback(()=>{lt(null);},[]),Qa=useCallback((k,_)=>{if(k.preventDefault(),!fe||fe===_||_==="name")return;let X=[...dt],ne=X.findIndex(Q=>Q.id===fe),de=X.findIndex(Q=>Q.id===_);if(ne===-1||de===-1)return;let We=X.splice(ne,1);We[0]&&(X.splice(de,0,We[0]),_a(X),Ne(null),lt(null));},[fe,dt,_a]),Bs=useCallback(async k=>{if(a.onCreateCustomField){let _={...k,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(_);}j(false);},[a]),eo=useCallback(k=>k.progress===100||k.status==="completed"?"completed":k.progress&&k.progress>0||k.status==="in-progress"?"in-progress":"todo",[]),$s=t.groupBy==="status",vr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[Jr,Hn]=useState(()=>{let k=new Set(t.defaultCollapsedGroups??["completed"]);if(!vr)return k;try{let _=localStorage.getItem(vr);return _?new Set(JSON.parse(_)):k}catch{return k}}),Os=useCallback(k=>{Hn(_=>{let X=new Set(_);if(X.has(k)?X.delete(k):X.add(k),vr)try{localStorage.setItem(vr,JSON.stringify([...X]));}catch{}return X});},[vr]),cn=!!t.selectable,[Hs,Li]=useState(new Set),Un=useMemo(()=>t.selectedIds?new Set(t.selectedIds):Hs,[t.selectedIds,Hs]),Ai=useRef(null),{lista:$r,cabeceras:Zo,todas:wr}=useMemo(()=>{let k=ef(e);if(st.trim()){let X=st.toLowerCase();k=k.filter(ne=>ne.name.toLowerCase().includes(X));}let _=t.showStatusFilter!==false;if(_&&Ee!=="all"){let X=new Set(k.filter(ne=>eo(ne)===Ee).flatMap(ne=>ne.parentPath));k=k.filter(ne=>X.has(ne.id));}if(_&&ht){let X=new Set(k.filter(ne=>eo(ne)!=="completed").flatMap(ne=>ne.parentPath));k=k.filter(ne=>X.has(ne.id));}if(t.groupBy==="assignee"||t.groupBy==="due"){let X=t.groupBy==="assignee",ne=[],de=(it,ea,xt,Lt)=>{for(let pt of it){let At=[...xt,pt.id];ne.push({...pt,level:ea,hasChildren:(pt.subtasks?.length||0)>0,parentPath:At,...Lt?{__padre:Lt}:{}}),pt.subtasks?.length&&de(pt.subtasks,ea+1,At,pt.name);}};de(e,0,[]);let We=st.trim().toLowerCase(),Q=We?ne.filter(it=>it.name.toLowerCase().includes(We)):ne,De=f==="es",Re=[["overdue","Vencidas","Overdue"],["today","Hoy","Today"],["week","Esta semana","This week"],["later","M\xE1s adelante","Later"],["past","Anteriores","Earlier"],["none","Sin fecha","No date"]],Ke=new Map;for(let it of Q){let ea=X?(()=>{let xt=(it.assignees??[]).map(Lt=>Lt.name).filter(Boolean);return xt.length?xt:["__sin"]})():[t.dueBucket?.(it)??"none"];for(let xt of ea){let Lt=X?`user:${xt}`:`due:${xt}`,pt=X?xt==="__sin"?De?"Sin responsable":"Unassigned":xt:Re.find(At=>At[0]===xt)?.[De?1:2]??xt;Ke.has(Lt)||Ke.set(Lt,{titulo:pt,filas:[]}),Ke.get(Lt).filas.push({...it,level:0,hasChildren:false,__claveFila:`${Lt}|${it.id}`});}}let $t=X?[...Ke.keys()].sort((it,ea)=>it==="user:__sin"?1:ea==="user:__sin"?-1:Ke.get(it).titulo.localeCompare(Ke.get(ea).titulo)):Re.map(it=>`due:${it[0]}`).filter(it=>Ke.has(it)),ut=it=>it.endDate?new Date(it.endDate).getTime():1/0,ct=[],Zt=new Map;for(let it of $t){let ea=Ke.get(it),xt=Jr.has(it);Zt.set(ct.length,[...Zt.get(ct.length)??[],{clave:it,cuenta:ea.filas.length,plegado:xt,titulo:ea.titulo}]),xt||ct.push(...ea.filas.sort((Lt,pt)=>ut(Lt)-ut(pt)));}return {lista:ct,cabeceras:Zt,todas:Q}}if($s){let X=["todo","in-progress","completed"],ne=new Map,de=[];for(let Re of k){let Ke=Re.parentPath[0]??Re.id;Re.level===0&&de.push(Re),ne.has(Ke)||ne.set(Ke,[]),ne.get(Ke).push(Re);}let We=Re=>Re.endDate?new Date(Re.endDate).getTime():1/0,Q=[],De=new Map;for(let Re of X){let Ke=de.filter(it=>eo(it)===Re).sort((it,ea)=>We(it)-We(ea)),$t=Ke.flatMap(it=>ne.get(it.id)??[it]),ut=$t.filter(it=>!it.hasChildren).length;if(ut===0&&Ke.length===0)continue;let ct=Jr.has(Re),Zt=Q.length;De.set(Zt,[...De.get(Zt)??[],{clave:Re,cuenta:ut,plegado:ct}]),ct||Q.push(...$t);}return {lista:Q,cabeceras:De,todas:k}}return k.sort((X,ne)=>{let de,We;switch(Ae){case "name":de=X.name.toLowerCase(),We=ne.name.toLowerCase();break;case "startDate":de=X.startDate?.getTime()||0,We=ne.startDate?.getTime()||0;break;case "endDate":de=X.endDate?.getTime()||0,We=ne.endDate?.getTime()||0;break;case "progress":de=X.progress||0,We=ne.progress||0;break;case "status":de=X.status||"todo",We=ne.status||"todo";break;case "priority":let Q={urgent:0,high:1,medium:2,low:3,none:4};de=Q[X.priority]??4,We=Q[ne.priority]??4;break;case "position":return 0;default:return 0}return de<We?Ie==="asc"?-1:1:de>We?Ie==="asc"?1:-1:0}),{lista:k,cabeceras:new Map,todas:k}},[e,st,Ee,ht,Ae,Ie,eo,t.showStatusFilter,$s,Jr,t.groupBy,t.dueBucket,f]);Xe.current=$r;let No=(k,_)=>{let X=new Set(Un),ne=Ai.current,de=Xe.current.map(We=>We.id);if(_&&ne&&ne!==k&&de.includes(ne)&&de.includes(k)){let We=de.indexOf(ne),Q=de.indexOf(k),De=Math.min(We,Q),Re=Math.max(We,Q),Ke=!Un.has(k);for(let $t of de.slice(De,Re+1))Ke?X.add($t):X.delete($t);}else X.has(k)?X.delete(k):X.add(k);Ai.current=k,t.selectedIds||Li(X),a.onSelectionChange?.([...X]);},Do=Un.size>0,oa=k=>jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:_=>_.stopPropagation(),children:jsx("input",{type:"checkbox","data-casilla-fila":k,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:Un.has(k),onChange:()=>{},onClick:_=>{_.stopPropagation(),No(k,_.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",Do?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),dc={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En curso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Us=(k,_)=>{let X=Zo.get(k);if(!X?.length)return _;let ne=X.map(de=>jsx("div",{"data-grupo-de-estado":de.clave,"data-plegado":de.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",G?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxs("button",{type:"button",onClick:()=>Os(de.clave),"aria-expanded":!de.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",G?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[de.plegado?jsx(ChevronRight,{className:"w-3.5 h-3.5"}):jsx(ChevronDown,{className:"w-3.5 h-3.5"}),de.titulo??dc[de.clave]?.[f==="es"?"es":"en"]??de.clave,jsx("span",{className:g("font-normal tabular-nums",G?"text-white/40":"text-gray-400"),children:de.cuenta})]})},`grupo-${de.clave}`));return _?[...ne,_]:ne},es=useCallback((k,_)=>{let X=We=>{a.onTaskUpdate?.({...k,...We});},ne=We=>We?k.customFields?.find(De=>De.fieldId===We)?.value:void 0,de=(We,Q)=>{if(!We)return;let Re=[...k.customFields||[]],Ke=Re.findIndex($t=>$t.fieldId===We);Ke>=0?Re[Ke]={fieldId:We,value:Q}:Re.push({fieldId:We,value:Q}),X({customFields:Re});};switch(_.type){case "name":return null;case "status":return jsx(Hg,{value:k.status||(k.progress===100?"completed":k.progress&&k.progress>0?"in-progress":"todo"),onChange:Q=>{X({status:Q,progress:Q==="completed"?100:Q==="in-progress"?50:0});},isDark:G,locale:f,translations:we.status});case "priority":return jsx(Wg,{value:k.priority,onChange:Q=>X({priority:Q}),isDark:G,locale:f});case "assignees":{let Q=k.hasChildren,De=k.assignees||[];if(Q&&k.subtasks?.length){let Re=new Map,Ke=$t=>{($t||[]).forEach(ut=>{(ut.assignees||[]).forEach(ct=>{Re.has(ct.name)||Re.set(ct.name,ct);}),ut.subtasks?.length&&Ke(ut.subtasks);});};Ke(k.subtasks),De=Array.from(Re.values());}else Q&&(De=[]);return jsx(Rl,{value:De,availableUsers:i,onChange:Re=>X({assignees:Re}),isDark:G,locale:f,disabled:Q})}case "startDate":return jsx($l,{value:k.startDate,onChange:Q=>X({startDate:Q}),isDark:G,locale:f,dateField:"start",startDate:k.startDate,endDate:k.endDate});case "endDate":{let Q=jsx($l,{value:k.endDate,onChange:De=>X({endDate:De}),isDark:G,locale:f,dateField:"end",startDate:k.startDate,endDate:k.endDate});return t.isTaskOverdue?.(k)?jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:G?"#FF7A7F":"#C22F35"},children:[jsx(AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),Q]}):Q}case "progress":{let Q=!!(k.subtasks&&k.subtasks.length>0),De=Q?Z0(uu(k.subtasks||[])):k.progress||0;return jsx(Xg,{value:De,onChange:Q?void 0:Re=>{let Ke=Re===100?"completed":Re>0?"in-progress":"todo";X({progress:Re,status:Ke});},isDark:G,disabled:Q})}case "tags":return jsx(p0,{value:k.tags||[],isDark:G});case "text":return jsx(Zg,{value:ne(_.customFieldId)||"",onChange:Q=>de(_.customFieldId,Q),isDark:G});case "number":return jsx(a0,{value:ne(_.customFieldId)||0,onChange:Q=>de(_.customFieldId,Q),isDark:G});case "date":let We=ne(_.customFieldId);return jsx($l,{value:We?new Date(We):void 0,onChange:Q=>de(_.customFieldId,Q),isDark:G,locale:f});case "dropdown":return jsx(r0,{value:ne(_.customFieldId)||"",options:_.options||[],onChange:Q=>de(_.customFieldId,Q),isDark:G});case "checkbox":return jsx(o0,{value:ne(_.customFieldId)||false,onChange:Q=>de(_.customFieldId,Q),isDark:G});case "multiselect":return jsx(s0,{value:ne(_.customFieldId)||[],options:_.options||[],onChange:Q=>de(_.customFieldId,Q),isDark:G,maxSelectable:_.maxSelectable});case "person":{let Q=ne(_.customFieldId)||[];return jsx(Rl,{value:Q.map(De=>({name:De.name,avatar:De.avatar,initials:De.initials||(De.name||"?").slice(0,2).toUpperCase(),color:De.color||"#00E5CC"})),availableUsers:i,onChange:De=>de(_.customFieldId,De),isDark:G,locale:f})}case "file":return jsx(c0,{value:ne(_.customFieldId),isDark:G,onOpen:Q=>{Q.url&&window.open(Q.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let Q=k.status==="completed"||k.progress===100;return jsx(Gr,{value:k.estimatedTime,onChange:De=>X({estimatedTime:De}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k)})}case "quotedTime":{let Q=k.status==="completed"||k.progress===100,De=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(Gr,{value:k.quotedTime,onChange:Re=>X({quotedTime:Re}),isDark:G,locale:f,disabled:Q,isBlurred:De,lens:$,hourlyRate:Ve(k)})}case "elapsedTime":{let Q=k.status==="completed"||k.progress===100,De=k.executedDollarsCanonical;return jsx(Gr,{value:k.elapsedTime,onChange:Re=>X({elapsedTime:Re}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k),financialOverride:De})}case "effortMinutes":{if(Se&&k.subtasks&&k.subtasks.length>0){let{allocated:$t}=Fs(k);if($==="financial"){let ut=oe(k),ct=Math.round(ut.dollarAllocated),Zt=Math.round(ut.dollarQuoted),it=Zt-ct;return jsxs("div",{className:"flex flex-col",children:[ct>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",ct.toLocaleString("es-CO")]}):null,it!==0&&ct>0&&Zt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",it>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[it>0?"+":"",Math.abs(it)>=1e3?`$${(it/1e3).toFixed(1)}K`:`$${it}`]})]})}return jsx(Gr,{value:$t>0?$t:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Y})}let Q=k.status==="completed"||k.progress===100,De=k.effortMinutes||0,Re=k.soldEffortMinutes||0,Ke=Ve(k);if($==="financial"&&Ke&&De>0&&Re>0){let $t=Math.round(De/60*Ke),ct=Math.round(Re/60*Ke)-$t;return jsxs("div",{className:"flex flex-col",children:[jsx(Gr,{value:De,onChange:Zt=>X({effortMinutes:Zt}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k)}),ct!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ct>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ct>0?"+":"",Math.abs(ct)>=1e3?`$${(ct/1e3).toFixed(1)}K`:`$${ct}`]})]})}return jsx(Gr,{value:De,onChange:$t=>X({effortMinutes:$t}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k)})}case "timeLoggedMinutes":{let Q=k.executedDollarsCanonical;if(Se&&k.subtasks&&k.subtasks.length>0){let{spent:Re}=Fs(k);return jsx(Gr,{value:Re>0?Re:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k),financialOverride:Q})}let De=k.status==="completed"||k.progress===100;return jsx(Gr,{value:k.timeLoggedMinutes,onChange:a.onLogTime?Re=>{a.onLogTime?.(k,Re);}:void 0,isDark:G,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:De,lens:$,hourlyRate:Ve(k),financialOverride:Q})}case "soldEffortMinutes":{if(Se&&k.subtasks&&k.subtasks.length>0){let{quoted:Re}=Fs(k),Ke=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(Gr,{value:Re>0?Re:void 0,isDark:G,locale:f,disabled:true,isBlurred:Ke,lens:$,hourlyRate:Ve(k)})}let Q=k.status==="completed"||k.progress===100,De=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(Gr,{value:k.soldEffortMinutes,onChange:Re=>X({soldEffortMinutes:Re}),isDark:G,locale:f,disabled:Q,isBlurred:De,lens:$,hourlyRate:Ve(k)})}case "scheduleVariance":{let Q=k.effortMinutes||0,De=k.soldEffortMinutes||0,Re=k.timeLoggedMinutes||0,Ke=Q>0||De>0||Re>0;return jsx(b0,{startDate:k.startDate,endDate:k.endDate,scheduleVariance:k.scheduleVariance,isDark:G,locale:f,hasTimeAllocated:Ke})}case "hoursBar":{if(Se&&k.hasChildren){let{spent:Q,allocated:De,quoted:Re}=Fs(k),Ke=Q>De&&De>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",G?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",Ke?"text-[#FF453A]":G?"text-white/80":"text-gray-800"),children:Ps(Q)}),De>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:G?"text-white/60":"text-gray-600",children:Ps(De)})]}),Re>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:G?"text-amber-400/70":"text-amber-600",children:Ps(Re)})]})]})}return jsx(y0,{task:k,isDark:G,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:$,hourlyRate:Ve(k)})}case "teamLoad":return k.hasChildren||k.subtasks&&k.subtasks.length>0?jsx(v0,{task:k,isDark:G,locale:f}):jsx(Rl,{value:k.assignees||[],availableUsers:i,onChange:De=>{a.onTaskUpdate?.({...k,assignees:De});},isDark:G,locale:f});case "blockers":return jsx(k0,{blockers:k.blockers,isDark:G,locale:f});case "weight":{let Q=He.get(k.id);if(Q!==void 0)return jsx("span",{className:g("text-xs font-mono",Q>0?G?"text-white/50":"text-gray-400":G?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?`${Number(Q.toFixed(2))}%`:"\u2014"});let De=k.weight||0;return jsx(bC,{value:De,onChange:Re=>X({weight:Re}),isDark:G})}default:return jsx("span",{className:g("text-sm",G?"text-white/60":"text-gray-500"),children:"-"})}},[a,G,f,i,we,Se,He]),Ws=useCallback(k=>{let X={name:we.columns.name,status:we.columns.status,priority:we.columns.priority,assignees:we.columns.assignees,startDate:we.columns.startDate,endDate:we.columns.endDate,progress:we.columns.progress,tags:we.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:we.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:we.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:we.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:we.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:we.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:we.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:we.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:we.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:we.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:we.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:we.columns.weight||(f==="es"?"Peso":"Weight")}[k.type]||k.label;return typeof X=="string"?X:String(X||k.type)},[we,f]),Wn=useMemo(()=>{let X=Qt.reduce((de,We)=>de+We.width,0)+(C?48:0),ne={};for(let de of Qt)ne[de.id]=`${de.width/X*100}%`;return ne},[Qt,C]);return r?jsx("div",{className:g("flex-1 flex items-center justify-center",G?"bg-[#0D0D0D]":"bg-white",s),style:o,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-[#00E5CC]"}),jsxs("p",{className:g("text-sm",G?"text-white/60":"text-gray-600"),children:[we.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",G?"bg-[#0D0D0D]":"bg-white",s),style:o,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:g("text-lg font-semibold mb-2",G?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",G?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",G?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",G?"text-white":"text-gray-900"),children:we.empty.noTasks}),jsx("p",{className:g("text-sm",G?"text-white/60":"text-gray-600"),children:we.empty.addFirstTask})]})}):jsxs("div",{ref:gt,className:g(G?"bg-[#0D0D0D]":"bg-white",re&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let k=!!t.toolbarContainer,_=jsx("div",{className:k?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",G?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:k?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",G?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let X=wr.filter(We=>(We.subtasks?.length??0)>0).length,ne=wr.length-X,de=f==="es";return jsxs(Fragment,{children:[ne," ",we.pagination.tasks,X>0&&jsxs(Fragment,{children:[" \xB7 ",X," ",de?X===1?"tarea padre":"tareas padre":X===1?"parent task":"parent tasks"]})]})})()}),b&&!k&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",G?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:st,onChange:X=>bt(X.target.value),placeholder:we.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",G?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),!k&&jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),h&&B>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:pe,onClick:()=>q(!me),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",G?me?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":me?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),Ja==="all"?f==="es"?"Todos":"All":`L${Ja}`]}),me&&jsx("div",{ref:ce,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",G?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(B,5)},(X,ne)=>({value:ne+1,label:`L${ne+1}`}))].map(X=>jsxs("button",{onClick:()=>{se(X.value),q(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",G?Ja===X.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Ja===X.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:X.label}),Ja===X.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(X.value)))})]}),t.showStatusFilter!==false&&jsx(_0,{value:Ee,hideCompleted:ht,onChange:Dt,onHideCompletedChange:_e,isDark:G,locale:f}),$e?.enabled&&$e.data&&!Pe&&jsx("button",{onClick:()=>je(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",G?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&D&&!k&&jsxs(motion.button,{onClick:D,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:we.toolbar.newTask})]})]})});return k?createPortal(_,t.toolbarContainer):_})(),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",G?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[cn&&jsx("div",{className:"w-6 flex-shrink-0"}),rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(k=>{let _=k.id!=="name",X=ye===k.id&&fe!==k.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",G?"text-white/60":"text-gray-500",_&&"cursor-grab",k.type!=="name"&&"justify-center",fe===k.id&&"opacity-50",X&&(G?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Wn[k.id],minWidth:k.minWidth},draggable:_,onDragStart:_?ne=>Xr(ne,k.id):void 0,onDragEnd:_?Pi:void 0,onDragOver:_?ne=>Qo(ne,k.id):void 0,onDragLeave:_?Fi:void 0,onDrop:_?ne=>Qa(ne,k.id):void 0,onContextMenu:ne=>On(ne,void 0,k.id),children:[_&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",G?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),p?jsxs("button",{draggable:false,onClick:ne=>{let de=ne.currentTarget.getBoundingClientRect();p(k.id,de);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ws(k),u?.includes(k.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),Ae===k.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):k.sortable?jsxs("button",{draggable:false,onClick:()=>Er(k.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ws(k),u?.includes(k.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Ae===k.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ws(k),u?.includes(k.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),P&&k.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:ne=>Rs(ne,k.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",re===k.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},k.id)}),C&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:k=>{k.stopPropagation(),xe(_=>!_);},className:g("p-0.5 rounded transition-colors",G?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",J&&(G?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(H0,{isOpen:J,onClose:()=>xe(false),columns:dt,customFields:c,mostrarColumnasDensas:w,onColumnsChange:_a,onCreateCustomField:()=>{xe(false),j(true);},isDark:G,locale:f})]})]}),jsxs(AnimatePresence,{mode:"popLayout",children:[$r.map((k,_)=>Us(_,(()=>{let X=Et.has(k.id),ne=Math.min(_*.01,.2),de=k.hasChildren&&k.level===0,We=k.subtasks?.length||0;if(de){let{spent:ut,allocated:ct,quoted:Zt}=Fs(k),it=fC(k);return jsxs(motion.div,{"data-task-id":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ne},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",G?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",tt===k.id&&(G?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(k),children:[cn&&oa(k.id),rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(ea=>jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",ea.type!=="name"&&"justify-center"),style:{width:Wn[ea.id],minWidth:ea.minWidth},children:ea.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:xt=>{xt.stopPropagation(),ja(k.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",G?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:X?jsx(ChevronDown,{className:g("w-4 h-4",G?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",G?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:xt=>{xt.stopPropagation(),ja(k.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:X?jsx(FolderOpen,{className:"w-4 h-4",style:{color:G?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:G?"#FFD60A":"#B45309"}})}),k.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:G?"#FFD60A":"#B45309"},children:k.wbsCode}),jsxs("div",{className:g("flex min-w-0",R?"flex-row items-baseline gap-2":"flex-col"),children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",R&&"truncate",G?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:k.name}),jsxs("span",{className:g(R?"text-[12px] flex-shrink-0":"text-[10px] font-mono",G?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),it!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",it>=1?"text-[#32D74B] bg-[#32D74B]/10":it>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",it.toFixed(2)]})]})]}):ea.type==="timeLoggedMinutes"?$==="financial"?(()=>{let xt=k.executedDollarsCanonical,Lt=xt!=null?Math.round(xt):Math.round(oe(k).dollarSpent);return Lt>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",Lt.toLocaleString("en-US")]}):null})():jsx(Gr,{value:ut>0?ut:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ea.type==="soldEffortMinutes"?$==="financial"?(()=>{let xt=oe(k),Lt=Math.round(xt.dollarQuoted);return Lt>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",Lt.toLocaleString("en-US")]}):null})():jsx(Gr,{value:Zt>0?Zt:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ea.type==="effortMinutes"?$==="financial"?(()=>{let xt=oe(k),Lt=Math.round(xt.dollarAllocated),pt=Math.round(xt.dollarQuoted),At=pt-Lt;return jsxs("div",{className:"flex flex-col",children:[Lt>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",Lt.toLocaleString("es-CO")]}):null,At!==0&&Lt>0&&pt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`]})]})})():jsx(Gr,{value:ct>0?ct:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):es(k,ea)},ea.id)),C&&jsx("div",{className:"w-12 flex-shrink-0"})]},k.id)}let Q=ue===k.id,De=vt===k.id,Re=De&&wt==="above",Ke=De&&wt==="below",$t=De&&wt==="child";return jsxs(motion.div,{"data-task-id":k.id,"data-listview-row":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ne},className:g("flex items-center border-b transition-colors relative group",G?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",tt===k.id&&(G?"!bg-[#FFD60A]/15":"!bg-yellow-100"),cn&&Un.has(k.id)&&(G?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":cn&&Un.has(k.id)?"true":void 0,style:{opacity:Q?.4:1,backgroundColor:$t?G?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(k),onDoubleClick:()=>a.onTaskDoubleClick?.(k),onContextMenu:ut=>On(ut,k),onMouseEnter:()=>Ft(k.id),onMouseLeave:()=>Ft(ut=>ut===k.id?null:ut),children:[Re&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Ke&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),cn&&oa(k.id),rt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:ut=>et(k.id,ut),style:{color:G?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Qt.map(ut=>{let ct=!!(k.subtasks&&k.subtasks.length>0),Zt=aa(ut),ea=!!Zt&&!ct&&Tt===k.id&&!kt,xt=!!kt&&!!Zt&&cr(kt.column,Zt)&&Ra(k.id);return jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",ut.type!=="name"&&"justify-center"),style:{width:Wn[ut.id],minWidth:ut.minWidth,position:"relative",backgroundColor:xt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:xt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:ut.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&k.level>0&&jsx("div",{style:{width:`${k.level*24}px`},className:"flex-shrink-0"}),h&&k.hasChildren&&jsx("button",{onClick:Lt=>{Lt.stopPropagation(),ja(k.id);},className:g("p-0.5 rounded flex-shrink-0",G?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:X?jsx(ChevronDown,{className:g("w-4 h-4",G?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",G?"text-white/60":"text-gray-400")})}),h&&!k.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:g("flex min-w-0 flex-1",R?"flex-row items-center gap-2":"flex-col"),children:[(k.wbsCode||k.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[k.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",G?"text-[#00E5CC]":"text-[#00C4AE]"),children:k.wbsCode}),k.taskCode&&jsx("span",{"data-codigo-tarea":true,className:g(R?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",G?"text-white/40":"text-gray-400"),style:R&&!G?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:k.taskCode})]}),jsxs("span",{className:g("truncate",k.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",k.progress===100?t.completedStyle==="dim"?G?"text-white/45":"text-gray-400":G?"line-through text-white/50":"line-through text-gray-400":k.hasChildren?G?"text-white":"text-gray-900":G?"text-[#D1D5DB]":"text-gray-600"),children:[k.__padre&&jsxs("span",{"data-prefijo-padre":true,className:G?"text-white/35":"text-gray-400",children:[k.__padre," \u203A "]}),k.name]}),k.tags?.[0]&&jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",R&&"flex-shrink-0"),style:{backgroundColor:`${k.tags[0].color}20`,color:k.tags[0].color},children:k.tags[0].name})]})]}):ea&&Zt?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[es(k,ut),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Lt=>xr(Lt,k.id,Zt,_),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):es(k,ut)},ut.id)}),C&&jsx("div",{className:"w-12 flex-shrink-0"})]},k.__claveFila??k.id)})())),Us($r.length,null)]}),W&&$r.length>0&&(()=>{let{spent:k,allocated:_,quoted:X}=le,ne=_-k,de=ne<0,We=de?`+${Ps(Math.abs(ne))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Ps(ne)} ${f==="es"?"AHORRADO":"SAVED"}`,Q=$==="financial"&&Y>0,De=Ce?.breakdown,Re=!!De&&((De.equipment??0)>0||(De.travel??0)>0),Ke=De?.laborSpent!=null?De.laborSpent:Ce?.spent!=null?Ce.spent:le.dollarSpent,$t=De?.laborAllocated!=null?De.laborAllocated:Ce?.allocated!=null?Ce.allocated:le.dollarAllocated,ut=Ce?.quoted!=null?Ce.quoted:le.dollarQuoted,ct=(xt,Lt)=>{if(Q){let pt=Lt??xt/60*Y;return `$${Math.round(pt).toLocaleString("es-CO")}`}return Ps(xt)},Zt=Q?Math.abs($t-Ke):0,it=Q?`+$${Zt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${de?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,ea=Q&&Re?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",G?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:G?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[cn&&jsx("div",{className:"w-6 flex-shrink-0"}),rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(xt=>jsx("div",{className:g("flex items-center px-4 py-3",xt.type!=="name"&&"justify-center"),style:{width:Wn[xt.id],minWidth:xt.minWidth},children:xt.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),ea&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",G?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),ea]})]}):xt.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ct(k,Q?Ke:void 0)}),jsx("span",{className:g("text-[11px]",G?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",G?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ct(_,Q?$t:void 0)})]}),_>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",de?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q?it:We})]}):xt.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:X>0?ct(X,Q?ut:void 0):"\u2013"}):xt.type==="effortMinutes"?(()=>{if(Q&&X>0&&_>0){let Lt=Math.round(ut),pt=Math.round($t),At=Lt-pt,Ba=Lt>0?Math.round(At/Lt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ct(_,$t)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>=0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Ba,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:_>0?ct(_,Q?$t:void 0):"\u2013"})})():xt.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:k>0?ct(k,Q?Ke:void 0):"\u2013"}):xt.type==="progress"?(()=>{let Lt=Z0(uu(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",G?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Lt,"%"]})})():xt.type==="weight"?(()=>{let Lt=e||[],pt=[],At=ur=>{for(let Ka of ur)pt.push(Ka),Ka.subtasks?.length&&At(Ka.subtasks);};At(Lt);let kr=pt.filter(ur=>!ur.subtasks?.length||ur.subtasks.length===0).reduce((ur,Ka)=>ur+(Ka.weight||0),0),Pr=Math.abs(kr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Pr?G?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(kr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",G?"text-white/30":"text-gray-300"),children:"\u2013"})},xt.id)),C&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),$r.length===0&&st&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",G?"text-white/30":"text-gray-400")}),jsx("p",{className:g(G?"text-white/60":"text-gray-600"),children:we.empty.noResults})]})})]})}),$e?.enabled&&$e.data&&Pe&&jsx(q0,{data:$e.data,isDark:G,locale:f,onClose:()=>je(false),lens:t?.lens,onUnassignedTaskClick:k=>{let _=document.querySelector(`[data-task-id="${k}"]`);_&&(_.scrollIntoView({behavior:"smooth",block:"center"}),ee(k),setTimeout(()=>ee(null),2e3));}})]}),jsx(M0,{state:ke,onClose:Vr,isDark:G,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Mr,onColumnSort:xa,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),yt&&Ht&&ue&&createPortal(jsx("div",{style:{position:"fixed",left:Ht.x+12,top:Ht.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Me.flattenTasks(e).find(X=>X.id===ue);return _?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:G?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${G?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:G?"#e6edf3":"#111827"},children:_.name})]}):null})()}),document.body),jsx(z0,{isOpen:I,onClose:()=>j(false),onSave:Bs,isDark:G,locale:f})]})}var af=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],rf=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],nf=[{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 pu={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},mu={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},gu={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Kl={dark:pu,light:mu,neutral:gu};function of(e){return Kl[e]||Kl.dark}function ql(e,t,a,r,n=5){let s=[],o=[],i=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of i){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),b=0;for(;(s[b]||[]).some(([h,y])=>!(v<h||f>y));)b++;(s[b]=s[b]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:b,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let l=[],p=[],u={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(u[m.serial]=u[m.serial]||[]).push(m);}),Object.keys(u).forEach(m=>{let f=+m,v=u[f],b=[];for(let h=0;h<n;h++)c[f].has(h)||b.push(h);if(v.length<=b.length)v.forEach((h,y)=>l.push({it:h,day:f,lane:b[y]}));else {let h=Math.max(b.length-1,0);v.slice(0,h).forEach((y,x)=>l.push({it:y,day:f,lane:b[x]})),p.push({day:f,lane:b[h]!=null?b[h]:n-1,count:v.length-h,items:v.slice(h)});}});let d=s.length;return l.forEach(m=>{d=Math.max(d,m.lane+1);}),p.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:l,more:p,laneCount:Math.max(d,1)}}var hC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],yC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function sf(e){return e==="es"?hC:yC}function lf(e){return (e.getDay()+6)%7}function cf(e,t){let a=new Date(e,t,1),r=lf(a),n=new Date(e,t,1-r),s=[];for(let u=0;u<6;u++)s.push({ws:u*7+1,we:u*7+7});let o=u=>{let d=new Date(n);return d.setDate(n.getDate()+(u-1)),d},i=u=>{let d=u.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=i(a),l=new Date(e,t+1,0),p=i(l);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:i,monthStartSerial:c,monthEndSerial:p}}function wi(e,t){return lf(e.serialToDate(t))>=5}function df(e,t,a,r,n){let s=[],o=[],i=[],c=Math.max(1,n),l=0;for(let p=a;p<=r;p++){let u=e.filter(b=>!b.container&&b.endSerial===p).sort((b,h)=>+!!b.done-+!!h.done||b.name.localeCompare(h.name)),d=t.filter(b=>b.serial===p),m=u.length+d.length;if(m===0)continue;let f=Math.min(m,c),v=0;for(let b of u.slice(0,f))s.push({t:b,s:p,e:p,lane:v++,contL:false,contR:false});for(let b of d.slice(0,Math.max(0,f-Math.min(u.length,f))))o.push({it:b,day:p,lane:v++});if(m>f){let b=d.slice(Math.max(0,f-Math.min(u.length,f)));i.push({day:p,lane:-1,count:m-f,items:b});}l=Math.max(l,v);}return {bars:s,chips:o,more:i,laneCount:Math.max(l,1)}}function xC(e){let t=[],a=(r,n,s)=>{for(let o of r){let i=n||o.id,c=s||o.name;t.push({t:o,phaseId:i,phaseName:c}),o.subtasks?.length&&a(o.subtasks,i,c);}};return a(e,"",""),t}function uf(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function pf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Yl(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=xC(t),i=42,c=[];for(let{t:p,phaseId:u,phaseName:d}of o){let m=uf(p.startDate),f=uf(p.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),b=a.dateToSerial(f);if(b<1||v>i)continue;let h=p.effortMinutes??0,y=Math.round(h/60*10)/10,x=p.costAtCompletion,w=x!=null?pf(x):pf(y*n),C=p.assignees?.[0],P=C?.initials||(C?.name?kC(C.name):void 0),O=p.displayId||p.wbsCode||"",T=wC(O||p.id)?"":O||p.id;c.push({uid:p.id,id:T,name:p.name,projectId:s,color:p.color,startSerial:Math.max(v,1),endSerial:Math.min(b,i),hrs:y,cost:w,critical:!!p.isCriticalPath,who:P,realStart:m,realEnd:f,phaseId:u,phaseName:d,done:p.progress===100||p.status==="completed",overdue:!(p.progress===100||p.status==="completed")&&(()=>{let D=new Date;D.setHours(0,0,0,0);let M=new Date(f);return M.setHours(0,0,0,0),M<D})(),milestone:!!p.isMilestone,container:!!(p.subtasks&&p.subtasks.length>0)});}let l=[];return {calTasks:c,dayItems:l,isEmpty:c.length===0&&l.length===0}}var vC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function wC(e){return vC.test(e)||/^task-\d+/.test(e)}function kC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var CC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],TC=["January","February","March","April","May","June","July","August","September","October","November","December"];function mf(e,t,a){return `${(a==="es"?CC:TC)[t]} ${e}`}var fu=26,NC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Xl({locale:e}){let t=sf(e);return jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function Jl({bar:e,ws:t,money:a,projColor:r,slotH:n=fu,due:s=false,showValues:o=true}){let{t:i}=e,c=e.s-t,l=e.e-e.s+1,p="cal-bar"+(i.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":"")+(s?" due":"")+(s&&i.done?" done":"")+(s&&i.overdue?" overdue":"")+(s&&i.milestone?" hito":""),u=a==="$"?i.cost:`${i.hrs}h`,d=o&&(a==="$"||i.hrs>0),m={"--proj":e.color??i.color??r,left:`calc(${c}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:p,style:m,children:[i.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s&&i.done?jsx("span",{className:"ico","aria-hidden":true,children:"\u2713"}):null,s&&i.overdue?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 12 12","aria-hidden":true,children:[jsx("circle",{cx:"6",cy:"6",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"6",y1:"3.4",x2:"6",y2:"6.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"8.6",r:"0.8",fill:"currentColor"})]}):null,s&&i.milestone?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":true,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",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"})]}):null,i.id?jsx("span",{className:"tk",children:i.id}):null,jsx("span",{className:"nom",children:i.name}),l>=3&&d?jsx("span",{className:"val",children:u}):null,s&&i.overdue?jsx("span",{className:"sr-only",children:"Overdue"}):null]})}function Ql({chip:e,ws:t,slotH:a=fu}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:NC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Zl({more:e,ws:t,slotH:a=fu,onClick:r,enCabecera:n=false,locale:s="es"}){let o=e.day-t,i=n?{left:`calc(${o+1}/7*100% - 4px)`,top:"-25px",transform:"translateX(-100%)"}:{left:`calc(${o}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:n?"cal-more en-cabecera":"cal-more",style:i,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," ",s==="en"?"more":"m\xE1s"]})}function gf({projects:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var MC=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Lookahead",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function bu({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:i=false,hiddenViews:c=[]}){let l=o==="en",p=MC.filter(u=>!c.includes(u.id));return i?jsxs(Fragment,{children:[jsx("div",{className:"cal-seg",children:p.map(u=>jsx("button",{type:"button",className:e===u.id?"on":"",onClick:()=>t(u.id),title:`${l?u.en:u.es} (${u.key})`,children:l?u.en:u.es},u.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]}):jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:p.map(u=>jsxs("button",{type:"button",className:e===u.id?"on":"",onClick:()=>t(u.id),children:[l?u.en:u.es,jsx("span",{className:"key",children:u.key})]},u.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function ff({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:i,phaseFilter:c="all",onPhaseChange:l,locale:p="es",children:u}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),b=p==="es";useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);let h=c==="all"?b?"Todas":"All":i?.find(y=>y.id===c)?.name??(b?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:b?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),i&&i.length>0&&l?jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:b?"Fase":"Phase"})," ",h," \u25BE"]}),m?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{l("all"),f(false);},children:jsx("span",{className:"nm",children:b?"Todas las fases":"All phases"})}),i.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{l(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,u,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",b?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var PC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function bf({off:e,onToggle:t}){let a=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:PC.map(r=>{let n=a.includes(r.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:r.nm}),jsx("div",{className:"sub",children:r.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var IC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},RC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function yf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let i=o==="en",c=useRef(null);useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=a.length+t.length,u=r||(d=>{switch(d.type){case "hito":return i?"Milestone":"Hito";case "desembolso":return i?"Disb.":"Desemb.";case "deadline":return i?"Due":"Vence";case "aus":return i?"Absence":"Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} ${i?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",i?l===1?"item":"items":l===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[a.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:RC[d.type]},children:IC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:u(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var hf={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function xf({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r,irAPrimera:n}){let s=hf[a]||hf.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:s.title}),jsxs("p",{children:[s.body,jsx("br",{}),jsx("b",{children:e})]}),n?jsx("button",{type:"button","data-ir-a-primera":true,className:"cal-empty-crear",onClick:n.onClick,children:a==="en"?`Go to the first (${n.mes}) \u2192`:`Ir a la primera (${n.mes}) \u2192`}):null,r?jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:s.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:s.upcoming}),t.map((o,i)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(o.type==="deadline"?"rd":"cy"),children:o.type==="deadline"?"\u2691":"\u25C6"}),o.label,jsx("span",{className:"d",children:o.date})]},i))]}):null]})}function wf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function OC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var vf=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function HC(e){return vf[e%vf.length]}function UC(e){return e>1?"over":e>=.9?"warn":"ok"}var hu="\xA0";function _o(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function kf(e,t,a){let r=new Map,n=new Set;for(let i of t)i.isWeekend||i.isHoliday||n.add(wf(i.date));if(n.size===0)return r;let s=new Map;e.forEach((i,c)=>{s.set(i.userId,{color:HC(c),initials:OC(i.name)});});let o=new Map;for(let i of e)for(let c of i.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let l=o.get(c.date);l.set(i.userId,(l.get(i.userId)??0)+(c.hours||0));}for(let i of n){let c=o.get(i)??new Map,l=e.map(u=>{let d=s.get(u.userId);return {name:u.name,initials:d.initials,color:d.color,hours:Math.round((c.get(u.userId)??0)*100)/100,capacity:a}}),p=l.reduce((u,d)=>u+d.hours,0);r.set(i,{assigned:Math.round(p*100)/100,capacity:a*e.length,perPerson:l});}return r}function Cf({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=wf(n.date),o=n.isWeekend||n.isHoliday,i=o?void 0:t.get(s),c=!!i&&i.capacity>0,l=c?i.assigned/i.capacity:0,u="cal-cap-cell "+(o?"off":UC(l))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:u,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${hu}/${hu}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[_o(i.assigned),"h"]}),jsxs("span",{children:["/",hu,_o(i.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(l*100,100)+"%"}}):null})]},n.serial)})})}function Tf({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=useRef(null);useEffect(()=>{let l=u=>{u.key==="Escape"&&a();},p=u=>{n.current&&!n.current.contains(u.target)&&a();};return document.addEventListener("keydown",l),document.addEventListener("mousedown",p),()=>{document.removeEventListener("keydown",l),document.removeEventListener("mousedown",p);}},[a]);let s=t.reduce((l,p)=>l+p.hours,0),o=t.reduce((l,p)=>l+p.capacity,0),i=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...r},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:i?{color:"var(--red)"}:void 0,children:[_o(s),"h asignadas / ",_o(o),"h"]}),i?jsx("div",{className:"rng",children:jsxs("b",{children:["+",_o(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(l=>{let p=l.capacity>0&&l.hours>l.capacity,u=l.capacity>0?l.capacity:1;return jsxs("div",{className:p?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:l.color},children:l.initials}),jsx("span",{className:"nm",title:l.name,children:l.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(l.hours/u*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[_o(l.hours),"h / ",_o(l.capacity),"h"]})]},l.name)})})]})}var yu=28,zC=182;function Df({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:i,capRows:c,teamSize:l,onTaskOpen:p,onMore:u,onCapDay:d}){let m=i==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxs("div",{style:{display:"contents"},children:[jsx(GC,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:p,onMore:u}),c&&c[v]?jsx(Cf,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",l!=null?` \xB7 ${l} ${m?l===1?"persona":"personas":l===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function GC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,onTaskOpen:c,onMore:l}){let p=useMemo(()=>ql(r,n,t,a),[r,n,t,a]),u=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=a;f++)d.push(f);let m={height:`${zC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:m,children:[jsx("div",{className:"cal-week-bg",children:d.map(f=>{let v=e.serialToDate(f),b=f>=e.monthStartSerial&&f<=e.monthEndSerial,h="cal-day";return wi(e,f)&&(h+=" wknd"),b||(h+=" out"),f===i&&(h+=" today"),u.has(f)&&(h+=" deadline-day"),jsx("div",{className:h,children:jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[p.bars.map((f,v)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Jl,{bar:f,ws:t,money:s,projColor:o,slotH:yu})},`b${v}`)),p.chips.map((f,v)=>jsx(Ql,{chip:f,ws:t,slotH:yu},`c${v}`)),p.more.map((f,v)=>jsx(Zl,{more:f,ws:t,slotH:yu,onClick:()=>l(f.day,f.items,r.filter(b=>b.startSerial<=f.day&&b.endSerial>=f.day))},`m${v}`))]})]})}var VC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jC(e){return VC.test(e)||/^task-\d+/.test(e)}function _C(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function Sf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function KC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Ef(e,t){let a=KC(e),r=[];for(let n of a){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,i=n.costAtCompletion,c=i!=null?Sf(i):Sf(o*t),l=n.assignees?.[0],p=l?.initials||(l?.name?_C(l.name):void 0),u=n.displayId||n.wbsCode||"",d=jC(u||n.id)?"":u||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:p,projColor:n.color});}return r}function Mf({items:e,onItemClick:t,onCollapse:a,money:r,projColor:n,locale:s="es"}){let o=s==="en";return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:a,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:o?"Drag onto the calendar":"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(i=>{let c=r==="$"?i.cost:`${i.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(i.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.taskId));},children:[jsxs("div",{className:"row1",children:[i.id?jsx("span",{className:"tk",children:i.id}):null,jsx("span",{className:"pdot",style:{background:i.projColor||n}})]}),jsx("div",{className:"nom",children:i.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[i.hrs,"h"]})," est"]}),jsx("span",{children:c}),i.who?jsx("span",{className:"cal-ava",children:i.who}):null]})]},i.taskId)})]})}function Pf({onExpand:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",a?"Status":"Estado"]})]})}function As(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Ff({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:i}){let c=useRef(null),l=n==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let p=a.wasCritical,u=a.projectEndDeltaDays,d=u>0?`+${u} ${l?u===1?"d\xEDa":"d\xEDas":u===1?"day":"days"} \xB7 ${As(a.oldProjectEnd,n)} \u2192 ${As(a.newProjectEnd,n)}`:`+0 ${l?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${l?"holgura":"slack"} ${a.slackDays}d`:""}`,m=u>0?l?`Confirmar +${u} ${u===1?"d\xEDa":"d\xEDas"}`:`Confirm +${u} ${u===1?"day":"days"}`:l?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...i},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:l?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[As(a.oldStart,n)," \u2013 ",As(a.oldEnd,n)," \u2192 ",jsxs("b",{children:[As(a.newStart,n)," \u2013 ",As(a.newEnd,n)]})]})]}),p?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",l?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?l?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Fin de proyecto":"Project end"}),jsx("span",{className:u>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?l?"Sigue en CPM":"Stays critical":a.wasCritical?l?"Sale de CPM":"Leaves critical":l?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:l?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:p||u>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?l?"Guardando\u2026":"Saving\u2026":m})]})]})}var JC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Lf({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:i}){let c=o==="es",l=useMemo(()=>{let u=new Map,d=m=>(u.has(m)||u.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),u.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...u.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(l.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let p=u=>u.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:l.map(u=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:u.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[p(u.date),u.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),u.tasks.map(d=>jsxs("button",{type:"button",onClick:()=>i?.(d.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:d.color??n,flex:"none"}}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,d.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:r==="$"?d.cost:`${d.hrs}h`})]},d.uid)),u.items.map((d,m)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:JC[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},u.serial))})}function QC(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function ec(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function xu(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function Af(e,t){let a=new Map(e.map(l=>[l.id,l])),r=new Map;for(let l of e)for(let p of ec(l))r.has(p)||r.set(p,[]),r.get(p).push(l.id);let n=new Map,s=new Map,o=new Set,i=l=>{if(s.has(l))return s.get(l);if(o.has(l))return s.get(l)??0;o.add(l);let p=a.get(l);if(!p)return o.delete(l),0;let u=ec(p).filter(f=>a.has(f)),d=t.has(l)?t.get(l):p.startDate?new Date(p.startDate).getTime():0;for(let f of u){let v=i(f);v>d&&(d=v);}let m=xu(p)*864e5;return n.set(l,d),s.set(l,d+m),o.delete(l),s.get(l)};for(let l of e)i(l.id);let c=0;return s.forEach(l=>{l>c&&(c=l);}),{finish:s,start:n,projectEnd:c}}function If(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let l of ec(c))n.has(l)||n.set(l,[]),n.get(l).push(c.id);let s=new Map,o=[...e].sort((c,l)=>(t.get(l.id)??0)-(t.get(c.id)??0));for(let c of o){let l=n.get(c.id)??[];if(l.length===0)s.set(c.id,a);else {let p=1/0;for(let u of l){let d=s.get(u),m=r.get(u);d!=null&&m&&(p=Math.min(p,d-xu(m)*864e5));}s.set(c.id,p===1/0?a:p);}}let i=new Set;for(let c of e){let l=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(l)<864e5/2&&ec(c).length+(n.get(c.id)?.length??0)>0&&i.add(c.id);}return i}function tc(e,t,a,r){let n=QC(e),s=n.find(h=>h.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),i=new Date(s.endDate),c=Af(n,new Map),l=If(n,c.finish,c.projectEnd),p=n.map(h=>h.id===t?{...h,startDate:a,endDate:r}:h),u=Af(p,new Map([[t,a.getTime()]])),d=If(p,u.finish,u.projectEnd),m=new Map(p.map(h=>[h.id,h])),f=[];for(let h of n){if(h.id===t)continue;let y=c.start.get(h.id),x=u.start.get(h.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=xu(m.get(h.id))*864e5;f.push({id:h.id,name:h.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((u.projectEnd-c.projectEnd)/864e5),b=l.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:i,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(u.projectEnd),wasCritical:l.has(t),stillCritical:d.has(t),slackDays:b}}function Bf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Of=132,ac=26,wu=20,e2="#5B7FD4";function Hf({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:i,onMoneyChange:c,onTaskOpen:l,toolbarContainer:p,hiddenViews:u,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:b,members:h=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w,monthMode:C="span",showValues:P=true,openOnToday:O=false}){let T=useRef(null),[D,M]=useState(0);useEffect(()=>{if(C!=="due")return;let he=T.current;if(!he||typeof ResizeObserver>"u")return;let Fe=new ResizeObserver(()=>M(he.clientHeight));return Fe.observe(he),M(he.clientHeight),()=>Fe.disconnect()});let[N,z]=useState("mes"),[$,Y]=useState(()=>{let he=new Date,Fe={y:he.getFullYear(),m:he.getMonth()};if(O)return Fe;let Qe=(e??[]).map(Ft=>Ft.startDate?new Date(Ft.startDate):null).filter(Ft=>!!Ft&&!isNaN(Ft.getTime()));if(Qe.length===0||(e??[]).some(Ft=>{let kt=Ft.startDate?new Date(Ft.startDate):null,Da=Ft.endDate?new Date(Ft.endDate):kt;if(!kt||isNaN(kt.getTime()))return false;let aa=new Date(Fe.y,Fe.m,1),cr=new Date(Fe.y,Fe.m+1,0,23,59,59);return kt<=cr&&(Da??kt)>=aa}))return Fe;let Tt=Qe.reduce((Ft,kt)=>Ft<kt?Ft:kt);return {y:Tt.getFullYear(),m:Tt.getMonth()}}),[A,Se]=useState(false),[W,Ce]=useState([]),[R,we]=useState("all"),[G,Ve]=useState(null),[oe,Be]=useState(null),[le,He]=useState(false),[$e,Pe]=useState(null),[je,tt]=useState(false),ee=useMemo(()=>cf($.y,$.m),[$.y,$.m]),Ae=r||e2,ot=useMemo(()=>{let he=new Set;for(let Fe of y){let Qe=new Date(`${Fe}T12:00:00`),rt=ee.dateToSerial(Qe);rt>=1&&rt<=42&&he.add(rt);}return he},[y,ee]);useEffect(()=>{w?.({start:Bf(ee.serialToDate(1)),end:Bf(ee.serialToDate(42))});},[$.y,$.m]);let Ie=h.length,zt=useMemo(()=>{let he=x?.hoursPerDay;if(!he)return 8;let Fe=[he.monday,he.tuesday,he.wednesday,he.thursday,he.friday].map(Qe=>Qe||0).filter(Qe=>Qe>0);return Fe.length?Math.round(Fe.reduce((Qe,rt)=>Qe+rt,0)/Fe.length*10)/10:8},[x]),st=useMemo(()=>Yl({tasks:e,grid:ee,projectColor:()=>Ae,hourlyRate:o,projectId:a}),[e,ee,Ae,o,a]),bt=useMemo(()=>{if(d===false)return [];let he=new Map;for(let Fe of st.calTasks)Fe.phaseId&&Fe.phaseName&&he.set(Fe.phaseId,Fe.phaseName);return [...he.entries()].map(([Fe,Qe])=>({id:Fe,name:Qe})).sort((Fe,Qe)=>Fe.name.localeCompare(Qe.name))},[st.calTasks,d]),Ee=!W.includes("tareas"),Dt=!W.includes("cpm"),ht=useMemo(()=>{let he=Ee?st.calTasks:[];return R!=="all"&&(he=he.filter(Fe=>Fe.phaseId===R)),Dt||(he=he.map(Fe=>Fe.critical?{...Fe,critical:false}:Fe)),he},[st.calTasks,Ee,Dt,R]),_e=useMemo(()=>{let he=new Set;return W.includes("hitos")&&(he.add("hito"),he.add("desembolso")),W.includes("ext")&&he.add("ext"),W.includes("aus")&&he.add("aus"),st.dayItems.filter(Fe=>!he.has(Fe.type))},[st.dayItems,W]),dt=!W.includes("festivos"),L=new Date,J=ee.dateToSerial(new Date(L.getFullYear(),L.getMonth(),L.getDate())),xe=he=>Ce(Fe=>Fe.includes(he)?Fe.filter(Qe=>Qe!==he):[...Fe,he]),I=()=>Y(he=>{let Fe=new Date(he.y,he.m-1,1);return {y:Fe.getFullYear(),m:Fe.getMonth()}}),j=()=>Y(he=>{let Fe=new Date(he.y,he.m+1,1);return {y:Fe.getFullYear(),m:Fe.getMonth()}}),ke=()=>{let he=new Date;Y({y:he.getFullYear(),m:he.getMonth()});},Ue=useMemo(()=>{let he=(e??[]).flatMap(Fe=>[Fe.startDate,Fe.endDate]).map(Fe=>Fe?new Date(Fe):null).filter(Fe=>!!Fe&&!isNaN(Fe.getTime()));return he.length?he.reduce((Fe,Qe)=>Fe<Qe?Fe:Qe):null},[e]),ue=(he,Fe,Qe)=>{if(!v||Fe===0)return;let rt=st.calTasks.find(aa=>aa.uid===he);if(!rt)return;let Tt=Fe*864e5,Ft=new Date(rt.realStart.getTime()+Tt),kt=new Date(rt.realEnd.getTime()+Tt),Da=tc(e,he,Ft,kt);Da&&Pe({uid:he,taskId:rt.id,taskName:rt.name,sim:Da,anchor:Qe});},at=async()=>{if(!$e||!b)return;tt(true);let he=[{id:$e.uid,startDate:$e.sim.newStart,endDate:$e.sim.newEnd},...$e.sim.movedSuccessors.map(Qe=>({id:Qe.id,startDate:Qe.newStart,endDate:Qe.newEnd}))],Fe=await b(he);tt(false),Fe&&Pe(null);},yt=mf($.y,$.m,n),Ye=[{id:"",name:t,color:Ae}],vt=useMemo(()=>Ef(e,o),[e,o]),Xt=useMemo(()=>{if(N==="lookahead"){let he=ee.weeks.find(Qe=>J>=Qe.ws&&J<=Qe.we)??ee.weeks[0],Fe=ee.weeks.indexOf(he);return ee.weeks.slice(Fe,Fe+2)}return N==="semana"?[ee.weeks.find(Fe=>J>=Fe.ws&&J<=Fe.we)??ee.weeks[0]]:[]},[N,ee.weeks,J]),wt=useMemo(()=>{let he={};return Xt.forEach((Fe,Qe)=>{let rt=[];for(let Ft=Fe.ws;Ft<=Fe.we;Ft++)rt.push({serial:Ft,date:ee.serialToDate(Ft),isWeekend:wi(ee,Ft),isHoliday:ot.has(Ft)});let Tt=kf(h,rt,zt);he[Qe]={days:rt,capByDay:Tt};}),he},[Xt,ee,ot,h,zt]),Ut=N==="semana"||N==="lookahead",Ht=N==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[p?createPortal(jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsx(bu,{enCabecera:true,hiddenViews:u,view:N,onViewChange:z,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:he=>c(he==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),p):jsx(bu,{view:N,onViewChange:z,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:he=>c(he==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:u}),jsx(ff,{monthLabel:yt,onPrev:I,onNext:j,onToday:ke,layersOpen:A,onToggleLayers:()=>Se(he=>!he),layersOff:W,phases:bt,phaseFilter:R,onPhaseChange:we,locale:n,children:A?jsx(bf,{off:W,onToggle:xe}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Ht?"hidden":void 0},children:[Ht?jsx(Lf,{grid:ee,tasks:ht,items:_e,money:i,projColor:Ae,todaySerial:J,locale:n,onTaskOpen:l}):Ut?jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx(Df,{grid:ee,weeks:Xt,tasks:ht,items:_e,money:i,projColor:Ae,todaySerial:J,locale:n,capRows:wt,teamSize:Ie,onTaskOpen:l,onMore:(he,Fe,Qe)=>Ve({day:he,items:Fe,tasks:Qe}),onCapDay:(he,Fe,Qe)=>{for(let rt of Object.keys(wt)){let Tt=wt[+rt].capByDay.get(he);if(Tt){Be({dayLabel:Fe,perPerson:Tt.perPerson,anchor:Qe.getBoundingClientRect()});break}}}})]}):st.isEmpty?jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx("div",{className:"cal-weeks",children:ee.weeks.map(he=>jsx("div",{className:"cal-week",style:{minHeight:C==="due"?0:`${Of}px`},children:jsx(Uf,{grid:ee,ws:he.ws,we:he.we,todaySerial:J,showFestivos:dt,holidaySerials:ot,locale:n,deadlineDays:new Set})},he.ws))}),jsx(xf,{monthLabel:yt,locale:n,onCreateTask:f,irAPrimera:Ue?{mes:Ue.toLocaleDateString(n==="en"?"en":"es",{month:"long",year:Ue.getFullYear()!==new Date().getFullYear()?"numeric":void 0}),onClick:()=>Y({y:Ue.getFullYear(),m:Ue.getMonth()})}:void 0})]}):jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx("div",{className:"cal-weeks",ref:T,style:C==="due"?{minHeight:0,overflow:"hidden"}:void 0,children:ee.weeks.map(he=>jsx(t2,{due:C==="due",slots:D>0?Math.max(1,Math.floor((D/ee.weeks.length-26)/wu)):2,showValues:P,grid:ee,ws:he.ws,we:he.we,tasks:ht,items:_e,money:i,projColor:Ae,todaySerial:J,showFestivos:dt,holidaySerials:ot,locale:n,onTaskOpen:l,onMore:(Fe,Qe,rt)=>Ve({day:Fe,items:Qe,tasks:rt}),canReschedule:v,onDragReschedule:ue,pendingGhost:$e?{uid:$e.uid,days:Math.round(($e.sim.newStart.getTime()-$e.sim.oldStart.getTime())/864e5)}:null},he.ws))})]}),G?jsx(yf,{dayLabel:`${ee.serialToDate(G.day).getDate()}`,items:G.items,tasks:G.tasks.map(he=>({swatch:Ae,taskId:he.id,label:he.name,critical:he.critical,value:i==="$"?he.cost:`${he.hrs}h`})),onClose:()=>Ve(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,oe?jsx(Tf,{dayLabel:oe.dayLabel,perPerson:oe.perPerson,onClose:()=>Be(null),style:{position:"fixed",top:`${oe.anchor.top-8}px`,left:`${oe.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,$e?jsx(Ff,{taskName:$e.taskName,taskId:$e.sim.taskId,sim:$e.sim,busy:je,locale:n,onConfirm:at,onCancel:()=>Pe(null),style:{position:"fixed",top:`${$e.anchor.top+12}px`,left:`${Math.min($e.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),le?jsx(Mf,{items:vt,money:i,projColor:Ae,onItemClick:he=>l?.(he),onCollapse:()=>He(false),locale:n==="en"?"en":"es"}):jsx(Pf,{onExpand:()=>He(true),locale:n==="en"?"en":"es"})]}),jsx(gf,{projects:Ye,locale:n==="en"?"en":"es"})]})}function Uf({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let i=[];for(let c=t;c<=a;c++)i.push(c);return jsx("div",{className:"cal-week-bg",children:i.map(c=>{let l=e.serialToDate(c),p=c>=e.monthStartSerial&&c<=e.monthEndSerial,u=n&&s.has(c),d="cal-day";return wi(e,c)&&(d+=" wknd"),u&&(d+=" festivo"),p||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:l.getDate()}),u?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function t2({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,showFestivos:c,holidaySerials:l,locale:p,onTaskOpen:u,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v,due:b=false,slots:h=2,showValues:y=true}){let x=useMemo(()=>b?df(r,n,t,a,h):ql(r,n,t,a),[r,n,t,a,b,h]),w=useMemo(()=>new Set(n.filter(M=>M.type==="deadline").map(M=>M.serial)),[n]),C=b?0:Math.max(Of,x.laneCount*ac+36),P=useRef(null),[O,T]=useState(null),D=(M,N)=>{if(!m||!f){u?.(N);return}M.preventDefault();let z=P.current;if(!z)return;let $=z.getBoundingClientRect().width/7,Y=M.clientX,A=0,Se=Ce=>{let R=Math.round((Ce.clientX-Y)/$);A=R,T({id:N,days:R});},W=Ce=>{if(window.removeEventListener("pointermove",Se),window.removeEventListener("pointerup",W),T(null),A===0){u?.(N);return}let R=new DOMRect(Ce.clientX,Ce.clientY,0,0);f(N,A,R);};window.addEventListener("pointermove",Se),window.addEventListener("pointerup",W);};return jsxs("div",{ref:P,className:"cal-week",style:{minHeight:`${C}px`},children:[jsx(Uf,{grid:e,ws:t,we:a,todaySerial:i,showFestivos:c,holidaySerials:l,locale:p,deadlineDays:w}),jsxs("div",{className:"cal-items",children:[x.bars.map((M,N)=>{let z=O?.id===M.t.uid?O.days:null,$=v?.uid===M.t.uid?v.days:null,Y=z??$??0,A=z==null&&$!=null,Se=Y!==0?{...M,s:M.s+Y,e:M.e+Y}:M;return jsx("div",{onPointerDown:W=>D(W,M.t.uid),style:{cursor:m?"grab":u?"pointer":"default",display:"contents",opacity:A?.6:1},children:jsx(Jl,{bar:Se,ws:t,money:s,projColor:o,slotH:b?wu:ac,due:b,showValues:y})},`b${N}`)}),x.chips.map((M,N)=>jsx(Ql,{chip:M,ws:t,slotH:ac},`c${N}`)),x.more.map((M,N)=>jsx(Zl,{more:M,ws:t,slotH:b?wu:ac,enCabecera:b,locale:p,onClick:()=>d(M.day,M.items,b?r.filter(z=>!z.container&&z.endSerial===M.day):r.filter(z=>z.startSerial<=M.day&&z.endSerial>=M.day))},`m${N}`))]})]})}function r2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:i}){let[c,l]=useState(false),p=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),u=useMemo(()=>{let m=p.length,f=new Set(p.flatMap(h=>h.assignedUserIds||[])).size,v=p.map(h=>h.priority).filter(Boolean),b=new Set(p.flatMap(h=>h.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:b}},[p]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,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:g("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:u.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),o?.(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:[u.uniqueAssignees," assignees"]})]}),u.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:[u.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:p.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:p.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var zf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ci(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 Ti(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 Gf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Vf({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:i}){let c=useMemo(()=>({...zf,...o}),[o]),[l,p]=useState(new Set),u=useRef(null),d=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],C=y.get(w);C?C.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((C,P)=>P.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{p(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},b=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),O=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:O<7?`${O}d ago`:y.toLocaleDateString()},h=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&u.current){let y=u.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[Ti(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),h>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsx("div",{className:"history-timeline-container",ref:u,children:d.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((x,w)=>{let C=l.has(x.id),P=s===x.id,O=Gf(x.type);return jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:O},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Ti(x.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:O}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:Ci(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?b(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),v(x.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([T,D])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},T)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([T,D])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},T))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function _f({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],u=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:u&&Ti(u.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:u&&Ci(u)}),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:u&&u.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:m=>i(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>i(f),title:Ci(m)},m.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:n,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:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:p.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),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:u&&u.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(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ku(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Cu(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 Kf(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 qf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function c2(e,t,a,r,n,s=100){let o=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;o.forEach(p=>{let u=a/2,d=r/2;p.vx+=(u-p.x)*n.centerForce*l,p.vy+=(d-p.y)*n.centerForce*l,o.forEach(m=>{if(p.id===m.id)return;let f=p.x-m.x,v=p.y-m.y,b=Math.sqrt(f*f+v*v)||1,h=n.chargeStrength*l/(b*b);p.vx+=f/b*h,p.vy+=v/b*h;});}),t.forEach(p=>{let u=i.get(typeof p.source=="string"?p.source:p.source.id),d=i.get(typeof p.target=="string"?p.target:p.target.id);if(!u||!d)return;let m=d.x-u.x,f=d.y-u.y,v=Math.sqrt(m*m+f*f)||1,b=(v-n.linkDistance)/v*n.forceStrength*l;u.vx+=m*b,u.vy+=f*b,d.vx-=m*b,d.vy-=f*b;}),o.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,p.x)),p.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return o}function Yf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:i,className:c}){let l=useRef(null),[p,u]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[b,h]=useState(null),[y,x]=useState(1),[w,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let $=c2(e,t,a.width,a.height,a,150);u($);},[e,t,a]);let P=useCallback(($,Y)=>{a.enableDragging&&(Y.stopPropagation(),m($));},[a.enableDragging]),O=useCallback($=>{if(!d||!l.current)return;let A=l.current.getBoundingClientRect(),Se=($.clientX-A.left-w.x)/y,W=($.clientY-A.top-w.y)/y;u(Ce=>Ce.map(R=>R.id===d?{...R,x:Se,y:W,fx:Se,fy:W}:R));},[d,y,w]),T=useCallback(()=>{m(null);},[]),D=useCallback(($,Y)=>{Y.stopPropagation(),i?.({type:"node-click",node:$,position:{x:Y.clientX,y:Y.clientY}});},[i]),M=useCallback(($,Y)=>{Y.stopPropagation(),i?.({type:"edge-click",edge:$,position:{x:Y.clientX,y:Y.clientY}});},[i]),N=useCallback($=>{let Y=p.find(A=>A.id===$);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[p]),z=useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Y=$.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:g("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.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:o.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:()=>x($=>Math.min($+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.max($-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ku($)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Kf($)," ",Cu($)]})]},$))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:O,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let Y=N(typeof $.source=="string"?$.source:$.source.id),A=N(typeof $.target=="string"?$.target:$.target.id),Se=qf($.type),W=b===$.id,Ce=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>h($.id),onMouseLeave:()=>h(null),onClick:R=>M($,R),children:[jsx("line",{x1:Y.x,y1:Y.y,x2:A.x,y2:A.y,stroke:ku($.type),strokeWidth:Ce?a.edgeWidth*2:a.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Se?"url(#arrowhead)":void 0}),a.showEdgeLabels&&W&&jsx("text",{x:(Y.x+A.x)/2,y:(Y.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Cu($.type)})]},$.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let Y=f===$.id,A=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",Y&&"hovered",A&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Se=>P($.id,Se),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:Se=>D($,Se),children:[jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:z($),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:Y?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Qf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[i,c]=useState(false),[l,p]=useState(null),[u,d]=useState(null),m=useRef(null),f=i||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{f||(o(""),p(null),d(null),t());},b=async()=>{if(!(!s.trim()||f)){c(true),p(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{u&&(a(u),v());};return e?jsxs(ga,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),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:y=>y.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-[#00E5CC]",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:v,disabled:f,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:u?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!"})]}),u.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:u.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",u.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:u.columns.map((y,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",u.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[u.cards.slice(0,10).map((y,x)=>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:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},x)),u.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",u.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:m,value:s,onChange:y=>o(y.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-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,x)=>jsx("button",{onClick:()=>o(y),disabled:f,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:y},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:v,disabled:f,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"}),u?jsx("button",{onClick:h,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:b,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Tu={"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 u2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},p2={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 m2(e,t,a){let r=Tu[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function Ni(e){return `$${e.toFixed(4)}`}var Nu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=m2(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(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(u=>u.timestamp>=t.start&&u.timestamp<=t.end));let r=a.length,n=a.reduce((u,d)=>u+d.cost,0),s=a.reduce((u,d)=>u+d.inputTokens,0),o=a.reduce((u,d)=>u+d.outputTokens,0),i=a.filter(u=>u.success),c=a.reduce((u,d)=>u+d.duration,0),l={},p={};return a.forEach(u=>{l[u.feature]=(l[u.feature]||0)+1,p[u.feature]=(p[u.feature]||0)+u.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let i=this.operations.filter(p=>p.timestamp>=o).length,c=Math.max(0,n-i),l=i/n*100;return {used:i,limit:n,remaining:c,percentUsed:l,isExceeded:i>=n}}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)}},qo=new Nu;function tb({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(qo.getStats()),[s,o]=useState(qo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(qo.getStats()),o(qo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=qo.getRecentOperations(5);return jsxs(ga,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/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:Ni(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-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,u=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(p)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${u}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function nb({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,i]=useState(""),[c,l]=useState(""),[p,u]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[b,h]=useState(null),[y,x]=useState(null),w=useRef(null),C=d||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let M=N=>{N.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,C]);let P=()=>{C||(i(""),l(""),u(""),v(null),h(null),x(null),t());},O=async()=>{if(!(!o.trim()||C)){m(true),v(null),h(null),x(null);try{let M=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});h(M.tasks.tasks),x({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){v(M instanceof Error?M.message:"Failed to generate tasks");}finally{m(false);}}},T=()=>{b&&(a(b),P());};if(!e)return null;let D=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(ga,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:P}),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:[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-[#00E5CC]",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:P,disabled:C,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:b?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:[y?.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"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",D,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[b.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((M,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:M.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"})]}),M.start," \u2192 ",M.end]}),jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:M.priority})]})},M.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:o,onChange:M=>i(M.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-[#00E5CC]/50 transition-all resize-none",disabled:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:M=>l(M.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-[#00E5CC]/50 transition-all",disabled:C})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:p,onChange:M=>u(M.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-[#00E5CC]/50 transition-all",disabled:C})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((M,N)=>jsx("button",{onClick:()=>i(M),disabled:C,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:M},N))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:P,disabled:C,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"}),b?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:O,disabled:!o.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function oc({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(b=>{t&&Hi(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),s=useCallback(async(b,h,y)=>{r(x=>{let w=x.cards.find(M=>M.id===b);if(!w)return x;let C=w.columnId,P={...w,columnId:h,position:y},O=x.cards.map(M=>M.id===b?P:M),T=x.columns.map(M=>{if(M.id===C)return {...M,cardIds:M.cardIds.filter(N=>N!==b)};if(M.id===h){let N=O.filter(z=>z.columnId===h).sort((z,$)=>z.position-$.position);return {...M,cardIds:N.map(z=>z.id)}}return M}),D={...x,cards:O,columns:T};return n(D),D});},[n]),o=useCallback(async(b,h)=>{r(y=>{let x=y.cards.map(C=>C.id===b?{...C,...h}:C),w={...y,cards:x};return n(w),w});},[n]),i=useCallback(async b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h},w=y.columns.map(P=>P.id===b.columnId?{...P,cardIds:[...P.cardIds,h]}:P),C={...y,cards:[...y.cards,x],columns:w};return n(C),C});},[n]),c=useCallback(async b=>{r(h=>{let y=h.cards.find(P=>P.id===b);if(!y)return h;let x=h.cards.filter(P=>P.id!==b),w=h.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter(O=>O!==b)}:P),C={...h,cards:x,columns:w};return n(C),C});},[n]),l=useCallback(async b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),p=useCallback(async(b,h)=>{r(y=>{let x=y.columns.map(C=>C.id===b?{...C,...h}:C),w={...y,columns:x};return n(w),w});},[n]),u=useCallback(async b=>{r(h=>{let y=h.cards.filter(C=>C.columnId!==b),x=h.columns.filter(C=>C.id!==b),w={...h,cards:y,columns:x};return n(w),w});},[n]),d=useCallback(b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(b),h},[i]),m=useCallback(b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),h},[l]),f=useCallback(()=>{r(b=>{let h={...b,cards:[],columns:[]};return n(h),h});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:u},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:u,clearBoard:f}}}function sb({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=oc({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(u=>u.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(u=>u.position)):0;s.addColumn({title:c,position:l??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var Di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},lb={by:"none",order:"asc"};function cb({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...Di,...e}),[s,o]=useState({...lb,...t}),i=useCallback(v=>{n(b=>({...b,...v}));},[]),c=useCallback(v=>{o(b=>({...b,...v}));},[]),l=useCallback(()=>{n(Di),o(lb);},[]),p=useCallback(()=>{a&&n({...Di,assignees:[a]});},[a]),u=useCallback(()=>{n({...Di,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...Di,priorities:["HIGH","URGENT"]});},[]),m=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]),f=useCallback(v=>{let b=[...v];if(r.search){let h=r.search.toLowerCase();b=b.filter(y=>y.title.toLowerCase().includes(h)||y.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,y=h.getFullYear(),x=String(h.getMonth()+1).padStart(2,"0"),w=String(h.getDate()).padStart(2,"0"),C=`${y}-${x}-${w}`;b=b.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let O=P.endDate||P.dueDate;if(!O)return false;let T;if(typeof O=="string")T=O.split("T")[0]||O;else {let D=O.getUTCFullYear(),M=String(O.getUTCMonth()+1).padStart(2,"0"),N=String(O.getUTCDate()).padStart(2,"0");T=`${D}-${M}-${N}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let D=new Date(C+"T00:00:00"),M=new Date(T+"T00:00:00"),N=new Date(D);return N.setDate(N.getDate()+7),M>=D&&M<=N;case "custom":if(r.dateRange){let z=typeof O=="string"?new Date(O):O;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(b=b.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(b=b.filter(h=>h.labels&&h.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(b=b.filter(h=>r.columns.includes(h.columnId))),s.by!=="none"&&b.sort((h,y)=>{let x=0;switch(s.by){case "created":let w=h.createdAt?new Date(h.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;x=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},O=P[h.priority||"LOW"],T=P[y.priority||"LOW"];x=O-T;break;case "dueDate":let D=h.endDate||h.dueDate,M=y.endDate||y.dueDate;if(!D)return 1;if(!M)return -1;let N=typeof D=="string"?new Date(D).getTime():D.getTime(),z=typeof M=="string"?new Date(M).getTime():M.getTime();x=N-z;break;case "title":x=h.title.localeCompare(y.title);break;case "estimate":let $=h.estimatedTime||0,Y=y.estimatedTime||0;x=$-Y;break;default:x=0;}return s.order==="asc"?x:-x}),b},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:u,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var ub,pb;if(typeof window<"u")try{let e=Bi("ai");ub=e.generateObject,pb=e.generateText;}catch{}function mb(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(ub&&pb&&e.apiKey),o=useCallback(async u=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",u),{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: ${u}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{a(false);}},[s]),i=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",u.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{a(false);}},[s]),c=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(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(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{a(false);}},[s]),l=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",u.title),[{title:`Subtask 1 for: ${u.title}`,position:u.position+.1,columnId:u.columnId},{title:`Subtask 2 for: ${u.title}`,position:u.position+.2,columnId:u.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{a(false);}},[s]),p=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",u.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Su(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function gb(e){let{cards:t}=e,[a,r]=Su(),n=useCallback(u=>a.selectedCardIds.includes(u),[a.selectedCardIds]),s=useCallback((u,d)=>{if(!d){r({selectedCardIds:[u],lastSelectedCardId:u});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(u)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==u),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,u],lastSelectedCardId:u});else if(f&&a.lastSelectedCardId){let v=t.find(h=>h.id===u),b=t.find(h=>h.id===a.lastSelectedCardId);if(v&&b&&v.columnId===b.columnId){let h=t.filter(T=>T.columnId===v.columnId).sort((T,D)=>T.position-D.position),y=h.findIndex(T=>T.id===a.lastSelectedCardId),x=h.findIndex(T=>T.id===u),[w,C]=y<x?[y,x]:[x,y],P=h.slice(w,C+1).map(T=>T.id),O=Array.from(new Set([...a.selectedCardIds,...P]));r({selectedCardIds:O,lastSelectedCardId:u});}else r({selectedCardIds:[u],lastSelectedCardId:u});}else r({selectedCardIds:[u],lastSelectedCardId:u});},[t,a,r]),o=useCallback(u=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==u),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(u=>u.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(u=>{a.selectedCardIds.includes(u)?o(u):r({selectedCardIds:[...a.selectedCardIds,u],lastSelectedCardId:u});},[a,o,r]),p=useCallback(()=>t.filter(u=>a.selectedCardIds.includes(u.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var fb={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function bb(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...fb,...a}),[a]),[s,o]=useState([]),i=useCallback((v,b,h,y,x)=>{if(b.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:b,columnId:h,strategy:y,color:x,isExpanded:true,position:s.filter(C=>C.columnId===h).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(b=>b.filter(h=>h.id!==v));},[]),l=useCallback(v=>{o(b=>b.map(h=>h.id===v?{...h,isExpanded:!h.isExpanded}:h));},[]),p=useCallback((v,b)=>{o(h=>h.map(y=>y.id===v&&!y.cardIds.includes(b)?{...y,cardIds:[...y.cardIds,b]}:y));},[]),u=useCallback((v,b)=>{o(h=>h.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==b);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(b=>b.columnId===v).sort((b,h)=>b.position-h.position),[s]),m=useCallback(async v=>{let b=t.filter(C=>C.columnId===v);if(b.length<n.minCardsPerStack*2)return [];let h=[],y=new Map;b.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(P=>{y.has(P)||y.set(P,[]),y.get(P).push(C);});}),y.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map(O=>O.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let x=new Map;b.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{x.has(P)||x.set(P,[]),x.get(P).push(C);});}),x.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map(O=>O.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(b.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,P)=>{if(C.length>=n.minCardsPerStack){let O={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";h.push({stack:{title:`${O} ${P} Priority`,cardIds:C.map(T=>T.id),columnId:v,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let C of b){let O=(await r.findSimilar(C,b)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(O.length>=n.minCardsPerStack-1){let T=[C.id,...O.map(M=>M.card.id)],D=O.reduce((M,N)=>M+N.similarity,0)/O.length;h.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${O.length+1} similar tasks`,confidence:D});}}return h.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{i(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[i]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let h=await m(b),y=h[0];h.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:u,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var hb=createContext(null);function yb({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:l}=Bi("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Bi("@libxai/core");o.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Bi("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(hb.Provider,{value:{store:n},children:e})}function sc(){let e=useContext(hb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ei(){let e=sc(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let i=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),l=useCallback((y,x)=>{e.updateColumn(y,x);},[e]),p=useCallback(y=>{e.deleteColumn(y);},[e]),u=useCallback(y=>e.getColumn(y),[e]),d=useCallback(y=>{e.addCard(y);},[e]),m=useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),v=useCallback((y,x,w)=>{e.moveCard(y,x,w);},[e]),b=useCallback(y=>e.getCard(y),[e]),h=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:u,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:b,getCardsByColumn:h}}function vb(e){let{cards:t}=Ei();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!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(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function wb(e="position",t="asc"){let{cards:a}=Ei();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?i[n.priority]:0,l=s.priority?i[s.priority]:0;o=c-l;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var ic=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=np.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 n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let i=await Promise.resolve(o.apply(s,a));i!==void 0&&(n=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},P2=new ic;function Cb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:i=0,getItemKey:c}){let l=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:i}),u=p.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:d,className:n,children:jsx("div",{style:m,children:u.map(f=>{let v=e[f.index];if(!v)return null;let b=c?c(v,f.index):f.index,h={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:h,"data-index":f.index,children:r(v,f.index)},b)})})})}function Tb(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 Db({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=useRef(null),u=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:o,gap:i}),d=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${u.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:p,style:m,className:s,children:jsx("div",{style:f,children:d.map(v=>{let b=e[v.index];if(!b)return null;let h=c?c(b,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:y,"data-index":v.index,children:n(b,v.index)},h)})})})}function Sb(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 Eb(e,t=10){return e>t}var Fu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Au={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Iu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ru={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Bu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$u={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ou={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)"},Hu={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)"},Uu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wu={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}},zu={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}},lc={spacing:Fu,borderRadius:Lu,fontSize:Au,fontWeight:Iu,lineHeight:Ru,zIndex:Bu,duration:$u,easing:Ou,shadows:Hu,opacity:Uu,kanban:Wu,gantt:zu};function Mb(e,t,a){return e[t]??a}function Gu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Gu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function A2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vu(e="asakaa"){let t=Gu(lc),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=A2(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function m0(e){let t=[],a=n=>{for(let r of n)t.push(r),r.subtasks?.length&&a(r.subtasks);};return a(e),t}function Mo(e,t){let a=m0(e),n=t.toLowerCase().trim(),r=a.find(i=>i.name.toLowerCase()===n);if(r)return r;let s=a.find(i=>i.name.toLowerCase().includes(n));if(s)return s;let o=n.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return o.every(l=>c.includes(l))})}function Ou(e,t=new Date){let a=e.toLowerCase().trim(),n=new Date(t);if(n.setHours(0,0,0,0),a==="today"||a==="hoy")return n;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(n);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(n);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(n);return d.setDate(d.getDate()+7),d}let r=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(r){let m={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}[r[1].toLowerCase()];if(m!==void 0){let f=new Date(n),v=f.getDay(),b=m-v;return b<=0&&(b+=7),f.setDate(f.getDate()+b),f}}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 d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(n);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let d=parseInt(i[1],10),m=parseInt(i[2],10)-1,f=parseInt(i[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),m=c[l[2].toLowerCase()],f=l[3]?parseInt(l[3],10):n.getFullYear();if(m!==void 0)return new Date(f,m,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let d=u[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):n.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function Hu(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 n=parseInt(a[1],10),r=a[2].toLowerCase();if(r==="day"||r==="d\xEDa"||r==="dias")return n;if(r==="week"||r==="semana"||r==="semanas")return n*7;if(r==="month"||r==="mes"||r==="meses")return n*30}return null}function Wu(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 g0(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 f0(e,t){let a=e.toLowerCase().trim(),n=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),u=n[2].trim(),p=Mo(t,l),d=Ou(u);if(!p)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:d,endDate:f},message:`Moved "${p.name}" to ${d.toLocaleDateString()}.`,success:true}}let r=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),u=r[2].trim(),p=Mo(t,l),d=Hu(u);if(!p)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),u=s[2].trim(),p=Mo(t,l),d=Wu(u);return p?d===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:d},message:`Set "${p.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),u=o[2].trim(),p=Mo(t,l);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),u=i[2].trim(),p=Mo(t,l),d=Mo(t,u);return p?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:p.id,dependencyTo:d.id,message:`Linked "${p.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),u=Mo(t,l);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function b0(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 pC(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 mC(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Mc(e,t=[],a=[]){let n=e.assignedUserIds?.map(u=>{let p=a.find(d=>d.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),r=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Mc(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},i=o(e.startDate),c=o(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:pC(e.metadata?.status),assignees:n?.length?n:void 0,dependencies:s?.length?s:void 0,subtasks:r?.length?r:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function h0(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(n=>t.find(s=>s.name===n.name||s.initials===n.initials)?.id).filter(n=>n!==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:mC(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function y0(e,t=[]){return e.filter(n=>!n.metadata?.parentCardId).map(n=>Mc(n,e,t))}function zu(e){return e.minWidth!=null?e.minWidth:e.type==="name"?Math.min(e.width,220):e.width}function x0(e,t){return e.reduce((a,n)=>a+zu(n),0)+t}var Uu={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",costBar:"Cost (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To do",inProgress:"In progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},ju={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",costBar:"Costo (Ejecutado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por hacer",inProgress:"En progreso",completed:"Completada"},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"}},Pc={en:Uu,es:ju};function Vu(e){return Pc[e]||Pc.en}function Fc(e,t){let a=Vu(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 Gu=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function v0(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 w0({value:e,onChange:t,isDark:a,translations:n,disabled:r=false}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=v0(e),l=Gu[0],u=Gu.find(m=>m.value===c)??l,p=u.icon,d=m=>{switch(v0(m)){case "completed":return n.completed;case "in-progress":return n.inProgress;default:return n.todo}};return r||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gu.map(m=>{let f=m.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function as(e,t,a=320){let[n,r]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,i=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;r(!i&&c);},[t,a,e]),n}var _u=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function C0({value:e="none",onChange:t,isDark:a,locale:n,disabled:r=false}){let[s,o]=useState(false),i=useRef(null),c=as(i,s,180);useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=_u.find(p=>p.value===e)??_u[4],u=n==="es"?"es":"en";return r||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[u]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[u]}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:_u.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function nl(e){return ma(e)}function Ku(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],a=0;for(let n=0;n<e.length;n++)a=e.charCodeAt(n)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-[#00E5CC]"}function Ic({value:e=[],availableUsers:t=[],onChange:a,isDark:n,locale:r,disabled:s=false}){let[o,i]=useState(false),[c,l]=useState(""),u=useRef(null),p=useRef(null),d=as(u,o);useEffect(()=>{let b=w=>{u.current&&!u.current.contains(w.target)&&(i(false),l(""));};return o&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),f=b=>e.some(w=>w.name===b),v=b=>{if(a){if(f(b.name))a(e.filter(w=>w.name!==b.name));else {let w={name:b.name,initials:nl(b.name),color:b.color||Ku(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,w]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:g("text-sm",n?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,w)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",n?"border-[#0D0D0D]":"border-white",!b.avatar&&Ku(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||nl(b.name)},`${b.name}-${w}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",n?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{type:"button","aria-label":e.length===0?r==="es"?"Asignar responsable":"Assign":r==="es"?`Responsables: ${e.map(b=>b.name).join(", ")}`:`Assignees: ${e.map(b=>b.name).join(", ")}`,onClick:b=>{b.stopPropagation(),i(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",n?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",n?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,w)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",n?"border-[#0D0D0D]":"border-white",!b.avatar&&Ku(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||nl(b.name)},`${b.name}-${w}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",n?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),style:{width:260,backgroundColor:n?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${n?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:n?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${n?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:n?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:p,type:"text",value:c,onChange:b=>l(b.target.value),placeholder:r==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:n?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${n?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,w)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:n?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(n?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||nl(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(x=>x.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${b.name}-${w}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:"var(--pj-texto-tenue, #5b6270)",textAlign:"center"},children:r==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let w=f(b.name);return jsxs("button",{onClick:h=>{h.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:w?n?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:n?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:h=>{w||(h.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:h=>{w||(h.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):nl(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),w&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}var ui=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function S0(e,t){let a=t.locale==="es",n=r=>r.toLocaleDateString(a?"es-ES":"en-US",{day:"numeric",month:"short"});return t.minimo&&ui(e)<ui(t.minimo)?a?`Antes del inicio del proyecto (${n(t.minimo)})`:`Before the project start (${n(t.minimo)})`:t.campo==="end"&&t.inicio&&ui(e)<ui(t.inicio)?a?`El fin no puede ser anterior al inicio (${n(t.inicio)})`:`The end can't be before the start (${n(t.inicio)})`:t.campo==="start"&&t.fin&&ui(e)>ui(t.fin)?a?`El inicio no puede ser posterior al fin (${n(t.fin)})`:`The start can't be after the end (${n(t.fin)})`:null}function P0({startDate:e,endDate:t,onChange:a,singleDateMode:n=false,singleDateField:r="end",isDark:s,locale:o,disabled:i=false,placeholder:c,minDate:l}){let[u,p]=useState(false),[d,m]=useState(r),[f,v]=useState(()=>{let W=r==="start"?e:t;if(W){let E=W instanceof Date?W:new Date(W);return new Date(E.getFullYear(),E.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),w=useRef(null),h=useRef(null),[x,y]=useState(null),k=e?e instanceof Date?e:new Date(e):null,M=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let W=E=>{let Pe=E.target;b.current&&b.current.contains(Pe)||h.current&&h.current.contains(Pe)||p(false);};return u&&document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[u]),useLayoutEffect(()=>{if(!u){y(null);return}let W=()=>{let E=w.current?.getBoundingClientRect();if(!E)return;let Pe=520,J=360,de=window.innerHeight-E.bottom,R=de<J&&E.top>de,Ae=R?E.top-4:E.bottom+4,nt=Math.min(Math.max(E.left,8),window.innerWidth-Pe-8);y({top:Ae,left:nt,flipUp:R});};return W(),window.addEventListener("scroll",W,true),window.addEventListener("resize",W),()=>{window.removeEventListener("scroll",W,true),window.removeEventListener("resize",W);}},[u]),useEffect(()=>{u&&m(n?r:"start");},[u,n,r]);let z=W=>W?Jn(W,o==="es"?"es":"en"):c||"-",L=useCallback(()=>{let W=f.getFullYear(),E=f.getMonth(),Pe=new Date(W,E,1),de=new Date(W,E+1,0).getDate(),R=Pe.getDay(),Ae=[],Ge=new Date(W,E,0).getDate();for(let ce=R-1;ce>=0;ce--)Ae.push({date:new Date(W,E-1,Ge-ce),isCurrentMonth:false});for(let ce=1;ce<=de;ce++)Ae.push({date:new Date(W,E,ce),isCurrentMonth:true});let B=42-Ae.length;for(let ce=1;ce<=B;ce++)Ae.push({date:new Date(W,E+1,ce),isCurrentMonth:false});return Ae},[f]),N=l?l instanceof Date?l:new Date(l):null,D=W=>S0(W,{campo:n?r:d,inicio:k,fin:M,minimo:N,locale:o}),S=W=>{if(!D(W))if(n)r==="start"?a(W,M||void 0):a(k||void 0,W),p(false);else if(d==="start"){let E=M&&W>M?W:M;a(W,E||void 0),m("end");}else {let E=k&&W<k?W:k;a(E||void 0,W),p(false);}},V=()=>{let W=new Date,E=new Date(W);E.setDate(W.getDate()+1);let Pe=new Date(W);Pe.setDate(W.getDate()+((6-W.getDay()+7)%7||7));let J=new Date(W);J.setDate(W.getDate()+((1-W.getDay()+7)%7||7));let de=new Date(W);de.setDate(W.getDate()+(6-W.getDay()+7)%7+7);let R=new Date(W);R.setDate(W.getDate()+14);let Ae=new Date(W);return Ae.setDate(W.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:E,display:E.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:Pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:J,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:de,display:Jn(de,o==="es"?"es":"en")},{label:o==="es"?"2 semanas":"2 weeks",date:R,display:Jn(R,o==="es"?"es":"en")},{label:o==="es"?"4 semanas":"4 weeks",date:Ae,display:Jn(Ae,o==="es"?"es":"en")}]};if(i){let W=n&&r==="start"?k:M;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:z(W)})]})}let U=n&&r==="start"?k:M;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:w,onClick:W=>{W.stopPropagation(),p(!u);let E=r==="start"?k:M;E&&v(new Date(E.getFullYear(),E.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:z(U)})]}),u&&x&&createPortal(jsxs("div",{ref:h,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:x.flipUp?void 0:x.top,bottom:x.flipUp?window.innerHeight-x.top:void 0,left:x.left,zIndex:10001},onClick:W=>W.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[V().map((W,E)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>S(W.date),disabled:!!D(W.date),title:D(W.date)??void 0,style:D(W.date)?{opacity:.35,cursor:"not-allowed"}:void 0,children:[jsx("span",{children:W.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:W.display})]},E)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{n?r==="start"?a(void 0,M||void 0):a(k||void 0,void 0):a(void 0,void 0),p(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!n&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="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:g("font-medium",s?"text-white":"text-gray-900"),children:f.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>v(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(W=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:W},W))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:L().map((W,E)=>{let Pe=W.date.toDateString()===new Date().toDateString(),J=k?.toDateString()===W.date.toDateString(),de=M?.toDateString()===W.date.toDateString(),R=J||de,Ae=!n&&k&&M&&W.date>=k&&W.date<=M;return jsx("button",{onClick:()=>S(new Date(W.date)),disabled:!!D(W.date),title:D(W.date)??void 0,style:D(W.date)?{opacity:.3,cursor:"not-allowed"}:void 0,className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!W.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),W.isCurrentMonth&&(s?"text-white":"text-gray-900"),Pe&&"ring-2 ring-[#00E5CC]",J&&"bg-[#00E5CC] text-white",de&&!J&&"bg-[#7C3AED] text-white",Ae&&!R&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:W.date.getDate()},E)})})]})]}),document.body)]})}function Bc({value:e,onChange:t,isDark:a,locale:n,disabled:r=false,dateField:s="end",startDate:o,endDate:i,minDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsx(P0,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:i||null,onChange:(m,f)=>{t&&t(s==="start"?m:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:n,disabled:r||!t,placeholder:"-",minDate:c})}function pi(e=600){let[t,a]=useState(false),n=useRef(null),r=useCallback(()=>{n.current&&clearTimeout(n.current),a(true),n.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{n.current&&clearTimeout(n.current);},[]),{isFlashing:t,triggerFlash:r}}function $c(e,t={}){let{enabled:a=true,duration:n=400,steps:r=8}=t,[s,o]=useState(e),[i,c]=useState(false),l=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===l.current||e===void 0){o(e),l.current=e;return}let p=l.current??0,d=e,m=d-p,f=n/r;c(true);for(let v=1;v<=r;v++){let b=setTimeout(()=>{let w=v/r,h=1-Math.pow(1-w,3),x=Math.round(p+m*h);o(x),v===r&&(c(false),o(d));},f*v);u.current.push(b);}return l.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,n,r]),{displayValue:s,isAnimating:i}}function F0(e,t={}){let{delay:a=1500,onCancel:n}=t,[r,s]=useState(null),[o,i]=useState(0),c=useRef(null),l=useRef(null),u=useCallback(m=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(m),i(0);let f=Date.now();l.current=setInterval(()=>{let v=Date.now()-f,b=Math.min(v/a*100,100);i(b);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(m),s(null),i(0);},a);},[a,e]),p=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),n?.();},[n]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:r,isPending:r!==null,progress:o,startChange:u,cancelChange:p}}function A0({value:e=0,onChange:t,isDark:a,disabled:n=false,enableSlotMachine:r=true,enableSaveFlash:s=true}){let[o,i]=useState(false),[c,l]=useState(""),u=useRef(null),{isFlashing:p,triggerFlash:d}=pi(),{displayValue:m,isAnimating:f}=$c(e,{enabled:r,duration:300,steps:6}),v=y=>{if(n||!t)return;y.stopPropagation();let k=y.currentTarget.getBoundingClientRect(),M=y.clientX-k.left,z=Math.round(M/k.width*100),L=Math.max(0,Math.min(100,z));L!==e&&(t(L),s&&d());},b=useCallback(y=>{n||!t||(y.stopPropagation(),l(String(e)),i(true));},[n,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let w=useCallback(()=>{i(false);let y=parseInt(c,10);if(!isNaN(y)&&t){let k=Math.max(0,Math.min(100,y));k!==e&&(t(k),s&&d());}},[c,t,e,s,d]),h=useCallback(y=>{y.key==="Enter"&&w(),y.key==="Escape"&&i(false);},[w]),x=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!n&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:y=>y.stopPropagation(),children:[jsx("input",{ref:u,value:c,onChange:y=>l(y.target.value.replace(/[^0-9]/g,"")),onBlur:w,onKeyDown:h,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:b,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!n&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!n&&t?"Click to edit":void 0,children:[x,"%"]})]})}function B0({value:e="",onChange:t,isDark:a,placeholder:n="-",disabled:r=false}){let[s,o]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{i!==e&&t?.(i),o(false);},p=d=>{d.key==="Enter"?u():d.key==="Escape"&&(c(e),o(false));};return r||!t?jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||n}):s?jsx("input",{ref:l,type:"text",value:i,onChange:d=>c(d.target.value),onBlur:u,onKeyDown:p,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:d=>{d.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||n})}function H0({value:e,onChange:t,isDark:a,placeholder:n="-",min:r,max:s,disabled:o=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,u]=useState(false),[p,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=pi(),{displayValue:b,isAnimating:w}=$c(e,{enabled:i&&!l});useEffect(()=>{l&&m.current&&(m.current.focus(),m.current.select());},[l]),useEffect(()=>{d(e?.toString()||"");},[e]);let h=()=>{let y=parseFloat(p);if(!isNaN(y)){let k=y;r!==void 0&&(k=Math.max(r,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&v());}u(false);},x=y=>{y.key==="Enter"?h():y.key==="Escape"&&(d(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",w&&"font-medium"),children:b!==void 0?b:n}):l?jsx("input",{ref:m,type:"number",value:p,onChange:y=>d(y.target.value),onBlur:h,onKeyDown:x,onClick:y=>y.stopPropagation(),min:r,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:y=>{y.stopPropagation(),u(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",b===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),w&&"font-medium scale-105"),children:b!==void 0?b:n})}function W0({value:e,options:t=[],onChange:a,isDark:n,placeholder:r="-",disabled:s=false}){let[o,i]=useState(false),c=useRef(null),l=as(c,o,220);return useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),s||!a?jsx("span",{className:g("text-sm",n?"text-white/60":"text-gray-500"),children:e||r}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),i(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",n?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",n?"text-white/60":"text-gray-500",!e&&(n?"text-white/30":"text-gray-400")),children:e||r}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",n?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(l?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",n?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",n?"text-white/30":"text-gray-400"),children:"No options"}):t.map(u=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(u),i(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:n?"text-white":"text-gray-900",children:u}),e===u&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function U0({value:e=false,onChange:t,isDark:a,disabled:n=false,enableDelayedConfirm:r=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:i,progress:c,startChange:l,cancelChange:u}=F0(t,{delay:s}),p=m=>{m.stopPropagation(),!n&&t&&(r?i?u():l(!e):t(!e));},d=i?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:p,disabled:n||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(n||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&d&&"ring-green-500/50",i&&!d&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:m=>{m.stopPropagation(),u();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function j0({value:e=[],options:t=[],onChange:a,isDark:n,placeholder:r="-",disabled:s=false,maxSelectable:o,maxVisible:i=2}){let[c,l]=useState(false),u=useRef(null),p=as(u,c,220);useEffect(()=>{let w=h=>{u.current&&!u.current.contains(h.target)&&l(false);};return c&&document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let d=e.slice(0,i),m=e.length-d.length,f=e.length===0?r:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsx("span",{className:g("text-sm truncate",n?"text-white/60":"text-gray-500"),children:f});let v=w=>{let h=e.includes(w),x=h?e.filter(y=>y!==w):[...e,w];!h&&o!=null&&e.length>=o||a(x);},b=o!=null&&e.length>=o;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:w=>{w.stopPropagation(),l(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",n?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",n?"text-white/60":"text-gray-500",e.length===0&&(n?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",n?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 left-0 "+(p?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",n?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",n?"text-white/30":"text-gray-400"),children:"No options"}):t.map(w=>{let h=e.includes(w),x=!h&&b;return jsxs("button",{disabled:x,onClick:y=>{y.stopPropagation(),v(w);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":n?"hover:bg-white/[0.05]":"hover:bg-gray-100",h&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:n?"text-white":"text-gray-900",children:w}),h&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},w)})})]})}function a2(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function _0({value:e,isDark:t,placeholder:a="-",onOpen:n}){let r=a2(e);if(r.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=r[0],o=r.length-1,i=o>0?`${s.name} +${o}`:s.name;return n?jsxs("button",{onClick:c=>{c.stopPropagation(),n(s);},title:r.map(c=>c.name).join(`
|
|
414
|
+
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:i})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),i]})}function Y0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let n=e.slice(0,a),r=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[n.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),r>0&&jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",r]})]})}function o2(e,t="en"){return e==null||e===0||!e||Number(e)===0?"-":hr(e,t==="es"?"es":"en")}function s2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let n=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(n&&n[1]){let i=parseFloat(n[1]),c=n[2]?parseInt(n[2],10):0;return Math.round(i*60)+c}let r=t.match(/^(\d+\.?\d*)\s*h$/);if(r&&r[1])return Math.round(parseFloat(r[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function gr({value:e,onChange:t,isDark:a,locale:n="en",placeholder:r,disabled:s=false,enableSaveFlash:o=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0,financialOverride:u,currencyCode:p}){let[d,m]=useState(false),[f,v]=useState(""),[b,w]=useState(null);useEffect(()=>{if(!b||d)return;let S=setTimeout(()=>w(null),4e3);return ()=>clearTimeout(S)},[b,d]);let h=useRef(null),{isFlashing:x,triggerFlash:y}=pi(),k=c==="financial"&&(l>0||u!=null),M=u??(e?e/60*l:0),z=k&&(u!=null?u>0:e)?nn(Math.round(M),p,n==="es"?"es":"en"):o2(e,n);useEffect(()=>{d&&h.current&&(h.current.focus(),h.current.select());},[d]),useEffect(()=>{if(e){let S=Math.floor(e/60),V=e%60;S>0&&V>0?v(`${S}h ${V}m`):S>0?v(`${S}h`):v(`${V}m`);}else v("");},[e,d]);let L=(S=true)=>{let V=s2(f);if(f.trim()!==""&&f.trim()!=="-"&&(V==null||V<0)){w(V!=null&&V<0?n==="es"?"No puede ser negativo: no se guard\xF3":"Can't be negative: not saved":n==="es"?`\xAB${f.trim()}\xBB no es una duraci\xF3n (usa 8, 2h 30m o 2:30): no se guard\xF3`:`"${f.trim()}" is not a duration (use 8, 2h 30m or 2:30): not saved`),S&&m(false);return}w(null),V!==e&&(t?.(V),o&&y()),m(false);},N=S=>{S.key==="Enter"?L(false):S.key==="Escape"&&m(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let D=k?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(D,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:z})]}):d?jsx("input",{ref:h,type:"text",value:f,onChange:S=>v(S.target.value),onBlur:()=>L(true),title:b??void 0,onKeyDown:N,onClick:S=>S.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400",b&&"!border-red-500")}):jsxs("button",{onClick:S=>{S.stopPropagation(),m(true);},title:b??void 0,className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"ring-1 ring-red-500 bg-red-500/10"),children:[e!=null&&e>0&&jsx(D,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:z})]})}function J0({startDate:e,endDate:t,scheduleVariance:a,isDark:n,locale:r="en",hasTimeAllocated:s=true,sinEmpezar:o=false}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",n?"text-white/30":"text-gray-400"),children:"-"});let i=l=>Jn(l,r==="es"?"es":"en"),c=()=>{if(a==null)return null;let l=r==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"var(--pj-texto-tenue, #5b6270)",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):a>0&&o?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"var(--pj-texto-tenue, #5b6270)",fontWeight:500},children:l?"Sin iniciar":"Not started"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",n?"text-white/60":"text-gray-500"),children:[e?i(e):"\u2014",jsx("span",{className:n?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?i(t):"\u2014"]}),c()]})}function ip({task:e,isDark:t,locale:a="en",onLogTime:n,onEstimateUpdate:r,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:i="hours",hourlyRate:c=0,currencyCode:l}){let u=a==="es",p=i==="financial"&&c>0,d=(de,R)=>p?nn(Math.round(de*c),l,u?"es":"en"):hr(R,u?"es":"en"),[m,f]=useState(false),[v,b]=useState(false),[w,h]=useState(null),x=useRef(null),y=e.timeLoggedMinutes||0,k=e.effortMinutes||0,M=e.soldEffortMinutes||0,z=Math.round(y/60*10)/10,L=Math.round(k/60*10)/10,N=k>0?y/k*100:0,D=N>100?Math.round((y-k)/60*10)/10:0,S=N>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!v&&!w)return;let de=R=>{x.current&&!x.current.contains(R.target)&&(b(false),h(null));};return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[v,w]);let V=de=>{if(de.stopPropagation(),n&&!r&&!s){h("log");return}if(n||r||s){b(R=>!R),h(null);return}o&&o(e);},U=de=>{b(false),h(de);},W=async(de,R)=>{w==="log"&&n&&de?n(e,de,R):w==="estimate"&&r?r(e,de):w==="quoted"&&s&&s(e,de),h(null);},E=n||r||s||o,Pe=[{mode:"log",icon:Clock,label:u?"Registrar tiempo":"Log time",show:!!n},{mode:"estimate",icon:Target,label:u?"Estimaci\xF3n":"Estimate",show:!!r},{mode:"quoted",icon:DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(de=>de.show),J=w==="estimate"?k:w==="quoted"?M:void 0;return k===0&&y===0&&M===0?jsxs("div",{ref:x,className:"relative flex items-center gap-2",onClick:de=>de.stopPropagation(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&E&&jsx("button",{onClick:V,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:de=>{de.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",de.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:de=>{de.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",de.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:Pe.map(de=>jsxs("button",{onClick:R=>{R.stopPropagation(),U(de.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:R=>{R.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:R=>{R.target.style.background="transparent";},children:[jsx(de.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),de.label]},de.mode))})}),jsx(AnimatePresence,{children:w&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(no,{mode:w,locale:a,isDark:t,currentValue:J||void 0,onSave:W,onClose:()=>h(null)})})})})]}):jsxs("div",{ref:x,className:"relative flex items-center gap-2 w-full",onClick:de=>de.stopPropagation(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let de=y===0,Ae=(k>0?y/k:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:de?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:d(z,y)}),k>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(L,k)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:Ae?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:Ae?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(D,y-k)," ",u?"Excedido":"Over"]})]})})(),k>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(N,100)}%`,backgroundColor:S,borderRadius:2,transition:"width 0.3s"}})})]}),E&&jsx("button",{onClick:V,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:de=>{de.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",de.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:de=>{de.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",de.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:Pe.map(de=>jsxs("button",{onClick:R=>{R.stopPropagation(),U(de.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:R=>{R.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:R=>{R.target.style.background="transparent";},children:[jsx(de.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),de.label]},de.mode))})}),jsx(AnimatePresence,{children:w&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(no,{mode:w,locale:a,isDark:t,currentValue:J||void 0,onSave:W,onClose:()=>h(null)})})})})]})}function m2(e){let t=new Map;function a(n){if(n.assignees)for(let r of n.assignees)r.name&&!t.has(r.name)&&t.set(r.name,r);if(n.subtasks)for(let r of n.subtasks)a(r);}return a(e),Array.from(t.values())}function g2(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Z0({assignee:e,size:t=28,isDark:a}){let n=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",r=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(n,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(n,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",r,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||ma(e.name)})}function eb({task:e,isDark:t,locale:a="en"}){let n=a==="es",r=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(r){let u=m2(e);if(u.length===0)return null;let p=u.slice(0,3),d=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsx(Z0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:n?"Sin asignar":"Unassigned"})]});let i=o?.percentage??0,c=!!o&&i>0,l=c?g2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Z0,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var f2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function ab({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((n,r)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",f2[n.severity]),children:[n.type," #",n.id]},`${n.type}-${n.id}-${r}`))})}function P2(e){return ma(e)}function F2(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let n=0;n<e.length;n++)a=e.charCodeAt(n)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function cb({state:e,onClose:t,isDark:a,locale:n,onTaskEdit:r,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:b}){let w=useRef(null),h=n==="es"?ob.es:ob.en,[x,y]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{y({left:e.x,top:e.y});let N=w.current;if(!N)return;let D=N.getBoundingClientRect(),S=8,V=e.x,U=e.y;e.y+D.height>window.innerHeight-S&&(U=Math.max(S,e.y-D.height)),e.x+D.width>window.innerWidth-S&&(V=Math.max(S,window.innerWidth-D.width-S)),(V!==e.x||U!==e.y)&&y({left:V,top:U});},[e.x,e.y,e.isOpen]),useEffect(()=>{let N=S=>{w.current&&!w.current.contains(S.target)&&t();},D=S=>{S.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",D);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return r&&N.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{r(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),i&&(N.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),N.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),u.length>0&&N.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(D=>({id:`assign-${D.id}`,label:D.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:ma(D.name)}),onClick:()=>{let S=e.task.assignees||[],U=S.some(W=>W.name===D.name)?S.filter(W=>W.name!==D.name):[...S,{name:D.name,initials:P2(D.name),color:D.color||F2(D.name),avatar:D.avatarUrl}];i({...e.task,assignees:U}),t();}}))})),p&&N.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),N.push({id:"sep2",label:"",icon:null,separator:true}),s&&N.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||b)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),b&&N.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{b(e.task.id),t();}})),o&&N.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),N},M=()=>{if(!e.columnId)return [];let N=[];return l&&(N.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),N.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},z=e.type==="task"?k():M(),L={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:w,style:L,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:z.map(N=>N.separator?jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsx(L2,{item:N,isDark:a},N.id):jsxs("button",{onClick:N.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",N.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:g(N.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function L2({item:e,isDark:t}){let[a,n]=useState(false),r=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{r.current&&clearTimeout(r.current),n(true);},onMouseLeave:()=>{r.current=setTimeout(()=>n(false),150);},children:[jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var ob={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Por hacer",inProgress:"En progreso",completed:"Completada",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var yb={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),costBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},q2=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function vb({isOpen:e,onClose:t,columns:a,customFields:n=[],onColumnsChange:r,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:i,locale:c}){let[l,u]=useState(""),[p,d]=useState(null),[m,f]=useState(null),v=useRef(null),b=c==="es"?xb.es:xb.en;useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let D=v.current.parentElement;if(D){let W=D.getBoundingClientRect();f({top:W.bottom+4,right:window.innerWidth-W.right});}let S=v.current.getBoundingClientRect(),U=window.innerHeight-S.top-20;d(Math.max(300,U));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let D=V=>{v.current&&!v.current.contains(V.target)&&t();},S=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",D),document.addEventListener("keydown",S),v._cleanup=()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",S);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let w=useMemo(()=>{let N=new Set([...q2]);return a.forEach(D=>{D.type&&D.type!=="assignees"&&N.add(D.type);}),Array.from(N)},[a]);if(!e)return null;let h=N=>{let D=b.columns[N];if(D)return D;let S=a.find(V=>V.type===N);return S?.label?S.label:N},x=N=>{if(N==="name")return;let D=a.map(S=>S.id===N?{...S,visible:!S.visible}:S);r(D);},y=(N,D)=>{let S=a.find(U=>U.type===N&&(!D||U.customFieldId===D));if(S){x(S.id);return}let V={id:D||N,type:N,label:D?n.find(U=>U.id===D)?.name||N:h(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:D};r([...a,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=w.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&h(N).toLowerCase().includes(l.toLowerCase())),z=n.filter(N=>N.name.toLowerCase().includes(l.toLowerCase())),L=i?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:i?"#111114":"#FFFFFF",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:i?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:i?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:b.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=i?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:i?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:N=>u(N.target.value),placeholder:b.searchPlaceholder,style:{fontSize:12,background:i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:i?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:N=>{N&&N.style.setProperty("--focus-border",L);},onFocus:N=>{N.currentTarget.style.borderColor=L,N.currentTarget.style.background=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.currentTarget.style.background=i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:N=>N.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:b.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(N=>{let D=a.find(U=>U.type===N&&!U.customFieldId),S=D?.visible??false,V=N==="name";return jsxs("button",{onClick:()=>{V||(D?x(D.id):y(N));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:U=>{V||(U.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:U=>{U.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?L:"transparent",border:S?`1.5px solid ${L}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${L}40`:"none"},children:S&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:S?L:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:yb[N]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:S?500:400,color:S?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:h(N),children:h(N)})]},N)})})]}),z.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:b.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:z.map(N=>{let S=a.find(V=>V.customFieldId===N.id)?.visible??false;return jsxs("button",{onClick:()=>y(N.type,N.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?L:"transparent",border:S?`1.5px solid ${L}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${L}40`:"none"},children:S&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:S?L:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:yb[N.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:S?500:400,color:S?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:N.name})]},N.id)})})]})]})]})}var xb={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var n5=[{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 Cb({isOpen:e,onClose:t,onSave:a,isDark:n,locale:r}){let[s,o]=useState(""),[i,c]=useState("text"),[l,u]=useState([""]),p=r==="es"?kb.es:kb.en;useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),useEffect(()=>{let b=w=>{w.key==="Escape"&&t();};return e&&document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);let d=()=>{if(!s.trim())return;let b={name:s.trim(),type:i};i==="dropdown"&&(b.options=l.filter(w=>w.trim())),a(b),t();},m=()=>{u([...l,""]);},f=(b,w)=>{let h=[...l];h[b]=w,u(h);},v=b=>{l.length>1&&u(l.filter((w,h)=>h!==b));};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:g("relative w-full max-w-md rounded-xl shadow-2xl border",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",n?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",n?"text-white":"text-gray-900"),children:p.title}),jsx("button",{onClick:t,className:g("p-1 rounded",n?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",n?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",n?"text-white":"text-gray-900"),children:p.fieldName}),jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),placeholder:p.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",n?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",n?"text-white":"text-gray-900"),children:p.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:n5.map(b=>jsxs("button",{onClick:()=>c(b.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===b.type?"border-[#00E5CC] bg-[#00E5CC]/10":n?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===b.type?"text-[#00E5CC]":n?"text-white/60":"text-gray-400",children:b.icon}),jsx("span",{className:g("text-xs",i===b.type?"text-[#00E5CC]":n?"text-white/60":"text-gray-500"),children:p.types[b.type]})]},b.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",n?"text-white":"text-gray-900"),children:p.options}),jsxs("div",{className:"space-y-2",children:[l.map((b,w)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:b,onChange:h=>f(w,h.target.value),placeholder:`${p.option} ${w+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",n?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>v(w),className:g("p-2 rounded-lg transition-colors",n?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},w)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",n?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",n?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",n?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:p.cancel}),jsx("button",{onClick:d,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:p.create})]})]})]}):null}var kb={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 Nb={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To do",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En progreso",toDo:"Por hacer",hideCompleted:"Ocultar Tareas Completadas"}};function Sb({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:n,isDark:r,locale:s}){let[o,i]=useState(false),c=useRef(null),l=useRef(0),u=s==="es"?Nb.es:Nb.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-l.current<100||c.current&&!c.current.contains(v.target)&&i(false);},f=v=>{v.key==="Escape"&&i(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(l.current=Date.now()),i(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",r?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",d&&(r?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(r?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,d&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",r?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",r?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxs("button",{onClick:()=>{a(m.value),n(false),i(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",r?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",r?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let m=!t;n(m),m&&a("all"),i(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",r?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function Eb({data:e,isDark:t,locale:a="en",onClose:n,lens:r="hours",onUnassignedTaskClick:s,currencyCode:o}){let i=a==="es",c=r==="financial",l=i?"es":"en",u=m=>hr(m<=0?0:m,l),p=m=>nn(Math.round(m),o,l),d=m=>Xn(m,l);return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?i?"SALUD FINANCIERA":"FINANCIAL HEALTH":i?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),n&&jsx("button",{onClick:n,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:i?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),c&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let m=e.totalOffered??0,f=e.totalEstimated??0,v=e.totalExecuted??0,b=m-v,w=m>0?Math.round(b/m*100):0,h=m-f,x=m>0?Math.round(h/m*100):0,y=m>0?Math.min(Math.round(v/m*100),120):0,k=v>m&&m>0,M=k?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:i?"PRESUPUESTO":"BUDGET"}),e.avisoRevisar&&jsxs("div",{"data-revisar":true,className:"mb-3 rounded-md px-2 py-1.5 text-[11px] leading-snug",style:{color:"#D97706",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)"},children:[jsxs("span",{className:"font-semibold",children:["\u26A0 ",i?"revisar":"check"]})," \xB7 ",jsx("span",{className:t?"text-white/70":"text-gray-700",children:e.avisoRevisar})]}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:p(m)})]}),(()=>{let z=e.totalEstimatedLabor??0,L=e.totalEstimatedEquipment??0,N=e.totalEstimatedTravel??0,D=L>0||N>0,S=(V,U)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:V}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:p(U)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:p(f)})]}),D&&jsxs(Fragment,{children:[S(i?"Mano de obra":"Labor",z),L>0&&S(i?"Activos":"Equipment",L),N>0&&S(i?"Vi\xE1ticos":"Travel",N)]})]})})(),v>0&&(()=>{let z=e.totalExecutedLabor??0,L=e.totalExecutedEquipment??0,N=e.totalExecutedTravel??0,D=L>0||N>0,S=(V,U)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:V}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:p(U)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",k?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:p(v)})]}),D&&jsxs(Fragment,{children:[S(i?"Mano de obra":"Labor",z),L>0&&S(i?"Activos":"Equipment",L),N>0&&S(i?"Vi\xE1ticos":"Travel",N)]})]})})(),m>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(y,100)}%`,backgroundColor:M}})}),f>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",h>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:i?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[h>=0?"+":"",p(h),m>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",h>=0?"+":"",d(x),")"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:i?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[b>=0?`+${p(b)} ${i?"disponible (caja)":"available (cash)"}`:`${p(Math.abs(b))} ${i?"sobregirado":"overdrawn"}`,m>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d(w),")"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let m=e.totalHoursSpentMinutes??0,f=e.totalHoursAllocatedMinutes??0,v=f>0?Math.min(Math.round(m/f*100),100):0,h=(f>0?m/f:0)>1.1?"#F87171":v>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:i?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:u(m)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:u(f)})]}),f>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${v}%`,backgroundColor:h}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:i?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsx("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:d(e.submittalsApprovalPercent)})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:i?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?i?"tarea pendiente":"pending task":i?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:i?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(m=>jsxs("button",{onClick:()=>s?.(m.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:m.name})]},m.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:i?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let m=e.scheduleVarianceDays??0,f=m>0,v=m<0,b=e.scheduleVarianceLabel||(f?`+${m} ${i?"D\xEDas ADELANTE":"Days AHEAD"}`:v?`${m} ${i?"D\xEDas ATR\xC1S":"Days BEHIND"}`:i?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",f&&"bg-[#3BF06E]/15 text-[#3BF06E]",v&&"bg-[#F87171]/15 text-[#F87171]",!f&&!v&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:b})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:i?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((m,f)=>{let v=m.utilizationPercent>=100?"#F87171":m.utilizationPercent>=80?"#FFD60A":m.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:m.name}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:d(m.utilizationPercent)})]}),jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(m.utilizationPercent,100)}%`,backgroundColor:v}})})]},`${m.name}-${f}`)})})]})]})}var x5=[{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 Ab(e,t=0,a=[]){let n=[];for(let r of e){let s=[...a,r.id];n.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:s}),r.subtasks?.length&&r.isExpanded!==false&&n.push(...Ab(r.subtasks,t+1,s));}return n}function v5(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,n=0,r=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;n+=p,r++;}return r>0?n/r:null}function hi(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,n=0;for(let r of e.subtasks)if(r.subtasks?.length){let s=hi(r);t+=s.spent>0?s.spent:r.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:r.effortMinutes??0,n+=s.quoted>0?s.quoted:r.soldEffortMinutes??0;}else t+=r.timeLoggedMinutes??0,a+=r.effortMinutes??0,n+=r.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:n}}function bi(e,t="en"){return e<=0?hr(0,t):hr(e,t)}function Vc(e,t,a,n){return `${n?"+":""}${nn(e,t,a,{compacto:true})}`}function w5({value:e,onChange:t,isDark:a,idioma:n="en"}){let[r,s]=useState(false),[o,i]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:o,onClick:c=>c.stopPropagation(),onChange:c=>i(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(o);!isNaN(c)&&c>=0&&c<=100?t(c):o===""&&t(0),s(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(i(String(e||"")),s(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),i(String(e||"")),s(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?Xn(e,n,2):"\u2014"})}function Ib({tasks:e,config:t={},callbacks:a={},isLoading:n=false,error:r,className:s,style:o,availableUsers:i=[],customFields:c=[],toolbarRightContent:l,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:b=true,showHierarchy:w=true,tableColumns:h,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:y=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:z=true,showCreateTaskButton:L=false,onCreateTask:N,persistFilter:D=false,financialBlur:S,healthSidebar:V,lens:U="hours",hourlyRate:W=0,rateMap:E,aggregateParentHours:Pe=false,showProjectTotals:J=false,totalsDollarOverride:de,currencyCode:R}=t,Ae=f==="es"?"es":"en",nt=t.rowDensity==="compact",Ge=Fc(f,v),B=m==="dark",ce=C=>{if(!E||!C.assignees||C.assignees.length===0)return W;let G=0,ne=0;for(let ve of C.assignees){let je=ve.id?E[ve.id]:void 0;if(je==null||je<=0)continue;let se=typeof ve.estimatedMinutes=="number"?ve.estimatedMinutes:0;se>0&&(G+=je*se,ne+=se);}if(ne>0)return G/ne;let le=C.assignees.map(ve=>ve.id?E[ve.id]:void 0).filter(ve=>ve!=null&&ve>0);return le.length===0?W:le.reduce((ve,je)=>ve+je,0)/le.length},oe=C=>{let G=0,ne=0,le=0,ve=je=>{for(let se of je)if(se.subtasks&&se.subtasks.length>0){let Fe={s:G,a:ne,q:le};if(ve(se.subtasks),G-Fe.s+(ne-Fe.a)+(le-Fe.q)===0){let We=ce(se);G+=(se.timeLoggedMinutes??0)/60*We,ne+=(se.effortMinutes??0)/60*We,le+=(se.soldEffortMinutes??0)/60*We;}}else {let Fe=ce(se);G+=(se.timeLoggedMinutes??0)/60*Fe,ne+=(se.effortMinutes??0)/60*Fe,le+=(se.soldEffortMinutes??0)/60*Fe;}};return C.subtasks&&ve(C.subtasks),{dollarSpent:G,dollarAllocated:ne,dollarQuoted:le}},gt=useCallback(()=>{if(!D||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let C=localStorage.getItem(D);if(C){let G=JSON.parse(C);return {statusFilter:G.statusFilter||"all",hideCompleted:G.hideCompleted||!1}}}catch(C){console.error("Error loading persisted filter:",C);}return {statusFilter:"all",hideCompleted:false}},[D]),Je=useMemo(()=>{function C(G){let ne=0,le=0,ve=0,je=0,se=0,Fe=0;for(let Oe of G)if(Oe.subtasks&&Oe.subtasks.length>0){let We=C(Oe.subtasks);if(We.spent+We.allocated+We.quoted>0)ne+=We.spent,le+=We.allocated,ve+=We.quoted,je+=We.dollarSpent,se+=We.dollarAllocated,Fe+=We.dollarQuoted;else {let Ct=Oe.timeLoggedMinutes??0,St=Oe.effortMinutes??0,ea=Oe.soldEffortMinutes??0;ne+=Ct,le+=St,ve+=ea;let bt=ce(Oe);je+=Ct/60*bt,se+=St/60*bt,Fe+=ea/60*bt;}}else {let We=Oe.timeLoggedMinutes??0,Lt=Oe.effortMinutes??0,Ct=Oe.soldEffortMinutes??0;ne+=We,le+=Lt,ve+=Ct;let St=ce(Oe);je+=We/60*St,se+=Lt/60*St,Fe+=Ct/60*St;}return {spent:ne,allocated:le,quoted:ve,dollarSpent:je,dollarAllocated:se,dollarQuoted:Fe}}return C(e)},[e]),ct=useMemo(()=>{let C=new Map;function G(ne){let le=0;for(let ve of ne)if(ve.subtasks&&ve.subtasks.length>0){let je=G(ve.subtasks);C.set(ve.id,je),le+=je;}else le+=ve.weight||0;return le}return G(e),C},[e]),ft=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Je.spent,totalHoursAllocatedMinutes:Je.allocated}},[V,Je]),[ut,Rt]=useState(()=>typeof window>"u"||window.innerWidth>=1280),[lt,vt]=useState(null),[Mt,Pt]=useState("position"),[zt,Ne]=useState("asc"),[Ot,wt]=useState(""),[Ut,Ye]=useState(()=>gt().statusFilter),[qe,_]=useState(()=>gt().hideCompleted),[he,Z]=useState(h||x5),[ze,Me]=useState(false),[Ve,O]=useState(false),[xe,Be]=useState({isOpen:false,x:0,y:0,type:"task"}),[Qe,Ft]=useState(null),[Xe,Tt]=useState(false),[it,ba]=useState(null),[Jt,Ht]=useState(null),[we,Te]=useState(null),dt=useRef(0),ht=useRef(false),jt=!!(a.onTaskMove||a.onTaskReparent),[Dt,la]=useState(null),[ha,Ha]=useState(null),Zt=C=>{let G=C.type;return C.customFieldId?G==="file"?null:{kind:"customField",fieldId:C.customFieldId}:G==="assignees"||G==="teamLoad"?"assignees":G==="startDate"?"startDate":G==="endDate"?"endDate":null},Wa=(C,G)=>typeof C=="string"||typeof G=="string"?C===G:C.fieldId===G.fieldId,Va=useRef([]),xn=useCallback((C,G)=>{jt&&(G.preventDefault(),dt.current=G.clientY,Ft(C),ht.current=false,Tt(false),Te({x:G.clientX,y:G.clientY}));},[jt]),ia=useCallback(C=>{if(!Qe||(Math.abs(C.clientY-dt.current)>5&&!ht.current&&(ht.current=true,Tt(true)),Te({x:C.clientX,y:C.clientY}),!ht.current))return;let ne=document.querySelectorAll("[data-listview-row]"),le=null,ve=null;ne.forEach(je=>{let se=je.getBoundingClientRect(),Fe=je.getAttribute("data-listview-row");if(Fe&&Fe!==Qe&&C.clientY>=se.top&&C.clientY<=se.bottom){le=Fe;let Oe=C.clientY-se.top,We=se.height;ve=Oe<We*.25?"above":Oe>We*.75?"below":"child";}}),ba(le),Ht(ve);},[Qe]),vn=useCallback(()=>{if(ht.current&&Qe&&it&&Jt){if(Jt==="child"&&a.onTaskReparent)a.onTaskReparent(Qe,it);else if(Jt==="above"||Jt==="below"){let C=(le,ve,je=null)=>{for(let se of le){if(se.id===ve)return je;if(se.subtasks){let Fe=C(se.subtasks,ve,se.id);if(Fe!==void 0)return Fe}}},G=C(e,Qe,null),ne=C(e,it,null);if(a.onTaskReparent){let le=(We,Lt)=>{if(Lt===null)return We;for(let Ct of We){if(Ct.id===Lt)return Ct.subtasks||[];if(Ct.subtasks){let St=le(Ct.subtasks,Lt);if(St.length>0||Ct.subtasks.some(ea=>ea.id===Lt))return St}}return []},ve=le(e,ne??null),je=ve.findIndex(We=>We.id===it),se=G===ne,Fe=se?ve.findIndex(We=>We.id===Qe):-1,Oe=Jt==="below"?je+1:je;se&&Fe!==-1&&Fe<je&&(Oe-=1),a.onTaskReparent(Qe,ne??null,Math.max(0,Oe));}}}Ft(null),ba(null),Ht(null),Te(null),ht.current=false,Tt(false);},[Qe,it,Jt,e,a]),A=(C,G)=>typeof G!="string"?C.customFields?.find(le=>le.fieldId===G.fieldId)?.value:G==="assignees"?C.assignees:G==="startDate"?C.startDate:C.endDate,Y=(C,G,ne,le)=>{C.preventDefault(),C.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ve=Array.from(document.querySelectorAll("[data-listview-row]")),je=ve.map(At=>At.getAttribute("data-listview-row")||""),se=Math.max(0,je.indexOf(G)),Fe=At=>je.slice(se,At+1);Ha({sourceTaskId:G,column:ne,sourceIndex:le,targetIndex:le,rangeIds:new Set([G])});let We=(At=>{let It=At?.parentElement??null;for(;It;){let Qa=window.getComputedStyle(It).overflowY;if((Qa==="auto"||Qa==="scroll")&&It.scrollHeight>It.clientHeight)return It;It=It.parentElement;}let ca=document.scrollingElement;return ca&&ca.scrollHeight>ca.clientHeight?ca:null})(C.currentTarget),Lt=At=>{let It=se,ca=false;ve.forEach((Qa,fr)=>{let zn=Qa.getBoundingClientRect();At>=zn.top&&At<=zn.bottom&&(It=fr,ca=true);});let ua=ve[ve.length-1];if(!ca&&ua){let Qa=ua.getBoundingClientRect();At>Qa.bottom&&(It=ve.length-1);}return It<se&&(It=se),It},Ct=C.clientY,St=null,ea=()=>{St!==null&&(cancelAnimationFrame(St),St=null);},bt=()=>{let At=Lt(Ct),It=new Set(Fe(At));Ha(ca=>ca&&{...ca,targetIndex:At,rangeIds:It});},Kt=()=>{if(ea(),!We)return;let At=We,ca=At===document.scrollingElement?{top:0,bottom:window.innerHeight}:At.getBoundingClientRect(),ua=60,Qa=12,fr=Ct-ca.top,zn=ca.bottom-Ct,ho=At.scrollHeight-At.clientHeight;if(zn<ua&&At.scrollTop<ho){let wr=Math.max(1,Math.round(Qa*(1-Math.max(0,zn)/ua))),Zn=()=>{At.scrollTop+=wr,bt(),At.scrollTop<At.scrollHeight-At.clientHeight&&(St=requestAnimationFrame(Zn));};St=requestAnimationFrame(Zn);}else if(fr<ua&&At.scrollTop>0){let wr=Math.max(1,Math.round(Qa*(1-Math.max(0,fr)/ua))),Zn=()=>{At.scrollTop-=wr,bt(),At.scrollTop>0&&(St=requestAnimationFrame(Zn));};St=requestAnimationFrame(Zn);}},Qt=At=>{Ct=At.clientY,bt(),Kt();},ra=At=>{window.removeEventListener("mousemove",Qt),window.removeEventListener("mouseup",ra),ea(),document.body.style.cursor="",document.body.style.userSelect="",Ha(null);let It=Lt(At.clientY),ca=new Map(Va.current.map(zn=>[zn.id,zn])),ua=ca.get(G);if(!ua)return;let Qa=A(ua,ne),fr=[];for(let zn of Fe(It)){if(zn===G)continue;let ho=ca.get(zn);ho&&(ho.subtasks&&ho.subtasks.length>0||fr.push(zn));}fr.length>0&&a.onBulkFill?.(fr,ne,Qa);};window.addEventListener("mousemove",Qt),window.addEventListener("mouseup",ra);},ee=C=>ha?ha.rangeIds.has(C):false;useEffect(()=>{if(Qe)return document.addEventListener("mousemove",ia),document.addEventListener("mouseup",vn),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ia),document.removeEventListener("mouseup",vn),document.body.style.cursor="",document.body.style.userSelect="";}},[Qe,ia,vn]);let[q,He]=useState("all"),[Ze,$e]=useState(false),Q=useRef(null),Ie=useRef(null),pt=useMemo(()=>{let C=0;function G(ne,le){for(let ve of ne)le>C&&(C=le),ve.subtasks?.length&&G(ve.subtasks,le+1);}return G(e,1),C},[e]);useEffect(()=>{if(!Ze)return;let C=G=>{Q.current?.contains(G.target)||Ie.current?.contains(G.target)||$e(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[Ze]),useEffect(()=>{if(q==="all"){let ne=function(le){for(let ve of le)ve.subtasks?.length&&(ve.isExpanded===false&&a.onTaskToggleExpand?.(ve.id),ne(ve.subtasks));};ne(e);}else {let ne=function(le,ve){for(let je of le)if(je.subtasks?.length){let se=ve<q,Fe=je.isExpanded!==false;se!==Fe&&a.onTaskToggleExpand?.(je.id),ne(je.subtasks,ve+1);}};ne(e,1);}},[q]);let[P,ie]=useState(null),[$,te]=useState(0),[I,H]=useState(0),fe=useRef(null),[me,ge]=useState(null),[pe,Ce]=useState(null);useEffect(()=>{h&&Z(C=>{if(C.length===h.length){let G=true;for(let ne=0;ne<C.length;ne++){let le=C[ne],ve=h[ne];if(!le||!ve||le.id!==ve.id||le.visible!==ve.visible||le.width!==ve.width||le.label!==ve.label){G=false;break}}if(G)return C}return h});},[h]),useEffect(()=>{if(!(!D||typeof window>"u"))try{localStorage.setItem(D,JSON.stringify({statusFilter:Ut,hideCompleted:qe}));}catch(C){console.error("Error persisting filter state:",C);}},[D,Ut,qe]);let Se=useMemo(()=>{let C=new Set;function G(ne){for(let le of ne)le.subtasks?.length&&(le.isExpanded!==false&&C.add(le.id),G(le.subtasks));}return G(e),C},[e]),st=useMemo(()=>he.filter(C=>C.visible),[he]),et=useCallback(C=>{a.onTaskToggleExpand?.(C);},[a]),ke=useCallback(C=>{Mt===C?Ne(G=>G==="asc"?"desc":"asc"):(Pt(C),Ne("asc")),a.onSortChange?.({column:C,direction:zt==="asc"?"desc":"asc"});},[Mt,zt,a]),tt=useCallback(C=>{Z(C),a.onColumnsChange?.(C);},[a]),Ia=useCallback(C=>{let G=he.map(ne=>ne.id===C?{...ne,visible:false}:ne);tt(G);},[he,tt]),Ma=useCallback((C,G)=>{Pt(C),Ne(G);},[]),ka=useCallback((C,G,ne)=>{z&&(C.preventDefault(),Be({isOpen:true,x:C.clientX,y:C.clientY,type:G?"task":"header",task:G,columnId:ne}));},[z]),Le=useCallback(()=>{Be(C=>({...C,isOpen:false}));},[]),na=useCallback((C,G)=>{if(!M)return;C.preventDefault(),C.stopPropagation();let ne=he.find(le=>le.id===G);ne&&(ie(G),te(C.clientX),H(ne.width));},[he,M]);useEffect(()=>{if(!P)return;let C=he,G=le=>{let ve=le.clientX-$,je=Math.max(50,I+ve);C=C.map(se=>se.id===P?{...se,width:je}:se),Z(C);},ne=()=>{a.onColumnsChange?.(C),ie(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",ne),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",ne);}},[P,$,I,a]);let Ra=useCallback((C,G)=>{if(G==="name"){C.preventDefault();return}ge(G),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",G),C.currentTarget instanceof HTMLElement&&(C.currentTarget.style.opacity="0.5");},[]),Sn=useCallback(C=>{C.currentTarget instanceof HTMLElement&&(C.currentTarget.style.opacity="1"),ge(null),Ce(null);},[]),Xa=useCallback((C,G)=>{C.preventDefault(),G!=="name"&&(C.dataTransfer.dropEffect="move",Ce(G));},[]),Kn=useCallback(()=>{Ce(null);},[]),En=useCallback((C,G)=>{if(C.preventDefault(),!me||me===G||G==="name")return;let ne=[...he],le=ne.findIndex(se=>se.id===me),ve=ne.findIndex(se=>se.id===G);if(le===-1||ve===-1)return;let je=ne.splice(le,1);je[0]&&(ne.splice(ve,0,je[0]),tt(ne),ge(null),Ce(null));},[me,he,tt]),An=useCallback(async C=>{if(a.onCreateCustomField){let G={...C,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(G);}O(false);},[a]),Pa=useCallback(C=>C.progress===100||C.status==="completed"?"completed":C.progress&&C.progress>0||C.status==="in-progress"?"in-progress":"todo",[]),Ir=t.groupBy==="status",Rr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[go,Io]=useState(()=>{let C=new Set(t.defaultCollapsedGroups??["completed"]);if(!Rr)return C;try{let G=localStorage.getItem(Rr);return G?new Set(JSON.parse(G)):C}catch{return C}}),cn=useCallback(C=>{Io(G=>{let ne=new Set(G);if(ne.has(C)?ne.delete(C):ne.add(C),Rr)try{localStorage.setItem(Rr,JSON.stringify([...ne]));}catch{}return ne});},[Rr]),Ja=!!t.selectable,[vl,wi]=useState(new Set),Zr=useMemo(()=>t.selectedIds?new Set(t.selectedIds):vl,[t.selectedIds,vl]),ki=useRef(null),{lista:qn,cabeceras:eo,todas:fo}=useMemo(()=>{let C=Ab(e);if(Ot.trim()){let ne=Ot.toLowerCase();C=C.filter(le=>le.name.toLowerCase().includes(ne));}let G=t.showStatusFilter!==false;if(G&&Ut!=="all"){let ne=new Set(C.filter(le=>Pa(le)===Ut).flatMap(le=>le.parentPath));C=C.filter(le=>ne.has(le.id));}if(G&&qe){let ne=new Set(C.filter(le=>Pa(le)!=="completed").flatMap(le=>le.parentPath));C=C.filter(le=>ne.has(le.id));}if(t.groupBy==="assignee"||t.groupBy==="due"){let ne=t.groupBy==="assignee",le=[],ve=(bt,Kt,Qt,ra)=>{for(let At of bt){let It=[...Qt,At.id];le.push({...At,level:Kt,hasChildren:(At.subtasks?.length||0)>0,parentPath:It,...ra?{__padre:ra}:{}}),At.subtasks?.length&&ve(At.subtasks,Kt+1,It,At.name);}};ve(e,0,[]);let je=Ot.trim().toLowerCase(),se=je?le.filter(bt=>bt.name.toLowerCase().includes(je)):le,Fe=f==="es",Oe=[["overdue","Vencidas","Overdue"],["today","Hoy","Today"],["week","Esta semana","This week"],["later","M\xE1s adelante","Later"],["past","Anteriores","Earlier"],["none","Sin fecha","No date"]],We=new Map;for(let bt of se){let Kt=ne?(()=>{let Qt=(bt.assignees??[]).map(ra=>ra.name).filter(Boolean);return Qt.length?Qt:["__sin"]})():[t.dueBucket?.(bt)??"none"];for(let Qt of Kt){let ra=ne?`user:${Qt}`:`due:${Qt}`,At=ne?Qt==="__sin"?Fe?"Sin responsable":"Unassigned":Qt:Oe.find(It=>It[0]===Qt)?.[Fe?1:2]??Qt;We.has(ra)||We.set(ra,{titulo:At,filas:[]}),We.get(ra).filas.push({...bt,level:0,hasChildren:false,__claveFila:`${ra}|${bt.id}`});}}let Lt=ne?[...We.keys()].sort((bt,Kt)=>bt==="user:__sin"?1:Kt==="user:__sin"?-1:We.get(bt).titulo.localeCompare(We.get(Kt).titulo)):Oe.map(bt=>`due:${bt[0]}`).filter(bt=>We.has(bt)),Ct=bt=>bt.endDate?new Date(bt.endDate).getTime():1/0,St=[],ea=new Map;for(let bt of Lt){let Kt=We.get(bt),Qt=go.has(bt);ea.set(St.length,[...ea.get(St.length)??[],{clave:bt,cuenta:Kt.filas.length,plegado:Qt,titulo:Kt.titulo}]),Qt||St.push(...Kt.filas.sort((ra,At)=>Ct(ra)-Ct(At)));}return {lista:St,cabeceras:ea,todas:se}}if(Ir){let ne=["todo","in-progress","completed"],le=new Map,ve=[];for(let Oe of C){let We=Oe.parentPath[0]??Oe.id;Oe.level===0&&ve.push(Oe),le.has(We)||le.set(We,[]),le.get(We).push(Oe);}let je=Oe=>Oe.endDate?new Date(Oe.endDate).getTime():1/0,se=[],Fe=new Map;for(let Oe of ne){let We=ve.filter(bt=>Pa(bt)===Oe).sort((bt,Kt)=>je(bt)-je(Kt)),Lt=We.flatMap(bt=>le.get(bt.id)??[bt]),Ct=Lt.filter(bt=>!bt.hasChildren).length;if(Ct===0&&We.length===0)continue;let St=go.has(Oe),ea=se.length;Fe.set(ea,[...Fe.get(ea)??[],{clave:Oe,cuenta:Ct,plegado:St}]),St||se.push(...Lt);}return {lista:se,cabeceras:Fe,todas:C}}return C.sort((ne,le)=>{let ve,je;switch(Mt){case "name":ve=ne.name.toLowerCase(),je=le.name.toLowerCase();break;case "startDate":ve=ne.startDate?.getTime()||0,je=le.startDate?.getTime()||0;break;case "endDate":ve=ne.endDate?.getTime()||0,je=le.endDate?.getTime()||0;break;case "progress":ve=ne.progress||0,je=le.progress||0;break;case "status":ve=ne.status||"todo",je=le.status||"todo";break;case "priority":let se={urgent:0,high:1,medium:2,low:3,none:4};ve=se[ne.priority]??4,je=se[le.priority]??4;break;case "position":return 0;default:return 0}return ve<je?zt==="asc"?-1:1:ve>je?zt==="asc"?1:-1:0}),{lista:C,cabeceras:new Map,todas:C}},[e,Ot,Ut,qe,Mt,zt,Pa,t.showStatusFilter,Ir,go,t.groupBy,t.dueBucket,f]);Va.current=qn;let Ci=(C,G)=>{let ne=new Set(Zr),le=ki.current,ve=Va.current.map(je=>je.id);if(G&&le&&le!==C&&ve.includes(le)&&ve.includes(C)){let je=ve.indexOf(le),se=ve.indexOf(C),Fe=Math.min(je,se),Oe=Math.max(je,se),We=!Zr.has(C);for(let Lt of ve.slice(Fe,Oe+1))We?ne.add(Lt):ne.delete(Lt);}else ne.has(C)?ne.delete(C):ne.add(C);ki.current=C,t.selectedIds||wi(ne),a.onSelectionChange?.([...ne]);},Ws=Zr.size>0,Ti=C=>jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:G=>G.stopPropagation(),children:jsx("input",{type:"checkbox","data-casilla-fila":C,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:Zr.has(C),onChange:()=>{},onClick:G=>{G.stopPropagation(),Ci(C,G.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",Ws?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),wl={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En progreso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Di=(C,G)=>{let ne=eo.get(C);if(!ne?.length)return G;let le=ne.map(ve=>jsx("div",{"data-grupo-de-estado":ve.clave,"data-plegado":ve.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",B?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxs("button",{type:"button",onClick:()=>cn(ve.clave),"aria-expanded":!ve.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",B?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[ve.plegado?jsx(ChevronRight,{className:"w-3.5 h-3.5"}):jsx(ChevronDown,{className:"w-3.5 h-3.5"}),ve.titulo??wl[ve.clave]?.[f==="es"?"es":"en"]??ve.clave,jsx("span",{className:g("font-normal tabular-nums",B?"text-white/40":"text-gray-400"),children:ve.cuenta})]})},`grupo-${ve.clave}`));return G?[...le,G]:le},Ni=useCallback((C,G)=>{let ne=je=>{a.onTaskUpdate?.({...C,...je});},le=je=>je?C.customFields?.find(Fe=>Fe.fieldId===je)?.value:void 0,ve=(je,se)=>{if(!je)return;let Oe=[...C.customFields||[]],We=Oe.findIndex(Lt=>Lt.fieldId===je);We>=0?Oe[We]={fieldId:je,value:se}:Oe.push({fieldId:je,value:se}),ne({customFields:Oe});};switch(G.type){case "name":return null;case "status":return jsx(w0,{value:C.status||(C.progress===100?"completed":C.progress&&C.progress>0?"in-progress":"todo"),onChange:se=>{ne({status:se,progress:se==="completed"?100:se==="in-progress"?50:0});},isDark:B,locale:f,translations:Ge.status});case "priority":return jsx(C0,{value:C.priority,onChange:se=>ne({priority:se}),isDark:B,locale:f});case "assignees":{let se=C.hasChildren,Fe=C.assignees||[];if(se&&C.subtasks?.length){let Oe=new Map,We=Lt=>{(Lt||[]).forEach(Ct=>{(Ct.assignees||[]).forEach(St=>{Oe.has(St.name)||Oe.set(St.name,St);}),Ct.subtasks?.length&&We(Ct.subtasks);});};We(C.subtasks),Fe=Array.from(Oe.values());}else se&&(Fe=[]);return jsx(Ic,{value:Fe,availableUsers:i,onChange:Oe=>ne({assignees:Oe}),isDark:B,locale:f,disabled:se})}case "startDate":return jsx(Bc,{value:C.startDate,onChange:se=>ne({startDate:se}),isDark:B,locale:f,dateField:"start",startDate:C.startDate,endDate:C.endDate,minDate:t.minTaskDate});case "endDate":{let se=jsx(Bc,{value:C.endDate,onChange:Fe=>ne({endDate:Fe}),isDark:B,locale:f,dateField:"end",startDate:C.startDate,endDate:C.endDate,minDate:t.minTaskDate});return t.isTaskOverdue?.(C)?jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:B?"#FF7A7F":"#C22F35"},children:[jsx(AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),se]}):se}case "progress":{let se=!!(C.subtasks&&C.subtasks.length>0),Fe=se?Ji(ks(C.subtasks||[])):C.progress||0;return jsx(A0,{value:Fe,onChange:se?void 0:Oe=>{let We=Oe===100?"completed":Oe>0?"in-progress":"todo";ne({progress:Oe,status:We});},isDark:B,disabled:se})}case "tags":return jsx(Y0,{value:C.tags||[],isDark:B});case "text":return jsx(B0,{value:le(G.customFieldId)||"",onChange:se=>ve(G.customFieldId,se),isDark:B});case "number":return jsx(H0,{value:le(G.customFieldId)||0,onChange:se=>ve(G.customFieldId,se),isDark:B});case "date":let je=le(G.customFieldId);return jsx(Bc,{value:je?new Date(je):void 0,onChange:se=>ve(G.customFieldId,se),isDark:B,locale:f});case "dropdown":return jsx(W0,{value:le(G.customFieldId)||"",options:G.options||[],onChange:se=>ve(G.customFieldId,se),isDark:B});case "checkbox":return jsx(U0,{value:le(G.customFieldId)||false,onChange:se=>ve(G.customFieldId,se),isDark:B});case "multiselect":return jsx(j0,{value:le(G.customFieldId)||[],options:G.options||[],onChange:se=>ve(G.customFieldId,se),isDark:B,maxSelectable:G.maxSelectable});case "person":{let se=le(G.customFieldId)||[];return jsx(Ic,{value:se.map(Fe=>({name:Fe.name,avatar:Fe.avatar,initials:Fe.initials||ma(Fe.name),color:Fe.color||"#00E5CC"})),availableUsers:i,onChange:Fe=>ve(G.customFieldId,Fe),isDark:B,locale:f})}case "file":return jsx(_0,{value:le(G.customFieldId),isDark:B,onOpen:se=>{se.url&&window.open(se.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let se=C.status==="completed"||C.progress===100;return jsx(gr,{value:C.estimatedTime,onChange:Fe=>ne({estimatedTime:Fe}),isDark:B,locale:f,disabled:se,lens:U,hourlyRate:ce(C),currencyCode:R})}case "quotedTime":{let se=C.status==="completed"||C.progress===100,Fe=S?.enabled&&(!S.columns||S.columns.includes("quotedTime"));return jsx(gr,{value:C.quotedTime,onChange:Oe=>ne({quotedTime:Oe}),isDark:B,locale:f,disabled:se,isBlurred:Fe,lens:U,hourlyRate:ce(C),currencyCode:R})}case "elapsedTime":{let se=C.status==="completed"||C.progress===100,Fe=C.executedDollarsCanonical;return jsx(gr,{value:C.elapsedTime,onChange:Oe=>ne({elapsedTime:Oe}),isDark:B,locale:f,disabled:se,lens:U,hourlyRate:ce(C),currencyCode:R,financialOverride:Fe})}case "effortMinutes":{if(Pe&&C.subtasks&&C.subtasks.length>0){let{allocated:Lt}=hi(C);if(U==="financial"){let Ct=oe(C),St=Math.round(Ct.dollarAllocated),ea=Math.round(Ct.dollarQuoted),bt=ea-St;return jsxs("div",{className:"flex flex-col",children:[St>0?jsx("span",{className:g("text-sm font-mono",B?"text-white/60":"text-gray-500"),children:nn(St,R,Ae)}):null,bt!==0&&St>0&&ea>0&&jsx("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",bt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:Vc(bt,R,Ae,bt>0)})]})}return jsx(gr,{value:Lt>0?Lt:void 0,isDark:B,locale:f,disabled:true,lens:U,hourlyRate:W,currencyCode:R})}let se=C.status==="completed"||C.progress===100,Fe=C.effortMinutes||0,Oe=C.soldEffortMinutes||0,We=ce(C);if(U==="financial"&&We&&Fe>0&&Oe>0){let Lt=Math.round(Fe/60*We),St=Math.round(Oe/60*We)-Lt;return jsxs("div",{className:"flex flex-col",children:[jsx(gr,{value:Fe,onChange:ea=>ne({effortMinutes:ea}),isDark:B,locale:f,disabled:se,lens:U,hourlyRate:ce(C),currencyCode:R}),St!==0&&jsx("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",St>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:Vc(St,R,Ae,St>0)})]})}return jsx(gr,{value:Fe,onChange:Lt=>ne({effortMinutes:Lt}),isDark:B,locale:f,disabled:se,lens:U,hourlyRate:ce(C),currencyCode:R})}case "timeLoggedMinutes":{let se=C.executedDollarsCanonical;if(Pe&&C.subtasks&&C.subtasks.length>0){let{spent:Oe}=hi(C);return jsx(gr,{value:Oe>0?Oe:void 0,isDark:B,locale:f,disabled:true,lens:U,hourlyRate:ce(C),currencyCode:R,financialOverride:se})}let Fe=C.status==="completed"||C.progress===100;return jsx(gr,{value:C.timeLoggedMinutes,onChange:a.onLogTime?Oe=>{a.onLogTime?.(C,Oe);}:void 0,isDark:B,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Fe,lens:U,hourlyRate:ce(C),currencyCode:R,financialOverride:se})}case "soldEffortMinutes":{if(Pe&&C.subtasks&&C.subtasks.length>0){let{quoted:Oe}=hi(C),We=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(gr,{value:Oe>0?Oe:void 0,isDark:B,locale:f,disabled:true,isBlurred:We,lens:U,hourlyRate:ce(C),currencyCode:R})}let se=C.status==="completed"||C.progress===100,Fe=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(gr,{value:C.soldEffortMinutes,onChange:Oe=>ne({soldEffortMinutes:Oe}),isDark:B,locale:f,disabled:se,isBlurred:Fe,lens:U,hourlyRate:ce(C),currencyCode:R})}case "scheduleVariance":{let se=C.effortMinutes||0,Fe=C.soldEffortMinutes||0,Oe=C.timeLoggedMinutes||0,We=se>0||Fe>0||Oe>0;return jsx(J0,{startDate:C.startDate,endDate:C.endDate,scheduleVariance:C.scheduleVariance,isDark:B,locale:f,hasTimeAllocated:We,sinEmpezar:(C.progress??0)===0&&C.status!=="completed"})}case "hoursBar":{if(Pe&&C.hasChildren){let{spent:se,allocated:Fe,quoted:Oe}=hi(C),We=se>Fe&&Fe>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",B?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",We?"text-[#FF453A]":B?"text-white/80":"text-gray-800"),children:bi(se,Ae)}),Fe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:B?"text-white/60":"text-gray-600",children:bi(Fe,Ae)})]}),Oe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:B?"text-amber-400/70":"text-amber-600",children:bi(Oe,Ae)})]})]})}return jsx(ip,{task:C,isDark:B,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:U,hourlyRate:ce(C),currencyCode:R})}case "costBar":{let se=f==="es"?"Sin tarifa: estas horas no se valoran":"No rate: these hours are not valued";if(Pe&&C.hasChildren){let{dollarSpent:Oe,dollarAllocated:We}=oe(C);if(Oe<=0&&We<=0)return jsx("span",{className:g("text-[11px] font-mono",B?"text-white/30":"text-gray-400"),title:se,children:"\u2014"});let Lt=We>0&&Oe>We;return jsxs("span",{"data-costo":true,className:g("text-[11px] font-mono flex items-center gap-1.5",B?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",Lt?"text-[#FF453A]":B?"text-white/80":"text-gray-800"),children:nn(Math.round(Oe),R,Ae)}),We>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:B?"text-white/60":"text-gray-600",children:nn(Math.round(We),R,Ae)})]})]})}let Fe=ce(C);return Fe>0?jsx("span",{"data-costo":true,className:"contents",children:jsx(ip,{task:C,isDark:B,locale:f,lens:"financial",hourlyRate:Fe,currencyCode:R})}):jsx("span",{className:g("text-[11px] font-mono",B?"text-white/30":"text-gray-400"),title:se,children:"\u2014"})}case "teamLoad":return C.hasChildren||C.subtasks&&C.subtasks.length>0?jsx(eb,{task:C,isDark:B,locale:f}):jsx(Ic,{value:C.assignees||[],availableUsers:i,onChange:Fe=>{a.onTaskUpdate?.({...C,assignees:Fe});},isDark:B,locale:f});case "blockers":return jsx(ab,{blockers:C.blockers,isDark:B,locale:f});case "weight":{let se=ct.get(C.id);if(se!==void 0)return jsx("span",{className:g("text-xs font-mono",se>0?B?"text-white/50":"text-gray-400":B?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?Xn(se,Ae,2):"\u2014"});let Fe=C.weight||0;return jsx(w5,{value:Fe,onChange:Oe=>ne({weight:Oe}),isDark:B,idioma:Ae})}default:return jsx("span",{className:g("text-sm",B?"text-white/60":"text-gray-500"),children:"-"})}},[a,B,f,i,Ge,Pe,ct,R]),vr=useCallback(C=>{let ne={name:Ge.columns.name,status:Ge.columns.status,priority:Ge.columns.priority,assignees:Ge.columns.assignees,startDate:Ge.columns.startDate,endDate:Ge.columns.endDate,progress:Ge.columns.progress,tags:Ge.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:Ge.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:Ge.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:Ge.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:Ge.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:Ge.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:Ge.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:Ge.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:Ge.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),costBar:Ge.columns.costBar||(f==="es"?"Costo (Ejecutado / Asignado)":"Cost (Spent / Allocated)"),teamLoad:Ge.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:Ge.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:Ge.columns.weight||(f==="es"?"Peso":"Weight")}[C.type]||C.label;return typeof ne=="string"?ne:String(ne||C.type)},[Ge,f]),bo=useMemo(()=>{let ne=st.reduce((ve,je)=>ve+je.width,0)+(k?48:0),le={};for(let ve of st)le[ve.id]=`${ve.width/ne*100}%`;return le},[st,k]),dn=useMemo(()=>{let C={};for(let G of st)C[G.id]=zu(G);return C},[st]),ls=useMemo(()=>x0(st,(k?48:0)+(Ja?24:0)+(jt?20:0)),[st,k,Ja,jt]);return n?jsx("div",{className:g("flex-1 flex items-center justify-center",B?"bg-[#0D0D0D]":"bg-white",s),style:o,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-[#00E5CC]"}),jsxs("p",{className:g("text-sm",B?"text-white/60":"text-gray-600"),children:[Ge.empty.noTasks,"..."]})]})}):r?jsx("div",{className:g("flex-1 flex items-center justify-center",B?"bg-[#0D0D0D]":"bg-white",s),style:o,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:g("text-lg font-semibold mb-2",B?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",B?"text-white/60":"text-gray-600"),children:typeof r=="string"?r:r.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",B?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",B?"text-white":"text-gray-900"),children:Ge.empty.noTasks}),jsx("p",{className:g("text-sm",B?"text-white/60":"text-gray-600"),children:Ge.empty.addFirstTask})]})}):jsxs("div",{ref:fe,className:g(B?"bg-[#0D0D0D]":"bg-white",P&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let C=!!t.toolbarContainer,G=jsx("div",{className:C?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",B?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:C?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",B?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let ne=0,le=0,ve=se=>{for(let Fe of se)Fe.subtasks&&Fe.subtasks.length>0?(ne++,ve(Fe.subtasks)):le++;};for(let se of fo)(se.subtasks?.length??0)>0?(ne++,se.isExpanded===false&&ve(se.subtasks)):le++;let je=f==="es";return jsxs(Fragment,{children:[le," ",Ge.pagination.tasks,ne>0&&jsxs(Fragment,{children:[" \xB7 ",ne," ",je?ne===1?"tarea padre":"tareas padre":ne===1?"parent task":"parent tasks"]})]})})()}),b&&!C&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",B?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ot,onChange:ne=>wt(ne.target.value),placeholder:Ge.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",B?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),!C&&jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),w&&pt>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Q,onClick:()=>$e(!Ze),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",B?Ze?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Ze?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),q==="all"?f==="es"?"Todos":"All":`L${q}`]}),Ze&&jsx("div",{ref:Ie,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",B?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(pt,5)},(ne,le)=>({value:le+1,label:`L${le+1}`}))].map(ne=>jsxs("button",{onClick:()=>{He(ne.value),$e(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",B?q===ne.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":q===ne.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:ne.label}),q===ne.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(ne.value)))})]}),t.showStatusFilter!==false&&jsx(Sb,{value:Ut,hideCompleted:qe,onChange:Ye,onHideCompletedChange:_,isDark:B,locale:f}),ft?.enabled&&ft.data&&!ut&&jsx("button",{onClick:()=>Rt(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",B?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,L&&N&&!C&&jsxs(motion.button,{onClick:N,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:Ge.toolbar.newTask})]})]})});return C?createPortal(G,t.toolbarContainer):G})(),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%",minWidth:ls},children:[jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",B?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Ja&&jsx("div",{className:"w-6 flex-shrink-0"}),jt&&jsx("div",{className:"w-5 flex-shrink-0"}),st.map(C=>{let G=C.id!=="name",ne=pe===C.id&&me!==C.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",B?"text-white/60":"text-gray-500",G&&"cursor-grab",C.type!=="name"&&"justify-center",me===C.id&&"opacity-50",ne&&(B?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:bo[C.id],minWidth:dn[C.id]},draggable:G,onDragStart:G?le=>Ra(le,C.id):void 0,onDragEnd:G?Sn:void 0,onDragOver:G?le=>Xa(le,C.id):void 0,onDragLeave:G?Kn:void 0,onDrop:G?le=>En(le,C.id):void 0,onContextMenu:le=>ka(le,void 0,C.id),children:[G&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",B?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:le=>{let ve=le.currentTarget.getBoundingClientRect();u(C.id,ve);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[vr(C),p?.includes(C.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),Mt===C.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):C.sortable?jsxs("button",{draggable:false,onClick:()=>ke(C.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[vr(C),p?.includes(C.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Mt===C.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[vr(C),p?.includes(C.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&C.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:le=>na(le,C.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",P===C.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},C.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:C=>{C.stopPropagation(),Me(G=>!G);},className:g("p-0.5 rounded transition-colors",B?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ze&&(B?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(vb,{isOpen:ze,onClose:()=>Me(false),columns:he,customFields:c,mostrarColumnasDensas:y,onColumnsChange:tt,onCreateCustomField:()=>{Me(false),O(true);},isDark:B,locale:f})]})]}),jsxs(AnimatePresence,{mode:"popLayout",children:[qn.map((C,G)=>Di(G,(()=>{let ne=Se.has(C.id),le=Math.min(G*.01,.2),ve=C.hasChildren&&C.level===0,je=C.subtasks?.length||0;if(ve){let{spent:Ct,allocated:St,quoted:ea}=hi(C),bt=v5(C);return jsxs(motion.div,{"data-task-id":C.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:le},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",B?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",lt===C.id&&(B?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(C),children:[Ja&&Ti(C.id),jt&&jsx("div",{className:"w-5 flex-shrink-0"}),st.map(Kt=>jsx("div",{className:g("flex items-center px-4",nt?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",Kt.type!=="name"&&"justify-center"),style:{width:bo[Kt.id],minWidth:dn[Kt.id]},children:Kt.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{type:"button","aria-expanded":ne,"aria-label":f==="es"?ne?"Plegar subtareas":"Desplegar subtareas":ne?"Collapse subtasks":"Expand subtasks",onClick:Qt=>{Qt.stopPropagation(),et(C.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",B?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ne?jsx(ChevronDown,{className:g("w-4 h-4",B?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",B?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Qt=>{Qt.stopPropagation(),et(C.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ne?jsx(FolderOpen,{className:"w-4 h-4",style:{color:B?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:B?"#FFD60A":"#B45309"}})}),C.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:B?"#FFD60A":"#B45309"},children:C.wbsCode}),jsxs("div",{className:g("flex min-w-0",nt?"flex-row items-baseline gap-2":"flex-col"),children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",nt&&"truncate",B?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:C.name}),jsxs("span",{className:g(nt?"text-[12px] flex-shrink-0":"text-[10px] font-mono",B?"text-white/30":"text-gray-500"),children:["(",je," ",f==="es"?je===1?"Tarea":"Tareas":je===1?"Item":"Items",")"]}),bt!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",bt>=1?"bg-[#32D74B]/10":bt>=.8?"bg-[#FFD60A]/10":"bg-[#FF453A]/10"),style:{color:bt>=1?"var(--pj-verde-texto, #32D74B)":bt>=.8?"var(--pj-ambar-texto, #FFD60A)":"var(--pj-rojo-texto, #FF453A)"},children:["Avg SPI: ",Ho(bt,Ae,2)]})]})]}):Kt.type==="timeLoggedMinutes"?U==="financial"?(()=>{let Qt=C.executedDollarsCanonical,ra=Qt!=null?Math.round(Qt):Math.round(oe(C).dollarSpent);return ra>0?jsx("span",{className:g("text-sm font-mono",B?"text-white/60":"text-gray-500"),children:nn(ra,R,Ae)}):null})():jsx(gr,{value:Ct>0?Ct:void 0,isDark:B,locale:f,disabled:true,lens:U,hourlyRate:ce(C),currencyCode:R}):Kt.type==="soldEffortMinutes"?U==="financial"?(()=>{let Qt=oe(C),ra=Math.round(Qt.dollarQuoted);return ra>0?jsx("span",{className:g("text-sm font-mono",B?"text-white/60":"text-gray-500"),children:nn(ra,R,Ae)}):null})():jsx(gr,{value:ea>0?ea:void 0,isDark:B,locale:f,disabled:true,lens:U,hourlyRate:ce(C),currencyCode:R}):Kt.type==="effortMinutes"?U==="financial"?(()=>{let Qt=oe(C),ra=Math.round(Qt.dollarAllocated),At=Math.round(Qt.dollarQuoted),It=At-ra;return jsxs("div",{className:"flex flex-col",children:[ra>0?jsx("span",{className:g("text-sm font-mono",B?"text-white/60":"text-gray-500"),children:nn(ra,R,Ae)}):null,It!==0&&ra>0&&At>0&&jsx("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",It>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:Vc(It,R,Ae,It>0)})]})})():jsx(gr,{value:St>0?St:void 0,isDark:B,locale:f,disabled:true,lens:U,hourlyRate:ce(C),currencyCode:R}):Ni(C,Kt)},Kt.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},C.id)}let se=Qe===C.id,Fe=it===C.id,Oe=Fe&&Jt==="above",We=Fe&&Jt==="below",Lt=Fe&&Jt==="child";return jsxs(motion.div,{"data-task-id":C.id,"data-listview-row":C.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:le},className:g("flex items-center border-b transition-colors relative group",B?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",lt===C.id&&(B?"!bg-[#FFD60A]/15":"!bg-yellow-100"),Ja&&Zr.has(C.id)&&(B?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":Ja&&Zr.has(C.id)?"true":void 0,style:{opacity:se?.4:1,backgroundColor:Lt?B?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Lt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(C),onDoubleClick:()=>a.onTaskDoubleClick?.(C),onContextMenu:Ct=>ka(Ct,C),onMouseEnter:()=>la(C.id),onMouseLeave:()=>la(Ct=>Ct===C.id?null:Ct),children:[Oe&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),We&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Ja&&Ti(C.id),jt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:Ct=>xn(C.id,Ct),style:{color:B?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),st.map(Ct=>{let St=!!(C.subtasks&&C.subtasks.length>0),ea=Zt(Ct),Kt=!!ea&&!St&&Dt===C.id&&!ha,Qt=!!ha&&!!ea&&Wa(ha.column,ea)&&ee(C.id);return jsx("div",{className:g("flex items-center px-4",nt?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",Ct.type!=="name"&&"justify-center"),style:{width:bo[Ct.id],minWidth:dn[Ct.id],position:"relative",backgroundColor:Qt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Qt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:Ct.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[w&&C.level>0&&jsx("div",{style:{width:`${C.level*24}px`},className:"flex-shrink-0"}),w&&C.hasChildren&&jsx("button",{onClick:ra=>{ra.stopPropagation(),et(C.id);},className:g("p-0.5 rounded flex-shrink-0",B?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ne?jsx(ChevronDown,{className:g("w-4 h-4",B?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",B?"text-white/60":"text-gray-400")})}),w&&!C.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:g("flex min-w-0 flex-1",nt?"flex-row items-center gap-2":"flex-col"),children:[(C.wbsCode||C.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[C.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",B?"text-[#00E5CC]":"text-[#00C4AE]"),children:C.wbsCode}),C.taskCode&&jsx("span",{"data-codigo-tarea":true,className:g(nt?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",B?"text-white/40":"text-gray-400"),style:nt&&!B?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:C.taskCode})]}),jsxs("span",{className:g("truncate",C.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",C.progress===100?t.completedStyle==="dim"?B?"text-white/45":"text-gray-400":B?"line-through text-white/50":"line-through text-gray-400":C.hasChildren?B?"text-white":"text-gray-900":B?"text-[#D1D5DB]":"text-gray-600"),children:[C.__padre&&jsxs("span",{"data-prefijo-padre":true,className:B?"text-white/35":"text-gray-400",children:[C.__padre," \u203A "]}),C.name]}),C.tags?.[0]&&jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",nt&&"flex-shrink-0"),style:{backgroundColor:`${C.tags[0].color}20`,color:C.tags[0].color},children:C.tags[0].name})]})]}):Kt&&ea?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[Ni(C,Ct),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:ra=>Y(ra,C.id,ea,G),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):Ni(C,Ct)},Ct.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},C.__claveFila??C.id)})())),Di(qn.length,null)]}),J&&qn.length>0&&(()=>{let{spent:C,allocated:G,quoted:ne}=Je,le=G-C,ve=le<0,je=ks(e),Fe=je.length>0&&je.every(It=>(It.progress??0)>=100)?f==="es"?"AHORRADO":"SAVED":f==="es"?"RESTANTE":"REMAINING",Oe=ve?`+${bi(Math.abs(le),Ae)} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${bi(le,Ae)} ${Fe}`,We=U==="financial"&&W>0,Lt=de?.breakdown,Ct=!!Lt&&((Lt.equipment??0)>0||(Lt.travel??0)>0),St=Lt?.laborSpent!=null?Lt.laborSpent:de?.spent!=null?de.spent:Je.dollarSpent,ea=Lt?.laborAllocated!=null?Lt.laborAllocated:de?.allocated!=null?de.allocated:Je.dollarAllocated,bt=de?.quoted!=null?de.quoted:Je.dollarQuoted,Kt=(It,ca)=>{if(We){let ua=ca??It/60*W;return nn(Math.round(ua),R,Ae)}return bi(It,Ae)},Qt=We?Math.abs(ea-St):0,ra=We?`+${nn(Qt,R,Ae)} ${ve?f==="es"?"EXCEDIDO":"OVER":Fe}`:Oe,At=We&&Ct?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",B?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:B?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ja&&jsx("div",{className:"w-6 flex-shrink-0"}),jt&&jsx("div",{className:"w-5 flex-shrink-0"}),st.map(It=>jsx("div",{className:g("flex items-center px-4 py-3",It.type!=="name"&&"justify-center"),style:{width:bo[It.id],minWidth:dn[It.id]},children:It.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),At&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",B?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),At]})]}):It.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Kt(C,We?St:void 0)}),jsx("span",{className:g("text-[11px]",B?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",B?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Kt(G,We?ea:void 0)})]}),G>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ve?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:We?ra:Oe})]}):It.type==="costBar"?(()=>{let ca=Math.round(St),ua=Math.round(ea),Qa=ua>0&&ca>ua;return jsxs("div",{className:"flex flex-col items-center w-full","data-costo-total":true,children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:nn(ca,R,Ae)}),jsx("span",{className:g("text-[11px]",B?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",B?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:nn(ua,R,Ae)})]}),ua>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Qa?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:`+${nn(Math.abs(ua-ca),R,Ae)} ${Qa?f==="es"?"EXCEDIDO":"OVER":Fe}`}),Ct&&jsx("span",{className:g("text-[9px] mt-0.5",B?"text-white/40":"text-gray-400"),children:f==="es"?"solo mano de obra":"labor only"})]})})():It.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne>0?Kt(ne,We?bt:void 0):"\u2013"}):It.type==="effortMinutes"?(()=>{if(We&&ne>0&&G>0){let ca=Math.round(bt),ua=Math.round(ea),Qa=ca-ua,fr=ca>0?Math.round(Qa/ca*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Kt(G,ea)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Qa>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Vc(Qa,R,Ae,Qa>=0),jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Xn(fr,Ae),")"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:G>0?Kt(G,We?ea:void 0):"\u2013"})})():It.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",B?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:C>0?Kt(C,We?St:void 0):"\u2013"}):It.type==="progress"?(()=>{let ca=Ji(ks(e||[]));return jsx("span",{className:g("text-[12px] font-bold font-mono",B?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Xn(ca,Ae)})})():It.type==="weight"?(()=>{let ca=e||[],ua=[],Qa=wr=>{for(let Zn of wr)ua.push(Zn),Zn.subtasks?.length&&Qa(Zn.subtasks);};Qa(ca);let zn=ua.filter(wr=>!wr.subtasks?.length||wr.subtasks.length===0).reduce((wr,Zn)=>wr+(Zn.weight||0),0),ho=Math.abs(zn-100)<.1;return jsx("span",{className:g("text-[12px] font-bold font-mono",ho?B?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Xn(zn,Ae,1)})})():jsx("span",{className:g("text-[11px]",B?"text-white/30":"text-gray-300"),children:"\u2013"})},It.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),qn.length===0&&Ot&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",B?"text-white/30":"text-gray-400")}),jsx("p",{className:g(B?"text-white/60":"text-gray-600"),children:Ge.empty.noResults})]})})]})}),ft?.enabled&&ft.data&&ut&&jsx(Eb,{data:ft.data,isDark:B,locale:f,onClose:()=>Rt(false),lens:ft.lens??t?.lens,currencyCode:R,onUnassignedTaskClick:C=>{let G=document.querySelector(`[data-task-id="${C}"]`);G&&(G.scrollIntoView({behavior:"smooth",block:"center"}),vt(C),setTimeout(()=>vt(null),2e3));}})]}),jsx(cb,{state:xe,onClose:Le,isDark:B,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ia,onColumnSort:Ma,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Xe&&we&&Qe&&createPortal(jsx("div",{style:{position:"fixed",left:we.x+12,top:we.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=Re.flattenTasks(e).find(ne=>ne.id===Qe);return G?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:B?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${B?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:B?"#e6edf3":"#111827"},children:G.name})]}):null})()}),document.body),jsx(Cb,{isOpen:Ve,onClose:()=>O(false),onSave:An,isDark:B,locale:f})]})}var Rb=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],Bb=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],$b=[{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 hp={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},yp={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},xp={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Gc={dark:hp,light:yp,neutral:xp};function Ob(e){return Gc[e]||Gc.dark}function _c(e,t,a,n,r=5){let s=[],o=[],i=e.filter(m=>m.endSerial>=a&&m.startSerial<=n).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of i){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,n),b=0;for(;(s[b]||[]).some(([w,h])=>!(v<w||f>h));)b++;(s[b]=s[b]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:b,contL:m.startSerial<a,contR:m.endSerial>n});}let c={};for(let m=a;m<=n;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let l=[],u=[],p={};t.filter(m=>m.serial>=a&&m.serial<=n).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],b=[];for(let w=0;w<r;w++)c[f].has(w)||b.push(w);if(v.length<=b.length)v.forEach((w,h)=>l.push({it:w,day:f,lane:b[h]}));else {let w=Math.max(b.length-1,0);v.slice(0,w).forEach((h,x)=>l.push({it:h,day:f,lane:b[x]})),u.push({day:f,lane:b[w]!=null?b[w]:r-1,count:v.length-w,items:v.slice(w)});}});let d=s.length;return l.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:l,more:u,laneCount:Math.max(d,1)}}var k5=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],C5=["MON","TUE","WED","THU","FRI","SAT","SUN"];function Hb(e){return e==="es"?k5:C5}function Wb(e){return (e.getDay()+6)%7}function zb(e,t){let a=new Date(e,t,1),n=Wb(a),r=new Date(e,t,1-n),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let d=new Date(r);return d.setDate(r.getDate()+(p-1)),d},i=p=>{let d=p.getTime()-r.getTime();return Math.floor(d/864e5)+1},c=i(a),l=new Date(e,t+1,0),u=i(l);return {gridStart:r,weeks:s,serialToDate:o,dateToSerial:i,monthStartSerial:c,monthEndSerial:u}}function dl(e,t){return Wb(e.serialToDate(t))>=5}function Ub(e,t,a,n,r){let s=[],o=[],i=[],c=Math.max(1,r),l=0;for(let u=a;u<=n;u++){let p=e.filter(b=>!b.container&&b.endSerial===u).sort((b,w)=>+!!b.done-+!!w.done||b.name.localeCompare(w.name)),d=t.filter(b=>b.serial===u),m=p.length+d.length;if(m===0)continue;let f=Math.min(m,c),v=0;for(let b of p.slice(0,f))s.push({t:b,s:u,e:u,lane:v++,contL:false,contR:false});for(let b of d.slice(0,Math.max(0,f-Math.min(p.length,f))))o.push({it:b,day:u,lane:v++});if(m>f){let b=d.slice(Math.max(0,f-Math.min(p.length,f)));i.push({day:u,lane:-1,count:m-f,items:b});}l=Math.max(l,v);}return {bars:s,chips:o,more:i,laneCount:Math.max(l,1)}}function T5(e){let t=[],a=(n,r,s)=>{for(let o of n){let i=r||o.id,c=s||o.name;t.push({t:o,phaseId:i,phaseName:c}),o.subtasks?.length&&a(o.subtasks,i,c);}};return a(e,"",""),t}function jb(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function ul(e,t="es",a){return nn(Math.round(e),a,t,{compacto:true})}function Is(e,t="es"){return hr(Math.round(e*60),t)}function Kc(e){let{tasks:t,grid:a,projectColor:n,hourlyRate:r,projectId:s,locale:o="es",currencyCode:i}=e,c=T5(t),l=42,u=[];for(let{t:d,phaseId:m,phaseName:f}of c){let v=jb(d.startDate),b=jb(d.endDate);if(!v||!b)continue;let w=a.dateToSerial(v),h=a.dateToSerial(b);if(h<1||w>l||d.isMilestone&&h>l)continue;let x=d.effortMinutes??0,y=Math.round(x/60*10)/10,k=d.costAtCompletion,M=k!=null?ul(k,o,i):ul(y*r,o,i),z=d.assignees?.[0],L=z?.initials||(z?.name?S5(z.name):void 0),N=d.displayId||d.wbsCode||"",D=N5(N||d.id)?"":N||d.id;u.push({uid:d.id,id:D,name:d.name,projectId:s,color:d.color,startSerial:Math.max(d.isMilestone?h:w,1),endSerial:Math.min(h,l),hrs:y,cost:M,critical:!!d.isCriticalPath,who:L,realStart:v,realEnd:b,phaseId:m,phaseName:f,done:d.progress===100||d.status==="completed",overdue:!(d.progress===100||d.status==="completed")&&(()=>{let S=new Date;S.setHours(0,0,0,0);let V=new Date(b);return V.setHours(0,0,0,0),V<S})(),milestone:!!d.isMilestone,container:!!(d.subtasks&&d.subtasks.length>0)});}let p=[];return {calTasks:u,dayItems:p,isEmpty:u.length===0&&p.length===0}}var D5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function N5(e){return D5.test(e)||/^task-\d+/.test(e)}function S5(e){return ma(e)}var E5=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],M5=["January","February","March","April","May","June","July","August","September","October","November","December"];function Vb(e,t,a){return `${(a==="es"?E5:M5)[t]} ${e}`}var vp=26,P5={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function qc({locale:e}){let t=Hb(e);return jsx("div",{className:"cal-dow",children:t.map((a,n)=>jsx("div",{className:n>=5?"wknd":"",children:a},a))})}function Yc({bar:e,ws:t,money:a,projColor:n,slotH:r=vp,due:s=false,showValues:o=true,locale:i="es"}){let{t:c}=e,l=e.s-t,u=e.e-e.s+1,p="cal-bar"+(c.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":"")+(s?" due":"")+(s&&c.done?" done":"")+(s&&c.overdue?" overdue":"")+(s&&c.milestone?" hito":""),d=a==="$"?c.cost:Is(c.hrs,i),m=o&&(a==="$"||c.hrs>0),f={"--proj":e.color??c.color??n,left:`calc(${l}/7*100% + 3px)`,width:`calc(${u}/7*100% - 6px)`,top:`${e.lane*r}px`};return jsxs("div",{className:p,style:f,children:[c.critical&&u>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s&&c.done?jsx("span",{className:"ico","aria-hidden":true,children:"\u2713"}):null,s&&c.overdue?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 12 12","aria-hidden":true,children:[jsx("circle",{cx:"6",cy:"6",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"6",y1:"3.4",x2:"6",y2:"6.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"8.6",r:"0.8",fill:"currentColor"})]}):null,c.milestone?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":true,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",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"})]}):null,c.id?jsx("span",{className:"tk",children:c.id}):null,jsx("span",{className:"nom",children:c.name}),u>=3&&m?jsx("span",{className:"val",children:d}):null,s&&c.overdue?jsx("span",{className:"sr-only",children:"Overdue"}):null]})}function Xc({chip:e,ws:t,slotH:a=vp}){let n=e.day-t,r=`cal-chip ${e.it.type}`,s={left:`calc(${n}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxs("div",{className:r,style:s,children:[jsx("span",{className:"ico",children:P5[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Jc({more:e,ws:t,slotH:a=vp,onClick:n,enCabecera:r=false,locale:s="es"}){let o=e.day-t,i=r?{left:`calc(${o+1}/7*100% - 4px)`,top:"-25px",transform:"translateX(-100%)"}:{left:`calc(${o}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:r?"cal-more en-cabecera":"cal-more",style:i,role:n?"button":void 0,tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,children:["+",e.count," ",s==="en"?"more":"m\xE1s"]})}function Gb({projects:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(n=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:n.color}}),n.id?`${n.id} `:"",n.name]},n.id||n.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var I5=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Pr\xF3ximas semanas",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function wp({view:e,onViewChange:t,money:a,onMoneyChange:n,mostrarConmutadorDeDinero:r,projectLabel:s,locale:o="es",enCabecera:i=false,hiddenViews:c=[]}){let l=o==="en",u=I5.filter(p=>!c.includes(p.id));return i?jsxs(Fragment,{children:[jsx("div",{className:"cal-seg",children:u.map(p=>jsx("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),title:`${l?p.en:p.es} (${p.key})`,children:l?p.en:p.es},p.id))}),r!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>n("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>n("$"),children:"$"})]})]}):jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:u.map(p=>jsxs("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),children:[l?p.en:p.es,jsx("span",{className:"key",children:p.key})]},p.id))}),r!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>n("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>n("$"),children:"$"})]})]})}function _b({monthLabel:e,onPrev:t,onNext:a,onToday:n,layersOpen:r,onToggleLayers:s,layersOff:o,phases:i,phaseFilter:c="all",onPhaseChange:l,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),b=u==="es";useEffect(()=>{if(!m)return;let h=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]);let w=c==="all"?b?"Todas":"All":i?.find(h=>h.id===c)?.name??(b?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:n,children:b?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),i&&i.length>0&&l?jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(h=>!h),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:b?"Fase":"Phase"})," ",w," \u25BE"]}),m?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{l("all"),f(false);},children:jsx("span",{className:"nm",children:b?"Todas las fases":"All phases"})}),i.map(h=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===h.id?"var(--cyan)":"var(--txt)"},onClick:()=>{l(h.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name})},h.id))]}):null]}):null,p,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(r?" open":""),onClick:s,children:["\u25E7 ",b?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var R5=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function Kb({off:e,onToggle:t}){let a=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:R5.map(n=>{let r=a.includes(n.id);return jsxs("div",{className:"cal-layer-row"+(r?" off":""),onClick:()=>t(n.id),children:[jsx("span",{className:"sw",style:{background:n.sw,opacity:r?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:n.nm}),jsx("div",{className:"sub",children:n.sub})]}),jsx("span",{className:"cal-switch"+(r?"":" on")})]},n.id)})})}var H5={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},W5={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Yb({dayLabel:e,items:t,tasks:a=[],itemValue:n,onClose:r,style:s,locale:o="es"}){let i=o==="en",c=useRef(null);useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&r();}function m(f){f.key==="Escape"&&r();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[r]);let l=a.length+t.length,p=n||(d=>{switch(d.type){case "hito":return i?"Milestone":"Hito";case "desembolso":return i?"Disb.":"Desemb.";case "deadline":return i?"Due":"Vence";case "aus":return i?"Absence":"Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} ${i?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",i?l===1?"item":"items":l===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[a.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:W5[d.type]},children:H5[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:p(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var qb={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function Xb({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:n,irAPrimera:r}){let s=qb[a]||qb.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:s.title}),jsxs("p",{children:[s.body,jsx("br",{}),jsx("b",{children:e})]}),r?jsx("button",{type:"button","data-ir-a-primera":true,className:"cal-empty-crear",onClick:r.onClick,children:a==="en"?`Go to the first (${r.mes}) \u2192`:`Ir a la primera (${r.mes}) \u2192`}):null,n?jsx("button",{type:"button",className:"cal-empty-crear",onClick:n,children:s.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:s.upcoming}),t.map((o,i)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(o.type==="deadline"?"rd":"cy"),children:o.type==="deadline"?"\u2691":"\u25C6"}),o.label,jsx("span",{className:"d",children:o.date})]},i))]}):null]})}function Qb(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function j5(e){return ma(e)}var Jb=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function V5(e){return Jb[e%Jb.length]}function G5(e){return e>1?"over":e>=.9?"warn":"ok"}var kp="\xA0";function ss(e){return hr(Math.round(e*60),"es")}function _5(e){return `${e.toLocaleDateString("es",{weekday:"short"}).replace(/\.$/,"")} ${Jn(e,"es")}`}function Zb(e,t,a){let n=new Map,r=new Set;for(let i of t)i.isWeekend||i.isHoliday||r.add(Qb(i.date));if(r.size===0)return n;let s=new Map;e.forEach((i,c)=>{s.set(i.userId,{color:V5(c),initials:j5(i.name)});});let o=new Map;for(let i of e)for(let c of i.dailyEstimated){if(!c.date||!r.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let l=o.get(c.date);l.set(i.userId,(l.get(i.userId)??0)+(c.hours||0));}for(let i of r){let c=o.get(i)??new Map,l=e.map(p=>{let d=s.get(p.userId);return {name:p.name,initials:d.initials,color:d.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:a}}),u=l.reduce((p,d)=>p+d.hours,0);n.set(i,{assigned:Math.round(u*100)/100,capacity:a*e.length,perPerson:l});}return n}function eh({days:e,capByDay:t,selectedKey:a,onSelectDay:n}){return jsx("div",{className:"cal-cap-row",children:e.map(r=>{let s=Qb(r.date),o=r.isWeekend||r.isHoliday,i=o?void 0:t.get(s),c=!!i&&i.capacity>0,l=c?i.assigned/i.capacity:0,p="cal-cap-cell "+(o?"off":G5(l))+(a===s?" sel":""),d=_5(r.date);return jsxs("div",{className:p,role:c&&n?"button":void 0,tabIndex:c&&n?0:void 0,title:o?void 0:d,onClick:m=>{!c||!n||n(s,d,m.currentTarget);},onKeyDown:m=>{!c||!n||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`${ss(0)}${kp}/${kp}\u2014`}):jsxs(Fragment,{children:[jsx("b",{children:ss(i.assigned)}),jsxs("span",{children:["/",kp,ss(i.capacity)]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(l*100,100)+"%"}}):null})]},r.serial)})})}function th({dayLabel:e,perPerson:t,onClose:a,style:n}){let r=useRef(null);useEffect(()=>{let l=p=>{p.key==="Escape"&&a();},u=p=>{r.current&&!r.current.contains(p.target)&&a();};return document.addEventListener("keydown",l),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",l),document.removeEventListener("mousedown",u);}},[a]);let s=t.reduce((l,u)=>l+u.hours,0),o=t.reduce((l,u)=>l+u.capacity,0),i=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:r,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...n},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:i?{color:"var(--red)"}:void 0,children:[ss(s)," asignadas / ",ss(o)]}),i?jsx("div",{className:"rng",children:jsxs("b",{children:["+",ss(c)," sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(l=>{let u=l.capacity>0&&l.hours>l.capacity,p=l.capacity>0?l.capacity:1;return jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:l.color},children:l.initials}),jsx("span",{className:"nm",title:l.name,children:l.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(l.hours/p*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[ss(l.hours)," / ",ss(l.capacity)]})]},l.name)})})]})}var Cp=28,q5=182;function nh({grid:e,weeks:t,tasks:a,items:n,money:r,projColor:s,todaySerial:o,locale:i,capRows:c,teamSize:l,onTaskOpen:u,onMore:p,onCapDay:d}){let m=i==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxs("div",{style:{display:"contents"},children:[jsx(Y5,{grid:e,ws:f.ws,we:f.we,tasks:a,items:n,money:r,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p,locale:i}),c&&c[v]?jsx(eh,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",l!=null?` \xB7 ${l} ${m?l===1?"persona":"personas":l===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function Y5({grid:e,ws:t,we:a,tasks:n,items:r,money:s,projColor:o,todaySerial:i,onTaskOpen:c,onMore:l,locale:u="es"}){let p=useMemo(()=>_c(n,r,t,a),[n,r,t,a]),d=useMemo(()=>new Set(r.filter(v=>v.type==="deadline").map(v=>v.serial)),[r]),m=[];for(let v=t;v<=a;v++)m.push(v);let f={height:`${q5}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:f,children:[jsx("div",{className:"cal-week-bg",children:m.map(v=>{let b=e.serialToDate(v),w=v>=e.monthStartSerial&&v<=e.monthEndSerial,h="cal-day";return dl(e,v)&&(h+=" wknd"),w||(h+=" out"),v===i&&(h+=" today"),d.has(v)&&(h+=" deadline-day"),jsx("div",{className:h,children:jsx("span",{className:"cal-day-num",children:b.getDate()})},v)})}),jsxs("div",{className:"cal-items",children:[p.bars.map((v,b)=>jsx("div",{onClick:()=>c?.(v.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Yc,{bar:v,ws:t,money:s,projColor:o,slotH:Cp,locale:u})},`b${b}`)),p.chips.map((v,b)=>jsx(Xc,{chip:v,ws:t,slotH:Cp},`c${b}`)),p.more.map((v,b)=>jsx(Jc,{more:v,ws:t,slotH:Cp,onClick:()=>l(v.day,v.items,n.filter(w=>w.startSerial<=v.day&&w.endSerial>=v.day))},`m${b}`))]})]})}var X5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function J5(e){return X5.test(e)||/^task-\d+/.test(e)}function Q5(e){return ma(e)}function Z5(e){let t=[],a=n=>{for(let r of n)t.push(r),r.subtasks?.length&&a(r.subtasks);};return a(e),t}function rh(e,t,a="es",n){let r=Z5(e),s=[];for(let o of r){if(o.startDate&&o.endDate)continue;let i=o.effortMinutes??0,c=Math.round(i/60*10)/10,l=o.costAtCompletion,u=l!=null?ul(l,a,n):ul(c*t,a,n),p=o.assignees?.[0],d=p?.initials||(p?.name?Q5(p.name):void 0),m=o.displayId||o.wbsCode||"",f=J5(m||o.id)?"":m||o.id;s.push({taskId:o.id,id:f,name:o.name,hrs:c,cost:u,who:d,projColor:o.color});}return s}function oh({items:e,onItemClick:t,onCollapse:a,money:n,projColor:r,locale:s="es"}){let o=s==="en";return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:a,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:o?"Drag onto the calendar":"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(i=>{let c=n==="$"?i.cost:Is(i.hrs,s);return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(i.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.taskId));},children:[jsxs("div",{className:"row1",children:[i.id?jsx("span",{className:"tk",children:i.id}):null,jsx("span",{className:"pdot",style:{background:i.projColor||r}})]}),jsx("div",{className:"nom",children:i.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsx("b",{children:Is(i.hrs,s)})," est"]}),jsx("span",{children:c}),i.who?jsx("span",{className:"cal-ava",children:i.who}):null]})]},i.taskId)})]})}function sh({onExpand:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),e());},title:a?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",a?"Status":"Estado"]})]})}function xi(e,t){return Jn(e,t)}function ih({taskName:e,taskId:t,sim:a,busy:n,locale:r,onConfirm:s,onCancel:o,style:i}){let c=useRef(null),l=r==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=a.wasCritical,p=a.projectEndDeltaDays,d=p>0?`+${p} ${l?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${xi(a.oldProjectEnd,r)} \u2192 ${xi(a.newProjectEnd,r)}`:`+0 ${l?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${l?"holgura":"slack"} ${a.slackDays}d`:""}`,m=p>0?l?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:l?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...i},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:l?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[xi(a.oldStart,r)," \u2013 ",xi(a.oldEnd,r)," \u2192 ",jsxs("b",{children:[xi(a.newStart,r)," \u2013 ",xi(a.newEnd,r)]})]})]}),u?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",l?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?l?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Fin de proyecto":"Project end"}),jsx("span",{className:p>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?l?"Sigue en CPM":"Stays critical":a.wasCritical?l?"Sale de CPM":"Leaves critical":l?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:n,children:l?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:n,children:n?l?"Guardando\u2026":"Saving\u2026":m})]})]})}var nT={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function lh({grid:e,tasks:t,items:a,money:n,projColor:r,todaySerial:s,locale:o,onTaskOpen:i}){let c=o==="es",l=useMemo(()=>{let p=new Map,d=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(l.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let u=p=>p.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:l.map(p=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[u(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(d=>jsxs("button",{type:"button",onClick:()=>i?.(d.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:d.color??r,flex:"none"}}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,d.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:n==="$"?d.cost:Is(d.hrs,o)})]},d.uid)),p.items.map((d,m)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:nT[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function rT(e){let t=[],a=n=>n.forEach(r=>{t.push(r),r.subtasks?.length&&a(r.subtasks);});return a(e),t}function Qc(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function Tp(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function ch(e,t){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let u of Qc(l))n.has(u)||n.set(u,[]),n.get(u).push(l.id);let r=new Map,s=new Map,o=new Set,i=l=>{if(s.has(l))return s.get(l);if(o.has(l))return s.get(l)??0;o.add(l);let u=a.get(l);if(!u)return o.delete(l),0;let p=Qc(u).filter(f=>a.has(f)),d=t.has(l)?t.get(l):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=i(f);v>d&&(d=v);}let m=Tp(u)*864e5;return r.set(l,d),s.set(l,d+m),o.delete(l),s.get(l)};for(let l of e)i(l.id);let c=0;return s.forEach(l=>{l>c&&(c=l);}),{finish:s,start:r,projectEnd:c}}function dh(e,t,a){let n=new Map(e.map(c=>[c.id,c])),r=new Map;for(let c of e)for(let l of Qc(c))r.has(l)||r.set(l,[]),r.get(l).push(c.id);let s=new Map,o=[...e].sort((c,l)=>(t.get(l.id)??0)-(t.get(c.id)??0));for(let c of o){let l=r.get(c.id)??[];if(l.length===0)s.set(c.id,a);else {let u=1/0;for(let p of l){let d=s.get(p),m=n.get(p);d!=null&&m&&(u=Math.min(u,d-Tp(m)*864e5));}s.set(c.id,u===1/0?a:u);}}let i=new Set;for(let c of e){let l=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(l)<864e5/2&&Qc(c).length+(r.get(c.id)?.length??0)>0&&i.add(c.id);}return i}function Zc(e,t,a,n){let r=rT(e),s=r.find(w=>w.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),i=new Date(s.endDate),c=ch(r,new Map),l=dh(r,c.finish,c.projectEnd),u=r.map(w=>w.id===t?{...w,startDate:a,endDate:n}:w),p=ch(u,new Map([[t,a.getTime()]])),d=dh(u,p.finish,p.projectEnd),m=new Map(u.map(w=>[w.id,w])),f=[];for(let w of r){if(w.id===t)continue;let h=c.start.get(w.id),x=p.start.get(w.id);if(h!=null&&x!=null&&Math.abs(x-h)>=864e5/2){let y=Tp(m.get(w.id))*864e5;f.push({id:w.id,name:w.name,newStart:new Date(x),newEnd:new Date(x+y)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),b=l.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:i,newStart:a,newEnd:n,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:l.has(t),stillCritical:d.has(t),slackDays:b}}function ph(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var gh=132,ed=26,Np=20,sT="#5B7FD4";function fh({tasks:e,projectName:t,projectId:a,projectColor:n,locale:r,themeMode:s,hourlyRate:o,money:i,onMoneyChange:c,onTaskOpen:l,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:b,members:w=[],holidayDates:h=[],timesheetSettings:x,onVisibleRangeChange:y,monthMode:k="span",showValues:M=true,openOnToday:z=false,currencyCode:L}){let N=useRef(null),[D,S]=useState(0);useEffect(()=>{if(k!=="due")return;let we=N.current;if(!we||typeof ResizeObserver>"u")return;let Te=new ResizeObserver(()=>S(we.clientHeight));return Te.observe(we),S(we.clientHeight),()=>Te.disconnect()});let[V,U]=useState("mes"),[W,E]=useState(()=>{let we=new Date,Te={y:we.getFullYear(),m:we.getMonth()};if(z)return Te;let dt=(e??[]).map(Dt=>Dt.startDate?new Date(Dt.startDate):null).filter(Dt=>!!Dt&&!isNaN(Dt.getTime()));if(dt.length===0||(e??[]).some(Dt=>{let la=Dt.startDate?new Date(Dt.startDate):null,ha=Dt.endDate?new Date(Dt.endDate):la;if(!la||isNaN(la.getTime()))return false;let Ha=new Date(Te.y,Te.m,1),Zt=new Date(Te.y,Te.m+1,0,23,59,59);return la<=Zt&&(ha??la)>=Ha}))return Te;let jt=dt.reduce((Dt,la)=>Dt<la?Dt:la);return {y:jt.getFullYear(),m:jt.getMonth()}}),[Pe,J]=useState(false),[de,R]=useState([]),[Ae,nt]=useState("all"),[Ge,B]=useState(null),[ce,oe]=useState(null),[gt,Je]=useState(false),[ct,ft]=useState(null),[ut,Rt]=useState(false),lt=useMemo(()=>zb(W.y,W.m),[W.y,W.m]),vt=n||sT,Mt=useMemo(()=>{let we=new Set;for(let Te of h){let dt=new Date(`${Te}T12:00:00`),ht=lt.dateToSerial(dt);ht>=1&&ht<=42&&we.add(ht);}return we},[h,lt]);useEffect(()=>{y?.({start:ph(lt.serialToDate(1)),end:ph(lt.serialToDate(42))});},[W.y,W.m]);let Pt=w.length,zt=useMemo(()=>{let we=x?.hoursPerDay;if(!we)return 8;let Te=[we.monday,we.tuesday,we.wednesday,we.thursday,we.friday].map(dt=>dt||0).filter(dt=>dt>0);return Te.length?Math.round(Te.reduce((dt,ht)=>dt+ht,0)/Te.length*10)/10:8},[x]),Ne=useMemo(()=>Kc({tasks:e,grid:lt,projectColor:()=>vt,hourlyRate:o,projectId:a,locale:r,currencyCode:L}),[e,lt,vt,o,a,r,L]),Ot=useMemo(()=>{if(d===false)return [];let we=new Map;for(let Te of Ne.calTasks)Te.phaseId&&Te.phaseName&&we.set(Te.phaseId,Te.phaseName);return [...we.entries()].map(([Te,dt])=>({id:Te,name:dt})).sort((Te,dt)=>Te.name.localeCompare(dt.name))},[Ne.calTasks,d]),wt=!de.includes("tareas"),Ut=!de.includes("cpm"),Ye=useMemo(()=>{let we=wt?Ne.calTasks:[];return Ae!=="all"&&(we=we.filter(Te=>Te.phaseId===Ae)),Ut||(we=we.map(Te=>Te.critical?{...Te,critical:false}:Te)),we},[Ne.calTasks,wt,Ut,Ae]),qe=useMemo(()=>{let we=new Set;return de.includes("hitos")&&(we.add("hito"),we.add("desembolso")),de.includes("ext")&&we.add("ext"),de.includes("aus")&&we.add("aus"),Ne.dayItems.filter(Te=>!we.has(Te.type))},[Ne.dayItems,de]),_=!de.includes("festivos"),he=new Date,Z=lt.dateToSerial(new Date(he.getFullYear(),he.getMonth(),he.getDate())),ze=we=>R(Te=>Te.includes(we)?Te.filter(dt=>dt!==we):[...Te,we]),Me=()=>E(we=>{let Te=new Date(we.y,we.m-1,1);return {y:Te.getFullYear(),m:Te.getMonth()}}),Ve=()=>E(we=>{let Te=new Date(we.y,we.m+1,1);return {y:Te.getFullYear(),m:Te.getMonth()}}),O=()=>{let we=new Date;E({y:we.getFullYear(),m:we.getMonth()});},xe=useMemo(()=>{let we=(e??[]).flatMap(Te=>[Te.startDate,Te.endDate]).map(Te=>Te?new Date(Te):null).filter(Te=>!!Te&&!isNaN(Te.getTime()));return we.length?we.reduce((Te,dt)=>Te<dt?Te:dt):null},[e]),Be=(we,Te,dt)=>{if(!v||Te===0)return;let ht=Ne.calTasks.find(Ha=>Ha.uid===we);if(!ht)return;let jt=Te*864e5,Dt=new Date(ht.realStart.getTime()+jt),la=new Date(ht.realEnd.getTime()+jt),ha=Zc(e,we,Dt,la);ha&&ft({uid:we,taskId:ht.id,taskName:ht.name,sim:ha,anchor:dt});},Qe=async()=>{if(!ct||!b)return;Rt(true);let we=[{id:ct.uid,startDate:ct.sim.newStart,endDate:ct.sim.newEnd},...ct.sim.movedSuccessors.map(dt=>({id:dt.id,startDate:dt.newStart,endDate:dt.newEnd}))],Te=await b(we);Rt(false),Te&&ft(null);},Ft=Vb(W.y,W.m,r),Xe=[{id:"",name:t,color:vt}],Tt=useMemo(()=>rh(e,o,r,L),[e,o,r,L]),it=useMemo(()=>{if(V==="lookahead"){let we=lt.weeks.find(dt=>Z>=dt.ws&&Z<=dt.we)??lt.weeks[0],Te=lt.weeks.indexOf(we);return lt.weeks.slice(Te,Te+2)}return V==="semana"?[lt.weeks.find(Te=>Z>=Te.ws&&Z<=Te.we)??lt.weeks[0]]:[]},[V,lt.weeks,Z]),ba=useMemo(()=>{let we={};return it.forEach((Te,dt)=>{let ht=[];for(let Dt=Te.ws;Dt<=Te.we;Dt++)ht.push({serial:Dt,date:lt.serialToDate(Dt),isWeekend:dl(lt,Dt),isHoliday:Mt.has(Dt)});let jt=Zb(w,ht,zt);we[dt]={days:ht,capByDay:jt};}),we},[it,lt,Mt,w,zt]),Jt=V==="semana"||V==="lookahead",Ht=V==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[u?createPortal(jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsx(wp,{enCabecera:true,hiddenViews:p,view:V,onViewChange:U,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:we=>c(we==="$"?"$":"Hrs"),projectLabel:t,locale:r})}),u):jsx(wp,{view:V,onViewChange:U,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:we=>c(we==="$"?"$":"Hrs"),projectLabel:t,locale:r,hiddenViews:p}),jsx(_b,{monthLabel:Ft,onPrev:Me,onNext:Ve,onToday:O,layersOpen:Pe,onToggleLayers:()=>J(we=>!we),layersOff:de,phases:Ot,phaseFilter:Ae,onPhaseChange:nt,locale:r,children:Pe?jsx(Kb,{off:de,onToggle:ze}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Ht?"hidden":void 0},children:[Ht?jsx(lh,{grid:lt,tasks:Ye,items:qe,money:i,projColor:vt,todaySerial:Z,locale:r,onTaskOpen:l}):Jt?jsxs(Fragment,{children:[jsx(qc,{locale:r}),jsx(nh,{grid:lt,weeks:it,tasks:Ye,items:qe,money:i,projColor:vt,todaySerial:Z,locale:r,capRows:ba,teamSize:Pt,onTaskOpen:l,onMore:(we,Te,dt)=>B({day:we,items:Te,tasks:dt}),onCapDay:(we,Te,dt)=>{for(let ht of Object.keys(ba)){let jt=ba[+ht].capByDay.get(we);if(jt){oe({dayLabel:Te,perPerson:jt.perPerson,anchor:dt.getBoundingClientRect()});break}}}})]}):Ne.isEmpty?jsxs(Fragment,{children:[jsx(qc,{locale:r}),jsx("div",{className:"cal-weeks",children:lt.weeks.map(we=>jsx("div",{className:"cal-week",style:{minHeight:k==="due"?0:`${gh}px`},children:jsx(bh,{grid:lt,ws:we.ws,we:we.we,todaySerial:Z,showFestivos:_,holidaySerials:Mt,locale:r,deadlineDays:new Set})},we.ws))}),jsx(Xb,{monthLabel:Ft,locale:r,onCreateTask:f,irAPrimera:xe?{mes:xe.toLocaleDateString(r==="en"?"en":"es",{month:"long",year:xe.getFullYear()!==new Date().getFullYear()?"numeric":void 0}),onClick:()=>E({y:xe.getFullYear(),m:xe.getMonth()})}:void 0})]}):jsxs(Fragment,{children:[jsx(qc,{locale:r}),jsx("div",{className:"cal-weeks",ref:N,style:k==="due"?{minHeight:0,overflow:"hidden"}:void 0,children:lt.weeks.map(we=>jsx(iT,{due:k==="due",slots:D>0?Math.max(1,Math.floor((D/lt.weeks.length-26)/Np)):2,showValues:M,grid:lt,ws:we.ws,we:we.we,tasks:Ye,items:qe,money:i,projColor:vt,todaySerial:Z,showFestivos:_,holidaySerials:Mt,locale:r,onTaskOpen:l,onMore:(Te,dt,ht)=>B({day:Te,items:dt,tasks:ht}),canReschedule:v,onDragReschedule:Be,pendingGhost:ct?{uid:ct.uid,days:Math.round((ct.sim.newStart.getTime()-ct.sim.oldStart.getTime())/864e5)}:null},we.ws))})]}),Ge?jsx(Yb,{dayLabel:`${lt.serialToDate(Ge.day).getDate()}`,items:Ge.items,tasks:Ge.tasks.map(we=>({swatch:vt,taskId:we.id,label:we.name,critical:we.critical,value:i==="$"?we.cost:`${we.hrs}h`})),onClose:()=>B(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:r==="en"?"en":"es"}):null,ce?jsx(th,{dayLabel:ce.dayLabel,perPerson:ce.perPerson,onClose:()=>oe(null),style:{position:"fixed",top:`${ce.anchor.top-8}px`,left:`${ce.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,ct?jsx(ih,{taskName:ct.taskName,taskId:ct.sim.taskId,sim:ct.sim,busy:ut,locale:r,onConfirm:Qe,onCancel:()=>ft(null),style:{position:"fixed",top:`${ct.anchor.top+12}px`,left:`${Math.min(ct.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),gt?jsx(oh,{items:Tt,money:i,projColor:vt,onItemClick:we=>l?.(we),onCollapse:()=>Je(false),locale:r==="en"?"en":"es"}):jsx(sh,{onExpand:()=>Je(true),locale:r==="en"?"en":"es"})]}),jsx(Gb,{projects:Xe,locale:r==="en"?"en":"es"})]})}function bh({grid:e,ws:t,we:a,todaySerial:n,showFestivos:r,holidaySerials:s,deadlineDays:o}){let i=[];for(let c=t;c<=a;c++)i.push(c);return jsx("div",{className:"cal-week-bg",children:i.map(c=>{let l=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=r&&s.has(c),d="cal-day";return dl(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===n&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:l.getDate()}),p?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function iT({grid:e,ws:t,we:a,tasks:n,items:r,money:s,projColor:o,todaySerial:i,showFestivos:c,holidaySerials:l,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v,due:b=false,slots:w=2,showValues:h=true}){let x=useMemo(()=>b?Ub(n,r,t,a,w):_c(n,r,t,a),[n,r,t,a,b,w]),y=useMemo(()=>new Set(r.filter(D=>D.type==="deadline").map(D=>D.serial)),[r]),k=b?0:Math.max(gh,x.laneCount*ed+36),M=useRef(null),[z,L]=useState(null),N=(D,S)=>{if(!m||!f){p?.(S);return}D.preventDefault();let V=M.current;if(!V)return;let U=V.getBoundingClientRect().width/7,W=D.clientX,E=0,Pe=de=>{let R=Math.round((de.clientX-W)/U);E=R,L({id:S,days:R});},J=de=>{if(window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",J),L(null),E===0){p?.(S);return}let R=new DOMRect(de.clientX,de.clientY,0,0);f(S,E,R);};window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",J);};return jsxs("div",{ref:M,className:"cal-week",style:{minHeight:`${k}px`},children:[jsx(bh,{grid:e,ws:t,we:a,todaySerial:i,showFestivos:c,holidaySerials:l,locale:u,deadlineDays:y}),jsxs("div",{className:"cal-items",children:[x.bars.map((D,S)=>{let V=z?.id===D.t.uid?z.days:null,U=v?.uid===D.t.uid?v.days:null,W=V??U??0,E=V==null&&U!=null,Pe=W!==0?{...D,s:D.s+W,e:D.e+W}:D;return jsx("div",{onPointerDown:J=>N(J,D.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:E?.6:1},children:jsx(Yc,{bar:Pe,ws:t,money:s,projColor:o,slotH:b?Np:ed,due:b,showValues:h,locale:u})},`b${S}`)}),x.chips.map((D,S)=>jsx(Xc,{chip:D,ws:t,slotH:ed},`c${S}`)),x.more.map((D,S)=>jsx(Jc,{more:D,ws:t,slotH:b?Np:ed,enCabecera:b,locale:u,onClick:()=>d(D.day,D.items,b?n.filter(V=>!V.container&&V.endSerial===D.day):n.filter(V=>V.startSerial<=D.day&&V.endSerial>=D.day))},`m${S}`))]})]})}function cT({stack:e,cards:t,renderCard:a,onCardClick:n,onToggleExpand:r,onUnstack:s,onDeleteStack:o,className:i}){let[c,l]=useState(false),u=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=useMemo(()=>{let m=u.length,f=new Set(u.flatMap(w=>w.assignedUserIds||[])).size,v=u.map(w=>w.priority).filter(Boolean),b=new Set(u.flatMap(w=>w.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:b}},[u]),d=()=>{r?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,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:g("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:p.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),o?.(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:[p.uniqueAssignees," assignees"]})]}),p.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:[p.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>n?.(m),children:a(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>n?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var yh={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ml(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 gl(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 xh(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function vh({events:e,filter:t,onFilterChange:a,onClearFilter:n,onEventClick:r,selectedEventId:s,config:o,className:i}){let c=useMemo(()=>({...yh,...o}),[o]),[l,u]=useState(new Set),p=useRef(null),d=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(x=>{let y=x.timestamp.toISOString().split("T")[0],k=h.get(y);k?k.push(x):h.set(y,[x]);}),Array.from(h.entries()).sort((x,y)=>y[0].localeCompare(x[0])).map(([x,y])=>({date:new Date(x),events:y.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let h=new Set,x=new Set;return e.forEach(y=>{h.add(y.userId),x.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(x)}},[e]),v=h=>{u(x=>{let y=new Set(x);return y.has(h)?y.delete(h):y.add(h),y});},b=h=>{let y=new Date().getTime()-h.getTime(),k=Math.floor(y/6e4),M=Math.floor(y/36e5),z=Math.floor(y/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:z<7?`${z}d ago`:h.toLocaleDateString()},w=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&&p.current){let h=p.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let x=h.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxs("option",{value:h,children:[gl(h)," ",h.replace("_"," ")]},h))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let x=h.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.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})})]}),w>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:n,children:["Clear filters (",w,")"]})]}),jsx("div",{className:"history-timeline-container",ref:p,children:d.map(h=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((x,y)=>{let k=l.has(x.id),M=s===x.id,z=xh(x.type);return jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>r?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:z},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:gl(x.type)})}),y<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:z}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:ml(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?b(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:L=>{L.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([L,N])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[L,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},L)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([L,N])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[L,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},L))]})]})]})]},x.id)})})]},h.date?.toISOString()||"all"))})]})}function kh({replayState:e,events:t,onStartReplay:a,onStopReplay:n,onTogglePlayback:r,onPrevious:s,onNext:o,onGoToEvent:i,onSpeedChange:c,className:l}){let u=[.5,1,1.5,2,3],p=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:p&&gl(p.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:p&&ml(p)}),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:p&&p.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:m=>i(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>i(f),title:ml(m)},m.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:r,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:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:n,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:p&&p.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(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Sp(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Ep(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 Ch(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 Th(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function fT(e,t,a,n,r,s=100){let o=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??n/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;o.forEach(u=>{let p=a/2,d=n/2;u.vx+=(p-u.x)*r.centerForce*l,u.vy+=(d-u.y)*r.centerForce*l,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,b=Math.sqrt(f*f+v*v)||1,w=r.chargeStrength*l/(b*b);u.vx+=f/b*w,u.vy+=v/b*w;});}),t.forEach(u=>{let p=i.get(typeof u.source=="string"?u.source:u.source.id),d=i.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!d)return;let m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f)||1,b=(v-r.linkDistance)/v*r.forceStrength*l;p.vx+=m*b,p.vy+=f*b,d.vx-=m*b,d.vy-=f*b;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(r.nodeSize,Math.min(a-r.nodeSize,u.x)),u.y=Math.max(r.nodeSize,Math.min(n-r.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function Dh({nodes:e,edges:t,config:a,filter:n,onFilterChange:r,criticalPath:s,stats:o,onInteraction:i,className:c}){let l=useRef(null),[u,p]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[b,w]=useState(null),[h,x]=useState(1),[y,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let U=fT(e,t,a.width,a.height,a,150);p(U);},[e,t,a]);let M=useCallback((U,W)=>{a.enableDragging&&(W.stopPropagation(),m(U));},[a.enableDragging]),z=useCallback(U=>{if(!d||!l.current)return;let E=l.current.getBoundingClientRect(),Pe=(U.clientX-E.left-y.x)/h,J=(U.clientY-E.top-y.y)/h;p(de=>de.map(R=>R.id===d?{...R,x:Pe,y:J,fx:Pe,fy:J}:R));},[d,h,y]),L=useCallback(()=>{m(null);},[]),N=useCallback((U,W)=>{W.stopPropagation(),i?.({type:"node-click",node:U,position:{x:W.clientX,y:W.clientY}});},[i]),D=useCallback((U,W)=>{W.stopPropagation(),i?.({type:"edge-click",edge:U,position:{x:W.clientX,y:W.clientY}});},[i]),S=useCallback(U=>{let W=u.find(E=>E.id===U);return W?{x:W.x,y:W.y}:{x:0,y:0}},[u]),V=useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let W=U.card.priority;return W==="URGENT"?"#ef4444":W==="HIGH"?"#f59e0b":W==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:g("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.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:o.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:()=>x(U=>Math.min(U+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Sp(U)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Ch(U)," ",Ep(U)]})]},U))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:z,onMouseUp:L,onMouseLeave:L,children:[jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let W=S(typeof U.source=="string"?U.source:U.source.id),E=S(typeof U.target=="string"?U.target:U.target.id),Pe=Th(U.type),J=b===U.id,de=U.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",J&&"hovered",de&&"critical"),onMouseEnter:()=>w(U.id),onMouseLeave:()=>w(null),onClick:R=>D(U,R),children:[jsx("line",{x1:W.x,y1:W.y,x2:E.x,y2:E.y,stroke:Sp(U.type),strokeWidth:de?a.edgeWidth*2:a.edgeWidth,strokeOpacity:J?1:.6,markerEnd:Pe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&J&&jsx("text",{x:(W.x+E.x)/2,y:(W.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ep(U.type)})]},U.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(U=>{let W=f===U.id,E=U.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",W&&"hovered",E&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:Pe=>M(U.id,Pe),onMouseEnter:()=>v(U.id),onMouseLeave:()=>v(null),onClick:Pe=>N(U,Pe),children:[jsx("circle",{r:E?a.nodeSize*1.2:a.nodeSize,fill:V(U),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:W?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 Eh({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:n,isLoading:r}){let[s,o]=useState(""),[i,c]=useState(false),[l,u]=useState(null),[p,d]=useState(null),m=useRef(null),f=i||r;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let h=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let v=()=>{f||(o(""),u(null),d(null),t());},b=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let h=await n(s.trim());d(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},w=()=>{p&&(a(p),v());};return e?jsxs(Fa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),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-[#00E5CC]",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:v,disabled:f,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:p?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!"})]}),p.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((h,x)=>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},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((h,x)=>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-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},x)),p.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.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:m,value:s,onChange:h=>o(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-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,x)=>jsx("button",{onClick:()=>o(h),disabled:f,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},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:v,disabled:f,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"}),p?jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:b,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Mp={"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 hT={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},yT={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 xT(e,t,a){let n=Mp[e];if(!n)throw new Error(`Unknown model: ${e}`);let r=t/1e3*n.costPer1kInput,s=a/1e3*n.costPer1kOutput;return r+s}function fl(e){return `$${e.toFixed(4)}`}var Pp=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=xT(t.model,t.inputTokens,t.outputTokens),n={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(n),this.listeners.forEach(r=>r(n)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),n}getStats(t){let a=this.operations;t&&(a=a.filter(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let n=a.length,r=a.reduce((p,d)=>p+d.cost,0),s=a.reduce((p,d)=>p+d.inputTokens,0),o=a.reduce((p,d)=>p+d.outputTokens,0),i=a.filter(p=>p.success),c=a.reduce((p,d)=>p+d.duration,0),l={},u={};return a.forEach(p=>{l[p.feature]=(l[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:n,totalCost:r,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:l,costsByFeature:u,averageDuration:n>0?c/n:0,successRate:n>0?i.length/n:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let r={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let i=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,r-i),l=i/r*100;return {used:i,limit:r,remaining:c,percentUsed:l,isExceeded:i>=r}}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)}},Bs=new Pp;function Fh({isOpen:e,onClose:t,planTier:a="hobby"}){let[n,r]=useState(Bs.getStats()),[s,o]=useState(Bs.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{r(Bs.getStats()),o(Bs.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=Bs.getRecentOperations(5);return jsxs(Fa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/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:fl(n.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-[#00E5CC] mt-1",children:n.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:(n.totalInputTokens+n.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[n.totalInputTokens.toLocaleString()," in /"," ",n.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:[(n.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",n.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(n.operationsByFeature).map(([c,l])=>{let u=n.costsByFeature[c]||0,p=n.totalOperations>0?l/n.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:fl(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:fl(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Ih({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:n,isLoading:r,projectName:s}){let[o,i]=useState(""),[c,l]=useState(""),[u,p]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[b,w]=useState(null),[h,x]=useState(null),y=useRef(null),k=d||r;useEffect(()=>{e&&y.current&&y.current.focus();},[e]),useEffect(()=>{let D=S=>{S.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,k]);let M=()=>{k||(i(""),l(""),p(""),v(null),w(null),x(null),t());},z=async()=>{if(!(!o.trim()||k)){m(true),v(null),w(null),x(null);try{let D=await n({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});w(D.tasks.tasks),x({from_cache:D.from_cache,tokens_used:D.tokens_used,mock_mode:D.mock_mode,similarity:D.similarity,tokens_saved:D.tokens_saved});}catch(D){v(D instanceof Error?D.message:"Failed to generate tasks");}finally{m(false);}}},L=()=>{b&&(a(b),M());};if(!e)return null;let N=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(Fa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),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:D=>D.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-[#00E5CC]",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:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:b?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-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",N,"% 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:[b.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((D,S)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",S+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:D.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"})]}),D.start," \u2192 ",D.end]}),jsxs("span",{children:[D.duration," days"]}),D.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",D.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${D.priority==="high"?"bg-red-500/20 text-red-400":D.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:D.priority})]})},D.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:y,value:o,onChange:D=>i(D.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-[#00E5CC]/50 transition-all resize-none",disabled:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:D=>l(D.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-[#00E5CC]/50 transition-all",disabled:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:D=>p(D.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-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((D,S)=>jsx("button",{onClick:()=>i(D),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:D},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:M,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),b?jsx("button",{onClick:L,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:z,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function nd({initialBoard:e,onPersist:t}){let[a,n]=useState(e),r=useCallback(b=>{t&&El(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,h,x)=>{console.warn(`Retry attempt ${h} after ${x}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),s=useCallback(async(b,w,h)=>{n(x=>{let y=x.cards.find(D=>D.id===b);if(!y)return x;let k=y.columnId,M={...y,columnId:w,position:h},z=x.cards.map(D=>D.id===b?M:D),L=x.columns.map(D=>{if(D.id===k)return {...D,cardIds:D.cardIds.filter(S=>S!==b)};if(D.id===w){let S=z.filter(V=>V.columnId===w).sort((V,U)=>V.position-U.position);return {...D,cardIds:S.map(V=>V.id)}}return D}),N={...x,cards:z,columns:L};return r(N),N});},[r]),o=useCallback(async(b,w)=>{n(h=>{let x=h.cards.map(k=>k.id===b?{...k,...w}:k),y={...h,cards:x};return r(y),y});},[r]),i=useCallback(async b=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;n(h=>{let x={...b,id:w},y=h.columns.map(M=>M.id===b.columnId?{...M,cardIds:[...M.cardIds,w]}:M),k={...h,cards:[...h.cards,x],columns:y};return r(k),k});},[r]),c=useCallback(async b=>{n(w=>{let h=w.cards.find(M=>M.id===b);if(!h)return w;let x=w.cards.filter(M=>M.id!==b),y=w.columns.map(M=>M.id===h.columnId?{...M,cardIds:M.cardIds.filter(z=>z!==b)}:M),k={...w,cards:x,columns:y};return r(k),k});},[r]),l=useCallback(async b=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;n(h=>{let x={...b,id:w,cardIds:[]},y={...h,columns:[...h.columns,x]};return r(y),y});},[r]),u=useCallback(async(b,w)=>{n(h=>{let x=h.columns.map(k=>k.id===b?{...k,...w}:k),y={...h,columns:x};return r(y),y});},[r]),p=useCallback(async b=>{n(w=>{let h=w.cards.filter(k=>k.columnId!==b),x=w.columns.filter(k=>k.id!==b),y={...w,cards:h,columns:x};return r(y),y});},[r]),d=useCallback(b=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(b),w},[i]),m=useCallback(b=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),w},[l]),f=useCallback(()=>{n(b=>{let w={...b,cards:[],columns:[]};return r(w),w});},[r]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:u,onColumnDelete:p},setBoard:n,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Bh({initialData:e,availableUsers:t=[],onSave:a}){let{board:n,callbacks:r,helpers:s}=nd({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,l,u={})=>{s.addCard({title:l,columnId:c,position:n.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,l)=>{let u=n.columns.length>0?Math.max(...n.columns.map(p=>p.position)):0;s.addColumn({title:c,position:l??u+1e3});},reset:s.clearBoard}),[n.cards,n.columns,s]);return {props:useMemo(()=>({board:n,callbacks:r,availableUsers:t}),[n,r,t]),board:n,callbacks:r,utils:o}}var bl={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Oh={by:"none",order:"asc"};function Hh({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[n,r]=useState({...bl,...e}),[s,o]=useState({...Oh,...t}),i=useCallback(v=>{r(b=>({...b,...v}));},[]),c=useCallback(v=>{o(b=>({...b,...v}));},[]),l=useCallback(()=>{r(bl),o(Oh);},[]),u=useCallback(()=>{a&&r({...bl,assignees:[a]});},[a]),p=useCallback(()=>{r({...bl,dateFilter:"overdue"});},[]),d=useCallback(()=>{r({...bl,priorities:["HIGH","URGENT"]});},[]),m=useMemo(()=>n.dateFilter!=="all"||n.priorities.length>0||n.assignees.length>0||n.labels.length>0||n.columns.length>0||n.search!==""||s.by!=="none",[n,s]),f=useCallback(v=>{let b=[...v];if(n.search){let w=n.search.toLowerCase();b=b.filter(h=>h.title.toLowerCase().includes(w)||h.description?.toLowerCase().includes(w));}if(n.dateFilter!=="all"){let w=new Date,h=w.getFullYear(),x=String(w.getMonth()+1).padStart(2,"0"),y=String(w.getDate()).padStart(2,"0"),k=`${h}-${x}-${y}`;b=b.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let z=M.endDate||M.dueDate;if(!z)return false;let L;if(typeof z=="string")L=z.split("T")[0]||z;else {let N=z.getUTCFullYear(),D=String(z.getUTCMonth()+1).padStart(2,"0"),S=String(z.getUTCDate()).padStart(2,"0");L=`${N}-${D}-${S}`;}switch(n.dateFilter){case "overdue":return L<k;case "today":return L===k;case "this-week":let N=new Date(k+"T00:00:00"),D=new Date(L+"T00:00:00"),S=new Date(N);return S.setDate(S.getDate()+7),D>=N&&D<=S;case "custom":if(n.dateRange){let V=typeof z=="string"?new Date(z):z;return V>=n.dateRange.start&&V<=n.dateRange.end}return true;default:return true}});}return n.priorities.length>0&&(b=b.filter(w=>w.priority&&n.priorities.includes(w.priority))),n.assignees.length>0&&(b=b.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(x=>n.assignees.includes(x)))),n.labels.length>0&&(b=b.filter(w=>w.labels&&w.labels.some(h=>n.labels.includes(h)))),n.columns.length>0&&(b=b.filter(w=>n.columns.includes(w.columnId))),s.by!=="none"&&b.sort((w,h)=>{let x=0;switch(s.by){case "created":let y=w.createdAt?new Date(w.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;x=y-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},z=M[w.priority||"LOW"],L=M[h.priority||"LOW"];x=z-L;break;case "dueDate":let N=w.endDate||w.dueDate,D=h.endDate||h.dueDate;if(!N)return 1;if(!D)return -1;let S=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof D=="string"?new Date(D).getTime():D.getTime();x=S-V;break;case "title":x=w.title.localeCompare(h.title);break;case "estimate":let U=w.estimatedTime||0,W=h.estimatedTime||0;x=U-W;break;default:x=0;}return s.order==="asc"?x:-x}),b},[n,s]);return {filters:n,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var zh,Uh;if(typeof window<"u")try{let e=Dl("ai");zh=e.generateObject,Uh=e.generateText;}catch{}function jh(e={}){let[t,a]=useState(false),[n,r]=useState(null),s=!!(zh&&Uh&&e.apiKey),o=useCallback(async p=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),r(null);try{return console.log("Generating plan for:",p),{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: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw r(m),m}finally{a(false);}},[s]),i=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),r(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw r(m),m}finally{a(false);}},[s]),c=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),r(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(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw r(m),m}finally{a(false);}},[s]),l=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),r(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw r(m),m}finally{a(false);}},[s]),u=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),r(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw r(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:u,isAvailable:s,isLoading:t,error:n}}function Lp(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(r=>{t(r);}),[]);let a=useCallback(n=>{selectionStore.setState(n);},[]);return [e,a]}function Vh(e){let{cards:t}=e,[a,n]=Lp(),r=useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=useCallback((p,d)=>{if(!d){n({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(p)?n({selectedCardIds:a.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:a.lastSelectedCardId}):n({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let v=t.find(w=>w.id===p),b=t.find(w=>w.id===a.lastSelectedCardId);if(v&&b&&v.columnId===b.columnId){let w=t.filter(L=>L.columnId===v.columnId).sort((L,N)=>L.position-N.position),h=w.findIndex(L=>L.id===a.lastSelectedCardId),x=w.findIndex(L=>L.id===p),[y,k]=h<x?[h,x]:[x,h],M=w.slice(y,k+1).map(L=>L.id),z=Array.from(new Set([...a.selectedCardIds,...M]));n({selectedCardIds:z,lastSelectedCardId:p});}else n({selectedCardIds:[p],lastSelectedCardId:p});}else n({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,n]),o=useCallback(p=>{n({selectedCardIds:a.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,n]),i=useCallback(()=>{n({selectedCardIds:[],lastSelectedCardId:null});},[n]),c=useCallback(()=>{n({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,n]),l=useCallback(p=>{a.selectedCardIds.includes(p)?o(p):n({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,o,n]),u=useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:r,selectCard:s,deselectCard:o,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:u}}var Gh={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function _h(e){let{cards:t,config:a,aiService:n}=e,r=useMemo(()=>({...Gh,...a}),[a]),[s,o]=useState([]),i=useCallback((v,b,w,h,x)=>{if(b.length<r.minCardsPerStack){console.warn(`Cannot create stack: minimum ${r.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:b,columnId:w,strategy:h,color:x,isExpanded:true,position:s.filter(k=>k.columnId===w).length,createdAt:new Date};o(k=>[...k,y]);},[r.minCardsPerStack,s]),c=useCallback(v=>{o(b=>b.filter(w=>w.id!==v));},[]),l=useCallback(v=>{o(b=>b.map(w=>w.id===v?{...w,isExpanded:!w.isExpanded}:w));},[]),u=useCallback((v,b)=>{o(w=>w.map(h=>h.id===v&&!h.cardIds.includes(b)?{...h,cardIds:[...h.cardIds,b]}:h));},[]),p=useCallback((v,b)=>{o(w=>w.map(h=>{if(h.id===v){let x=h.cardIds.filter(y=>y!==b);return x.length<r.minCardsPerStack?null:{...h,cardIds:x}}return h}).filter(h=>h!==null));},[r.minCardsPerStack]),d=useCallback(v=>s.filter(b=>b.columnId===v).sort((b,w)=>b.position-w.position),[s]),m=useCallback(async v=>{let b=t.filter(k=>k.columnId===v);if(b.length<r.minCardsPerStack*2)return [];let w=[],h=new Map;b.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{h.has(M)||h.set(M,[]),h.get(M).push(k);});}),h.forEach((k,M)=>{k.length>=r.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(z=>z.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;b.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.forEach((k,M)=>{k.length>=r.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(z=>z.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(b.forEach(k=>{k.priority&&(y.has(k.priority)||y.set(k.priority,[]),y.get(k.priority).push(k));}),y.forEach((k,M)=>{if(k.length>=r.minCardsPerStack){let z={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";w.push({stack:{title:`${z} ${M} Priority`,cardIds:k.map(L=>L.id),columnId:v,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),n&&r.enableAutoStacking)for(let k of b){let z=(await n.findSimilar(k,b)).filter(L=>L.similarity>=r.autoStackConfidenceThreshold);if(z.length>=r.minCardsPerStack-1){let L=[k.id,...z.map(D=>D.card.id)],N=z.reduce((D,S)=>D+S.similarity,0)/z.length;w.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:L,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${z.length+1} similar tasks`,confidence:N});}}return w.filter(k=>k.confidence>=r.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,r,n]),f=useCallback(v=>{i(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[i]);return useEffect(()=>{r.enableAutoStacking&&s.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let w=await m(b),h=w[0];w.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:r}}var Kh=createContext(null);function qh({children:e,initialData:t,onStateChange:a}){let n=useRef();if(!n.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:l}=Dl("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Dl("@libxai/core");o.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Dl("@libxai/core");i=new c(t.board);}n.current=new BoardStore({board:i,columns:s,cards:o});}let r=n.current;return useEffect(()=>{if(a)return r.subscribeAll(s=>{a(r.getState());})},[r,a]),jsx(Kh.Provider,{value:{store:r},children:e})}function rd(){let e=useContext(Kh);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function yl(){let e=rd(),[t,a]=useState(e.getBoard()),[n,r]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),r(e.getAllColumns()),o(e.getAllCards());}),[e]);let i=useCallback(h=>{e.updateBoard(h);},[e]),c=useCallback(h=>{e.addColumn(h);},[e]),l=useCallback((h,x)=>{e.updateColumn(h,x);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),p=useCallback(h=>e.getColumn(h),[e]),d=useCallback(h=>{e.addCard(h);},[e]),m=useCallback((h,x)=>{e.updateCard(h,x);},[e]),f=useCallback(h=>{e.deleteCard(h);},[e]),v=useCallback((h,x,y)=>{e.moveCard(h,x,y);},[e]),b=useCallback(h=>e.getCard(h),[e]),w=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:n,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:b,getCardsByColumn:w}}function Xh(e){let{cards:t}=yl();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let n=e.searchQuery.toLowerCase(),r=a.title.toLowerCase().includes(n),s=a.description?.toLowerCase().includes(n);if(!r&&!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(r=>a.isAssignedTo(r))||e.labels&&e.labels.length>0&&!e.labels.some(r=>a.hasLabel(r))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Jh(e="position",t="asc"){let{cards:a}=yl();return useMemo(()=>[...a].sort((r,s)=>{let o=0;switch(e){case "title":o=r.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=r.priority?i[r.priority]:0,l=s.priority?i[s.priority]:0;o=c-l;break}case "createdAt":o=r.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=r.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=r.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var od=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Dm.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(n=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,n);}),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,n){this.config.has(t)||this.config.set(t,{});let r=this.config.get(t);r[a]=n,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:n});}async executeHook(t,a,n){let r=n;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let i=await Promise.resolve(o.apply(s,a));i!==void 0&&(r=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return r}async executeHookParallel(t,a){let n=[];for(let r of this.plugins.values()){if(!this.enabled.has(r.id))continue;let s=r[t];typeof s=="function"&&n.push(Promise.resolve(s.apply(r,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${r.id}.${t}`,o,{plugin:r.id,hook:t});}));}await Promise.all(n);}},BT=new od;function Zh({items:e,height:t,estimateSize:a,renderItem:n,className:r="",overscan:s=5,horizontal:o=false,gap:i=0,getItemKey:c}){let l=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:i}),p=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:d,className:r,children:jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let b=c?c(v,f.index):f.index,w={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:w,"data-index":f.index,children:n(v,f.index)},b)})})})}function ey(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 ay({items:e,height:t,width:a="100%",estimateColumnWidth:n,renderColumn:r,className:s="",overscan:o=3,gap:i=16,getItemKey:c,horizontal:l=true}){let u=useRef(null),p=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>n,overscan:o,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:m,className:s,children:jsx("div",{style:f,children:d.map(v=>{let b=e[v.index];if(!b)return null;let w=c?c(b,v.index):v.index,h={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:h,"data-index":v.index,children:r(b,v.index)},w)})})})}function ny(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 ry(e,t=10){return e>t}var Bp={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$p={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Op={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Hp={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Wp={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},zp={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Up={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},jp={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)"},Vp={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)"},Gp={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},_p={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}},Kp={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}},sd={spacing:Bp,borderRadius:$p,fontSize:Op,fontWeight:Hp,lineHeight:Wp,zIndex:zp,duration:Up,easing:jp,shadows:Vp,opacity:Gp,kanban:_p,gantt:Kp};function oy(e,t,a){return e[t]??a}function qp(e,t="",a={}){for(let[n,r]of Object.entries(e)){let s=t?`${t}-${n}`:n;typeof r=="object"&&r!==null&&!Array.isArray(r)?qp(r,s,a):(typeof r=="string"||typeof r=="number")&&(a[s]=r);}return a}function HT(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Yp(e="asakaa"){let t=qp(sd),a=[];for(let[n,r]of Object.entries(t)){let s=`--${e}-${n}`,o=HT(r);a.push(` ${s}: ${o};`);}return `:root {
|
|
415
415
|
${a.join(`
|
|
416
416
|
`)}
|
|
417
|
-
}`}function
|
|
417
|
+
}`}function xl(e,t="asakaa"){let a=[],n=qp(e);for(let[r,s]of Object.entries(n)){let o=`--${t}-color-${r}`;a.push(` ${o}: ${s};`);}return `:root {
|
|
418
418
|
${a.join(`
|
|
419
419
|
`)}
|
|
420
|
-
}`}var
|
|
420
|
+
}`}var id={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},Xp={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},Jp={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function Qp(e=id,t="asakaa"){let a=Yp(t),n=xl(e,t);return `${a}
|
|
421
421
|
|
|
422
|
-
${
|
|
422
|
+
${n}`}function sy(){return `/**
|
|
423
423
|
* ASAKAA Design Tokens
|
|
424
424
|
* Auto-generated from design-tokens.ts
|
|
425
425
|
* Do not edit this file directly
|
|
426
426
|
*/
|
|
427
427
|
|
|
428
|
-
${
|
|
428
|
+
${Qp(id)}
|
|
429
429
|
|
|
430
430
|
/* Light theme */
|
|
431
431
|
[data-theme="light"] {
|
|
432
|
-
${
|
|
432
|
+
${xl(Xp,"asakaa").split(`
|
|
433
433
|
`).slice(1,-1).join(`
|
|
434
434
|
`)}
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
/* Neutral theme */
|
|
438
438
|
[data-theme="neutral"] {
|
|
439
|
-
${
|
|
439
|
+
${xl(Jp,"asakaa").split(`
|
|
440
440
|
`).slice(1,-1).join(`
|
|
441
441
|
`)}
|
|
442
442
|
}
|
|
443
|
-
`}var
|
|
444
|
-
export{
|
|
443
|
+
`}var WT=({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 iy({showLabels:e=true,compact:t=false,className:a=""}){let{theme:n,setTheme:r,themes:s}=Js();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,i])=>{let c=o,l=c===n;return jsxs("button",{onClick:()=>r(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(WT,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
|
|
444
|
+
export{Fh as AIUsageDashboard,yT as AI_FEATURES,Mp as AI_MODELS,Vd as AddCardButton,Hd as AddColumnButton,qs as AttachmentUploader,qh as BoardProvider,Ql as BulkOperationsToolbar,Qd as BurnDownChart,$b as CUSTOM_FIELD_TYPES,fh as CalendarBoard,xo as Card,kh as CardHistoryReplay,vh as CardHistoryTimeline,Dh as CardRelationshipsGraph,cT as CardStack,ou as CardTemplateSelector,bd as CircuitBreaker,js as Column,oc as ColumnManager,Kd as CommandPalette,cu as ConfigMenu,ti as ContextMenu,_i as DEFAULT_SHORTCUTS,Rb as DEFAULT_TABLE_COLUMNS,ru as DEFAULT_TEMPLATES,Pi as DateRangePicker,Li as DependenciesSelector,el as DependencyLine,Zd as DistributionCharts,Nd as EditableColumnTitle,Ks as ErrorBoundary,vf as ExportDropdown,iu as ExportImportModal,lu as FilterBar,u0 as GANTT_AI_SYSTEM_PROMPT,Cc as GanttAIAssistant,l0 as GanttBoard,gs as GanttI18nContext,gc as GanttMilestone,nc as GanttToolbar,Ih as GenerateGanttTasksDialog,Eh as GeneratePlanModal,au as GroupBySelector,Ld as HealthBar,jo as KanbanBoard,$d as KanbanToolbar,Vi as KanbanViewAdapter,nu as KeyboardShortcutsHelp,Ib as ListView,ga as MenuIcons,od as PluginManager,us as PrioritySelector,Ad as ProfitabilityReport,Ui as QuickTaskCreate,hT as RATE_LIMITS,Bb as STANDARD_FIELDS,eu as SwimlaneBoardView,fc as TODOS_LOS_DIAS,Ed as TagBadge,pg as TagList,Vs as TagPicker,cc as TaskBar,bs as TaskDetailModal,d0 as TaskFormModal,lc as TaskGrid,mu as ThemeModal,cf as ThemeProvider,iy as ThemeSwitcher,no as TimeInputPopover,Md as TimePill,Pd as TimePopover,vc as Timeline,Bo as UserAssignmentSelector,Jd as VelocityChart,ay as VirtualGrid,Zh as VirtualList,Bs as aiUsageTracker,$p as borderRadius,Kc as buildCalendar,Sl as calculatePosition,Do as calendarioDe,Mc as cardToGanttTask,y0 as cardsToGanttTasks,g as cn,xc as conflictosDelCronograma,Ug as createKanbanView,My as createRetryWrapper,du as darkTheme,id as darkTokenTheme,ec as defaultTheme,sd as designTokens,Up as duration,jp as easing,ii as empujarSucesoras,Ns as enlacesDe,sy as exportTokensToCSS,Ss as fechasQueCumplen,bc as finConDuracion,Mo as findTaskByName,Op as fontSize,Hp as fontWeight,fl as formatCost,Ai as ganttEnTranslations,_m as ganttEsTranslations,h0 as ganttTaskToCardUpdate,Et as ganttThemes,Kp as ganttTokens,Cd as ganttTranslations,Re as ganttUtils,Yp as generateCSSVariables,Qp as generateCompleteCSS,Dy as generateInitialPositions,p0 as generateTasksContext,xl as generateThemeVariables,Ob as getListViewTheme,Vu as getListViewTranslations,oy as getToken,Km as getTranslations,si as habilDesde,Ds as habilesEntre,_p as kanbanTokens,uu as lightTheme,Xp as lightTokenTheme,yc as limiteDelEnlace,Wp as lineHeight,hp as listViewDarkTheme,Uu as listViewEnTranslations,ju as listViewEsTranslations,yp as listViewLightTheme,xp as listViewNeutralTheme,Gc as listViewThemes,Pc as listViewTranslations,Fc as mergeListViewTranslations,Td as mergeTranslations,pu as neutralTheme,Jp as neutralTokenTheme,Gp as opacity,f0 as parseLocalCommand,Ou as parseNaturalDate,Hu as parseNaturalDuration,Wu as parseProgress,g0 as parseStatus,BT as pluginManager,Ey as retrySyncOperation,El as retryWithBackoff,Vp as shadows,ry as shouldVirtualizeGrid,Zc as simulateReschedule,Bp as spacing,Zo as sumarHabiles,ys as themes,jh as useAI,Bh as useBoard,yl as useBoardCore,rd as useBoardStore,_h as useCardStacking,Rd as useDragState,Xh as useFilteredCards,Hh as useFilters,Un as useGanttI18n,nd as useKanbanState,of as useKeyboardShortcuts,Vh as useMultiSelect,Lp as useSelectionState,Jh as useSortedCards,Js as useTheme,ny as useVirtualGrid,ey as useVirtualList,b0 as validateAIResponse,Gd as withErrorBoundary,Fl as wouldCreateCircularDependency,zp as zIndex};//# sourceMappingURL=index.js.map
|
|
445
445
|
//# sourceMappingURL=index.js.map
|