@libxai/board 1.9.23 → 1.9.25
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 +29 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),
|
|
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 r=Ru(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let c=Ru(t[o]||"");if(c.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-c.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((p,f)=>{i[p]=c[f]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let m=n.get(d),u={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(u),m.cardIds.push(u.id);}catch(c){s.push(`Line ${o+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.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 Ru(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Bu(e,t){switch(t){case "json":return Sb(e);case "csv":return Eb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function $u(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}var Zl=react.createContext(null);function Ou(){return react.useContext(Zl)}var Hu=react.createContext(null);function Uu({children:e,themeName:t}){return jsxRuntime.jsx(Hu.Provider,{value:{themeName:t},children:e})}function vi(){return react.useContext(Hu)}function nr({children:e,container:t}){let[r,a]=react.useState(false),n=Ou(),s=vi();if(react.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:c,themeName:l}=n,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":l,"data-gantt-portal":"true",style:i,children:e}),o)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):reactDom.createPortal(e,o)}var ju={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Bb="#BDC3C7",$b=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function vo({priority:e,onChange:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),i=()=>{if(!l.current)return;let p=l.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=p.right-y;v<10&&(v=p.left),v+y>x-10&&(v=x-y-10);let w=f-p.bottom,C=p.top,M;w>=b+h?M=p.bottom+h:C>=b+h?M=p.top-b-h:M=w>=C?p.bottom+h:Math.max(10,p.top-b-h),o({top:M,left:v}),n(true);};react.useEffect(()=>{let p=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),react.useEffect(()=>{let p=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let d=p=>{t(p),n(false);},m=e?ju[e]:null,u=m?.color||Bb;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:m?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),a&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:c,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:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(ju).map(([p,f])=>jsxRuntime.jsxs("button",{onClick:()=>d(p),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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx($b,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>d(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:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Ob=[{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 Ds({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=react.useState(false),[o,c]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=(vi()?.themeName||"dark")==="dark",p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,M=320,F=380,k=4,N=v.left;N+M>C-10&&(N=C-M-10),N<10&&(N=10);let P=w-v.bottom,D=v.top,K;P>=F+k?K=v.bottom+k:D>=F+k?K=v.top-F-k:K=P>=D?v.bottom+k:Math.max(10,v.top-F-k),c({top:K,left:N}),s(true);};react.useEffect(()=>{let v=w=>{l.current&&!l.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),react.useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,C=N=>{let P=N.getFullYear(),D=String(N.getMonth()+1).padStart(2,"0"),K=String(N.getDate()).padStart(2,"0");return `${P}-${D}-${K}`},M=C(w),F=new Date(w);F.setDate(F.getDate()+v);let k=C(F);r(M,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=F=>{if(F instanceof Date)return F;if(typeof F!="string"||!F.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=F.split("-").map(Number);if(k.length!==3||k.some(K=>isNaN(K)))return null;let N=k[0],P=k[1],D=k[2];return N===void 0||P===void 0||D===void 0?null:new Date(N,P-1,D)},w=v(e),C=v(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[C.getMonth()]} ${C.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n?s(false):p(),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:y?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:l,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:u?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Ob.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>r(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>r(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ko({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[c,l]=react.useState(""),[i,d]=react.useState({top:0,left:0}),m=react.useRef(null),u=react.useRef(null),p=()=>{if(!u.current)return;let h=u.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,C=300,M=380,F=4,k=h.right-C;k<10&&(k=h.left),k+C>w-10&&(k=w-C-10);let N=v-h.bottom,P=h.top,D;N>=M+F?D=h.bottom+F:P>=M+F?D=h.top-M-F:D=N>=P?h.bottom+F:Math.max(10,h.top-M-F),d({top:D,left:k}),o(true);};react.useEffect(()=>{let h=v=>{m.current&&!m.current.contains(v.target)&&!u.current?.contains(v.target)&&(o(false),l(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&(o(false),l(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let v=e.some(w=>w.id===h.id);r(v?e.filter(w=>w.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>s?o(false):p(),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?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[y.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.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:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:m,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:h=>l(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(h=>{let v=e.some(w=>w.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>f(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),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 wi(e,t,r){let a=new Map;e.forEach(l=>{if(l.dependencies&&Array.isArray(l.dependencies)){let i=l.dependencies.map(d=>{if(typeof d=="string")return d;let m=d;return m.taskId||m.targetId||""}).filter(Boolean);a.set(l.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,c=l=>{if(!s.has(l)){s.add(l),o.add(l);let i=a.get(l)||[];for(let d of i){if(!s.has(d)&&c(d))return true;if(o.has(d))return true}}return o.delete(l),false};return c(r)}function Es({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[c,l]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(t.length>0),[p,f]=react.useState({top:0,left:0}),[x,y]=react.useState(null),b=react.useRef(null),h=react.useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,D=300,K=m?380:120,H=4,ee=k.right-D;ee<10&&(ee=k.left),ee+D>P-10&&(ee=P-D-10);let A=N-k.bottom,Ee=k.top,O;A>=K+H?O=k.bottom+H:Ee>=K+H?O=k.top-K-H:O=A>=Ee?k.bottom+H:Math.max(10,k.top-K-H),f({top:O,left:ee}),l(true);};react.useEffect(()=>{if(!c||!h.current)return;let k=h.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,D=300,K=m?380:120,H=4,ee=k.right-D;ee<10&&(ee=k.left),ee+D>P-10&&(ee=P-D-10);let A=N-k.bottom,Ee=k.top,O;A>=K+H?O=k.bottom+H:Ee>=K+H?O=k.top-K-H:O=A>=Ee?k.bottom+H:Math.max(10,k.top-K-H),f({top:O,left:ee});},[m,c]),react.useEffect(()=>{let k=N=>{b.current&&!b.current.contains(N.target)&&!h.current?.contains(N.target)&&(l(false),d(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),react.useEffect(()=>{let k=N=>{N.key==="Escape"&&(l(false),d(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let N=t.includes(k),P=r.find(D=>D.id===k);if(y(null),N){let D=t.filter(K=>K!==k);a(D),D.length===0&&u(false);}else {if(s&&wi(r,k,e)){let K=`Cannot add "${P?.title||k}" as dependency - would create circular reference`;y(K),o?.(k,P?.title||k),setTimeout(()=>y(null),3e3);return}a([...t,k]),u(true);}},C=()=>{let k=!m;u(k),k||a([]);},M=r.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),F=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>c?l(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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:F,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:F},children:t.length})]}),c&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:k=>d(k.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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:M.length===0?jsxRuntime.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(k=>{let N=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>w(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsxRuntime.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&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),u(false),l(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 An=react.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:c=[],allCards:l=[]})=>{let{attributes:i,listeners:d,setNodeRef:m,transform:u,transition:p,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:bi.Transform.toString(u),transition:p};if(t)return jsxRuntime.jsx("div",{ref:m,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let y=c.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:m,style:v,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.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:M=>{M.currentTarget.style.display="none";}}),C===3&&h.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},w.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(vo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ds,{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})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(ko,{assignedUsers:y,availableUsers:c,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Es,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:l,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsxRuntime.jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.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(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));An.displayName="Card";var ki={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"}},tp=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function rp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=react.useState(false),[o,c]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),d=[...Object.entries(ki).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...a.filter(y=>!Object.keys(ki).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let y=ki[e];if(y)return {...y,id:e};let b=a.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ki.todo,id:"todo"}},u=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,w=280,C=4,M=y.right-v;M<10&&(M=y.left),M+v>h-10&&(M=h-v-10);let F=b-y.bottom,k=y.top,N;F>=w+C?N=y.bottom+C:k>=w+C?N=y.top-w-C:N=F>=k?y.bottom+C:Math.max(10,y.top-w-C),c({top:N,left:M}),s(true);};react.useEffect(()=>{let y=b=>{l.current&&!l.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let p=y=>{t(y),s(false);},f=m(),x=f.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>n?s(false):u(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsxRuntime.jsx(tp,{icon:f.icon,color:x})}),n&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:l,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:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>jsxRuntime.jsxs("button",{onClick:()=>p(y.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:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(tp,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var ap={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 np({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=ap[s]||ap.en,[c,l]=react.useState(false),[i,d]=react.useState(false),[m,u]=react.useState(e),[p,f]=react.useState({top:0,left:0}),x=react.useRef(null),y=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(c&&y.current){let C=y.current.getBoundingClientRect();f({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[c]),react.useEffect(()=>{let C=M=>{x.current&&!x.current.contains(M.target)&&!y.current?.contains(M.target)&&(l(false),d(false));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=M=>{M.key==="Escape"&&(l(false),d(false),u(e));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c,e]),react.useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{d(true),u(e);},v=()=>{let C=m.trim();C&&C!==e&&t(C),d(false),l(false),u(e);},w=C=>{C.key==="Enter"?v():C.key==="Escape"&&(d(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>l(!c),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),c&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${p.top}px`,left:`${p.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:C=>u(C.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{r(),l(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var _o=react.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:c,availableUsers:l,allCards:i,enableVirtualization:d,cardHeight:m=120,isCollapsed:u,onToggleCollapse:p,onColumnRename:f,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:w,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),M=react.useRef(null),F=d??Mu(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>m,enabled:F});if(r)return jsxRuntime.jsx("div",{ref:w,className:b,children:r(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let H=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:H}:H>=80?{state:"warning",percentage:H}:H>=60?{state:"approaching",percentage:H}:{state:"ok",percentage:H}})(),D=P.state==="exceeded",K=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g(K()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),P.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),P.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),P.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsxRuntime.jsx(np,{columnTitle:e.title,onRename:H=>f?.(e.id,H),onDelete:x?()=>x(e.id):void 0,isDeletable:y,locale:v}),p&&jsxRuntime.jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!u&&jsxRuntime.jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:F?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(H=>H.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):F?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(H=>{let ee=t[H.index];return ee?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:jsxRuntime.jsx(An,{card:ee,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i})},ee.id):null})}):t.map(H=>jsxRuntime.jsx(An,{card:H,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i},H.id))})})]})});_o.displayName="Column";function nc({title:e,onSave:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let l=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?l():d.key==="Escape"&&(o(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:l,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:g("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function nh(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function dp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(c=>{let l=c.name.toLowerCase(),i=l.replace(/\s+/g,""),d=l.split(/\s+/);return !!(i===s||l===s||d.some(m=>m===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function oh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function sh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var ih=["\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 up({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:c="dark",locale:l="es",currentUser:i,enableEmoji:d=true,enableAttachments:m=true,pendingFiles:u=[],onFilesSelect:p,onRemoveFile:f,maxFileSizeMB:x=10}){let y=c==="dark",[b,h]=react.useState(false),[v,w]=react.useState([]),[C,M]=react.useState(0),[F,k]=react.useState(null),[N,P]=react.useState(false),D=react.useRef(null),K=react.useRef(null),H=react.useRef(null),ee=react.useRef(null),A=react.useCallback((J,De)=>{let oe=nh(J,De);if(k(oe),oe){let Ue=a.filter(Ne=>Ne.name.toLowerCase().includes(oe.query)||Ne.email&&Ne.email.toLowerCase().includes(oe.query)).slice(0,5);w(Ue),h(Ue.length>0),M(0);}else h(false),w([]);},[a]),Ee=J=>{let De=J.target.value;if(t(De),A(De,J.target.selectionStart||0),D.current){D.current.style.height="24px";let oe=D.current.scrollHeight,Ue=280,Ne=Math.min(oe,Ue);D.current.style.height=`${Ne}px`,D.current.style.overflowY=oe>Ue?"auto":"hidden";}},O=()=>{D.current&&A(e,D.current.selectionStart||0);},U=react.useCallback(J=>{if(!F||!D.current)return;let De=e.slice(0,F.start),oe=e.slice(F.end),Ue=`@${J.name.replace(/\s+/g,"")} `,Ne=De+Ue+oe;t(Ne),h(false),k(null),setTimeout(()=>{if(D.current){let Me=F.start+Ue.length;D.current.selectionStart=Me,D.current.selectionEnd=Me,D.current.focus();}},0);},[F,e,t]),R=J=>{if(b&&v.length>0)switch(J.key){case "ArrowDown":J.preventDefault(),M(De=>De<v.length-1?De+1:0);break;case "ArrowUp":J.preventDefault(),M(De=>De>0?De-1:v.length-1);break;case "Enter":{J.preventDefault();let De=v[C];De&&U(De);break}case "Tab":{J.preventDefault();let De=v[C];De&&U(De);break}case "Escape":J.preventDefault(),h(false);break}else J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),r());};react.useEffect(()=>{let J=De=>{K.current&&!K.current.contains(De.target)&&D.current&&!D.current.contains(De.target)&&h(false),ee.current&&!ee.current.contains(De.target)&&P(false);};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[]);let Ae=react.useCallback(J=>{if(!D.current)return;let De=D.current.selectionStart||e.length,oe=e.slice(0,De)+J+e.slice(De);t(oe),P(false),setTimeout(()=>{if(D.current){let Ue=De+J.length;D.current.selectionStart=Ue,D.current.selectionEnd=Ue,D.current.focus();}},0);},[e,t]),Je=react.useCallback(J=>{if(!p||!J.target.files)return;let De=Array.from(J.target.files),oe=x*1024*1024,Ue=De.filter(Ne=>Ne.size>oe?(console.warn(`File ${Ne.name} exceeds max size of ${x}MB`),false):true);Ue.length>0&&p(Ue),J.target.value="";},[p,x]),$e=react.useCallback(J=>J.type.startsWith("image/")?lucideReact.Image:J.type.includes("pdf")||J.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&K.current){let J=K.current.children[C];J&&J.scrollIntoView({block:"nearest"});}},[C,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(J=>{let De=$e(J.file),oe=J.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[oe&&J.preview?jsxRuntime.jsx("img",{src:J.preview,alt:J.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(De,{className:g("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:g("text-xs truncate",y?"text-white":"text-gray-900"),children:J.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:sh(J.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(J.id),className:g("p-0.5 rounded-full transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},J.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>P(!N),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",y?"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:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ee,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",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:ih.map(J=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Ae(J),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:J},J))})})})]}),m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",y?"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:l==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:H,type:"file",multiple:true,onChange:Je,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:D,value:e,onChange:Ee,onSelect:O,onKeyDown:R,placeholder:n||(l==="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",y?"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"}}),jsxRuntime.jsx("button",{onClick:r,disabled:o||!e.trim()&&u.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:K,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",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((J,De)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>U(J),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",De===C?y?"bg-white/10":"bg-gray-100":y?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.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:J.color||"#8B5CF6"},children:oh(J.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:g("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:J.name}),J.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:J.email})]})]},J.id))})})]})]})]})}function pp({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((c,l)=>c.type==="mention"?jsxRuntime.jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:c.value},l):jsxRuntime.jsx("span",{children:c.value},l))})}var Si=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Ko({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[c,l]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(false),[p,f]=react.useState(Si[10]||"#00E5CC"),[x,y]=react.useState({top:0,left:0}),b=react.useRef(null),h=react.useRef(null),v=react.useRef(null),w=react.useRef(null),C=t.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),M=t.some(D=>D.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(c&&h.current){let D=h.current.getBoundingClientRect();y({top:D.bottom+6,left:D.left});}},[c]),react.useEffect(()=>{let D=K=>{let H=K.target,ee=b.current?.contains(H),A=v.current?.contains(H);!ee&&!A&&(l(false),d(""),u(false));};if(c)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[c]),react.useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let F=D=>{let K=e.some(H=>H.id===D.id);r(K?e.filter(H=>H.id!==D.id):[...e,D]);},k=async()=>{if(!(!a||!i.trim())){u(true);try{let D=await a(i.trim(),p);D&&(r([...e,D]),d(""),f(Si[Math.floor(Math.random()*Si.length)]||"#00E5CC"));}finally{u(false);}}},N=(D,K)=>{K.stopPropagation(),r(e.filter(H=>H.id!==D));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&l(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:D=>d(D.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:D=>{D.key==="Enter"&&i.trim()&&!M&&a&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${D.color}20`,color:D.color},onClick:K=>N(D.id,K),children:[D.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},D.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(D=>{let K=e.some(H=>H.id===D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>F(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${D.color}15`:"transparent",color:n.textPrimary},onMouseEnter:H=>{K||(H.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:H=>{K||(H.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:D.name}),K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!M&&a&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Si.map(D=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:p===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:p,color:"#FFFFFF",opacity:m?.7:1},children:[m?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function sc({tag:e,onRemove:t,size:r="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="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&&jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function gp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsxRuntime.jsx(sc,{tag:s,size:r},s.id)),n>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="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 To=[{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 fp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function bh(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 hh({className:e}){return jsxRuntime.jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function ic({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=bh(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"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},l=fp(e.loggedMinutes),i=e.estimateMinutes?fp(e.estimateMinutes):null,d=r&&i?`${l} / ${i}`:l;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(a?"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],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsxRuntime.jsx(hh,{className:c[t]}),jsxRuntime.jsx("span",{children:d})]})}function yh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Mi(e){let t=yh(e);return t!==null?String(t):e}function hp(e){let r=Mi(e).trim().toLowerCase();if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Pi(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function wh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function kh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Ch({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function yp({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Th({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function lc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:c,onStopTimer:l,onDiscardTimer:i,onClose:d,className:m}){let[u,p]=react.useState(""),[f,x]=react.useState(t.estimateMinutes?Pi(t.estimateMinutes):""),[y,b]=react.useState(""),[h,v]=react.useState(false),[w,C]=react.useState(false),M=react.useRef(null);react.useEffect(()=>{M.current?.focus();},[]);let F=async()=>{let P=hp(u);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),p(""),b("");}finally{v(false);}}},k=async()=>{if(!o)return;let P=f.trim()?hp(f):null;await o(P),C(false);},N=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),F()),P.key==="Escape"&&d?.();};return jsxRuntime.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",m),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(yp,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:wh(n)})]}),jsxRuntime.jsx("button",{onClick:l,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Ch,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(yp,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:c,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:[jsxRuntime.jsx(kh,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(Th,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:M,type:"text",value:u,onChange:P=>p(P.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")})]}),jsxRuntime.jsx("button",{onClick:F,disabled:h||!u.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"})]}),jsxRuntime.jsx("input",{type:"text",value:y,onChange:P=>b(P.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")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Pi(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:f,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&k(),P.key==="Escape"&&C(false);},onBlur:k,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"})}):jsxRuntime.jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Pi(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.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,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.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)}%`}})})]})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(P=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Pi(P.durationMinutes)})]},P.id))})]})]})}function Mh(e){let r=Mi(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Ph(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function wn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[c,l]=react.useState(Ph(a)),[i,d]=react.useState(""),[m,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{p.current?.focus();},[]);let f=async()=>{u(true);let v=Mh(c);await n(v&&v>0?v:null,i||void 0),u(false);},x=async()=>{u(true),await n(null),u(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxRuntime.jsxs("div",{className:g("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:p,type:"text",value:c,onChange:v=>l(v.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:m||!c.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:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:m?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),a&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Fh(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 Lh(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 dc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Fh(e.health),s=Lh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},c=e.progressPercent??0,l=Math.min(100,c),i=c>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsxRuntime.jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsxRuntime.jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${l}%`}}),i&&jsxRuntime.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&&jsxRuntime.jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[c,"%"]})]})}function qo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function Ih(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 Rh(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 Bh(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 $h({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",c=r?"text-[#9CA3AF]":"text-gray-500",l=r?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-1",c),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:g("text-2xl font-bold",n),children:[a?"+":"",qo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:g("text-xs mt-1",c),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",c),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",c),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:qo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:qo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.totalTasksWithEstimate})]})]})]})]})}function Oh({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",c=r?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:g("border-b",s,a&&g("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:g("text-xs mt-1",c),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?qo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:qo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":c),children:[n,qo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":c),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Rh(e.status,r),Ih(e.status,r)),children:Bh(e.status,t)})})]})}function uc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",c=o?"bg-[#050505]":"bg-gray-50",l=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",u=o?"bg-[#050505]/50":"bg-gray-50",p=react.useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:g("space-y-6 p-6",c,n),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:g("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",m),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx($h,{summary:e.summary,locale:r,isDark:o}),jsxRuntime.jsx("div",{className:g("rounded-lg border overflow-hidden",l,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:u,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",i),children:p.map(f=>jsxRuntime.jsx(Oh,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",m),children:r==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Yo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Qh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Ep(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function Zh(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 No({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:c=[],availableTags:l=[],onCreateTag:i,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:u,availableTasks:p=[],comments:f=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:M=false,timerElapsedSeconds:F=0,onTimeLog:k,onEstimateUpdate:N,onSoldEffortUpdate:P,onTimerStart:D,onTimerStop:K,onTimerDiscard:H,blurFinancials:ee=false}){let A=s==="dark",Ee={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)"},O=e&&"title"in e&&!("name"in e),U=e,[R,Ae]=react.useState(e?Ep(e,c):null),[Je,$e]=react.useState(false),[J,De]=react.useState(false),[oe,Ue]=react.useState(false),[Ne,Me]=react.useState(null),[Re,Qe]=react.useState(new Date),[ie,et]=react.useState(false),[Ve,Oe]=react.useState(false),[ut,pt]=react.useState(""),[Ge,Pe]=react.useState(false),[ot,$t]=react.useState(false),[Be,st]=react.useState(false),[L,X]=react.useState(false),[B,Y]=react.useState(""),re=react.useRef(null),he=react.useRef(null),[qe,j]=react.useState(""),ye=react.useRef(null),[Fe,Ie]=react.useState(""),[Ct,Ze]=react.useState(false),[Tt,ft]=react.useState([]),[zt,rr]=react.useState(""),[da,Vt]=react.useState(false),gr=react.useRef(null);react.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 T=Ep(e,c);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),Ae(T),Y(T.description||""),j(T.name||"");}},[e?.id,e?.quotedMinutes,c,t]),react.useEffect(()=>{if(!t||!B)return;let T=setTimeout(()=>{let W=he.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,B]),react.useEffect(()=>()=>{re.current&&clearTimeout(re.current),ye.current&&clearTimeout(ye.current);},[]),react.useEffect(()=>{t&&gr.current&&f.length>0&&setTimeout(()=>{gr.current&&(gr.current.scrollTop=gr.current.scrollHeight);},100);},[t,f.length]);let Bt=react.useCallback(T=>{Ae(T),O&&n&&U?n(Zh(T,U)):a&&a(T);},[O,U,n,a]),_r=react.useCallback(()=>{$e(false),De(false),Ue(false),Me(null),Oe(false),pt(""),Pe(false);},[]),jt=react.useCallback((T,W)=>{if(!R)return;let pe={...R,[T]:W};Bt(pe);},[R,Bt]),Qt=react.useCallback(()=>{let T=he.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),zr=react.useCallback(T=>{Y(T),setTimeout(Qt,0),re.current&&clearTimeout(re.current),re.current=setTimeout(()=>{if(R){let W={...R,description:T};Bt(W);}},800);},[R,Bt,Qt]),ua=react.useCallback(T=>{j(T),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{if(R&&T.trim()){let W={...R,name:T.trim()};Bt(W);}},800);},[R,Bt]),rt=react.useCallback(T=>{let W=T.map(pe=>{let _={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(_.preview=URL.createObjectURL(pe)),_});ft(pe=>[...pe,...W]);},[]),Ke=react.useCallback(T=>{ft(W=>{let pe=W.find(_=>_.id===T);return pe?.preview&&URL.revokeObjectURL(pe.preview),W.filter(_=>_.id!==T)});},[]),ba=react.useCallback(async()=>{if(!(!R||!Fe.trim()&&Tt.length===0||!x)){Ze(true);try{let T=dp(Fe,b),W=[];if(Tt.length>0&&h){let pe=Tt.map(_=>_.file);W=await h(pe);}await x(R.id,Fe.trim(),T.length>0?T:void 0,W.length>0?W:void 0),Ie(""),Tt.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),ft([]);}finally{Ze(false);}}},[R,Fe,Tt,x,b,h]),ir=react.useCallback(()=>{if(!R||!zt.trim())return;let T=R.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:zt.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},pe=[...T,W],_={...R,subtasks:pe};Bt(_),rr(""),Vt(false);},[R,zt,Bt]),Qr=react.useCallback(T=>{if(!R?.subtasks)return;let W=R.subtasks.map(_=>_.id===T?{..._,progress:_.progress===100?0:100}:_),pe={...R,subtasks:W};Bt(pe);},[R,Bt]),fr=react.useCallback(T=>{if(!R?.subtasks)return;let W=R.subtasks.filter(_=>_.id!==T),pe={...R,subtasks:W};Bt(pe);},[R,Bt]),Ca=react.useCallback(T=>{let W=typeof T=="string"?new Date(T):T,_=new Date().getTime()-W.getTime(),ve=Math.floor(_/6e4),it=Math.floor(_/36e5),ae=Math.floor(_/864e5);return ve<1?o==="es"?"Ahora":"Just now":ve<60?o==="es"?`Hace ${ve} min`:`${ve}m ago`:it<24?o==="es"?`Hace ${it}h`:`${it}h ago`:ae<7?o==="es"?`Hace ${ae}d`:`${ae}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),ce=react.useCallback(T=>{if(!R)return;let W=R.progress||0;T==="completed"?W=100:T==="in-progress"&&W===0?W=10:T==="todo"&&(W=0);let pe={...R,status:T,progress:W};Bt(pe),$e(false);},[R,Bt]),ue=react.useCallback((T,W)=>{if(!R)return;let pe={...R,startDate:T,endDate:W};Bt(pe);},[R,Bt]),mt=react.useCallback(()=>{let T=Re.getFullYear(),W=Re.getMonth(),pe=new Date(T,W,1),ve=new Date(T,W+1,0).getDate(),it=pe.getDay(),ae=[],lt=new Date(T,W,0).getDate();for(let Mt=it-1;Mt>=0;Mt--)ae.push({date:new Date(T,W-1,lt-Mt),isCurrentMonth:false});for(let Mt=1;Mt<=ve;Mt++)ae.push({date:new Date(T,W,Mt),isCurrentMonth:true});let bt=42-ae.length;for(let Mt=1;Mt<=bt;Mt++)ae.push({date:new Date(T,W+1,Mt),isCurrentMonth:false});return ae},[Re]),V=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),st(false),!R||!m)return;let W=Array.from(T.dataTransfer.files);if(W.length!==0){X(true);try{await m(R.id,W);}finally{X(false);}}},[R,m]),fe=react.useCallback(async T=>{if(!R||!m||!T.target.files)return;let W=Array.from(T.target.files);if(W.length!==0){X(true);try{await m(R.id,W);}finally{X(false);}T.target.value="";}},[R,m]),Q=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),st(true);},[]),$=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),st(false);},[]),te=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),xe=react.useCallback(T=>T.startsWith("image/")?lucideReact.Image:T.includes("pdf")||T.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!R?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.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"]}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=R.progress===100?0:100,pe={...R,progress:T,status:T===100?"completed":"todo"};Bt(pe);},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&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:qe,onChange:T=>ua(T.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")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{_r(),$e(!Je);},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"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(false)}),jsxRuntime.jsx(framerMotion.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(T=>jsxRuntime.jsxs("button",{onClick:()=>ce(T.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===T.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{_r(),Ue(!oe);},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?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((T,W)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},W)),R.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(false)}),jsxRuntime.jsx(framerMotion.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:c.length>0?c.map(T=>{let W=R.assignees?.some(pe=>pe.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let pe=R.assignees||[],_;W?_=pe.filter(ve=>ve.name!==T.name):_=[...pe,T],jt("assignees",_);},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",W&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.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:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g("flex-1",A?"text-white":"text-gray-900"),children:T.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsxRuntime.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"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Me(Ne?null:"start"),Qe(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"),jsxRuntime.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")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Me(null)}),jsxRuntime.jsxs(framerMotion.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:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,W=new Date(T);W.setDate(T.getDate()+1);let pe=new Date(T);pe.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let _=new Date(T);_.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let ve=new Date(T);ve.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let it=new Date(T);it.setDate(T.getDate()+14);let ae=new Date(T);return ae.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:W,display:W.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:_,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ve,display:ve.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:it,display:it.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:ae,display:ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Mt)=>jsxRuntime.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(Ne==="start"){let br=R.endDate&&bt.date>R.endDate?bt.date:R.endDate;ue(bt.date,br),Me("end");}else {let br=R.startDate&&bt.date<R.startDate?bt.date:R.startDate;ue(br,bt.date),Me(null);}},children:[jsxRuntime.jsx("span",{children:bt.label}),jsxRuntime.jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Mt))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ue(void 0,void 0),Me(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:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.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:Ne==="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"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",A?"text-white":"text-gray-900"),children:Re.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>Qe(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"}),jsxRuntime.jsx("button",{onClick:()=>Qe(new Date(Re.getFullYear(),Re.getMonth()-1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>Qe(new Date(Re.getFullYear(),Re.getMonth()+1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.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(T=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:mt().map((T,W)=>{let pe=T.date.toDateString()===new Date().toDateString(),_=R.startDate?.toDateString()===T.date.toDateString(),ve=R.endDate?.toDateString()===T.date.toDateString(),it=_||ve,ae=R.startDate&&R.endDate&&T.date>=R.startDate&&T.date<=R.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let lt=new Date(T.date);if(Ne==="start"){let bt=R.endDate&<>R.endDate?lt:R.endDate;ue(lt,bt),Me("end");}else {let bt=R.startDate&<<R.startDate?lt:R.startDate;ue(bt,lt),Me(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(A?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",_&&"bg-[#00E5CC] text-white",ve&&!_&&"bg-[#7C3AED] text-white",ae&&!it&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!it&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},W)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{_r(),De(!J);},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"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>De(false)}),jsxRuntime.jsx(framerMotion.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(T=>jsxRuntime.jsxs("button",{onClick:()=>{jt("priority",T.id),De(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===T.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.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"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ie?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:T=>{let W=parseInt(T.target.value),pe=R.status;W===100?pe="completed":W>0?pe="in-progress":pe="todo";let _={...R,progress:W,status:pe};Bt(_);},onBlur:()=>et(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}):jsxRuntime.jsx("button",{onClick:()=>et(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:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.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"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsxRuntime.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?Yo(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>$t("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:Yo(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>$t("estimate"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot==="estimate"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:"estimate",locale:o,isDark:A,currentValue:w?.estimateMinutes||null,onSave:async T=>{await N?.(R.id,T),$t(false);},onClose:()=>$t(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.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"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ee?jsxRuntime.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?jsxRuntime.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?Yo(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>$t("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:Yo(R.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>$t("quoted"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot==="quoted"&&!ee&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:"quoted",locale:o,isDark:A,currentValue:R.quotedMinutes||null,onSave:async T=>{P?(await P(R.id,T),Ae(W=>W?{...W,quotedMinutes:T}:null)):jt("quotedMinutes",T),$t(false);},onClose:()=>$t(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsxRuntime.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:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxRuntime.jsxs("button",{type:"button",onClick:()=>K?.(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:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),Qh(F||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>D?.(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:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>$t("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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:[Yo(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",Yo(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.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)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot==="log"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:"log",locale:o,isDark:A,currentValue:null,onSave:async(T,W)=>{T&&await k?.(R.id,{durationMinutes:T,note:W,source:"manual"}),$t(false);},onClose:()=>$t(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Ko,{selectedTags:R.tags||[],availableTags:l,onChange:T=>{jt("tags",T);},onCreateTag:i,theme:Ee})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(T=>{let W=p.find(pe=>pe.id===T);return jsxRuntime.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:[W?.name||T.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let pe=(R.dependencies||[]).filter(_=>_!==T);jt("dependencies",pe);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{_r(),Oe(!Ve);},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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Oe(false),pt("");}}),jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx("div",{className:g("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ut,onChange:T=>pt(T.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})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:p.length>0?p.filter(T=>T.id!==R.id).filter(T=>ut===""||T.name.toLowerCase().includes(ut.toLowerCase())).map(T=>{let W=R.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let pe=R.dependencies||[],_;W?_=pe.filter(ve=>ve!==T.id):_=[...pe,T.id],jt("dependencies",_);},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",W&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",W?"bg-[#00E5CC] border-[#00E5CC]":A?"border-white/30":"border-gray-300"),children:W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:g("block truncate",A?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.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"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{_r(),Pe(!Ge);},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:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:R.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:To.find(T=>T.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:To.map(T=>{let W=R.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{jt("color",T.value),Pe(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:W?T.value:void 0},title:T.name,children:W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:T=>jt("isMilestone",T.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")}),jsxRuntime.jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:he,value:B,onChange:T=>zr(T.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")})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.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&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(T=>T.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((T,W)=>(T.position??0)-(W.position??0)).map(T=>jsxRuntime.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:[jsxRuntime.jsx("button",{onClick:()=>Qr(T.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",T.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:T.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:g("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("button",{onClick:()=>fr(T.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:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),da?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:zt,onChange:T=>rr(T.target.value),onKeyDown:T=>{T.key==="Enter"&&zt.trim()?ir():T.key==="Escape"&&(Vt(false),rr(""));},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]")}),jsxRuntime.jsx("button",{onClick:ir,disabled:!zt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",zt.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"}),jsxRuntime.jsx("button",{onClick:()=>{Vt(false),rr("");},className:g("p-2 rounded-lg transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>Vt(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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:d.map(T=>{let W=xe(T.type),pe=T.type.startsWith("image/");return jsxRuntime.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:[pe&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(W,{className:g("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:te(T.size)})]}),u&&jsxRuntime.jsx("button",{onClick:()=>u(T.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:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:Q,onDragLeave:$,onDrop:V,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Be?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:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||L}),L?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:g("w-6 h-6 mx-auto mb-2",Be?"text-[#00E5CC]":A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:Be?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!m&&jsxRuntime.jsx("p",{className:g("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.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:[jsxRuntime.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:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Fb=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Fb__default=/*#__PURE__*/_interopDefault(Fb);var hi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var yi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [yi.Translate.toString(e),yi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function xi(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 Db(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function Ql(e,t){return e.length===0?1e3:t===0?xi(null,e[0].position):t>=e.length?xi(e[e.length-1].position,null):xi(e[t-1].position,e[t].position)}function Au(e,t=100){return e>t}var Sb=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 Eb(e,t,r,a){let n=t*Math.pow(r,e-1),s=n*.2*Math.random();return Math.min(n+s,a)}async function vi(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Sb,onRetry:c}=t,l,i=0;for(let d=1;d<=r;d++){i=d;try{return {data:await e(),attempts:i,success:!0}}catch(m){if(l=m,d===r||!o(l,d))return {error:l,attempts:i,success:false};let p=Eb(d,a,n,s);if(c)try{c(l,d,p);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,p));}}return {error:l||new Error("Unknown error"),attempts:i,success:false}}function Mb(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function Pb(e,t={}){return async(...r)=>vi(()=>e(...r),t)}var Zl=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;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 r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}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 Iu=(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))(Iu||{}),vo=class vo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:s,...o}=t,c=`[${r}] [${a}] [${s}]`,l=Object.keys(o).length>0;switch(a){case "DEBUG":console.debug(c,n,l?o:"");break;case "INFO":console.info(c,n,l?o:"");break;case "WARN":console.warn(c,n,l?o:"");break;case "ERROR":console.error(c,n,l?o:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...vo.globalOptions};}static configure(t){vo.globalOptions={...vo.globalOptions,...t};}child(t){return new vo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new wi((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new wi(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Iu[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};vo.globalOptions={};var ec=vo,wi=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Ru=new ec;function Lb(e,t){let r={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(r,null,2)}function Ab(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(s=>{let o=e.columns.find(c=>c.id===s.columnId);return [s.id,tc(s.title),tc(s.description||""),tc(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [r.join(","),...a.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function Ib(e,t,r){let a=t;if(!a){let o=document.querySelector(".asakaa-board");o&&(a=o.parentElement||o);}if(a)try{let o=await Fb__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),c=o.toDataURL("image/png"),l=297,i=210,d=o.width/o.height,m=l-20,u=m/d;u>i-20&&(u=i-20,m=u*d);let p=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});p.setFontSize(16),p.setTextColor(255,255,255),p.setFillColor(10,10,10),p.rect(0,0,l,15,"F"),p.text(e.title||"Kanban Board",10,10);let f=(l-m)/2;return p.addImage(c,"PNG",f,20,m,u),p}catch(o){console.error("Error capturing board:",o);}let n=new jspdf.jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let c=e.cards.filter(l=>l.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,c.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):c.forEach(l=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(l.title,25,s),s+=6,l.description){n.setFontSize(9),n.setFont("helvetica","normal");let d=n.splitTextToSize(l.description,160);n.text(d,25,s),s+=d.length*5;}let i=[];if(l.priority&&i.push(`Priority: ${l.priority}`),l.labels&&l.labels.length>0&&i.push(`Labels: ${l.labels.join(", ")}`),l.assignedUserIds&&l.assignedUserIds.length>0&&i.push(`Assigned: ${l.assignedUserIds.length} user(s)`),l.startDate||l.endDate){let d=[];l.startDate&&d.push(`Start: ${l.startDate}`),l.endDate&&d.push(`End: ${l.endDate}`),i.push(d.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function tc(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function $u(e,t,r,a){switch(t){case "json":return Lb(e,a);case "csv":return Ab(e);case "pdf":return await Ib(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Ou(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let d=`${a}.pdf`;e.save(d);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:o[t]}),l=URL.createObjectURL(c),i=document.createElement("a");i.href=l,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l);}function Rb(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 r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Bb(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 r=Hu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let c=Hu(t[o]||"");if(c.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-c.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((p,f)=>{i[p]=c[f]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let m=n.get(d),u={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(u),m.cardIds.push(u.id);}catch(c){s.push(`Line ${o+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.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 Hu(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Uu(e,t){switch(t){case "json":return Rb(e);case "csv":return Bb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Wu(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}var rc=react.createContext(null);function zu(){return react.useContext(rc)}var Gu=react.createContext(null);function Vu({children:e,themeName:t}){return jsxRuntime.jsx(Gu.Provider,{value:{themeName:t},children:e})}function ki(){return react.useContext(Gu)}function or({children:e,container:t}){let[r,a]=react.useState(false),n=zu(),s=ki();if(react.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:c,themeName:l}=n,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":l,"data-gantt-portal":"true",style:i,children:e}),o)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):reactDom.createPortal(e,o)}var Yu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Vb="#BDC3C7",jb=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function wo({priority:e,onChange:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),i=()=>{if(!l.current)return;let p=l.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,h=160,b=220,y=4,v=p.right-h;v<10&&(v=p.left),v+h>x-10&&(v=x-h-10);let w=f-p.bottom,C=p.top,P;w>=b+y?P=p.bottom+y:C>=b+y?P=p.top-b-y:P=w>=C?p.bottom+y:Math.max(10,p.top-b-y),o({top:P,left:v}),n(true);};react.useEffect(()=>{let p=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),react.useEffect(()=>{let p=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let d=p=>{t(p),n(false);},m=e?Yu[e]:null,u=m?.color||Vb;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:m?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),a&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:c,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:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Yu).map(([p,f])=>jsxRuntime.jsxs("button",{onClick:()=>d(p),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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(jb,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>d(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:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var _b=[{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 Es({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=react.useState(false),[o,c]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=(ki()?.themeName||"dark")==="dark",p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,P=320,L=380,k=4,D=v.left;D+P>C-10&&(D=C-P-10),D<10&&(D=10);let F=w-v.bottom,E=v.top,G;F>=L+k?G=v.bottom+k:E>=L+k?G=v.top-L-k:G=F>=E?v.bottom+k:Math.max(10,v.top-L-k),c({top:G,left:D}),s(true);};react.useEffect(()=>{let v=w=>{l.current&&!l.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),react.useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,C=D=>{let F=D.getFullYear(),E=String(D.getMonth()+1).padStart(2,"0"),G=String(D.getDate()).padStart(2,"0");return `${F}-${E}-${G}`},P=C(w),L=new Date(w);L.setDate(L.getDate()+v);let k=C(L);r(P,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=L=>{if(L instanceof Date)return L;if(typeof L!="string"||!L.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=L.split("-").map(Number);if(k.length!==3||k.some(G=>isNaN(G)))return null;let D=k[0],F=k[1],E=k[2];return D===void 0||F===void 0||E===void 0?null:new Date(D,F-1,E)},w=v(e),C=v(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()}`},h=e&&t,y=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n?s(false):p(),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:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:l,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:u?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:_b.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>r(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>r(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Co({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[c,l]=react.useState(""),[i,d]=react.useState({top:0,left:0}),m=react.useRef(null),u=react.useRef(null),p=()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,C=300,P=380,L=4,k=y.right-C;k<10&&(k=y.left),k+C>w-10&&(k=w-C-10);let D=v-y.bottom,F=y.top,E;D>=P+L?E=y.bottom+L:F>=P+L?E=y.top-P-L:E=D>=F?y.bottom+L:Math.max(10,y.top-P-L),d({top:E,left:k}),o(true);};react.useEffect(()=>{let y=v=>{m.current&&!m.current.contains(v.target)&&!u.current?.contains(v.target)&&(o(false),l(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&(o(false),l(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let v=e.some(w=>w.id===y.id);r(v?e.filter(w=>w.id!==y.id):[...e,y]);},x=t.filter(y=>y.name.toLowerCase().includes(c.toLowerCase())),h=e.slice(0,n),b=e.length-n;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>s?o(false):p(),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?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.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:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:m,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:y=>l(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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(y=>{let v=e.some(w=>w.id===y.id);return jsxRuntime.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:[jsxRuntime.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?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsxRuntime.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}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),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 Ci(e,t,r){let a=new Map;e.forEach(l=>{if(l.dependencies&&Array.isArray(l.dependencies)){let i=l.dependencies.map(d=>{if(typeof d=="string")return d;let m=d;return m.taskId||m.targetId||""}).filter(Boolean);a.set(l.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,c=l=>{if(!s.has(l)){s.add(l),o.add(l);let i=a.get(l)||[];for(let d of i){if(!s.has(d)&&c(d))return true;if(o.has(d))return true}}return o.delete(l),false};return c(r)}function Ps({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[c,l]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(t.length>0),[p,f]=react.useState({top:0,left:0}),[x,h]=react.useState(null),b=react.useRef(null),y=react.useRef(null),v=()=>{if(!y.current)return;let k=y.current.getBoundingClientRect(),D=window.innerHeight,F=window.innerWidth,E=300,G=m?380:120,O=4,ee=k.right-E;ee<10&&(ee=k.left),ee+E>F-10&&(ee=F-E-10);let I=D-k.bottom,Ae=k.top,H;I>=G+O?H=k.bottom+O:Ae>=G+O?H=k.top-G-O:H=I>=Ae?k.bottom+O:Math.max(10,k.top-G-O),f({top:H,left:ee}),l(true);};react.useEffect(()=>{if(!c||!y.current)return;let k=y.current.getBoundingClientRect(),D=window.innerHeight,F=window.innerWidth,E=300,G=m?380:120,O=4,ee=k.right-E;ee<10&&(ee=k.left),ee+E>F-10&&(ee=F-E-10);let I=D-k.bottom,Ae=k.top,H;I>=G+O?H=k.bottom+O:Ae>=G+O?H=k.top-G-O:H=I>=Ae?k.bottom+O:Math.max(10,k.top-G-O),f({top:H,left:ee});},[m,c]),react.useEffect(()=>{let k=D=>{b.current&&!b.current.contains(D.target)&&!y.current?.contains(D.target)&&(l(false),d(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),react.useEffect(()=>{let k=D=>{D.key==="Escape"&&(l(false),d(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let D=t.includes(k),F=r.find(E=>E.id===k);if(h(null),D){let E=t.filter(G=>G!==k);a(E),E.length===0&&u(false);}else {if(s&&Ci(r,k,e)){let G=`Cannot add "${F?.title||k}" as dependency - would create circular reference`;h(G),o?.(k,F?.title||k),setTimeout(()=>h(null),3e3);return}a([...t,k]),u(true);}},C=()=>{let k=!m;u(k),k||a([]);},P=r.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),L=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>c?l(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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:L,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:L},children:t.length})]}),c&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:k=>d(k.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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:P.length===0?jsxRuntime.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(k=>{let D=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>w(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:F=>{F.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:F=>{F.currentTarget.style.background="transparent";},children:[jsxRuntime.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&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),u(false),l(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 An=react.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:c=[],allCards:l=[]})=>{let{attributes:i,listeners:d,setNodeRef:m,transform:u,transition:p,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:yi.Transform.toString(u),transition:p};if(t)return jsxRuntime.jsx("div",{ref:m,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let h=c.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:m,style:v,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.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&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.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";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((w,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.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&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},w.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(wo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Es,{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})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Co,{assignedUsers:h,availableUsers:c,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Ps,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:l,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsxRuntime.jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.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(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));An.displayName="Card";var Ti={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"}},op=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function sp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=react.useState(false),[o,c]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),d=[...Object.entries(Ti).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...a.filter(h=>!Object.keys(Ti).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let h=Ti[e];if(h)return {...h,id:e};let b=a.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Ti.todo,id:"todo"}},u=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,v=180,w=280,C=4,P=h.right-v;P<10&&(P=h.left),P+v>y-10&&(P=y-v-10);let L=b-h.bottom,k=h.top,D;L>=w+C?D=h.bottom+C:k>=w+C?D=h.top-w-C:D=L>=k?h.bottom+C:Math.max(10,h.top-w-C),c({top:D,left:P}),s(true);};react.useEffect(()=>{let h=b=>{l.current&&!l.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let p=h=>{t(h),s(false);},f=m(),x=f.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>n?s(false):u(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsxRuntime.jsx(op,{icon:f.icon,color:x})}),n&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:l,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:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(h=>jsxRuntime.jsxs("button",{onClick:()=>p(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(op,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var ip={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 lp({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=ip[s]||ip.en,[c,l]=react.useState(false),[i,d]=react.useState(false),[m,u]=react.useState(e),[p,f]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(c&&h.current){let C=h.current.getBoundingClientRect();f({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[c]),react.useEffect(()=>{let C=P=>{x.current&&!x.current.contains(P.target)&&!h.current?.contains(P.target)&&(l(false),d(false));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=P=>{P.key==="Escape"&&(l(false),d(false),u(e));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c,e]),react.useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{d(true),u(e);},v=()=>{let C=m.trim();C&&C!==e&&t(C),d(false),l(false),u(e);},w=C=>{C.key==="Enter"?v():C.key==="Escape"&&(d(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>l(!c),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),c&&jsxRuntime.jsx(or,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${p.top}px`,left:`${p.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:C=>u(C.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{r(),l(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var qo=react.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:c,availableUsers:l,allCards:i,enableVirtualization:d,cardHeight:m=120,isCollapsed:u,onToggleCollapse:p,onColumnRename:f,onColumnDelete:x,isDeletable:h=false,className:b,renderMetrics:y,locale:v})=>{let{setNodeRef:w,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),P=react.useRef(null),L=d??Au(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>P.current,estimateSize:()=>m,enabled:L});if(r)return jsxRuntime.jsx("div",{ref:w,className:b,children:r(e,t)});let F=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),E=F.state==="exceeded",G=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",E&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g(G()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&F.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${F.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[F.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),F.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),F.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),F.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsxRuntime.jsx(lp,{columnTitle:e.title,onRename:O=>f?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:v}),p&&jsxRuntime.jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!u&&jsxRuntime.jsx("div",{ref:P,className:"asakaa-column-cards",style:{maxHeight:L?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(O=>O.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):L?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(O=>{let ee=t[O.index];return ee?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsxRuntime.jsx(An,{card:ee,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i})},ee.id):null})}):t.map(O=>jsxRuntime.jsx(An,{card:O,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i},O.id))})})]})});qo.displayName="Column";function ic({title:e,onSave:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let l=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?l():d.key==="Escape"&&(o(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:l,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:g("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ph(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function gp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(c=>{let l=c.name.toLowerCase(),i=l.replace(/\s+/g,""),d=l.split(/\s+/);return !!(i===s||l===s||d.some(m=>m===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function mh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function gh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var fh=["\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 fp({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:c="dark",locale:l="es",currentUser:i,enableEmoji:d=true,enableAttachments:m=true,pendingFiles:u=[],onFilesSelect:p,onRemoveFile:f,maxFileSizeMB:x=10}){let h=c==="dark",[b,y]=react.useState(false),[v,w]=react.useState([]),[C,P]=react.useState(0),[L,k]=react.useState(null),[D,F]=react.useState(false),E=react.useRef(null),G=react.useRef(null),O=react.useRef(null),ee=react.useRef(null),I=react.useCallback((Y,Ee)=>{let te=ph(Y,Ee);if(k(te),te){let Be=a.filter(Se=>Se.name.toLowerCase().includes(te.query)||Se.email&&Se.email.toLowerCase().includes(te.query)).slice(0,5);w(Be),y(Be.length>0),P(0);}else y(false),w([]);},[a]),Ae=Y=>{let Ee=Y.target.value;if(t(Ee),I(Ee,Y.target.selectionStart||0),E.current){E.current.style.height="24px";let te=E.current.scrollHeight,Be=280,Se=Math.min(te,Be);E.current.style.height=`${Se}px`,E.current.style.overflowY=te>Be?"auto":"hidden";}},H=()=>{E.current&&I(e,E.current.selectionStart||0);},ge=react.useCallback(Y=>{if(!L||!E.current)return;let Ee=e.slice(0,L.start),te=e.slice(L.end),Be=`@${Y.name.replace(/\s+/g,"")} `,Se=Ee+Be+te;t(Se),y(false),k(null),setTimeout(()=>{if(E.current){let Le=L.start+Be.length;E.current.selectionStart=Le,E.current.selectionEnd=Le,E.current.focus();}},0);},[L,e,t]),N=Y=>{if(b&&v.length>0)switch(Y.key){case "ArrowDown":Y.preventDefault(),P(Ee=>Ee<v.length-1?Ee+1:0);break;case "ArrowUp":Y.preventDefault(),P(Ee=>Ee>0?Ee-1:v.length-1);break;case "Enter":{Y.preventDefault();let Ee=v[C];Ee&&ge(Ee);break}case "Tab":{Y.preventDefault();let Ee=v[C];Ee&&ge(Ee);break}case "Escape":Y.preventDefault(),y(false);break}else Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),r());};react.useEffect(()=>{let Y=Ee=>{G.current&&!G.current.contains(Ee.target)&&E.current&&!E.current.contains(Ee.target)&&y(false),ee.current&&!ee.current.contains(Ee.target)&&F(false);};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[]);let De=react.useCallback(Y=>{if(!E.current)return;let Ee=E.current.selectionStart||e.length,te=e.slice(0,Ee)+Y+e.slice(Ee);t(te),F(false),setTimeout(()=>{if(E.current){let Be=Ee+Y.length;E.current.selectionStart=Be,E.current.selectionEnd=Be,E.current.focus();}},0);},[e,t]),Xe=react.useCallback(Y=>{if(!p||!Y.target.files)return;let Ee=Array.from(Y.target.files),te=x*1024*1024,Be=Ee.filter(Se=>Se.size>te?(console.warn(`File ${Se.name} exceeds max size of ${x}MB`),false):true);Be.length>0&&p(Be),Y.target.value="";},[p,x]),He=react.useCallback(Y=>Y.type.startsWith("image/")?lucideReact.Image:Y.type.includes("pdf")||Y.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&G.current){let Y=G.current.children[C];Y&&Y.scrollIntoView({block:"nearest"});}},[C,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(Y=>{let Ee=He(Y.file),te=Y.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[te&&Y.preview?jsxRuntime.jsx("img",{src:Y.preview,alt:Y.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(Ee,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:Y.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:gh(Y.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(Y.id),className:g("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},Y.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(!D),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ee,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",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:fh.map(Y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>De(Y),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:Y},Y))})})})]}),m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:l==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:O,type:"file",multiple:true,onChange:Xe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:E,value:e,onChange:Ae,onSelect:H,onKeyDown:N,placeholder:n||(l==="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",h?"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"}}),jsxRuntime.jsx("button",{onClick:r,disabled:o||!e.trim()&&u.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:G,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",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((Y,Ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>ge(Y),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Ee===C?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.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:Y.color||"#8B5CF6"},children:mh(Y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:Y.name}),Y.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:Y.email})]})]},Y.id))})})]})]})]})}function bp({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((c,l)=>c.type==="mention"?jsxRuntime.jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:c.value},l):jsxRuntime.jsx("span",{children:c.value},l))})}var Mi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Yo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[c,l]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(false),[p,f]=react.useState(Mi[10]||"#00E5CC"),[x,h]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),v=react.useRef(null),w=react.useRef(null),C=t.filter(E=>E.name.toLowerCase().includes(i.toLowerCase())),P=t.some(E=>E.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(c&&y.current){let E=y.current.getBoundingClientRect();h({top:E.bottom+6,left:E.left});}},[c]),react.useEffect(()=>{let E=G=>{let O=G.target,ee=b.current?.contains(O),I=v.current?.contains(O);!ee&&!I&&(l(false),d(""),u(false));};if(c)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[c]),react.useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let L=E=>{let G=e.some(O=>O.id===E.id);r(G?e.filter(O=>O.id!==E.id):[...e,E]);},k=async()=>{if(!(!a||!i.trim())){u(true);try{let E=await a(i.trim(),p);E&&(r([...e,E]),d(""),f(Mi[Math.floor(Math.random()*Mi.length)]||"#00E5CC"));}finally{u(false);}}},D=(E,G)=>{G.stopPropagation(),r(e.filter(O=>O.id!==E));},F={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&l(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:F,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(E=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${E.color}20`,color:E.color},children:E.name},E.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:E=>d(E.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:E=>{E.key==="Enter"&&i.trim()&&!P&&a&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(E=>jsxRuntime.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:`${E.color}20`,color:E.color},onClick:G=>D(E.id,G),children:[E.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},E.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(E=>{let G=e.some(O=>O.id===E.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(E),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${E.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{G||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{G||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:E.name}),G&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:E.color}})]},E.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!P&&a&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Mi.map(E=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(E),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:E,outline:p===E?`2px solid ${E}`:"none",outlineOffset:"2px"}},E))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:p,color:"#FFFFFF",opacity:m?.7:1},children:[m?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function cc({tag:e,onRemove:t,size:r="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="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&&jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function yp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsxRuntime.jsx(cc,{tag:s,size:r},s.id)),n>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="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 No=[{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 xp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function Th(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 Nh({className:e}){return jsxRuntime.jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function dc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=Th(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"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},l=xp(e.loggedMinutes),i=e.estimateMinutes?xp(e.estimateMinutes):null,d=r&&i?`${l} / ${i}`:l;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(a?"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],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsxRuntime.jsx(Nh,{className:c[t]}),jsxRuntime.jsx("span",{children:d})]})}function Dh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Fi(e){let t=Dh(e);return t!==null?String(t):e}function wp(e){let r=Fi(e).trim().toLowerCase();if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Li(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Mh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function Ph({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Fh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function kp({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Lh({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function uc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:c,onStopTimer:l,onDiscardTimer:i,onClose:d,className:m}){let[u,p]=react.useState(""),[f,x]=react.useState(t.estimateMinutes?Li(t.estimateMinutes):""),[h,b]=react.useState(""),[y,v]=react.useState(false),[w,C]=react.useState(false),P=react.useRef(null);react.useEffect(()=>{P.current?.focus();},[]);let L=async()=>{let F=wp(u);if(!(F<=0||!s)){v(true);try{await s({durationMinutes:F,note:h.trim()||void 0,source:"manual"}),p(""),b("");}finally{v(false);}}},k=async()=>{if(!o)return;let F=f.trim()?wp(f):null;await o(F),C(false);},D=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),L()),F.key==="Escape"&&d?.();};return jsxRuntime.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",m),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(kp,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Mh(n)})]}),jsxRuntime.jsx("button",{onClick:l,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Fh,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(kp,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:c,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:[jsxRuntime.jsx(Ph,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(Lh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:P,type:"text",value:u,onChange:F=>p(F.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")})]}),jsxRuntime.jsx("button",{onClick:L,disabled:y||!u.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"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:F=>b(F.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")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Li(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:f,onChange:F=>x(F.target.value),onKeyDown:F=>{F.key==="Enter"&&k(),F.key==="Escape"&&C(false);},onBlur:k,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"})}):jsxRuntime.jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Li(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.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,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.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)}%`}})})]})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(F=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:F.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Li(F.durationMinutes)})]},F.id))})]})]})}function $h(e){let r=Fi(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Oh(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function wn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[c,l]=react.useState(Oh(a)),[i,d]=react.useState(""),[m,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{p.current?.focus();},[]);let f=async()=>{u(true);let v=$h(c);await n(v&&v>0?v:null,i||void 0),u(false);},x=async()=>{u(true),await n(null),u(false);},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxRuntime.jsxs("div",{className:g("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:p,type:"text",value:c,onChange:v=>l(v.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:h,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:m||!c.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:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:m?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),a&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Hh(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 Uh(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 mc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Hh(e.health),s=Uh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},c=e.progressPercent??0,l=Math.min(100,c),i=c>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsxRuntime.jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsxRuntime.jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${l}%`}}),i&&jsxRuntime.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&&jsxRuntime.jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[c,"%"]})]})}function Xo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function zh(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 Gh(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 Vh(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 jh({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",c=r?"text-[#9CA3AF]":"text-gray-500",l=r?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-1",c),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:g("text-2xl font-bold",n),children:[a?"+":"",Xo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:g("text-xs mt-1",c),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",c),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",c),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:Xo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:Xo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsxRuntime.jsx("span",{className:c,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:g("font-medium",l),children:e.totalTasksWithEstimate})]})]})]})]})}function _h({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",c=r?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:g("border-b",s,a&&g("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:g("text-xs mt-1",c),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Xo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Xo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":c),children:[n,Xo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":c),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Gh(e.status,r),zh(e.status,r)),children:Vh(e.status,t)})})]})}function gc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",c=o?"bg-[#050505]":"bg-gray-50",l=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",u=o?"bg-[#050505]/50":"bg-gray-50",p=react.useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:g("space-y-6 p-6",c,n),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:g("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",m),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(jh,{summary:e.summary,locale:r,isDark:o}),jsxRuntime.jsx("div",{className:g("rounded-lg border overflow-hidden",l,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:u,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",i),children:p.map(f=>jsxRuntime.jsx(_h,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",m),children:r==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Jo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function sy(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Lp(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function iy(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 Do({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:c=[],availableTags:l=[],onCreateTag:i,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:u,availableTasks:p=[],comments:f=[],onAddComment:x,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:P=false,timerElapsedSeconds:L=0,onTimeLog:k,onEstimateUpdate:D,onSoldEffortUpdate:F,onTimerStart:E,onTimerStop:G,onTimerDiscard:O,blurFinancials:ee=false}){let I=s==="dark",Ae={textTertiary:I?"#6B7280":"#9CA3AF",textSecondary:I?"#9CA3AF":"#6B7280",textPrimary:I?"#FFFFFF":"#111827",borderLight:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:I?"#1A1D25":"#FFFFFF",bgSecondary:I?"#0A0A0A":"#F9FAFB",hoverBg:I?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},H=e&&"title"in e&&!("name"in e),ge=e,[N,De]=react.useState(e?Lp(e,c):null),[Xe,He]=react.useState(false),[Y,Ee]=react.useState(false),[te,Be]=react.useState(false),[Se,Le]=react.useState(null),[$e,Ye]=react.useState(new Date),[le,Qe]=react.useState(false),[je,Ie]=react.useState(false),[Ct,it]=react.useState(""),[qe,Pe]=react.useState(false),[xt,St]=react.useState(false),[Re,ct]=react.useState(false),[A,X]=react.useState(false),[B,q]=react.useState(""),ce=react.useRef(null),ue=react.useRef(null),[_e,V]=react.useState(""),ye=react.useRef(null),[Fe,Ue]=react.useState(""),[dt,Ze]=react.useState(false),[Tt,gt]=react.useState([]),[rr,ar]=react.useState(""),[Er,_t]=react.useState(false),Mr=react.useRef(null);react.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 T=Lp(e,c);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),De(T),q(T.description||""),V(T.name||"");}},[e?.id,e?.quotedMinutes,c,t]),react.useEffect(()=>{if(!t||!B)return;let T=setTimeout(()=>{let U=ue.current;U&&(U.style.height="auto",U.style.height=`${Math.max(100,U.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,B]),react.useEffect(()=>()=>{ce.current&&clearTimeout(ce.current),ye.current&&clearTimeout(ye.current);},[]),react.useEffect(()=>{t&&Mr.current&&f.length>0&&setTimeout(()=>{Mr.current&&(Mr.current.scrollTop=Mr.current.scrollHeight);},100);},[t,f.length]);let Ft=react.useCallback(T=>{De(T),H&&n&&ge?n(iy(T,ge)):a&&a(T);},[H,ge,n,a]),Pr=react.useCallback(()=>{He(false),Ee(false),Be(false),Le(null),Ie(false),it(""),Pe(false);},[]),Kt=react.useCallback((T,U)=>{if(!N)return;let de={...N,[T]:U};Ft(de);},[N,Ft]),qt=react.useCallback(()=>{let T=ue.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),ea=react.useCallback(T=>{q(T),setTimeout(qt,0),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>{if(N){let U={...N,description:T};Ft(U);}},800);},[N,Ft,qt]),pa=react.useCallback(T=>{V(T),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{if(N&&T.trim()){let U={...N,name:T.trim()};Ft(U);}},800);},[N,Ft]),et=react.useCallback(T=>{let U=T.map(de=>{let _={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:de};return de.type.startsWith("image/")&&(_.preview=URL.createObjectURL(de)),_});gt(de=>[...de,...U]);},[]),Ke=react.useCallback(T=>{gt(U=>{let de=U.find(_=>_.id===T);return de?.preview&&URL.revokeObjectURL(de.preview),U.filter(_=>_.id!==T)});},[]),ha=react.useCallback(async()=>{if(!(!N||!Fe.trim()&&Tt.length===0||!x)){Ze(true);try{let T=gp(Fe,b),U=[];if(Tt.length>0&&y){let de=Tt.map(_=>_.file);U=await y(de);}await x(N.id,Fe.trim(),T.length>0?T:void 0,U.length>0?U:void 0),Ue(""),Tt.forEach(de=>{de.preview&&URL.revokeObjectURL(de.preview);}),gt([]);}finally{Ze(false);}}},[N,Fe,Tt,x,b,y]),_r=react.useCallback(()=>{if(!N||!rr.trim())return;let T=N.subtasks||[],U={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:rr.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},de=[...T,U],_={...N,subtasks:de};Ft(_),ar(""),_t(false);},[N,rr,Ft]),pr=react.useCallback(T=>{if(!N?.subtasks)return;let U=N.subtasks.map(_=>_.id===T?{..._,progress:_.progress===100?0:100}:_),de={...N,subtasks:U};Ft(de);},[N,Ft]),Kr=react.useCallback(T=>{if(!N?.subtasks)return;let U=N.subtasks.filter(_=>_.id!==T),de={...N,subtasks:U};Ft(de);},[N,Ft]),sa=react.useCallback(T=>{let U=typeof T=="string"?new Date(T):T,_=new Date().getTime()-U.getTime(),ke=Math.floor(_/6e4),st=Math.floor(_/36e5),oe=Math.floor(_/864e5);return ke<1?o==="es"?"Ahora":"Just now":ke<60?o==="es"?`Hace ${ke} min`:`${ke}m ago`:st<24?o==="es"?`Hace ${st}h`:`${st}h ago`:oe<7?o==="es"?`Hace ${oe}d`:`${oe}d ago`:U.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),se=react.useCallback(T=>{if(!N)return;let U=N.progress||0;T==="completed"?U=100:T==="in-progress"&&U===0?U=10:T==="todo"&&(U=0);let de={...N,status:T,progress:U};Ft(de),He(false);},[N,Ft]),pe=react.useCallback((T,U)=>{if(!N)return;let de={...N,startDate:T,endDate:U};Ft(de);},[N,Ft]),ft=react.useCallback(()=>{let T=$e.getFullYear(),U=$e.getMonth(),de=new Date(T,U,1),ke=new Date(T,U+1,0).getDate(),st=de.getDay(),oe=[],rt=new Date(T,U,0).getDate();for(let Ut=st-1;Ut>=0;Ut--)oe.push({date:new Date(T,U-1,rt-Ut),isCurrentMonth:false});for(let Ut=1;Ut<=ke;Ut++)oe.push({date:new Date(T,U,Ut),isCurrentMonth:true});let pt=42-oe.length;for(let Ut=1;Ut<=pt;Ut++)oe.push({date:new Date(T,U+1,Ut),isCurrentMonth:false});return oe},[$e]),j=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),ct(false),!N||!m)return;let U=Array.from(T.dataTransfer.files);if(U.length!==0){X(true);try{await m(N.id,U);}finally{X(false);}}},[N,m]),fe=react.useCallback(async T=>{if(!N||!m||!T.target.files)return;let U=Array.from(T.target.files);if(U.length!==0){X(true);try{await m(N.id,U);}finally{X(false);}T.target.value="";}},[N,m]),Q=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),ct(true);},[]),$=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),ct(false);},[]),Z=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),xe=react.useCallback(T=>T.startsWith("image/")?lucideReact.Image:T.includes("pdf")||T.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!N?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.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",I?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:g("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",I?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",I?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=N.progress===100?0:100,de={...N,progress:T,status:T===100?"completed":"todo"};Ft(de);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",N.progress===100?"bg-green-500 border-green-500":I?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:_e,onChange:T=>pa(T.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",N.progress===100?"line-through text-[#6B7280]":I?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Pr(),He(!Xe);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",N.progress===100||N.status==="completed"?"bg-green-500/20 text-green-400":N.progress&&N.progress>0||N.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:N.progress===100||N.status==="completed"?o==="es"?"COMPLETADO":"DONE":N.progress&&N.progress>0||N.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(false)}),jsxRuntime.jsx(framerMotion.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]",I?"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(T=>jsxRuntime.jsxs("button",{onClick:()=>se(T.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",N.status===T.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:I?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Pr(),Be(!te);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[N.assignees&&N.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[N.assignees.slice(0,3).map((T,U)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},U)),N.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:["+",N.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:g("text-sm",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(false)}),jsxRuntime.jsx(framerMotion.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",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(T=>{let U=N.assignees?.some(de=>de.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let de=N.assignees||[],_;U?_=de.filter(ke=>ke.name!==T.name):_=[...de,T],Kt("assignees",_);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",U&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.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:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g("flex-1",I?"text-white":"text-gray-900"),children:T.name}),U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Le(Se?null:"start"),Ye(N.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[N.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:g("mx-1",I?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),N.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(null)}),jsxRuntime.jsxs(framerMotion.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",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",I?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,U=new Date(T);U.setDate(T.getDate()+1);let de=new Date(T);de.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let _=new Date(T);_.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let ke=new Date(T);ke.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let st=new Date(T);st.setDate(T.getDate()+14);let oe=new Date(T);return oe.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:U,display:U.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:de,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:_,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ke,display:ke.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:st,display:st.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:oe,display:oe.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((pt,Ut)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Se==="start"){let Qt=N.endDate&&pt.date>N.endDate?pt.date:N.endDate;pe(pt.date,Qt),Le("end");}else {let Qt=N.startDate&&pt.date<N.startDate?pt.date:N.startDate;pe(Qt,pt.date),Le(null);}},children:[jsxRuntime.jsx("span",{children:pt.label}),jsxRuntime.jsx("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:pt.display})]},Ut))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",I?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{pe(void 0,void 0),Le(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",I?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Se==="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"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",I?"text-white":"text-gray-900"),children:$e.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>Ye(new Date),className:g("p-1 rounded text-sm transition-colors",I?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ye(new Date($e.getFullYear(),$e.getMonth()-1)),className:g("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>Ye(new Date($e.getFullYear(),$e.getMonth()+1)),className:g("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.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(T=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",I?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ft().map((T,U)=>{let de=T.date.toDateString()===new Date().toDateString(),_=N.startDate?.toDateString()===T.date.toDateString(),ke=N.endDate?.toDateString()===T.date.toDateString(),st=_||ke,oe=N.startDate&&N.endDate&&T.date>=N.startDate&&T.date<=N.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let rt=new Date(T.date);if(Se==="start"){let pt=N.endDate&&rt>N.endDate?rt:N.endDate;pe(rt,pt),Le("end");}else {let pt=N.startDate&&rt<N.startDate?rt:N.startDate;pe(pt,rt),Le(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(I?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(I?"text-white":"text-gray-900"),de&&"ring-2 ring-[#00E5CC]",_&&"bg-[#00E5CC] text-white",ke&&!_&&"bg-[#7C3AED] text-white",oe&&!st&&(I?"bg-[#7C3AED]/20":"bg-purple-100"),!st&&(I?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},U)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Pr(),Ee(!Y);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",N.priority==="high"||N.priority==="urgent"?"bg-red-500/20 text-red-400":N.priority==="medium"?"bg-yellow-500/20 text-yellow-400":N.priority==="low"?"bg-green-500/20 text-green-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:N.priority?N.priority==="high"||N.priority==="urgent"?o==="es"?"Alta":"High":N.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsxRuntime.jsx(framerMotion.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]",I?"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(T=>jsxRuntime.jsxs("button",{onClick:()=>{Kt("priority",T.id),Ee(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",N.priority===T.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:I?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:g("text-sm",I?"text-white":"text-gray-900"),children:N.startDate&&N.endDate?`${Math.ceil((N.endDate.getTime()-N.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded-full border-2",I?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[le?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:N.progress||0,onChange:T=>{let U=parseInt(T.target.value),de=N.status;U===100?de="completed":U>0?de="in-progress":de="todo";let _={...N,progress:U,status:de};Ft(_);},onBlur:()=>Qe(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",I?"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}):jsxRuntime.jsx("button",{onClick:()=>Qe(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",I?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",N.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${N.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",I?"text-white":"text-gray-900"),children:[N.progress||0,"%"]})]})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:N.status==="completed"||N.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Jo(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>St("estimate"),className:g("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Jo(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>St("estimate"),className:g("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xt==="estimate"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:"estimate",locale:o,isDark:I,currentValue:w?.estimateMinutes||null,onSave:async T=>{await D?.(N.id,T),St(false);},onClose:()=>St(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ee?jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",I?"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"}):N.status==="completed"||N.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:N.quotedMinutes?Jo(N.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):N.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>St("quoted"),className:g("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Jo(N.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>St("quoted"),className:g("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xt==="quoted"&&!ee&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:"quoted",locale:o,isDark:I,currentValue:N.quotedMinutes||null,onSave:async T=>{F?(await F(N.id,T),De(U=>U?{...U,quotedMinutes:T}:null)):Kt("quotedMinutes",T),St(false);},onClose:()=>St(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[N.status==="completed"||N.progress===100?jsxRuntime.jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",I?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):P?jsxRuntime.jsxs("button",{type:"button",onClick:()=>G?.(N.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:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),sy(L||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>E?.(N.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",I?"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:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),N.status==="completed"||N.progress===100?jsxRuntime.jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>St("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",I?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":I?"text-white":"text-gray-900"),children:[Jo(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",I?"text-[#6B7280]":"text-gray-400"),children:[" / ",Jo(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.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)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xt==="log"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:"log",locale:o,isDark:I,currentValue:null,onSave:async(T,U)=>{T&&await k?.(N.id,{durationMinutes:T,note:U,source:"manual"}),St(false);},onClose:()=>St(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Yo,{selectedTags:N.tags||[],availableTags:l,onChange:T=>{Kt("tags",T);},onCreateTag:i,theme:Ae})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[N.dependencies&&N.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:N.dependencies.map(T=>{let U=p.find(de=>de.id===T);return jsxRuntime.jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",I?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[U?.name||T.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let de=(N.dependencies||[]).filter(_=>_!==T);Kt("dependencies",de);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{Pr(),Ie(!je);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(false),it("");}}),jsxRuntime.jsxs(framerMotion.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]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("p-2 border-b",I?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Ct,onChange:T=>it(T.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:p.length>0?p.filter(T=>T.id!==N.id).filter(T=>Ct===""||T.name.toLowerCase().includes(Ct.toLowerCase())).map(T=>{let U=N.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let de=N.dependencies||[],_;U?_=de.filter(ke=>ke!==T.id):_=[...de,T.id],Kt("dependencies",_);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",U&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",U?"bg-[#00E5CC] border-[#00E5CC]":I?"border-white/30":"border-gray-300"),children:U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:g("block truncate",I?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Pr(),Pe(!qe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:N.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",I?"text-white":"text-gray-900"),children:No.find(T=>T.value===N.color)?.name||(o==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsxRuntime.jsx(framerMotion.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",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:No.map(T=>{let U=N.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{Kt("color",T.value),Pe(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",U&&"ring-2 ring-offset-2",I?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:U?T.value:void 0},title:T.name,children:U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:N.isMilestone||false,onChange:T=>Kt("isMilestone",T.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",N.isMilestone?"bg-purple-500 border-purple-500":I?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:g("text-sm",I?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:g("text-sm font-semibold",I?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:ue,value:B,onChange:T=>ea(T.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",I?"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")})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",N.subtasks&&N.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",N.subtasks.filter(T=>T.progress===100).length,"/",N.subtasks.length,")"]})]})}),N.subtasks&&N.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...N.subtasks].sort((T,U)=>(T.position??0)-(U.position??0)).map(T=>jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",I?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>pr(T.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",T.progress===100?"bg-green-500 border-green-500":I?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:g("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":I?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("button",{onClick:()=>Kr(T.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",I?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),Er?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:rr,onChange:T=>ar(T.target.value),onKeyDown:T=>{T.key==="Enter"&&rr.trim()?_r():T.key==="Escape"&&(_t(false),ar(""));},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",I?"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]")}),jsxRuntime.jsx("button",{onClick:_r,disabled:!rr.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",rr.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":I?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{_t(false),ar("");},className:g("p-2 rounded-lg transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>_t(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold mb-3",I?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:d.map(T=>{let U=xe(T.type),de=T.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[de&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",I?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(U,{className:g("w-5 h-5",I?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",I?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:Z(T.size)})]}),u&&jsxRuntime.jsx("button",{onClick:()=>u(T.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",I?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:Q,onDragLeave:$,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Re?I?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":I?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",A&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||A}),A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:g("w-6 h-6 mx-auto mb-2",Re?"text-[#00E5CC]":I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:Re?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!m&&jsxRuntime.jsx("p",{className:g("text-xs mt-1",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:g("w-96 border-l flex flex-col",I?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
border-radius: 4px !important;
|
|
14
14
|
}
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
|
-
background: ${
|
|
16
|
+
background: ${I?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{ref:gr,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?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((T,W)=>{let pe=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,_=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return pe.getTime()-_.getTime()}).map(T=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.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:T.user?.color||"#8B5CF6"},children:T.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:g("text-sm font-medium",A?"text-white":"text-gray-900"),children:T.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Ca(T.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(pp,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(W=>{let pe=W.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:W.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:[pe?jsxRuntime.jsx(lucideReact.Image,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:g("text-xs truncate max-w-[100px]",A?"text-white":"text-gray-900"),children:W.name})]},W.id)})})]})]},T.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:g("w-10 h-10 mb-3",A?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:g("py-4 pl-4 pr-2 border-t",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(up,{value:Fe,onChange:Ie,onSubmit:ba,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:Ct,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:Tt,onFilesSelect:rt,onRemoveFile:Ke})})]})]})]})})}function mc(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Zn({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:c,isLoading:l,error:i,children:d,availableTags:m=[],onCreateTag:u,attachmentsByCard:p,onUploadAttachments:f,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:M,timeTrackingSummary:F,timeEntries:k,timerState:N,onLogTime:P,onUpdateEstimate:D,onUpdateSoldEffort:K,onStartTimer:H,onStopTimer:ee,onDiscardTimer:A,blurFinancials:Ee=false,sidePanel:O,renderColumnMetrics:U,suppressDetailModal:R=false}){let[Ae,Je]=mc(),[$e,J]=react.useState(null),[De,oe]=react.useState(false),Ue=react.useRef(null),Ne=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Me=n?.theme||"dark",Re=Me==="dark"||Me==="neutral",Qe=Re?"dark":"",ie=react.useCallback((L,X)=>{t.onCardUpdate?.(L,X);},[t]),et=react.useCallback((L,X)=>{t.onColumnUpdate?.(L,{title:X});},[t]),Ve=react.useCallback(L=>{t.onColumnDelete?.(L);},[t]),Oe=["todo","in-progress","completed"],ut=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),pt=react.useMemo(()=>{let L=new Map;return e.columns.forEach(X=>{let B=X.cardIds.map(Y=>e.cards.find(re=>re.id===Y)).filter(Y=>Y!==void 0).sort((Y,re)=>Y.position-re.position);L.set(X.id,B);}),L},[e.cards,e.columns]);react.useEffect(()=>{let L=Ue.current;if(!L)return;let X=he=>{let qe=he.target,j=he.button===1,ye=qe===L||qe.classList.contains("asakaa-column")&&!qe.closest(".asakaa-card");(j||he.button===0&&ye&&!Ae.isDragging)&&(he.preventDefault(),oe(true),Ne.current={x:he.clientX,y:he.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},B=he=>{if(!De)return;let qe=he.clientX-Ne.current.x,j=he.clientY-Ne.current.y;L.scrollLeft=Ne.current.scrollLeft-qe,L.scrollTop=Ne.current.scrollTop-j;},Y=()=>{De&&(oe(false),L.style.cursor="",L.style.userSelect="");},re=()=>{De&&(oe(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",X),document.addEventListener("mousemove",B),document.addEventListener("mouseup",Y),L.addEventListener("mouseleave",re),()=>{L.removeEventListener("mousedown",X),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",Y),L.removeEventListener("mouseleave",re);}},[De,Ae.isDragging]);let Ge=react.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(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),Pe=react.useCallback(L=>{let{active:X}=L,B=e.cards.find(Y=>Y.id===X.id);B&&Je({isDragging:true,draggedCardId:B.id,sourceColumnId:B.columnId,targetColumnId:B.columnId});},[e.cards,Je]),ot=react.useCallback(L=>{let{active:X,over:B}=L;if(!B||!e.cards.find(he=>he.id===X.id))return;let re=null;B.data.current?.type==="column"?re=B.id:B.data.current?.type==="card"&&(re=e.cards.find(qe=>qe.id===B.id)?.columnId||null),re&&re!==Ae.targetColumnId&&Je({...Ae,targetColumnId:re});},[e.cards,Ae,Je]),$t=react.useCallback(async L=>{let{active:X,over:B}=L;if(Je({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!B)return;let Y=e.cards.find(j=>j.id===X.id);if(!Y)return;let re,he;if(B.data.current?.type==="column"){re=B.id;let j=pt.get(re)||[];he=Yl(j,0);}else {let j=e.cards.find(Ie=>Ie.id===B.id);if(!j)return;re=j.columnId;let ye=pt.get(re)||[],Fe=ye.findIndex(Ie=>Ie.id===B.id);he=Yl(ye,Fe);}let qe=e.columns.find(j=>j.id===re);if(qe&&qe.wipLimit&&qe.wipLimitType==="hard"){let j=pt.get(re)||[];if(Y.columnId!==re&&j.length>=qe.wipLimit){t.onWipLimitExceeded?.(qe,Y);return}}(Y.columnId!==re||Y.position!==he)&&await t.onCardMove?.(Y.id,re,he);},[e.cards,e.columns,pt,t,Je]),Be=react.useCallback(L=>{R||J(L),r?.(L),w?.(L.id);},[r,w,R]),st=react.useCallback(L=>{t.onCardUpdate?.(L.id,L),J(L);},[t]);return l?jsxRuntime.jsx("div",{className:g("asakaa-board",Qe,o),style:c,children:jsxRuntime.jsx(uy,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:g("asakaa-board",Qe,o),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Uu,{themeName:Me,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",O?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ut,collisionDetection:core$1.closestCorners,onDragStart:Pe,onDragOver:ot,onDragEnd:$t,children:[jsxRuntime.jsxs("div",{ref:Ue,className:g("asakaa-board",O?"flex-1":"",Qe,o),style:{...c,cursor:De?"grabbing":void 0},"data-theme":Me,children:[e.columns.sort((L,X)=>L.position-X.position).map(L=>{let X=pt.get(L.id)||[],B=!Oe.includes(L.id),Y=a?.renderColumnFooter?.(L);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(_o,{column:L,cards:X,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:U?(re,he)=>U(re,he):void 0,onCardClick:Be,onCardUpdate:ie,onColumnRename:t.onColumnUpdate?et:void 0,onColumnDelete:t.onColumnDelete?Ve:void 0,isDeletable:B,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),Y]},L.id)}),d]}),jsxRuntime.jsx(core$1.DragOverlay,{children:Ae.draggedCardId?jsxRuntime.jsx(An,{card:e.cards.find(L=>L.id===Ae.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),O]}),!R&&jsxRuntime.jsx(No,{task:$e,isOpen:!!$e,onClose:()=>J(null),onCardUpdate:st,theme:Re?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:u,attachments:$e?p?.get($e.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:Ge,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:C,enableTimeTracking:M,timeTrackingSummary:F,timeEntries:k,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:D,onSoldEffortUpdate:K,onTimerStart:H,onTimerStop:ee,onTimerDiscard:A,blurFinancials:Ee})]})}function uy({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var by={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)"},hy={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)"},yy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},xy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function vy({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let l=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n||a.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.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:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function wy({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=react.useState(false),[c,l]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let p=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),!(r||a||n))return null;let m=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),u=async(p,f)=>{if(f){l(p);try{await f();}catch(x){console.error(`Export ${p} failed:`,x);}finally{l(null),o(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"py-1",children:m.map((p,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(p.id,p.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<m.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:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===p.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):p.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function ky({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function fc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:c,onExportExcel:l,translations:i,toolbarRightContent:d,toolbarEndContent:m}){let u=a==="dark"?by:hy,p={...n==="es"?yy:xy,...i},f=o||c||l;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:u.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wy,{theme:u,t:p,onExportCSV:o,onExportJSON:c,onExportExcel:l}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),m,t&&(s?jsxRuntime.jsx(vy,{columns:e,onSelect:t,theme:u,t:p,createTaskLabel:r}):jsxRuntime.jsx(ky,{onClick:()=>t(),label:r||p.newTask}))]})})}function hc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=react.useState(false),[c,l]=react.useState(""),i=react.useCallback(()=>{let u=c.trim();u&&(e(u),l(""),o(false));},[c,e]),d=react.useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(l(""),o(false));},[i]),m=react.useCallback(()=>{setTimeout(()=>{c.trim()||o(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:u=>l(u.target.value),onKeyDown:d,onBlur:m,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{l(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:g("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Bs({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:c="up"}){let[l,i]=react.useState(""),[d,m]=react.useState(void 0),[u,p]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(false),[h,v]=react.useState(false),[w,C]=react.useState(false),[M,F]=react.useState(s||new Date),k=react.useRef(null),N=n==="es",P=c==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{k.current?.focus();},[]);let D=react.useCallback(()=>{b(false),v(false),C(false);},[]),K=react.useCallback(()=>{i(""),m(void 0),p(null),x(null),D(),t();},[t,D]),H=f||s||new Date,ee=react.useCallback(()=>{let O=l.trim();if(!O)return;let U=r.find(Ae=>Ae.id===u),R=H;e({name:O,priority:d,assignee:U||void 0,assigneeId:u,startDate:R,endDate:R}),i(""),m(void 0),p(null),x(null),D(),k.current?.focus();},[l,d,u,H,r,e,D]),A=react.useCallback(O=>{O.key==="Enter"&&l.trim()&&(O.preventDefault(),ee()),O.key==="Escape"&&K();},[ee,K,l]),Ee=H;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>D(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:k,type:"text",value:l,onChange:O=>i(O.target.value),placeholder:N?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:A})}),jsxRuntime.jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:O=>{O.stopPropagation(),b(!y),v(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.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(O=>jsxRuntime.jsxs("button",{onClick:()=>{m(O.id),b(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===O.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:O=>{O.stopPropagation(),C(!w),b(false),v(false),F(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?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),Ee.toLocaleDateString(N?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let O=new Date,U=new Date(O);U.setDate(O.getDate()+1);let R=new Date(O);R.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let Ae=new Date(O);Ae.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let Je=new Date(O);Je.setDate(O.getDate()+14);let $e=new Date(O);$e.setDate(O.getDate()+28);let J=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:O,display:O.toLocaleDateString(J,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:U,display:U.toLocaleDateString(J,{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:Je,display:Je.toLocaleDateString(J,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:$e,display:$e.toLocaleDateString(J,{day:"numeric",month:"short"})}].map((oe,Ue)=>jsxRuntime.jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(oe.date),C(false);},children:[jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:oe.display})]},Ue))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:g("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:M.toLocaleDateString(N?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:N?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(M.getFullYear(),M.getMonth()-1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(M.getFullYear(),M.getMonth()+1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.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(O=>jsxRuntime.jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let O=M.getFullYear(),U=M.getMonth(),R=new Date(O,U,1).getDay(),Ae=new Date(O,U+1,0).getDate(),Je=new Date(O,U,0).getDate(),$e=new Date().toDateString(),J=[];for(let oe=R-1;oe>=0;oe--)J.push({dayNum:Je-oe,isCurrent:false,date:new Date(O,U-1,Je-oe)});for(let oe=1;oe<=Ae;oe++)J.push({dayNum:oe,isCurrent:true,date:new Date(O,U,oe)});let De=42-J.length;for(let oe=1;oe<=De;oe++)J.push({dayNum:oe,isCurrent:false,date:new Date(O,U+1,oe)});return J.map((oe,Ue)=>{let Ne=oe.date.toDateString()===$e,Me=(f||s)?.toDateString()===oe.date.toDateString();return jsxRuntime.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&&(a?"text-white/20":"text-gray-300"),oe.isCurrent&&(a?"text-white":"text-gray-900"),Ne&&"ring-1 ring-[#007FFF]",Me&&"bg-[#007FFF] text-white",!Me&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(oe.date),C(false);},children:oe.dayNum},Ue)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:O=>{O.stopPropagation(),v(!h),b(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",u?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:u?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(O=>O.id===u)?.color||"#007FFF"},children:r.find(O=>O.id===u)?.initials||r.find(O=>O.id===u)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="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",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(null),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!u&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:a?"text-white/40":"text-gray-500",children:N?"Sin asignar":"Unassigned"})]}),r.map(O=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(O.id),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",u===O.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:O.color||"#007FFF"},children:O.initials||O.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:O.name})]},O.id)),r.length===0&&jsxRuntime.jsx("div",{className:g("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:ee,disabled:!l.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",l.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:N?"Guardar":"Save"})]})]})}function kc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:c="es"}){let[l,i]=react.useState(false),d=react.useRef(null),m=react.useRef(null),[u,p]=react.useState({}),[f,x]=react.useState(false),y=o==="dark",h={buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!l||!d.current)return;let w=90,C=()=>{let M=d.current.getBoundingClientRect(),k=window.innerHeight-M.bottom<w+8;x(k),p({position:"fixed",...k?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[l]),react.useEffect(()=>{if(!l)return;let w=C=>{let M=C.target;m.current&&!m.current.contains(M)&&d.current&&!d.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]);let v=react.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 jsxRuntime.jsxs("div",{ref:d,className:g("asakaa-add-card",a),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!l),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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:u,className:g("rounded-lg shadow-2xl",y?"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:jsxRuntime.jsx(Bs,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:y,locale:c,dropdownDirection:"up"})})}),document.body)]})}var Os=class extends core.BaseViewAdapter{constructor(r={}){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=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=client.createRoot(r),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(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){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: ${r}`)}}render(){if(!this.root||!this.data)return;let r={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(jsxRuntime.jsx(Zn,{board:r,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 r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(s=>s.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.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 a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Vp(e={}){return new Os(e)}var Xo=class extends react.Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsxRuntime.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 Cc(e,t){let r=a=>jsxRuntime.jsx(Xo,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Nc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:c,onOpenAIUsage:l,shortcut:i="k",className:d=""}){let[m,u]=react.useState(false),[p,f]=react.useState(""),[x,y]=react.useState("home"),[b,h]=react.useState(""),[v,w]=react.useState("");react.useEffect(()=>{let k=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),u(P=>!P)),N.key==="Escape"&&(u(false),y("home"),f(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{m||(y("home"),f(""),h(""),w(""));},[m]);let C=react.useCallback(()=>{u(false);},[]),M=react.useCallback(k=>{let[N,P]=k.split(":");switch(N){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(r?.(P),C()):y("navigate");break;case "search":a?.(p),C();break;case "priority":y("priority");break;case "set-priority":v&&P&&(n?.(v,P),C());break;case "assign":y("assign");break;case "assign-user":v&&P&&(s?.(v,P),C());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":c?.(),C();break;case "ai-usage":l?.(),C();break;case "back":y("home");break;}},[p,v,t,r,a,n,s,o,c,l,C]),F=react.useCallback(()=>{b&&p.trim()&&(t?.(b,p.trim()),C());},[b,p,t,C]);return m?jsxRuntime.jsx(nr,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${d}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:p,onValueChange:f,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&F();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},k.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let N=e.columns.find(P=>P.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:M,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},k.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function Kp(e,t,r,a,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
|
+
`}),jsxRuntime.jsx("div",{ref:Mr,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",I?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((T,U)=>{let de=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,_=typeof U.createdAt=="string"?new Date(U.createdAt):U.createdAt;return de.getTime()-_.getTime()}).map(T=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.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:T.user?.color||"#8B5CF6"},children:T.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:g("text-sm font-medium",I?"text-white":"text-gray-900"),children:T.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:sa(T.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(bp,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(U=>{let de=U.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:U.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[de?jsxRuntime.jsx(lucideReact.Image,{className:g("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:g("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:g("text-xs truncate max-w-[100px]",I?"text-white":"text-gray-900"),children:U.name})]},U.id)})})]})]},T.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:g("w-10 h-10 mb-3",I?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:g("text-sm",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:g("py-4 pl-4 pr-2 border-t",I?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(fp,{value:Fe,onChange:Ue,onSubmit:ha,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:dt,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:Tt,onFilesSelect:et,onRemoveFile:Ke})})]})]})]})})}function bc(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function eo({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:c,isLoading:l,error:i,children:d,availableTags:m=[],onCreateTag:u,attachmentsByCard:p,onUploadAttachments:f,onDeleteAttachment:x,comments:h,onAddComment:b,currentUser:y,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:L,timeEntries:k,timerState:D,onLogTime:F,onUpdateEstimate:E,onUpdateSoldEffort:G,onStartTimer:O,onStopTimer:ee,onDiscardTimer:I,blurFinancials:Ae=false,sidePanel:H,renderColumnMetrics:ge,suppressDetailModal:N=false}){let[De,Xe]=bc(),[He,Y]=react.useState(null),[Ee,te]=react.useState(false),Be=react.useRef(null),Se=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Le=n?.theme||"dark",$e=Le==="dark"||Le==="neutral",Ye=$e?"dark":"",le=react.useCallback((A,X)=>{t.onCardUpdate?.(A,X);},[t]),Qe=react.useCallback((A,X)=>{t.onColumnUpdate?.(A,{title:X});},[t]),je=react.useCallback(A=>{t.onColumnDelete?.(A);},[t]),Ie=["todo","in-progress","completed"],Ct=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),it=react.useMemo(()=>{let A=new Map;return e.columns.forEach(X=>{let B=X.cardIds.map(q=>e.cards.find(ce=>ce.id===q)).filter(q=>q!==void 0).sort((q,ce)=>q.position-ce.position);A.set(X.id,B);}),A},[e.cards,e.columns]);react.useEffect(()=>{let A=Be.current;if(!A)return;let X=ue=>{let _e=ue.target,V=ue.button===1,ye=_e===A||_e.classList.contains("asakaa-column")&&!_e.closest(".asakaa-card");(V||ue.button===0&&ye&&!De.isDragging)&&(ue.preventDefault(),te(true),Se.current={x:ue.clientX,y:ue.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},B=ue=>{if(!Ee)return;let _e=ue.clientX-Se.current.x,V=ue.clientY-Se.current.y;A.scrollLeft=Se.current.scrollLeft-_e,A.scrollTop=Se.current.scrollTop-V;},q=()=>{Ee&&(te(false),A.style.cursor="",A.style.userSelect="");},ce=()=>{Ee&&(te(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",X),document.addEventListener("mousemove",B),document.addEventListener("mouseup",q),A.addEventListener("mouseleave",ce),()=>{A.removeEventListener("mousedown",X),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",q),A.removeEventListener("mouseleave",ce);}},[Ee,De.isDragging]);let qe=react.useMemo(()=>e.cards.map(A=>({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(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),Pe=react.useCallback(A=>{let{active:X}=A,B=e.cards.find(q=>q.id===X.id);B&&Xe({isDragging:true,draggedCardId:B.id,sourceColumnId:B.columnId,targetColumnId:B.columnId});},[e.cards,Xe]),xt=react.useCallback(A=>{let{active:X,over:B}=A;if(!B||!e.cards.find(ue=>ue.id===X.id))return;let ce=null;B.data.current?.type==="column"?ce=B.id:B.data.current?.type==="card"&&(ce=e.cards.find(_e=>_e.id===B.id)?.columnId||null),ce&&ce!==De.targetColumnId&&Xe({...De,targetColumnId:ce});},[e.cards,De,Xe]),St=react.useCallback(async A=>{let{active:X,over:B}=A;if(Xe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!B)return;let q=e.cards.find(V=>V.id===X.id);if(!q)return;let ce,ue;if(B.data.current?.type==="column"){ce=B.id;let V=it.get(ce)||[];ue=Ql(V,0);}else {let V=e.cards.find(Ue=>Ue.id===B.id);if(!V)return;ce=V.columnId;let ye=it.get(ce)||[],Fe=ye.findIndex(Ue=>Ue.id===B.id);ue=Ql(ye,Fe);}let _e=e.columns.find(V=>V.id===ce);if(_e&&_e.wipLimit&&_e.wipLimitType==="hard"){let V=it.get(ce)||[];if(q.columnId!==ce&&V.length>=_e.wipLimit){t.onWipLimitExceeded?.(_e,q);return}}(q.columnId!==ce||q.position!==ue)&&await t.onCardMove?.(q.id,ce,ue);},[e.cards,e.columns,it,t,Xe]),Re=react.useCallback(A=>{N||Y(A),r?.(A),w?.(A.id);},[r,w,N]),ct=react.useCallback(A=>{t.onCardUpdate?.(A.id,A),Y(A);},[t]);return l?jsxRuntime.jsx("div",{className:g("asakaa-board",Ye,o),style:c,children:jsxRuntime.jsx(xy,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:g("asakaa-board",Ye,o),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Vu,{themeName:Le,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",H?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Ct,collisionDetection:core$1.closestCorners,onDragStart:Pe,onDragOver:xt,onDragEnd:St,children:[jsxRuntime.jsxs("div",{ref:Be,className:g("asakaa-board",H?"flex-1":"",Ye,o),style:{...c,cursor:Ee?"grabbing":void 0},"data-theme":Le,children:[e.columns.sort((A,X)=>A.position-X.position).map(A=>{let X=it.get(A.id)||[],B=!Ie.includes(A.id),q=a?.renderColumnFooter?.(A);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(qo,{column:A,cards:X,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:ge?(ce,ue)=>ge(ce,ue):void 0,onCardClick:Re,onCardUpdate:le,onColumnRename:t.onColumnUpdate?Qe:void 0,onColumnDelete:t.onColumnDelete?je:void 0,isDeletable:B,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),q]},A.id)}),d]}),jsxRuntime.jsx(core$1.DragOverlay,{children:De.draggedCardId?jsxRuntime.jsx(An,{card:e.cards.find(A=>A.id===De.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),H]}),!N&&jsxRuntime.jsx(Do,{task:He,isOpen:!!He,onClose:()=>Y(null),onCardUpdate:ct,theme:$e?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:u,attachments:He?p?.get(He.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:qe,comments:h,onAddComment:b,currentUser:y,mentionableUsers:v,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:L,timeEntries:k,isTimerRunning:D?.isRunning,timerElapsedSeconds:D?.elapsedSeconds,onTimeLog:F,onEstimateUpdate:E,onSoldEffortUpdate:G,onTimerStart:O,onTimerStop:ee,onTimerDiscard:I,blurFinancials:Ae})]})}function xy({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var Ty={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)"},Ny={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)"},Dy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Sy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ey({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let l=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n||a.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.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:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function My({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=react.useState(false),[c,l]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let p=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),!(r||a||n))return null;let m=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),u=async(p,f)=>{if(f){l(p);try{await f();}catch(x){console.error(`Export ${p} failed:`,x);}finally{l(null),o(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"py-1",children:m.map((p,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(p.id,p.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<m.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:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===p.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):p.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function Py({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function yc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:c,onExportExcel:l,translations:i,toolbarRightContent:d,toolbarEndContent:m}){let u=a==="dark"?Ty:Ny,p={...n==="es"?Dy:Sy,...i},f=o||c||l;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:u.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(My,{theme:u,t:p,onExportCSV:o,onExportJSON:c,onExportExcel:l}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),m,t&&(s?jsxRuntime.jsx(Ey,{columns:e,onSelect:t,theme:u,t:p,createTaskLabel:r}):jsxRuntime.jsx(Py,{onClick:()=>t(),label:r||p.newTask}))]})})}function vc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=react.useState(false),[c,l]=react.useState(""),i=react.useCallback(()=>{let u=c.trim();u&&(e(u),l(""),o(false));},[c,e]),d=react.useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(l(""),o(false));},[i]),m=react.useCallback(()=>{setTimeout(()=>{c.trim()||o(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:u=>l(u.target.value),onKeyDown:d,onBlur:m,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{l(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:g("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Os({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:c="up"}){let[l,i]=react.useState(""),[d,m]=react.useState(void 0),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(false),[y,v]=react.useState(false),[w,C]=react.useState(false),[P,L]=react.useState(s||new Date),k=react.useRef(null),D=n==="es",F=c==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{k.current?.focus();},[]);let E=react.useCallback(()=>{b(false),v(false),C(false);},[]),G=react.useCallback(()=>{i(""),m(void 0),p(null),x(null),E(),t();},[t,E]),O=f||s||new Date,ee=react.useCallback(()=>{let H=l.trim();if(!H)return;let ge=r.find(De=>De.id===u),N=O;e({name:H,priority:d,assignee:ge||void 0,assigneeId:u,startDate:N,endDate:N}),i(""),m(void 0),p(null),x(null),E(),k.current?.focus();},[l,d,u,O,r,e,E]),I=react.useCallback(H=>{H.key==="Enter"&&l.trim()&&(H.preventDefault(),ee()),H.key==="Escape"&&G();},[ee,G,l]),Ae=O;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>E(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:k,type:"text",value:l,onChange:H=>i(H.target.value),placeholder:D?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:I})}),jsxRuntime.jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:H=>{H.stopPropagation(),b(!h),v(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",F,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:H=>H.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(H=>jsxRuntime.jsxs("button",{onClick:()=>{m(H.id),b(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===H.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",H.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:H.label})]},H.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:H=>{H.stopPropagation(),C(!w),b(false),v(false),L(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?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),Ae.toLocaleDateString(D?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",F,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let H=new Date,ge=new Date(H);ge.setDate(H.getDate()+1);let N=new Date(H);N.setDate(H.getDate()+((6-H.getDay()+7)%7||7));let De=new Date(H);De.setDate(H.getDate()+((1-H.getDay()+7)%7||7));let Xe=new Date(H);Xe.setDate(H.getDate()+14);let He=new Date(H);He.setDate(H.getDate()+28);let Y=D?"es-ES":"en-US";return [{label:D?"Hoy":"Today",date:H,display:H.toLocaleDateString(Y,{weekday:"short"}).slice(0,3)+"."},{label:D?"Ma\xF1ana":"Tomorrow",date:ge,display:ge.toLocaleDateString(Y,{weekday:"short"}).slice(0,3)+"."},{label:D?"Este fin de semana":"This weekend",date:N,display:D?"s\xE1b.":"sat."},{label:D?"Pr\xF3xima semana":"Next week",date:De,display:D?"lun.":"mon."},{label:D?"2 semanas":"2 weeks",date:Xe,display:Xe.toLocaleDateString(Y,{day:"numeric",month:"short"})},{label:D?"4 semanas":"4 weeks",date:He,display:He.toLocaleDateString(Y,{day:"numeric",month:"short"})}].map((te,Be)=>jsxRuntime.jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(te.date),C(false);},children:[jsxRuntime.jsx("span",{children:te.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:te.display})]},Be))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:g("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:P.toLocaleDateString(D?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:D?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(P.getFullYear(),P.getMonth()-1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(P.getFullYear(),P.getMonth()+1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.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(H=>jsxRuntime.jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:H},H))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let H=P.getFullYear(),ge=P.getMonth(),N=new Date(H,ge,1).getDay(),De=new Date(H,ge+1,0).getDate(),Xe=new Date(H,ge,0).getDate(),He=new Date().toDateString(),Y=[];for(let te=N-1;te>=0;te--)Y.push({dayNum:Xe-te,isCurrent:false,date:new Date(H,ge-1,Xe-te)});for(let te=1;te<=De;te++)Y.push({dayNum:te,isCurrent:true,date:new Date(H,ge,te)});let Ee=42-Y.length;for(let te=1;te<=Ee;te++)Y.push({dayNum:te,isCurrent:false,date:new Date(H,ge+1,te)});return Y.map((te,Be)=>{let Se=te.date.toDateString()===He,Le=(f||s)?.toDateString()===te.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!te.isCurrent&&(a?"text-white/20":"text-gray-300"),te.isCurrent&&(a?"text-white":"text-gray-900"),Se&&"ring-1 ring-[#007FFF]",Le&&"bg-[#007FFF] text-white",!Le&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(te.date),C(false);},children:te.dayNum},Be)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:H=>{H.stopPropagation(),v(!y),b(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",u?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:u?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(H=>H.id===u)?.color||"#007FFF"},children:r.find(H=>H.id===u)?.initials||r.find(H=>H.id===u)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="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",F,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(null),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!u&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:a?"text-white/40":"text-gray-500",children:D?"Sin asignar":"Unassigned"})]}),r.map(H=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(H.id),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",u===H.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:H.color||"#007FFF"},children:H.initials||H.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:H.name})]},H.id)),r.length===0&&jsxRuntime.jsx("div",{className:g("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:D?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:ee,disabled:!l.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",l.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:D?"Guardar":"Save"})]})]})}function Nc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:c="es"}){let[l,i]=react.useState(false),d=react.useRef(null),m=react.useRef(null),[u,p]=react.useState({}),[f,x]=react.useState(false),h=o==="dark",y={buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!l||!d.current)return;let w=90,C=()=>{let P=d.current.getBoundingClientRect(),k=window.innerHeight-P.bottom<w+8;x(k),p({position:"fixed",...k?{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);}},[l]),react.useEffect(()=>{if(!l)return;let w=C=>{let P=C.target;m.current&&!m.current.contains(P)&&d.current&&!d.current.contains(P)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]);let v=react.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 jsxRuntime.jsxs("div",{ref:d,className:g("asakaa-add-card",a),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!l),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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:u,className:g("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Os,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:h,locale:c,dropdownDirection:"up"})})}),document.body)]})}var Us=class extends core.BaseViewAdapter{constructor(r={}){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=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=client.createRoot(r),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(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){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: ${r}`)}}render(){if(!this.root||!this.data)return;let r={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(jsxRuntime.jsx(eo,{board:r,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 r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(s=>s.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.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 a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function qp(e={}){return new Us(e)}var Qo=class extends react.Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsxRuntime.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 Dc(e,t){let r=a=>jsxRuntime.jsx(Qo,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Ec({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:c,onOpenAIUsage:l,shortcut:i="k",className:d=""}){let[m,u]=react.useState(false),[p,f]=react.useState(""),[x,h]=react.useState("home"),[b,y]=react.useState(""),[v,w]=react.useState("");react.useEffect(()=>{let k=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),u(F=>!F)),D.key==="Escape"&&(u(false),h("home"),f(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{m||(h("home"),f(""),y(""),w(""));},[m]);let C=react.useCallback(()=>{u(false);},[]),P=react.useCallback(k=>{let[D,F]=k.split(":");switch(D){case "create-card":h("create-card");break;case "create-card-in":y(F||"");break;case "navigate":F?(r?.(F),C()):h("navigate");break;case "search":a?.(p),C();break;case "priority":h("priority");break;case "set-priority":v&&F&&(n?.(v,F),C());break;case "assign":h("assign");break;case "assign-user":v&&F&&(s?.(v,F),C());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":c?.(),C();break;case "ai-usage":l?.(),C();break;case "back":h("home");break;}},[p,v,t,r,a,n,s,o,c,l,C]),L=react.useCallback(()=>{b&&p.trim()&&(t?.(b,p.trim()),C());},[b,p,t,C]);return m?jsxRuntime.jsx(or,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${d}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:p,onValueChange:f,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&L();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},k.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let D=e.columns.find(F=>F.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:P,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:F},F))})]},k.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function Jp(e,t,r,a,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=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,m.onclick=f=>f.stopPropagation(),r.forEach((f,x)=>{let
|
|
51
|
+
`,m.onclick=f=>f.stopPropagation(),r.forEach((f,x)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${x===a?"active":""}`,h.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,
|
|
59
|
+
`,h.onclick=b=>{b.stopPropagation(),i(),n(x);},m.appendChild(h);});let u=document.createElement("button");u.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",u.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>',u.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=f=>{f.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(m),o.appendChild(u),o.appendChild(p);}o.appendChild(c),o.appendChild(l),document.body.appendChild(o),setTimeout(()=>{l.style.transition="opacity 0.5s ease",l.style.opacity="0";},2e3);}function $y(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function Oy(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 Sc(e){return e.startsWith("image/")}function Jo({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,c]=react.useState(false),[l,i]=react.useState(false),[d,m]=react.useState(null),u=react.useRef(null),p=react.useRef(e);p.current=e;let f=react.useCallback((k,N)=>{N.preventDefault(),N.stopPropagation();let P=p.current.filter(H=>Sc(H.type)),D=P.findIndex(H=>H.id===k.id),K=H=>{let ee=p.current.filter(Ee=>Sc(Ee.type)),A=ee[H];A&&Kp(A.url,A.name,ee,H,K);};Kp(k.url,k.name,P,D,K);},[]),x=react.useCallback(k=>{let N=[],P=[];return e.length+k.length>s?(P.push(`Maximum ${s} files allowed`),{valid:N,errors:P}):(k.forEach(D=>{if(D.size/1048576>a){P.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some(H=>D.type.match(H))){P.push(`${D.name} has invalid file type`);return}N.push(D);}),{valid:N,errors:P})},[e.length,s,a,n]),y=react.useCallback(async k=>{let{valid:N,errors:P}=x(k);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(N.length!==0){i(true),m(null);try{await t?.(N);}catch(D){m(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),h=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),w=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let N=Array.from(k.dataTransfer.files);y(N);},[y]),C=react.useCallback(k=>{let N=k.target.files?Array.from(k.target.files):[];y(N),u.current&&(u.current.value="");},[y]),M=react.useCallback(()=>{u.current?.click();},[]),F=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&r?.(k);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${l?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:w,onClick:M,children:[jsxRuntime.jsx("input",{ref:u,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Sc(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:N=>f(k,N),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Oy(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:$y(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>F(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function _y({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," cards"]},a))]})}function Mc({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((c,l)=>c+l.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(_y,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,c)=>o+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,c)=>o+c.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,c)=>o+(c.planned||0),0)})]})]})]})}function tx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," tasks"]},a))]})}function Pc({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,l=s>0?(s-o)/s*100:0,i=o<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(n?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(tx,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:l>=50?"#10B981":"#F59E0B"},children:[l.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var dx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},tm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ux({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,c=e+o*Math.cos(-r*(Math.PI/180)),l=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:l,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function rm({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:r.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function Fc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((l,i)=>l+i.value,0),o=e.map(l=>({...l,totalValue:s,color:l.color||dx[l.name]||tm[e.indexOf(l)%tm.length]})),c=o.map(l=>l.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?ux:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((l,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(rm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(l,i)=>{let d=i.payload,m=s>0?(d.value/s*100).toFixed(0):"0";return `${l} (${d.value} - ${m}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(rm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((l,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((l,i)=>i.value>l.value?i:l).name})]})]})]})}var zi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,c]=react.useState(false),[l,i]=react.useState(false),[d,m]=react.useState(false),[u,p]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(f,{priority:w}),c(false);},y=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},h=w=>{let C=new Set;e.forEach(F=>{F.labels?.forEach(k=>C.add(k));});let M=Array.from(new Set([...C,...w]));a.onBulkUpdate?.(f,{labels:M}),p(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(f),r());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!o),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!l),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});zi.displayName="BulkOperationsToolbar";function bx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,c,l,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(p=>{let f=r?.find(x=>x.id===p);o=`assignee-${p}`,c=f?.name||`User ${p}`,l=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:c,groupValue:p,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",c="Unassigned",l="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=u.title,l=u.color,a.has(o)||a.set(o,{id:o,title:c,groupValue:s,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{o=`label-${p}`,c=p,l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:p,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);}):(o="label-none",c="No Labels",l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Lc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p}){let[f,x]=react.useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),y=react.useMemo(()=>s||bx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p},h=react.useCallback(v=>{x(w=>{let C=new Set(w);return C.has(v)?C.delete(v):C.add(v),C});},[]);return !s&&(t.groupBy==="none"||y.length===0)?jsxRuntime.jsx(Zn,{board:e,className:n,...b}):jsxRuntime.jsxs("div",{className:g("asakaa-swimlane-view",n),children:[y.map(v=>{let w=f.has(v.id),C=e.cards.filter(F=>v.cardIds.includes(F.id)),M={...e,cards:C};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>h(v.id)}):jsxRuntime.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(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Zn,{board:M,...b})})]},v.id)}),y.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Ac=[{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 Ic({value:e,onChange:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),c=Ac.find(i=>i.value===e)||Ac[0];react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!a),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:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Ac.map(i=>jsxRuntime.jsxs("button",{onClick:()=>l(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Us=[{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 xx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,l=n.meta?e.metaKey:true;return s&&o&&c&&l}function im(e={}){let{shortcuts:t=Us,enabled:r=true,preventDefault:a=true}=e,n=react.useRef(t),s=react.useRef(r);react.useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=react.useCallback(l=>{n.current=[...n.current,l];},[]),c=react.useCallback(l=>{n.current=n.current.filter(i=>i.action!==l);},[]);return react.useEffect(()=>{function l(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(xx(i,m)){a&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),{registerShortcut:o,unregisterShortcut:c,isEnabled:r}}function wx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function kx(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Cx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=kx(e),a=t?wx(t):"";return r?`${r} + ${a}`:a}function Tx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Rc({shortcuts:e=Us,isOpen:t,onClose:r,className:a}){let[n,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(l){l.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let o=Tx(e);return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,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"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([c,l])=>l.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:l.map(i=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.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:Cx(i)})]},i.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.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 Bc=[{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
|
+
`,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=f=>{f.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(m),o.appendChild(u),o.appendChild(p);}o.appendChild(c),o.appendChild(l),document.body.appendChild(o),setTimeout(()=>{l.style.transition="opacity 0.5s ease",l.style.opacity="0";},2e3);}function jy(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function _y(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 Pc(e){return e.startsWith("image/")}function Zo({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,c]=react.useState(false),[l,i]=react.useState(false),[d,m]=react.useState(null),u=react.useRef(null),p=react.useRef(e);p.current=e;let f=react.useCallback((k,D)=>{D.preventDefault(),D.stopPropagation();let F=p.current.filter(O=>Pc(O.type)),E=F.findIndex(O=>O.id===k.id),G=O=>{let ee=p.current.filter(Ae=>Pc(Ae.type)),I=ee[O];I&&Jp(I.url,I.name,ee,O,G);};Jp(k.url,k.name,F,E,G);},[]),x=react.useCallback(k=>{let D=[],F=[];return e.length+k.length>s?(F.push(`Maximum ${s} files allowed`),{valid:D,errors:F}):(k.forEach(E=>{if(E.size/1048576>a){F.push(`${E.name} is too large (max ${a}MB)`);return}if(n&&!n.some(O=>E.type.match(O))){F.push(`${E.name} has invalid file type`);return}D.push(E);}),{valid:D,errors:F})},[e.length,s,a,n]),h=react.useCallback(async k=>{let{valid:D,errors:F}=x(k);if(F.length>0){m(F.join(", ")),setTimeout(()=>m(null),5e3);return}if(D.length!==0){i(true),m(null);try{await t?.(D);}catch(E){m(E instanceof Error?E.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),y=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),w=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let D=Array.from(k.dataTransfer.files);h(D);},[h]),C=react.useCallback(k=>{let D=k.target.files?Array.from(k.target.files):[];h(D),u.current&&(u.current.value="");},[h]),P=react.useCallback(()=>{u.current?.click();},[]),L=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&r?.(k);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${l?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:v,onDrop:w,onClick:P,children:[jsxRuntime.jsx("input",{ref:u,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Pc(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:D=>f(k,D),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:_y(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:jy(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>L(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function ex({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," cards"]},a))]})}function Lc({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((c,l)=>c+l.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ex,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,c)=>o+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,c)=>o+c.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,c)=>o+(c.planned||0),0)})]})]})]})}function cx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," tasks"]},a))]})}function Ac({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,l=s>0?(s-o)/s*100:0,i=o<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(n?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(cx,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:l>=50?"#10B981":"#F59E0B"},children:[l.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var yx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},om=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function xx({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,c=e+o*Math.cos(-r*(Math.PI/180)),l=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:l,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function sm({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:r.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function Ic({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((l,i)=>l+i.value,0),o=e.map(l=>({...l,totalValue:s,color:l.color||yx[l.name]||om[e.indexOf(l)%om.length]})),c=o.map(l=>l.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?xx:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((l,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(sm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(l,i)=>{let d=i.payload,m=s>0?(d.value/s*100).toFixed(0):"0";return `${l} (${d.value} - ${m}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(sm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((l,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((l,i)=>i.value>l.value?i:l).name})]})]})]})}var Vi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,c]=react.useState(false),[l,i]=react.useState(false),[d,m]=react.useState(false),[u,p]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(f,{priority:w}),c(false);},h=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},y=w=>{let C=new Set;e.forEach(L=>{L.labels?.forEach(k=>C.add(k));});let P=Array.from(new Set([...C,...w]));a.onBulkUpdate?.(f,{labels:P}),p(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(f),r());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!o),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!l),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Vi.displayName="BulkOperationsToolbar";function Tx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,c,l,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(p=>{let f=r?.find(x=>x.id===p);o=`assignee-${p}`,c=f?.name||`User ${p}`,l=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:c,groupValue:p,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",c="Unassigned",l="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=u.title,l=u.color,a.has(o)||a.set(o,{id:o,title:c,groupValue:s,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{o=`label-${p}`,c=p,l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:p,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);}):(o="label-none",c="No Labels",l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Rc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p}){let[f,x]=react.useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),h=react.useMemo(()=>s||Tx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p},y=react.useCallback(v=>{x(w=>{let C=new Set(w);return C.has(v)?C.delete(v):C.add(v),C});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsxRuntime.jsx(eo,{board:e,className:n,...b}):jsxRuntime.jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(v=>{let w=f.has(v.id),C=e.cards.filter(L=>v.cardIds.includes(L.id)),P={...e,cards:C};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>y(v.id)}):jsxRuntime.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(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(eo,{board:P,...b})})]},v.id)}),h.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Bc=[{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 $c({value:e,onChange:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),c=Bc.find(i=>i.value===e)||Bc[0];react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!a),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:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Bc.map(i=>jsxRuntime.jsxs("button",{onClick:()=>l(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var zs=[{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 Sx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,l=n.meta?e.metaKey:true;return s&&o&&c&&l}function um(e={}){let{shortcuts:t=zs,enabled:r=true,preventDefault:a=true}=e,n=react.useRef(t),s=react.useRef(r);react.useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=react.useCallback(l=>{n.current=[...n.current,l];},[]),c=react.useCallback(l=>{n.current=n.current.filter(i=>i.action!==l);},[]);return react.useEffect(()=>{function l(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(Sx(i,m)){a&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),{registerShortcut:o,unregisterShortcut:c,isEnabled:r}}function Mx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Px(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Fx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Px(e),a=t?Mx(t):"";return r?`${r} + ${a}`:a}function Lx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Oc({shortcuts:e=zs,isOpen:t,onClose:r,className:a}){let[n,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(l){l.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let o=Lx(e);return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,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"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([c,l])=>l.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:l.map(i=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.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:Fx(i)})]},i.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.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 Hc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function $c({templates:e,onSelectTemplate:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.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:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(l).map(([i,d])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:d.map(m=>jsxRuntime.jsxs("button",{onClick:()=>c(m),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Hc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=react.useState("export"),[l,i]=react.useState("json"),[d,m]=react.useState(null),u=react.useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,y=await Au(e,l,x);Iu(y,l);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await $u(y),h=y.name.endsWith(".json")?"json":"csv",v=Bu(b,h);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:r,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"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("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"}),jsxRuntime.jsx("button",{onClick:()=>c("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"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[o==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,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"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:u,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var Mx=["URGENT","HIGH","MEDIUM","LOW"],Px=[{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"}],Fx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Uc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:f}){let[x,y]=react.useState(true),b=react.useCallback(M=>{r({search:M.target.value});},[r]),h=react.useCallback(M=>{r({dateFilter:M.target.value});},[r]),v=react.useCallback(M=>{a({by:M.target.value});},[a]),w=react.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[m&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:M=>{let F=M.target.value;r({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Mx.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let F=M.target.value;r({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),l.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let F=M.target.value;r({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Px.map(M=>jsxRuntime.jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fx.map(M=>jsxRuntime.jsx("option",{value:M.value,children:M.label},M.value))})}),C&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let p=f=>{m.current&&!m.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxRuntime.jsxs("div",{className:g("relative",a),ref:m,children:[jsxRuntime.jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.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"?jsxRuntime.jsxs("button",{onClick:()=>u(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>u(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>u(async()=>await 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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>u(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>u(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.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"]}),jsxRuntime.jsxs("button",{onClick:()=>u(r),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var zc={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"}},Gc={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"}},Vc={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"}},So={dark:zc,light:Gc,neutral:Vc},Vi="dark";var ji=react.createContext(void 0),Wx="asakaa-theme";function dm({children:e,defaultTheme:t=Vi,storageKey:r=Wx}){let[a,n]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=So[a];Object.entries(l.colors).forEach(([d,m])=>{m&&c.style.setProperty(`--theme-${zx(d)}`,m);}),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(([d,m])=>{let u=l.colors[d];u&&c.style.setProperty(m,u);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:So};return jsxRuntime.jsx(ji.Provider,{value:o,children:e})}function es(){let e=react.useContext(ji);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function jc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=es();return e?jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.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"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(So).map(([s,o])=>jsxRuntime.jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:o.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxRuntime.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"]})]}),a===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var ct={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 um(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:a("--theme-bg-card",ct[e].bgGrid),bgWeekend:a("--theme-bg-hover",ct[e].bgWeekend),border:a("--theme-border-primary",ct[e].border),borderLight:a("--theme-border-subtle",ct[e].borderLight),textPrimary:a("--theme-text-primary",ct[e].textPrimary),textSecondary:a("--theme-text-secondary",ct[e].textSecondary),textTertiary:a("--theme-text-tertiary",ct[e].textTertiary),accent:a("--theme-accent-primary",ct[e].accent),accentHover:a("--theme-accent-hover",ct[e].accentHover),accentLight:a("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ct[e].dependency),dependencyHover:a("--theme-border-secondary",ct[e].dependencyHover),criticalPath:a("--theme-error",ct[e].criticalPath),criticalPathLight:a("--theme-error",ct[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ct[e].today):e==="neutral"?a("--theme-text-primary",ct[e].today):a("--theme-error",ct[e].today),todayLight:e==="light"?a("--theme-accent-primary",ct[e].todayLight):e==="neutral"?a("--theme-text-primary",ct[e].todayLight):a("--theme-error",ct[e].todayLight),milestone:a("--theme-warning",ct[e].milestone),milestoneLight:a("--theme-warning",ct[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:a("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:a("--theme-success",ct[e].statusCompleted),hoverBg:a("--theme-bg-hover",ct[e].hoverBg),focusRing:a("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var _i={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},pm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},_c={en:_i,es:pm};function mm(e){return _c[e]||_c.en}function Kc(e,t){let r=mm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var rs=react.createContext(_i);function qa(){return react.useContext(rs)}function Gs(e,t,r="left",a=208){let[n,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function km({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=react.useState(false),[i,d]=react.useState(null),m=react.useRef(null),u=react.useRef(null),p=qa(),f=Gs(m,c,"right",176);if(react.useEffect(()=>{if(!c)return;let h=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||s||o))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){d(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{d(null),l(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:m,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:u,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:jsxRuntime.jsx("div",{className:"py-1",children:y.map((h,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function fm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=react.useState(false),[l,i]=react.useState(null),[d,m]=react.useState(false),u=react.useRef(null),p=react.useRef(null),f=qa(),x=Gs(u,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!o)return;let C=M=>{let F=M.target;u.current&&!u.current.contains(F)&&p.current&&!p.current.contains(F)&&c(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),v=async(C,M)=>{if(M){i(C);try{await M();}catch(F){console.error(`Export ${C} failed:`,F);}finally{i(null),c(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>c(!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:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.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:[h.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((C,M)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(C.id,C.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 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:M*.03},children:[jsxRuntime.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:l===C.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),h.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 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:h.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function dv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(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?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function uv({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function bm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=react.useState(false),o=react.useRef(null),c=react.useRef(null),l=qa(),i=Gs(o,n,"left");react.useEffect(()=>{if(!n)return;let u=p=>{let f=p.target;o.current&&!o.current.contains(f)&&c.current&&!c.current.contains(f)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.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:`${l.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(framerMotion.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-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((u,p)=>{let f=t===u.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(u.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:p<d.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:p*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:u.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function hm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=react.useState(false),c=react.useRef(null),l=react.useRef(null),i=qa(),d=Gs(c,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;c.current&&!c.current.contains(h)&&l.current&&!l.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),l._cleanup&&l._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:c,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"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:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!a,y=()=>f.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(f.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:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function pv({value:e,onChange:t,theme:r}){let a=qa(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function mv({theme:e,forecast:t}){let r=qa(),a=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,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:c})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&y&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function gv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=react.useState(false),f=react.useRef(null),x=react.useRef(null),y=qa(),b=Gs(f,u,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!u)return;let M=F=>{let k=F.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&p(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:c,onChange:l}],C=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:f,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.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:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:w.map((M,F)=>{let k=M.icon,N=M.disabled,P=M.tooltip;return jsxRuntime.jsxs(framerMotion.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:F*.03},title:P,children:[jsxRuntime.jsx(k,{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}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!N&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((M,F)=>{let k=i===M.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(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:(w.length+F)*.03},children:[jsxRuntime.jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Ki({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:C="execution",onViewModeChange:M,projectForecast:F,hideForecastHud:k,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportCSV:K,onExportJSON:H,onExportMSProject:ee,showCriticalPath:A=true,onShowCriticalPathChange:Ee,showDependencies:O=true,onShowDependenciesChange:U,highlightWeekends:R=true,onHighlightWeekendsChange:Ae,showBaseline:Je=false,onShowBaselineChange:$e,onCopySnapshotLink:J,hasDependencies:De=true}){let oe=qa(),Ue=N||P||D||K||H||ee,Ne=!!e.glassToolbar,Me=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],Re=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Qe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ne){let ie=Qe?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:M&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Qe?"#000000":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>M("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:oe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>M("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Qe?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:C==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(pv,{value:t,onChange:r,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),v&&jsxRuntime.jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsx(hm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),jsxRuntime.jsx(gv,{theme:e,showCriticalPath:A,onShowCriticalPathChange:Ee,showBaseline:Je,onShowBaselineChange:$e,highlightWeekends:R,onHighlightWeekendsChange:Ae,showDependencies:O,onShowDependenciesChange:U,rowDensity:c,onRowDensityChange:l,hasDependencies:De}),jsxRuntime.jsx(fm,{theme:e,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),d&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Qe?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||oe.toolbar.createTask})]})]})]}),F&&!k&&jsxRuntime.jsx(mv,{theme:e,forecast:F})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(uv,{options:Me,value:t,onChange:ie=>r(ie),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsxRuntime.jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(hm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||oe.toolbar.createTask})]}),(Ue||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(fm,{theme:e,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(dv,{options:Re,value:s,onChange:ie=>o(ie),theme:e})]})]})}function qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=react.useState(false),[s,o]=react.useState({x:0,y:0}),c=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{if(!a)return;let d=m=>{c.current&&!c.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsx(framerMotion.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:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxRuntime.jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:d.label}),d.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function os({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=react.useRef(null),[c,l]=react.useState({x:t,y:r});if(react.useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,f=window.innerHeight,x=t,y=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>f&&(y=f-m-u,y<u&&(y=u)),l({x,y});},[e,t,r,a.length]),react.useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.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:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(d=>jsxRuntime.jsxs("div",{children:[d.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var tr={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Mm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=react.useRef(false),f=react.useCallback(v=>{p.current=v;},[]),x=react.useCallback(v=>{let w=[],C=M=>{for(let F of M)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&C(F.subtasks);};return C(v),w},[]),y=react.useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=react.useCallback((v,w)=>{let C=x(e);if(C.length===0)return;let M=y();if(!M){r(C[0].id,false);return}let F=C.findIndex(P=>P.id===M.id);if(F===-1)return;let k=v==="up"?F-1:F+1;if(k<0||k>=C.length)return;let N=C[k];r(N.id,w);},[e,y,x,r]),h=react.useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),N=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(N&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!N.isExpanded||v.key==="ArrowLeft"&&N.isExpanded)&&d(N.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!F){N&&(v.preventDefault(),a(N.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){N&&(v.preventDefault(),a(N.id,"above"));return}if(v.key==="Enter"&&F){N&&(v.preventDefault(),m(N.id));return}if(v.key==="F2"){N&&(v.preventDefault(),i(N.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&F&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[u,t,y,b,a,n,s,o,c,l,i,d,m]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:f}}function Fm(e){let[t,r]=react.useState(new Set),[a,n]=react.useState(null);react.useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=react.useCallback(u=>{r(new Set([u])),n(u);},[]),o=react.useCallback(u=>{r(p=>{let f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f}),n(u);},[]),c=react.useCallback((u,p)=>{if(!a){s(u);return}let f=p.indexOf(a),x=p.indexOf(u);if(f===-1||x===-1){s(u);return}let y=Math.min(f,x),b=Math.max(f,x),h=p.slice(y,b+1);r(new Set(h)),n(u);},[a,s]),l=react.useCallback((u,p,f,x)=>{x?c(u,p):f?o(u):s(u);},[s,o,c]),i=react.useCallback((u,p)=>{p?r(f=>{let x=new Set(f);return x.add(u),x}):s(u);},[s]),d=react.useCallback(()=>{r(new Set),n(null);},[]),m=react.useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:c,handleTaskClick:l,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function Qc(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?Qc(t.subtasks):t.subtasks}))}function Mo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ss(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ss(r.subtasks,t);if(a)return a}}return null}function Jc(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Jc(r.subtasks,t);if(a)return a}return null}function Zc(e,t){if(t.length===0)return e;let r=Mo(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let f=[];return {tasks:u.filter(y=>{if(p.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,p);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},c=(u,p,f)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,p,f)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),m=c(i,s.id,d);return Qc(m)}function ed(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Jc(r,a);if(!n)continue;let s=Jc(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let f=p.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=p.subtasks.splice(f,1);return x}}if(p.subtasks){let f=o(p.subtasks,d,m);if(f)return f}}return null},c=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&c(p.subtasks,d,m);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return Qc(r)}function td(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(m=>m.id===c);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function rd(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function js(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=l=>{let i=l.findIndex(p=>p.id===n);if(i===-1){for(let p of l)if(p.subtasks){let f=o(p.subtasks);if(f)return f}return null}let d=l[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return l.splice(i+1,0,u),u},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Lm(e,t,r){let a=[...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"},c=l=>{let i=l.findIndex(m=>m.id===t);if(i===-1){for(let m of l)if(m.subtasks&&c(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function ad(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ad(a.subtasks,t,r)}:a)}function nd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:nd(r.subtasks,t)}:r)}function od(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let f=r(p.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let f=l(p.subtasks);if(f>=0)return f}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let f=p.subtasks||[];return {...p,subtasks:[...f,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function Am(e,t,r,a){if(t===r)return e;let n=ss(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((f,x)=>({...f,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function Ya(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ya(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Xi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:c,onTaskDblClick:l,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:f,onTaskUpdate:x,onBulkFill:y,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:M,onTaskRename:F,onCreateSubtask:k,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:D,allTasks:K,scrollContainerRef:H,showCriticalPath:ee=false}){let A=react.useContext(rs),[Ee,O]=react.useState(null),[U,R]=react.useState(null),[Ae,Je]=react.useState(""),$e=react.useRef(null),[J,De]=react.useState(null),[oe,Ue]=react.useState(0),[Ne,Me]=react.useState(0),[Re,Qe]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ie,et]=react.useState(null),[Ve,Oe]=react.useState(null),[ut,pt]=react.useState(null),Ge=react.useRef(0),Pe=5,ot=react.useRef(false),[$t,Be]=react.useState(null),[st,L]=react.useState(false),X=react.useRef(null),[B,Y]=react.useState(null),[re,he]=react.useState(null),[qe,j]=react.useState(false),ye=react.useRef(null);react.useEffect(()=>{function ce(ue){ye.current&&!ye.current.contains(ue.target)&&j(false);}if(qe)return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[qe]),react.useEffect(()=>{U&&$e.current&&($e.current.focus(),$e.current.select());},[U]),react.useEffect(()=>{if(!J)return;let ce=mt=>{let V=mt.clientX-oe,fe=Ne+V;f?.(J,fe);},ue=()=>{De(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ce),document.addEventListener("mouseup",ue),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[J,oe,Ne,f]);let{selectedTaskIds:Fe,handleTaskClick:Ie,isTaskSelected:Ct}=Fm(c),{setIsEditing:Ze}=Mm({tasks:e,selectedTaskIds:Fe,onTaskSelect:(ce,ue)=>{let V=Mo(e).map(fe=>fe.id);Ie(ce,V,ue||false,false),o?.(ce);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:ce=>{let ue=Mo(e).find(mt=>mt.id===ce);ue&&_r(ue);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ce=>{let ue=Mo(e).find(mt=>mt.id===ce);ue&&N&&N(ue);},enableKeyboard:true}),Tt=(ce,ue=0,mt="")=>{let V=[],fe=[...ce].sort((Q,$)=>(Q.position??0)-($.position??0));for(let Q=0;Q<fe.length;Q++){let $=fe[Q],te=Q+1,xe=mt?`${mt}.${te}`:`${te}.0`,T=$.wbsCode||xe;if($.wbsCode=T,V.push({task:$,level:ue}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let pe=$.wbsCode?.replace(/\.0$/,"")||(mt?`${mt}.${te}`:`${te}`);V.push(...Tt($.subtasks,ue+1,pe));}}return V},ft=Tt(e),zt=48,rr=Math.max(ft.length*r,600-zt),da=(ce,ue)=>ue==="assignees"?ce.assignees:ue==="startDate"?ce.startDate:ce.endDate,Vt=(ce,ue,mt,V)=>{ce.preventDefault(),ce.stopPropagation(),Y({sourceTaskId:ue,column:mt,sourceIndex:V,targetIndex:V}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=ce.currentTarget.closest("[data-grid-body]"),Q=ve=>{let it=fe?.getBoundingClientRect().top??0,ae=Math.floor((ve-it)/r);return ae=Math.max(0,Math.min(ft.length-1,ae)),ae<V&&(ae=V),ae},$=ce.clientY,te=H?.current??null,xe=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},T=()=>{let ve=Q($);Y(it=>it&&{...it,targetIndex:ve});},W=()=>{if(xe(),!te)return;let ve=te.getBoundingClientRect(),it=60,ae=12,lt=$-ve.top,bt=ve.bottom-$;if(bt<it&&te.scrollTop<te.scrollHeight-te.clientHeight){let Mt=Math.max(1,Math.round(ae*(1-Math.max(0,bt)/it))),br=()=>{te.scrollTop+=Mt,T(),te.scrollTop<te.scrollHeight-te.clientHeight&&(X.current=requestAnimationFrame(br));};X.current=requestAnimationFrame(br);}else if(lt<it&&te.scrollTop>0){let Mt=Math.max(1,Math.round(ae*(1-Math.max(0,lt)/it))),br=()=>{te.scrollTop-=Mt,T(),te.scrollTop>0&&(X.current=requestAnimationFrame(br));};X.current=requestAnimationFrame(br);}},pe=ve=>{$=ve.clientY,T(),W();},_=ve=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",_),xe(),document.body.style.cursor="",document.body.style.userSelect="",Y(null);let it=Q(ve.clientY),ae=ft.find(ha=>ha.task.id===ue)?.task;if(!ae)return;let lt=da(ae,mt),bt=Math.min(V,it),Mt=Math.max(V,it),br=[];for(let ha=bt;ha<=Mt;ha++){if(ha===V)continue;let Mr=ft[ha]?.task;!Mr||Mr.subtasks&&Mr.subtasks.length>0||br.push(Mr.id);}br.length!==0&&y?.(br,mt,lt);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",_);},gr=ce=>{if(!B)return false;let ue=Math.min(B.sourceIndex,B.targetIndex),mt=Math.max(B.sourceIndex,B.targetIndex);return ce>=ue&&ce<=mt},Bt=ce=>!ce.startDate||!ce.endDate?"-":`${Math.ceil((ce.endDate.getTime()-ce.startDate.getTime())/(1e3*60*60*24))}d`,_r=ce=>{R(ce.id),Je(ce.name),Ze(true);},jt=ce=>{Ae.trim()&&Ae!==e.find(ue=>ue.id===ce)?.name&&F?.(ce,Ae.trim()),R(null),Je(""),Ze(false);},Qt=()=>{R(null),Je(""),Ze(false);},zr=(ce,ue)=>{ue.stopPropagation(),k?.(ce.id);},ua=(ce,ue)=>{ue.preventDefault(),Ge.current=ue.clientY,et(ce),ot.current=false,L(false),Be({x:ue.clientX,y:ue.clientY});},rt=ce=>{if(!ie||(Math.abs(ce.clientY-Ge.current)>Pe&&!ot.current&&(ot.current=true,L(true)),Be({x:ce.clientX,y:ce.clientY}),!ot.current))return;if(H?.current){let Q=H.current,$=Q.getBoundingClientRect(),te=60,xe=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let T=ce.clientY-$.top,W=$.bottom-ce.clientY;if(T<te&&Q.scrollTop>0){let pe=Math.round(xe*(1-T/te)),_=()=>{Q.scrollTop-=pe,ot.current&&Q.scrollTop>0&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}else if(W<te&&Q.scrollTop<Q.scrollHeight-Q.clientHeight){let pe=Math.round(xe*(1-W/te)),_=()=>{Q.scrollTop+=pe,ot.current&&Q.scrollTop<Q.scrollHeight-Q.clientHeight&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}}let mt=document.querySelectorAll("[data-task-row]"),V=null,fe=null;mt.forEach(Q=>{let $=Q.getBoundingClientRect(),te=Q.getAttribute("data-task-row");if(te&&te!==ie&&ce.clientY>=$.top&&ce.clientY<=$.bottom){V=te;let xe=ce.clientY-$.top,T=$.height;xe<T*.25?fe="above":xe>T*.75?fe="below":fe="child";}}),Oe(V),pt(fe);},Ke=()=>{if(ot.current&&ie&&Ve&&ut){if(ut==="child")D?.(ie,Ve);else if(ut==="above"||ut==="below"){let ce=(Q,$,te=null)=>{for(let xe of Q){if(xe.id===$)return te;if(xe.subtasks){let T=ce(xe.subtasks,$,xe.id);if(T!==void 0)return T}}},ue=K&&K.length>0?K:e,mt=ce(ue,ie,null),V=ce(ue,Ve,null),fe=(Q,$,te,xe)=>{let T=Q.findIndex(_=>_.id===$),W=xe?Q.findIndex(_=>_.id===te):-1,pe=ut==="below"?T+1:T;return xe&&W!==-1&&W<T&&(pe-=1),Math.max(0,pe)};if(V===null){let $=fe(ue,Ve,ie,mt===null);D?.(ie,null,$);}else {let Q=ss(ue,V);if(Q?.subtasks){let $=mt===V,te=fe(Q.subtasks,Ve,ie,$);D?.(ie,V,te);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),et(null),Oe(null),pt(null),Be(null),ot.current=false,L(false);};react.useEffect(()=>{if(ie)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",Ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",Ke),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ve,ut]);let ba=(ce,ue,mt)=>{let V=ue.subtasks&&ue.subtasks.length>0;switch(ce.id){case "name":let fe=U===ue.id,Q=Ee===ue.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${mt*20}px`},children:[D&&jsxRuntime.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:Q?1:.3},onMouseDown:ae=>ua(ue.id,ae),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ue.subtasks&&ue.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),d?.(ue.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ue.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),fe?jsxRuntime.jsx("input",{ref:$e,type:"text",value:Ae,onChange:ae=>Je(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?jt(ue.id):ae.key==="Escape"&&Qt();},onBlur:()=>jt(ue.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:ae=>ae.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ue.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ue.parentId?"13px":"14px",fontWeight:ue.isMilestone?600:ue.parentId?400:600,letterSpacing:ue.parentId?"0":"-0.01em"},title:ue.name,children:[ue.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ue.wbsCode}),ue.isHighlighted&&ue.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ue.name}),ue.subtasks&&ue.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ue.progress||0),"%"]}),ee&&ue.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ee&&ue.cpmData&&jsxRuntime.jsxs("span",{style:{color:ue.cpmData.totalFloat<=0?"#EF4444":ue.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ue.cpmData.totalFloat),"d"]})]}),Q&&!fe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ae=>zr(ue,ae),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),_r(ue);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let te=ce.id==="startDate"?"startDate":"endDate",xe=ue[te],T=re?.taskId===ue.id&&re?.field===te,W=ae=>ae?(typeof ae=="string"?new Date(ae):ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.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:V?.5:1,cursor:V?"default":"pointer"},title:V?"Auto-calculated from subtasks":void 0,onClick:ae=>{if(!V)if(T)he(null);else {let lt=ae.currentTarget.getBoundingClientRect();he({taskId:ue.id,field:te,month:xe?typeof xe=="string"?new Date(xe):xe:new Date,position:{top:lt.bottom+4,left:lt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:W(xe)}),V&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),T&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>he(null)}),jsxRuntime.jsxs(framerMotion.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:re?.position.top,left:re?.position.left},onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ae=new Date,lt=new Date(ae);lt.setDate(ae.getDate()+1);let bt=new Date(ae);bt.setDate(ae.getDate()+7);let Mt=new Date(ae);return Mt.setDate(ae.getDate()+14),[{label:"Hoy",date:ae},{label:"Ma\xF1ana",date:lt},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Mt}].map((ha,Mr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:tn=>tn.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:tn=>tn.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[te]:ha.date}),he(null);},children:ha.label},Mr))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[te]:void 0}),he(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:re?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ae,lt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ae},lt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=re?.month||new Date,lt=ae.getFullYear(),bt=ae.getMonth(),Mt=new Date(lt,bt,1).getDay(),br=new Date(lt,bt+1,0).getDate(),ha=new Date,Mr=[];for(let lr=Mt-1;lr>=0;lr--)Mr.push({day:new Date(lt,bt,-lr).getDate(),date:new Date(lt,bt-1,new Date(lt,bt,-lr).getDate()),isCurrentMonth:false});for(let lr=1;lr<=br;lr++)Mr.push({day:lr,date:new Date(lt,bt,lr),isCurrentMonth:true});let tn=42-Mr.length;for(let lr=1;lr<=tn;lr++)Mr.push({day:lr,date:new Date(lt,bt+1,lr),isCurrentMonth:false});return Mr.map((lr,Ra)=>{let Ho=lr.date.toDateString()===ha.toDateString(),_n=(xe?typeof xe=="string"?new Date(xe):xe:null)?.toDateString()===lr.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:lr.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:Ho&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(ue.id,{[te]:lr.date}),he(null);},children:lr.day},Ra)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Bt(ue)})});case "assignees":if(V)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let pe=a.filter(ae=>ue.assignees?.some(lt=>lt.id?lt.id===ae.id:lt.name===ae.name||lt.initials===ae.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(ko,{assignedUsers:pe,availableUsers:a,onChange:ae=>{let lt=ae.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));x?.(ue.id,{assignees:lt});}})});case "status":if(V){let ae=ue.progress===100?"\u2713":ue.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ae})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(rp,{status:ue.status||"todo",onChange:ae=>{x?.(ue.id,{status:ae,progress:ae==="completed"?100:ue.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:V?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:ue.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[ue.progress,"%"]})]});case "priority":let _={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ve={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},it=_[ue.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(vo,{priority:it,onChange:ae=>{ae&&x?.(ue.id,{priority:ve[ae]||"medium"});}})});default:return null}},ir=ce=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>p(ce),disabled:ce==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:tr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:tr.SortDesc,onClick:()=>{}}],Qr=ce=>{let ue=ce.subtasks&&ce.subtasks.length>0,mt=Mo(e),V=Fe.size>1&&Fe.has(ce.id),fe=V?mt.filter(T=>Fe.has(T.id)):[ce],Q=fe.map(T=>T.id),$=fe.filter(T=>!(T.subtasks&&T.subtasks.length>0)),te=V?` (${Q.length})`:"",xe=()=>{P?P(Q,ce.name):w?.(Q);};return ue?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(ce.id);}},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:xe}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{l?.(ce);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(ce.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(A?.contextMenu?.markIncomplete||"Mark Incomplete")+te,icon:tr.MarkIncomplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(T=>T.status==="todo")},{id:"setInProgress",label:(A?.contextMenu?.setInProgress||"Set In Progress")+te,icon:tr.SetInProgress,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"in-progress"}));},disabled:$.length===0||$.every(T=>T.status==="in-progress")},{id:"markComplete",label:(A?.contextMenu?.markComplete||"Mark Complete")+te,icon:tr.MarkComplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(T=>T.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:xe}]},fr=u.filter(ce=>ce.visible),Ca=fr.reduce((ce,ue)=>ce+ue.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ca},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${zt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:fr.map((ce,ue)=>{let mt=ue===fr.length-1,V=ce.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${V?"":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(V?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:V&&fr.length===1?1:0,flexGrow:V&&fr.length===1?1:0,borderRight:mt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Qe({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:ce.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.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:ce.label,children:ce.label}),ce.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:J===ce.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),De(ce.id),Ue(fe.clientX),Me(ce.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:J===ce.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ce.id)})}),jsxRuntime.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:[jsxRuntime.jsx(qi,{columns:u,onToggleColumn:p,theme:t}),jsxRuntime.jsx("button",{onClick:()=>j(!qe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),qe&&jsxRuntime.jsxs("div",{ref:ye,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:ce=>ce.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>j(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:rr},children:ft.map(({task:ce,level:ue},mt)=>{let V=Ct(ce.id),fe=gr(mt),Q=Ve===ce.id,$=Q&&ut==="above",te=Q&&ut==="below",xe=Q&&ut==="child",T={};return xe&&(T.backgroundColor=`${t.accent}15`,T.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ce.id,className:`flex items-center cursor-pointer group ${ie===ce.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:V?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:V?t.accentLight:xe?`${t.accent}15`:mt%2===0?t.bgPrimary:t.bgGrid,opacity:ee?ce.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...T},onMouseEnter:()=>O(ce.id),onMouseLeave:()=>O(null),onClick:W=>{let _=Mo(e).map(ae=>ae.id),it=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;Ie(ce.id,_,it,W.shiftKey),o?.(ce.id),!it&&!W.shiftKey&&s?.(ce);},onDoubleClick:W=>{W.stopPropagation(),l?.(ce);},onContextMenu:W=>{W.preventDefault(),Qe({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:ce}),i?.(ce,W);},whileHover:{backgroundColor:V?t.accentLight:t.hoverBg},children:[$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),fr.map((W,pe)=>{let _=pe===fr.length-1,ve=W.id==="name",it=!!(ce.subtasks&&ce.subtasks.length>0),ae=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!ae&&!it&&Ee===ce.id&&!B,Mt=fe&&!!B&&B.column===W.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${ve?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(ve?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:ve&&fr.length===1?1:0,flexGrow:ve&&fr.length===1?1:0,borderRight:_?"none":`1px solid ${Ee===ce.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Mt?`${t.accent}22`:void 0,boxShadow:Mt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ba(W,ce,ve?ue:0),bt&&ae&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:br=>Vt(br,ce.id,ae,mt),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}})]},`${ce.id}-${W.id}`)})]},ce.id)})}),jsxRuntime.jsx(os,{isOpen:Re.isOpen,x:Re.x,y:Re.y,items:Re.type==="header"&&Re.columnId?ir(Re.columnId):Re.type==="task"&&Re.task?Qr(Re.task):[],onClose:()=>Qe({...Re,isOpen:false}),theme:t}),st&&$t&&ie&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:$t.x+12,top:$t.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=ft.find(ue=>ue.task.id===ie)?.task;return ce?jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ce.name})}):null})()}),document.body)]})}function Om(e,t){let[r,a]=react.useState("none"),[n,s]=react.useState(0),[o,c]=react.useState(e),[l,i]=react.useState(t),[d,m]=react.useState(null),[u,p]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(0),[w,C]=react.useState(0),[M,F]=react.useState(null),[k,N]=react.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:M,setHoveredSegmentIndex:F,isHovered:k,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(ee,A)=>{a("none"),m(null),p(null),c(ee),i(A),C(0),b(null),v(0);}}}function Ji({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let C=Om(t,a),M=react.useRef(null),F=react.useRef(false),k=react.useRef(null),N=react.useRef(null),{dragMode:P,setDragMode:D,dragOffset:K,setDragOffset:H,ghostX:ee,setGhostX:A,ghostWidth:Ee,setGhostWidth:O,connectionLine:U,setConnectionLine:R,hoveredTaskId:Ae,setHoveredTaskId:Je,activeZone:$e,setActiveZone:J,draggedSegmentIndex:De,setDraggedSegmentIndex:oe,draggedSegmentStartX:Ue,setDraggedSegmentStartX:Ne,segmentDragOffsetX:Me,setSegmentDragOffsetX:Re,hoveredSegmentIndex:Qe,setHoveredSegmentIndex:ie,isHovered:et,setIsHovered:Ve,isDragging:Oe,isResizing:ut,isConnecting:pt,resetDragState:Ge}=C,Pe=18,ot=!!n.executionBarBg,$t=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Be=ot?3:6,st=e.subtasks&&e.subtasks.length>0,L=react.useRef(null),[X,B]=(()=>{let V=react.useRef(null),[,fe]=react.useState(0);return [V.current,Q=>{V.current=Q,fe($=>$+1);}]})(),Y=!!w&&!v&&!st&&!e.segments&&!!e.startDate&&!!e.endDate,re=e.endDate&&(()=>{let V=new Date;V.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<V})()&&e.progress<100,he=h&&e.isCriticalPath,qe=n.name==="neutral"||n.today==="#1C1917",j=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ie=h&&e.isCriticalPath||re?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:n.taskBarPrimary,Ct=v?"default":Oe?pt?"crosshair":ut?"ew-resize":"grabbing":"grab",Ze=v?"default":"ew-resize",ft=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),zt=a<50,rr=a<40;react.useEffect(()=>{x&&(!et||Oe||e.segments)&&x(null);},[et,Oe,e.segments,x]);let da=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Vt=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},gr=V=>Math.round(V/s)*s,Bt=V=>{let fe=Math.round(V/s),Q=new Date(o);return Q.setDate(Q.getDate()+fe),Q},_r=(V,fe)=>{for(let Q of p){if(Q.id===e.id)continue;let $=5;if(V>=Q.x-$&&V<=Q.x+Q.width+$&&fe>=Q.y-$&&fe<=Q.y+Q.height+$)return Q.id}return null},jt=react.useCallback((V,fe,Q)=>{if(v)return;V.preventDefault(),V.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let te=$.createSVGPoint();te.x=V.clientX,te.y=V.clientY;let xe=te.matrixTransform($.getScreenCTM()?.inverse()),T=Q!==void 0?Q:t,W=fe;if(!W){let pe=xe.x-T;V.shiftKey?(W="connect",R({x:t+a,y:r+Pe/2})):V.ctrlKey||V.metaKey?W="move":V.altKey?W=pe<a/2?"resize-start":"resize-end":rr?pe<a/2?W="move":W="resize-end":zt?pe<=ft/2?W="resize-start":pe>=a-ft/2?W="resize-end":W="move":pe<=ft?W="resize-start":pe>=a-ft?W="resize-end":W="move";}F.current=false,D(W),Ve(false),J(null),W==="move"?H(xe.x-T):W==="connect"?R({x:t+a,y:r+Pe/2}):H(0),A(T),O(a);},[t,a,r,Pe,v]),Qt=react.useCallback(V=>{let fe=M.current?.ownerSVGElement;if(!fe)return;let Q=fe.closest(".gantt-timeline-scroll");if(!Q)return;let $=Q.getBoundingClientRect(),te=60,xe=15,T=0;if(V.clientX<$.left+te){let W=$.left+te-V.clientX;T=-Math.min(xe,W/2);}else if(V.clientX>$.right-te){let W=V.clientX-($.right-te);T=Math.min(xe,W/2);}return T!==0&&(Q.scrollLeft+=T),T!==0},[]),zr=react.useCallback(V=>{if(P==="none")return;F.current=true,N.current=V;let fe=M.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let te=Qt(V);te&&!k.current?k.current=window.setInterval(()=>{N.current&&(Qt(N.current),zr(N.current));},16):!te&&k.current&&(window.clearInterval(k.current),k.current=null);}let Q=fe.createSVGPoint();Q.x=V.clientX,Q.y=V.clientY;let $=Q.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){R({x:$.x,y:$.y});let te=_r($.x,$.y);Je(te);}else if(P==="move"){let te=$.x-K,xe=gr(te);A(xe),O(a);let T=Math.round((xe-t)/s);if(f?.(e.id,T,true),e.segments&&e.segments.length>0&&De!==null){let W=xe-Ue;Re(W);}}else if(P==="resize-start"){let te=$.x,xe=gr(te),T=t+a-xe;T>=s&&(A(xe),O(T));}else if(P==="resize-end"){let te=$.x,T=gr(te)-t;T>=s&&O(T);}},[P,t,a,s,K,e,gr,De,Ue,_r,Je,R,A,O,Re,f,Qt]),ua=react.useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),N.current=null,P!=="none"){if(P==="connect")Ae&&u&&u(e,Ae),R(null),Je(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),fe,Q,$=true;if(P==="move"){if(fe=Bt(ee),Q=new Date(fe.getTime()+V),e.segments&&e.segments.length>0&&De!==null){let te=Math.round(Me/s),xe=e.segments.map((_,ve)=>{if(ve===De){let it=new Date(_.startDate),ae=new Date(_.endDate);return it.setDate(it.getDate()+te),ae.setDate(ae.getDate()+te),{startDate:it,endDate:ae}}return _}),T=xe.flatMap(_=>[_.startDate,_.endDate]),W=new Date(Math.min(...T.map(_=>_.getTime()))),pe=new Date(Math.max(...T.map(_=>_.getTime())));m?.({...e,segments:xe},W,pe),Ge(t,a);return}}else P==="resize-start"?(fe=Bt(ee),Q=e.endDate,fe>Q&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(fe=e.startDate,Q=Bt(ee+Ee),Q.setDate(Q.getDate()-1),Q<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&fe&&Q&&(Q.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,Q));}f?.(e.id,0,false),Ge(t,a);}},[P,ee,Ee,e,m,Ae,u,t,a,s,Bt,Me,De,Ge,f]);react.useEffect(()=>{if(P==="none")return;let V=Q=>{zr(Q);},fe=()=>{ua();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",fe),k.current&&(window.clearInterval(k.current),k.current=null);}},[P,zr,ua]);let rt=Oe&&!pt?ee:t,Ke=Oe&&!pt?Ee:a,ba=c.taskClass(e),ir=24,Qr=h?e.isCriticalPath?1:.25:1,fr=react.useCallback(V=>{if(!Y)return;V.stopPropagation(),V.preventDefault();let Q=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:Q,initialPct:e.progress||0},V.currentTarget.setPointerCapture(V.pointerId),B(e.progress||0);},[Y,e.progress,B]),Ca=react.useCallback(V=>{let fe=L.current;if(!fe)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!$||$.width<=0)return;let te=(V.clientX-$.left)/$.width,xe=Math.round(Math.max(0,Math.min(1,te))*100);V.shiftKey&&(xe=Math.round(xe/25)*25),B(xe);},[B]),ce=react.useCallback(V=>{let fe=L.current;if(!fe)return;V.stopPropagation(),V.preventDefault();try{V.currentTarget.releasePointerCapture(V.pointerId);}catch{}let Q=X;L.current=null,B(null),Q!=null&&Q!==fe.initialPct&&w&&w(e,Q);},[X,w,e,B]),ue=react.useCallback(V=>{V.stopPropagation(),V.preventDefault();},[]),mt=X??(e.progress||0);return jsxRuntime.jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:Qr,transition:"opacity 300ms ease"},onClick:()=>{!Oe&&!F.current&&l?.(e),F.current=false;},onDoubleClick:V=>{!Oe&&!F.current&&(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),d?.(e,V);},onMouseEnter:()=>!Oe&&Ve(true),onMouseMove:V=>{x&&et&&!Oe&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Pe,showBelow:false,mouseX:V.clientX,mouseY:V.clientY});},onMouseLeave:()=>{Oe||(Ve(false),J(null));},children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a+ir,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),et&&!Oe&&!zt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:ft,height:Pe,fill:$e==="resize-start"?n.accent:"transparent",opacity:$e==="resize-start"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-start"),onMouseDown:V=>jt(V,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ft,y:r,width:a-ft*2,height:Pe,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:V=>jt(V,"move")}),jsxRuntime.jsx("rect",{x:t+a-ft,y:r,width:ft,height:Pe,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:V=>jt(V,"resize-end")})]}),et&&!Oe&&rr&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Pe,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:V=>jt(V,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Pe,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.2:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:V=>jt(V,"resize-end")}),et&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Pe-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Oe&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ee,y:r,width:Ee,height:Pe,rx:Be,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"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!Oe&&(()=>{let V=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),Q=o.getTime(),$=864e5,te=(V-Q)/$,xe=(fe-V)/$,T=te*s,W=Math.max(xe*s,s),pe=rt+Ke,_=T+W,ve=e.endDate?.getTime()??0,it=Math.ceil((ve-fe)/$),ae=it>0,lt=it<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:T,y:r,width:W,height:Pe,rx:Be,fill:"none",stroke:$t?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ae&&pe>_&&jsxRuntime.jsx("rect",{x:_,y:r,width:pe-_,height:Pe,rx:0,fill:"#EF4444",opacity:.2}),ae&&jsxRuntime.jsxs("text",{x:Math.max(pe,_)+6,y:r+Pe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",it,"d"]}),lt&&jsxRuntime.jsxs("text",{x:pe+6,y:r+Pe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[it,"d"]})]})})(),!e.segments&&ot&&st&&(()=>{let fe=r+(Pe-8)/2,Q=4,$=e.progress||0,te=new Date;te.setHours(0,0,0,0);let xe=e.startDate&&te>=e.startDate,T=e.endDate&&(()=>{let ae=new Date(e.endDate);return ae.setHours(0,0,0,0),te>ae})(),W=e.startDate&&te<e.startDate,pe=1;if(xe&&e.startDate&&e.endDate&&!W){let ae=new Date(e.startDate);ae.setHours(0,0,0,0);let lt=new Date(e.endDate);lt.setHours(0,0,0,0);let bt=Math.max(1,(lt.getTime()-ae.getTime())/(1e3*60*60*24)),br=Math.min((te.getTime()-ae.getTime())/(1e3*60*60*24),bt)/bt*100;pe=br>0?$/br:1;}let _;$>=100?_="#00E5CC":W?_="#4B5563":T&&$<100?_="#EF4444":pe>=.95?_="#22C55E":pe>=.8?_="#F59E0B":_="#EF4444";let ve=Math.max($/100*Ke,$>0?Q*2:0),it=Ke>100&&$>0;return jsxRuntime.jsxs("g",{"data-task-class":ba,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt,y:fe,width:Ke,height:8,rx:Q,fill:"rgba(255,255,255,0.10)"}),$>0&&jsxRuntime.jsx("rect",{x:rt,y:fe,width:ve,height:8,rx:Q,fill:_}),it&&jsxRuntime.jsxs("text",{x:rt+ve+6,y:fe+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($),"%"]})]})})(),!e.segments&&ot&&!st&&jsxRuntime.jsx(framerMotion.motion.rect,{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ba,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Oe&&!pt?.15:e.parentId?.6:1,scale:et&&!Oe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>jt(V),style:{cursor:Ct,pointerEvents:"all"}}),!e.segments&&!ot&&jsxRuntime.jsx(framerMotion.motion.rect,{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:Ie,"data-task-class":ba,initial:{opacity:0,scale:.95},animate:{opacity:Oe&&!pt?.15:e.parentId?.6:et?.9:.8,scale:et&&!Oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:st?void 0:V=>jt(V),style:{cursor:st?"default":Ct,pointerEvents:"all"}}),ot&&(re||he)&&!e.segments&&jsxRuntime.jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&mt>0&&!st&&jsxRuntime.jsx("rect",{x:rt,y:r,width:Math.max(Ke*(mt/100),Be*2),height:Pe,rx:Be,fill:Ie,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!st&&e.progress<100&&(()=>{let V=e.progress>0?Ke*(e.progress/100):0,fe=rt+V,Q=Ke-V,$=e.progress===0?Be:0,te=e.progress===0?rt:fe,xe=e.progress===0?Ke:Q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:te,y:r,width:xe,height:Pe,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:te,y:r,width:xe,height:Pe,rx:$,fill:"none",stroke:Ie,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ot&&!e.segments&&e.progress>0&&e.progress<100&&!st&&!Oe&&X===null&&(()=>{let V=rt+Ke*(e.progress/100),fe=8,Q=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:V,cy:r+Pe/2,r:fe,fill:Q?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:V,y:r+Pe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Q?.initials||Q?.name?.charAt(0)?.toUpperCase()||""})]})})(),Y&&!Oe&&Ke>=40&&(X!==null||mt<88)&&(()=>{let V=rt+Ke*(mt/100),fe=r+Pe/2,Q=X!==null,$=Q?7:et?6:5,te=Q||et?1:.35,xe=rt+Ke-V,T=Math.max(4,Math.min(12,xe-10)),W=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:V-W,y:fe-12,width:W+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:fr,onPointerMove:Ca,onPointerUp:ce,onPointerCancel:ce,onClick:ue,onDoubleClick:ue,onMouseDown:pe=>pe.stopPropagation()}),jsxRuntime.jsx("circle",{cx:V,cy:fe,r:$,fill:"#FFFFFF",stroke:Ie,strokeWidth:2,opacity:te,style:{pointerEvents:"none",filter:Q?`drop-shadow(0 0 4px ${Ie})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Q&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:V-20,y:fe-28,width:40,height:18,rx:4,fill:$t?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ie,strokeWidth:1}),jsxRuntime.jsxs("text",{x:V,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:$t?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((V,fe)=>{let Q=(V.startDate.getTime()-o.getTime())/864e5*s,te=(V.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-Q+s,xe=Oe&&P==="move"&&De===fe,T=Qe===fe,W=xe?Q+Me:Q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Oe&&ie(fe),onMouseLeave:()=>!Oe&&ie(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:W,y:r,width:te,height:Pe,rx:Be,fill:Ie,initial:{opacity:0,scale:.95},animate:{opacity:xe||e.parentId?.6:T?.9:.8,scale:T&&!Oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),oe(fe),Ne(Q),jt(pe,void 0,Q);},style:{cursor:Ct,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:W,y:r,width:te*(e.progress/100),height:Pe,rx:Be,fill:Ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),qe&&(re||he)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[he&&!re&&jsxRuntime.jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),re&&jsxRuntime.jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ke>60&&!e.segments&&!(ot&&st)&&(()=>{let V=c.taskLabel(e),fe=typeof V=="string"?V:e.name,Q=fe.length>Math.floor(Ke/8)?`${fe.substring(0,Math.floor(Ke/8))}...`:fe;return jsxRuntime.jsx("text",{x:rt+8,y:r+Pe/2,dominantBaseline:"middle",fill:j?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:j?"line-through":"none"},children:Q})})(),!Oe&&!e.segments&&!st&&e.progress>0&&e.progress<100&&(ot?jsxRuntime.jsxs("text",{x:rt+Ke+6,y:r+Pe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ke>100?jsxRuntime.jsxs("text",{x:rt+Ke-12,y:r+Pe/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Ke>80&&!Oe&&!e.segments&&!(ot&&st)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:rt+Ke-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:rt+Ke-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(et||ut)&&!pt&&!e.segments&&!st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:rt-2,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>J("resize-start"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt+4,y:r+8,width:3,height:Pe-16,rx:1.5,fill:$e==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:rt+Ke-14,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>J("resize-end"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt+Ke-7,y:r+8,width:3,height:Pe-16,rx:1.5,fill:$e==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et&&!Oe&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+a+10,cy:r+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>J("connect"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+10,cy:r+Pe/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:$e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&U&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Pe/2,x2:U.x,y2:U.y,stroke:Ae?n.statusCompleted:n.accent,strokeWidth:Ae?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Ae?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:U.x,cy:U.y,r:Ae?8:6,fill:Ae?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Ae&&jsxRuntime.jsx(framerMotion.motion.text,{x:U.x+15,y:U.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:U.x+10},animate:{opacity:1,x:U.x+15},transition:{duration:.2},children:"Connect"})]}),(et||Oe)&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:rt-1,y:r-1,width:Ke+2,height:Pe+2,rx:Be+1,fill:"none",stroke:Oe?n.accent:ot?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ot?1:2,opacity:Oe||ot?.6:.4,initial:{opacity:0},animate:{opacity:Oe||ot?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:ee,y1:0,x2:ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:ee+Ee,y1:0,x2:ee+Ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et&&!Oe&&!e.segments&&!x&&(()=>{let Q=r<100,$=Q?r+Pe+13:r-82-13,te=Q?`M ${rt+Ke/2-6} ${r+Pe+3} L ${rt+Ke/2} ${r+Pe+13} L ${rt+Ke/2+6} ${r+Pe+3}`:`M ${rt+Ke/2-6} ${r-13} L ${rt+Ke/2} ${r-3} L ${rt+Ke/2+6} ${r-13}`,xe=$+22,T=$+40,W=$+55,pe=$+70,_=Q?$+82-5:r-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:te,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:rt+Ke/2-120,y:$,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))"}),jsxRuntime.jsx("text",{x:rt+Ke/2,y:xe,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}),jsxRuntime.jsx("text",{x:rt+Ke/2-110,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:rt+Ke/2-70,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.startDate)}),jsxRuntime.jsx("text",{x:rt+Ke/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:rt+Ke/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.endDate)}),jsxRuntime.jsx("text",{x:rt+Ke/2+10,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:rt+Ke/2+65,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt()}),jsxRuntime.jsx("text",{x:rt+Ke/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:rt+Ke/2+65,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:rt+Ke/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:rt+Ke/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ve=>ve.name).join(", ").substring(0,30),e.assignees.map(ve=>ve.name).join(", ").length>30?"...":""]})]}),!Q&&jsxRuntime.jsx("text",{x:rt+Ke/2,y:_,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:rr?"Left: move \u2022 Right: resize":zt?"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 sd=260,ls=8,Wm=16,aw=-12;function zm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:C}=e,M=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,k=(M?155:105)+(F?28:0),N=w+Wm,P=C+aw-k;N+sd>window.innerWidth-ls&&(N=w-sd-Wm),N<ls&&(N=ls);let D=P<ls;D&&(P=C+20),P+k>window.innerHeight-ls&&(P=window.innerHeight-ls-k),s({left:N,top:P,showBelow:D});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),C=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=k.getTime();){let P=F.getDay();v[P]&&!w.has(C(F))&&M++,F.setDate(F.getDate()+1);}let N=Math.max(0,M);return r==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),C=v%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxRuntime.jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:sd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(Qi,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(Qi,{label:l.duration,value:d(),labelColor:u,valueColor:p}),jsxRuntime.jsx(Qi,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(Qi,{label:l.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxRuntime.jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.tags,": "]}),jsxRuntime.jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(v=>jsxRuntime.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}55`,whiteSpace:"nowrap"},children:v.name},v.id))})]}),c&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxRuntime.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:o.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Uc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.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:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(l).map(([i,d])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:d.map(m=>jsxRuntime.jsxs("button",{onClick:()=>c(m),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function zc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=react.useState("export"),[l,i]=react.useState("json"),[d,m]=react.useState(null),u=react.useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,h=await $u(e,l,x);Ou(h,l);},f=async x=>{let h=x.target.files?.[0];if(h){try{let b=await Wu(h),y=h.name.endsWith(".json")?"json":"csv",v=Uu(b,y);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:r,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"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("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"}),jsxRuntime.jsx("button",{onClick:()=>c("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"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[o==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,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"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:u,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var $x=["URGENT","HIGH","MEDIUM","LOW"],Ox=[{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"}],Hx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Gc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:f}){let[x,h]=react.useState(true),b=react.useCallback(P=>{r({search:P.target.value});},[r]),y=react.useCallback(P=>{r({dateFilter:P.target.value});},[r]),v=react.useCallback(P=>{a({by:P.target.value});},[a]),w=react.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[m&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:P=>{let L=P.target.value;r({priorities:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),$x.map(P=>jsxRuntime.jsx("option",{value:P,children:P},P))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:P=>{let L=P.target.value;r({assignees:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),l.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:P=>{let L=P.target.value;r({labels:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(P=>jsxRuntime.jsx("option",{value:P,children:P},P))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Ox.map(P=>jsxRuntime.jsx("option",{value:P.value,children:P.label},P.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:P=>f(P.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Hx.map(P=>jsxRuntime.jsx("option",{value:P.value,children:P.label},P.value))})}),C&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Vc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let p=f=>{m.current&&!m.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxRuntime.jsxs("div",{className:g("relative",a),ref:m,children:[jsxRuntime.jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.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"?jsxRuntime.jsxs("button",{onClick:()=>u(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>u(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>u(async()=>await 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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>u(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>u(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.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"]}),jsxRuntime.jsxs("button",{onClick:()=>u(r),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var jc={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"}},_c={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"}},Kc={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"}},Eo={dark:jc,light:_c,neutral:Kc},_i="dark";var Ki=react.createContext(void 0),Yx="asakaa-theme";function gm({children:e,defaultTheme:t=_i,storageKey:r=Yx}){let[a,n]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=Eo[a];Object.entries(l.colors).forEach(([d,m])=>{m&&c.style.setProperty(`--theme-${Xx(d)}`,m);}),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(([d,m])=>{let u=l.colors[d];u&&c.style.setProperty(m,u);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:Eo};return jsxRuntime.jsx(Ki.Provider,{value:o,children:e})}function rs(){let e=react.useContext(Ki);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Xx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function qc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=rs();return e?jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.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"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Eo).map(([s,o])=>jsxRuntime.jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:o.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxRuntime.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"]})]}),a===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var lt={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 fm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return lt[e]||lt.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",lt[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",lt[e].bgSecondary),bgGrid:a("--theme-bg-card",lt[e].bgGrid),bgWeekend:a("--theme-bg-hover",lt[e].bgWeekend),border:a("--theme-border-primary",lt[e].border),borderLight:a("--theme-border-subtle",lt[e].borderLight),textPrimary:a("--theme-text-primary",lt[e].textPrimary),textSecondary:a("--theme-text-secondary",lt[e].textSecondary),textTertiary:a("--theme-text-tertiary",lt[e].textTertiary),accent:a("--theme-accent-primary",lt[e].accent),accentHover:a("--theme-accent-hover",lt[e].accentHover),accentLight:a("--theme-accent-primary",lt[e].accentLight),taskBarPrimary:a("--theme-accent-primary",lt[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",lt[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",lt[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",lt[e].dependency),dependencyHover:a("--theme-border-secondary",lt[e].dependencyHover),criticalPath:a("--theme-error",lt[e].criticalPath),criticalPathLight:a("--theme-error",lt[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",lt[e].today):e==="neutral"?a("--theme-text-primary",lt[e].today):a("--theme-error",lt[e].today),todayLight:e==="light"?a("--theme-accent-primary",lt[e].todayLight):e==="neutral"?a("--theme-text-primary",lt[e].todayLight):a("--theme-error",lt[e].todayLight),milestone:a("--theme-warning",lt[e].milestone),milestoneLight:a("--theme-warning",lt[e].milestoneLight),statusTodo:a("--theme-text-tertiary",lt[e].statusTodo),statusInProgress:a("--theme-accent-primary",lt[e].statusInProgress),statusCompleted:a("--theme-success",lt[e].statusCompleted),hoverBg:a("--theme-bg-hover",lt[e].hoverBg),focusRing:a("--theme-accent-primary",lt[e].focusRing),...lt[e].dotGrid&&{dotGrid:lt[e].dotGrid},...lt[e].glassHeader&&{glassHeader:lt[e].glassHeader},...lt[e].glassToolbar&&{glassToolbar:lt[e].glassToolbar},...lt[e].forecastHud&&{forecastHud:lt[e].forecastHud},...lt[e].neonRedGlow&&{neonRedGlow:lt[e].neonRedGlow},...lt[e].executionBarBg&&{executionBarBg:lt[e].executionBarBg}}}var qi={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},bm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Yc={en:qi,es:bm};function hm(e){return Yc[e]||Yc.en}function Xc(e,t){let r=hm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var ns=react.createContext(qi);function Ka(){return react.useContext(ns)}function js(e,t,r="left",a=208){let[n,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function Dm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=react.useState(false),[i,d]=react.useState(null),m=react.useRef(null),u=react.useRef(null),p=Ka(),f=js(m,c,"right",176);if(react.useEffect(()=>{if(!c)return;let y=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&l(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||r||a||n||s||o))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),b=async(y,v)=>{if(v){d(y);try{await v();}catch(w){console.error(`Export ${y} failed:`,w);}finally{d(null),l(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:m,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:u,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:jsxRuntime.jsx("div",{className:"py-1",children:h.map((y,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function xm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=react.useState(false),[l,i]=react.useState(null),[d,m]=react.useState(false),u=react.useRef(null),p=react.useRef(null),f=Ka(),x=js(u,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!o)return;let C=P=>{let L=P.target;u.current&&!u.current.contains(L)&&p.current&&!p.current.contains(L)&&c(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),v=async(C,P)=>{if(P){i(C);try{await P();}catch(L){console.error(`Export ${C} failed:`,L);}finally{i(null),c(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>c(!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:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((C,P)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(C.id,C.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:P*.03},children:[jsxRuntime.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:l===C.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function yv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(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?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function xv({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function vm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=react.useState(false),o=react.useRef(null),c=react.useRef(null),l=Ka(),i=js(o,n,"left");react.useEffect(()=>{if(!n)return;let u=p=>{let f=p.target;o.current&&!o.current.contains(f)&&c.current&&!c.current.contains(f)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.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:`${l.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(framerMotion.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-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((u,p)=>{let f=t===u.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(u.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:p<d.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:p*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:u.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function wm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=react.useState(false),c=react.useRef(null),l=react.useRef(null),i=Ka(),d=js(c,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let y=b.target;c.current&&!c.current.contains(y)&&l.current&&!l.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),l._cleanup&&l._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:c,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"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:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!a,h=()=>f.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(f.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:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function vv({value:e,onChange:t,theme:r}){let a=Ka(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function wv({theme:e,forecast:t}){let r=Ka(),a=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,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:c})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function kv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=react.useState(false),f=react.useRef(null),x=react.useRef(null),h=Ka(),b=js(f,u,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!u)return;let P=L=>{let k=L.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&p(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[u]);let v=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:c,onChange:l}],C=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:f,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.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:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:w.map((P,L)=>{let k=P.icon,D=P.disabled,F=P.tooltip;return jsxRuntime.jsxs(framerMotion.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:L*.03},title:F,children:[jsxRuntime.jsx(k,{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}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:P.label}),P.active&&!D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((P,L)=>{let k=i===P.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(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+L)*.03},children:[jsxRuntime.jsx("span",{style:{color:k?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:P.label}),k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.value)})]})]})}),document.body)]})}function Yi({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:b,wbsLevel:y,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:C="execution",onViewModeChange:P,projectForecast:L,hideForecastHud:k,onExportPNG:D,onExportPDF:F,onExportExcel:E,onExportCSV:G,onExportJSON:O,onExportMSProject:ee,showCriticalPath:I=true,onShowCriticalPathChange:Ae,showDependencies:H=true,onShowDependenciesChange:ge,highlightWeekends:N=true,onHighlightWeekendsChange:De,showBaseline:Xe=false,onShowBaselineChange:He,onCopySnapshotLink:Y,hasDependencies:Ee=true}){let te=Ka(),Be=D||F||E||G||O||ee,Se=!!e.glassToolbar,Le=[{value:"day",label:te.toolbar.day},{value:"week",label:te.toolbar.week},{value:"month",label:te.toolbar.month}],$e=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Ye=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Se){let le=Ye?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:P&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Ye?"#000000":e.bgSecondary,border:`1px solid ${Ye?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>P("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Ye?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:te.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>P("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Ye?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:C==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:te.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(vv,{value:t,onChange:r,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),v&&jsxRuntime.jsx(vm,{theme:e,value:y??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsx(wm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:h}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),jsxRuntime.jsx(kv,{theme:e,showCriticalPath:I,onShowCriticalPathChange:Ae,showBaseline:Xe,onShowBaselineChange:He,highlightWeekends:N,onHighlightWeekendsChange:De,showDependencies:H,onShowDependenciesChange:ge,rowDensity:c,onRowDensityChange:l,hasDependencies:Ee}),jsxRuntime.jsx(xm,{theme:e,onExportPNG:D,onExportPDF:F,onExportExcel:E,onExportMSProject:ee,onCopySnapshotLink:Y}),d&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Ye?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Ye?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||te.toolbar.createTask})]})]})]}),L&&!k&&jsxRuntime.jsx(wv,{theme:e,forecast:L})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(xv,{options:Le,value:t,onChange:le=>r(le),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsxRuntime.jsx(vm,{theme:e,value:y??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(wm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||te.toolbar.createTask})]}),(Be||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(xm,{theme:e,onExportPNG:D,onExportPDF:F,onExportExcel:E,onExportMSProject:ee,onCopySnapshotLink:Y}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(yv,{options:$e,value:s,onChange:le=>o(le),theme:e})]})]})}function Xi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=react.useState(false),[s,o]=react.useState({x:0,y:0}),c=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{if(!a)return;let d=m=>{c.current&&!c.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(or,{children:jsxRuntime.jsx(framerMotion.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:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxRuntime.jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:d.label}),d.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function is({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=react.useRef(null),[c,l]=react.useState({x:t,y:r});if(react.useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,f=window.innerHeight,x=t,h=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>f&&(h=f-m-u,h<u&&(h=u)),l({x,y:h});},[e,t,r,a.length]),react.useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.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:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(d=>jsxRuntime.jsxs("div",{children:[d.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var tr={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Am({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=react.useRef(false),f=react.useCallback(v=>{p.current=v;},[]),x=react.useCallback(v=>{let w=[],C=P=>{for(let L of P)w.push(L),L.subtasks&&L.subtasks.length>0&&L.isExpanded&&C(L.subtasks);};return C(v),w},[]),h=react.useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=react.useCallback((v,w)=>{let C=x(e);if(C.length===0)return;let P=h();if(!P){r(C[0].id,false);return}let L=C.findIndex(F=>F.id===P.id);if(L===-1)return;let k=v==="up"?L-1:L+1;if(k<0||k>=C.length)return;let D=C[k];r(D.id,w);},[e,h,x,r]),y=react.useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let L=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),D=h();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(D&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!D.isExpanded||v.key==="ArrowLeft"&&D.isExpanded)&&d(D.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!L){D&&(v.preventDefault(),a(D.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!L){D&&(v.preventDefault(),a(D.id,"above"));return}if(v.key==="Enter"&&L){D&&(v.preventDefault(),m(D.id));return}if(v.key==="F2"){D&&(v.preventDefault(),i(D.id));return}if(v.key==="Delete"||v.key==="Backspace"&&L){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&L&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[u,t,h,b,a,n,s,o,c,l,i,d,m]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[u,y]),{setIsEditing:f}}function Rm(e){let[t,r]=react.useState(new Set),[a,n]=react.useState(null);react.useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=react.useCallback(u=>{r(new Set([u])),n(u);},[]),o=react.useCallback(u=>{r(p=>{let f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f}),n(u);},[]),c=react.useCallback((u,p)=>{if(!a){s(u);return}let f=p.indexOf(a),x=p.indexOf(u);if(f===-1||x===-1){s(u);return}let h=Math.min(f,x),b=Math.max(f,x),y=p.slice(h,b+1);r(new Set(y)),n(u);},[a,s]),l=react.useCallback((u,p,f,x)=>{x?c(u,p):f?o(u):s(u);},[s,o,c]),i=react.useCallback((u,p)=>{p?r(f=>{let x=new Set(f);return x.add(u),x}):s(u);},[s]),d=react.useCallback(()=>{r(new Set),n(null);},[]),m=react.useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:c,handleTaskClick:l,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function td(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?td(t.subtasks):t.subtasks}))}function Po(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ls(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ls(r.subtasks,t);if(a)return a}}return null}function ed(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=ed(r.subtasks,t);if(a)return a}return null}function rd(e,t){if(t.length===0)return e;let r=Po(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let f=[];return {tasks:u.filter(h=>{if(p.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,p);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},c=(u,p,f)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,p,f)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),m=c(i,s.id,d);return td(m)}function ad(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=ed(r,a);if(!n)continue;let s=ed(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let f=p.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=p.subtasks.splice(f,1);return x}}if(p.subtasks){let f=o(p.subtasks,d,m);if(f)return f}}return null},c=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&c(p.subtasks,d,m);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return td(r)}function nd(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(m=>m.id===c);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function od(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function Ks(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=l=>{let i=l.findIndex(p=>p.id===n);if(i===-1){for(let p of l)if(p.subtasks){let f=o(p.subtasks);if(f)return f}return null}let d=l[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return l.splice(i+1,0,u),u},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Bm(e,t,r){let a=[...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"},c=l=>{let i=l.findIndex(m=>m.id===t);if(i===-1){for(let m of l)if(m.subtasks&&c(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function sd(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:sd(a.subtasks,t,r)}:a)}function id(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:id(r.subtasks,t)}:r)}function ld(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let f=r(p.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let f=l(p.subtasks);if(f>=0)return f}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let f=p.subtasks||[];return {...p,subtasks:[...f,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function $m(e,t,r,a){if(t===r)return e;let n=ls(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((f,x)=>({...f,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function qa(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=qa(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Qi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:c,onTaskDblClick:l,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:f,onTaskUpdate:x,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:P,onTaskRename:L,onCreateSubtask:k,onOpenTaskModal:D,onDeleteRequest:F,onTaskReparent:E,allTasks:G,scrollContainerRef:O,showCriticalPath:ee=false}){let I=react.useContext(ns),[Ae,H]=react.useState(null),[ge,N]=react.useState(null),[De,Xe]=react.useState(""),He=react.useRef(null),[Y,Ee]=react.useState(null),[te,Be]=react.useState(0),[Se,Le]=react.useState(0),[$e,Ye]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[le,Qe]=react.useState(null),[je,Ie]=react.useState(null),[Ct,it]=react.useState(null),qe=react.useRef(0),Pe=5,xt=react.useRef(false),[St,Re]=react.useState(null),[ct,A]=react.useState(false),X=react.useRef(null),[B,q]=react.useState(null),[ce,ue]=react.useState(null),[_e,V]=react.useState(false),ye=react.useRef(null);react.useEffect(()=>{function se(pe){ye.current&&!ye.current.contains(pe.target)&&V(false);}if(_e)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[_e]),react.useEffect(()=>{ge&&He.current&&(He.current.focus(),He.current.select());},[ge]),react.useEffect(()=>{if(!Y)return;let se=ft=>{let j=ft.clientX-te,fe=Se+j;f?.(Y,fe);},pe=()=>{Ee(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",pe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,te,Se,f]);let{selectedTaskIds:Fe,handleTaskClick:Ue,isTaskSelected:dt}=Rm(c),{setIsEditing:Ze}=Am({tasks:e,selectedTaskIds:Fe,onTaskSelect:(se,pe)=>{let j=Po(e).map(fe=>fe.id);Ue(se,j,pe||false,false),o?.(se);},onTaskCreate:P||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:se=>{let pe=Po(e).find(ft=>ft.id===se);pe&&Pr(pe);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:se=>{let pe=Po(e).find(ft=>ft.id===se);pe&&D&&D(pe);},enableKeyboard:true}),Tt=(se,pe=0,ft="")=>{let j=[],fe=[...se].sort((Q,$)=>(Q.position??0)-($.position??0));for(let Q=0;Q<fe.length;Q++){let $=fe[Q],Z=Q+1,xe=ft?`${ft}.${Z}`:`${Z}.0`,T=$.wbsCode||xe;if($.wbsCode=T,j.push({task:$,level:pe}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let de=$.wbsCode?.replace(/\.0$/,"")||(ft?`${ft}.${Z}`:`${Z}`);j.push(...Tt($.subtasks,pe+1,de));}}return j},gt=Tt(e),rr=48,ar=Math.max(gt.length*r,600-rr),Er=(se,pe)=>pe==="assignees"?se.assignees:pe==="startDate"?se.startDate:se.endDate,_t=(se,pe,ft,j)=>{se.preventDefault(),se.stopPropagation(),q({sourceTaskId:pe,column:ft,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=se.currentTarget.closest("[data-grid-body]"),Q=ke=>{let st=fe?.getBoundingClientRect().top??0,oe=Math.floor((ke-st)/r);return oe=Math.max(0,Math.min(gt.length-1,oe)),oe<j&&(oe=j),oe},$=se.clientY,Z=O?.current??null,xe=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},T=()=>{let ke=Q($);q(st=>st&&{...st,targetIndex:ke});},U=()=>{if(xe(),!Z)return;let ke=Z.getBoundingClientRect(),st=60,oe=12,rt=$-ke.top,pt=ke.bottom-$;if(pt<st&&Z.scrollTop<Z.scrollHeight-Z.clientHeight){let Ut=Math.max(1,Math.round(oe*(1-Math.max(0,pt)/st))),Qt=()=>{Z.scrollTop+=Ut,T(),Z.scrollTop<Z.scrollHeight-Z.clientHeight&&(X.current=requestAnimationFrame(Qt));};X.current=requestAnimationFrame(Qt);}else if(rt<st&&Z.scrollTop>0){let Ut=Math.max(1,Math.round(oe*(1-Math.max(0,rt)/st))),Qt=()=>{Z.scrollTop-=Ut,T(),Z.scrollTop>0&&(X.current=requestAnimationFrame(Qt));};X.current=requestAnimationFrame(Qt);}},de=ke=>{$=ke.clientY,T(),U();},_=ke=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",_),xe(),document.body.style.cursor="",document.body.style.userSelect="",q(null);let st=Q(ke.clientY),oe=gt.find(ya=>ya.task.id===pe)?.task;if(!oe)return;let rt=Er(oe,ft),pt=Math.min(j,st),Ut=Math.max(j,st),Qt=[];for(let ya=pt;ya<=Ut;ya++){if(ya===j)continue;let Wr=gt[ya]?.task;!Wr||Wr.subtasks&&Wr.subtasks.length>0||Qt.push(Wr.id);}Qt.length!==0&&h?.(Qt,ft,rt);};window.addEventListener("mousemove",de),window.addEventListener("mouseup",_);},Mr=se=>{if(!B)return false;let pe=Math.min(B.sourceIndex,B.targetIndex),ft=Math.max(B.sourceIndex,B.targetIndex);return se>=pe&&se<=ft},Ft=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,Pr=se=>{N(se.id),Xe(se.name),Ze(true);},Kt=se=>{De.trim()&&De!==e.find(pe=>pe.id===se)?.name&&L?.(se,De.trim()),N(null),Xe(""),Ze(false);},qt=()=>{N(null),Xe(""),Ze(false);},ea=(se,pe)=>{pe.stopPropagation(),k?.(se.id);},pa=(se,pe)=>{pe.preventDefault(),qe.current=pe.clientY,Qe(se),xt.current=false,A(false),Re({x:pe.clientX,y:pe.clientY});},et=se=>{if(!le||(Math.abs(se.clientY-qe.current)>Pe&&!xt.current&&(xt.current=true,A(true)),Re({x:se.clientX,y:se.clientY}),!xt.current))return;if(O?.current){let Q=O.current,$=Q.getBoundingClientRect(),Z=60,xe=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let T=se.clientY-$.top,U=$.bottom-se.clientY;if(T<Z&&Q.scrollTop>0){let de=Math.round(xe*(1-T/Z)),_=()=>{Q.scrollTop-=de,xt.current&&Q.scrollTop>0&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}else if(U<Z&&Q.scrollTop<Q.scrollHeight-Q.clientHeight){let de=Math.round(xe*(1-U/Z)),_=()=>{Q.scrollTop+=de,xt.current&&Q.scrollTop<Q.scrollHeight-Q.clientHeight&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}}let ft=document.querySelectorAll("[data-task-row]"),j=null,fe=null;ft.forEach(Q=>{let $=Q.getBoundingClientRect(),Z=Q.getAttribute("data-task-row");if(Z&&Z!==le&&se.clientY>=$.top&&se.clientY<=$.bottom){j=Z;let xe=se.clientY-$.top,T=$.height;xe<T*.25?fe="above":xe>T*.75?fe="below":fe="child";}}),Ie(j),it(fe);},Ke=()=>{if(xt.current&&le&&je&&Ct){if(Ct==="child")E?.(le,je);else if(Ct==="above"||Ct==="below"){let se=(Q,$,Z=null)=>{for(let xe of Q){if(xe.id===$)return Z;if(xe.subtasks){let T=se(xe.subtasks,$,xe.id);if(T!==void 0)return T}}},pe=G&&G.length>0?G:e,ft=se(pe,le,null),j=se(pe,je,null),fe=(Q,$,Z,xe)=>{let T=Q.findIndex(_=>_.id===$),U=xe?Q.findIndex(_=>_.id===Z):-1,de=Ct==="below"?T+1:T;return xe&&U!==-1&&U<T&&(de-=1),Math.max(0,de)};if(j===null){let $=fe(pe,je,le,ft===null);E?.(le,null,$);}else {let Q=ls(pe,j);if(Q?.subtasks){let $=ft===j,Z=fe(Q.subtasks,je,le,$);E?.(le,j,Z);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),Qe(null),Ie(null),it(null),Re(null),xt.current=false,A(false);};react.useEffect(()=>{if(le)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",Ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",Ke),document.body.style.cursor="",document.body.style.userSelect="";}},[le,je,Ct]);let ha=(se,pe,ft)=>{let j=pe.subtasks&&pe.subtasks.length>0;switch(se.id){case "name":let fe=ge===pe.id,Q=Ae===pe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ft*20}px`},children:[E&&jsxRuntime.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:Q?1:.3},onMouseDown:oe=>pa(pe.id,oe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),pe.subtasks&&pe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),d?.(pe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:pe.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),fe?jsxRuntime.jsx("input",{ref:He,type:"text",value:De,onChange:oe=>Xe(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"?Kt(pe.id):oe.key==="Escape"&&qt();},onBlur:()=>Kt(pe.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:oe=>oe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:pe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:pe.parentId?"13px":"14px",fontWeight:pe.isMilestone?600:pe.parentId?400:600,letterSpacing:pe.parentId?"0":"-0.01em"},title:pe.name,children:[pe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:pe.wbsCode}),pe.isHighlighted&&pe.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe.name}),pe.subtasks&&pe.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(pe.progress||0),"%"]}),ee&&pe.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ee&&pe.cpmData&&jsxRuntime.jsxs("span",{style:{color:pe.cpmData.totalFloat<=0?"#EF4444":pe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(pe.cpmData.totalFloat),"d"]})]}),Q&&!fe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:oe=>ea(pe,oe),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),Pr(pe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Z=se.id==="startDate"?"startDate":"endDate",xe=pe[Z],T=ce?.taskId===pe.id&&ce?.field===Z,U=oe=>oe?(typeof oe=="string"?new Date(oe):oe).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:oe=>{if(!j)if(T)ue(null);else {let rt=oe.currentTarget.getBoundingClientRect();ue({taskId:pe.id,field:Z,month:xe?typeof xe=="string"?new Date(xe):xe:new Date,position:{top:rt.bottom+4,left:rt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:U(xe)}),j&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),T&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ue(null)}),jsxRuntime.jsxs(framerMotion.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:ce?.position.top,left:ce?.position.left},onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let oe=new Date,rt=new Date(oe);rt.setDate(oe.getDate()+1);let pt=new Date(oe);pt.setDate(oe.getDate()+7);let Ut=new Date(oe);return Ut.setDate(oe.getDate()+14),[{label:"Hoy",date:oe},{label:"Ma\xF1ana",date:rt},{label:"Pr\xF3xima semana",date:pt},{label:"2 semanas",date:Ut}].map((ya,Wr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ga=>Ga.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ga=>Ga.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(pe.id,{[Z]:ya.date}),ue(null);},children:ya.label},Wr))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:oe=>oe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(pe.id,{[Z]:void 0}),ue(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>ue(oe=>oe?{...oe,month:new Date(oe.month.getFullYear(),oe.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ce?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ue(oe=>oe?{...oe,month:new Date(oe.month.getFullYear(),oe.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((oe,rt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:oe},rt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let oe=ce?.month||new Date,rt=oe.getFullYear(),pt=oe.getMonth(),Ut=new Date(rt,pt,1).getDay(),Qt=new Date(rt,pt+1,0).getDate(),ya=new Date,Wr=[];for(let lr=Ut-1;lr>=0;lr--)Wr.push({day:new Date(rt,pt,-lr).getDate(),date:new Date(rt,pt-1,new Date(rt,pt,-lr).getDate()),isCurrentMonth:false});for(let lr=1;lr<=Qt;lr++)Wr.push({day:lr,date:new Date(rt,pt,lr),isCurrentMonth:true});let Ga=42-Wr.length;for(let lr=1;lr<=Ga;lr++)Wr.push({day:lr,date:new Date(rt,pt+1,lr),isCurrentMonth:false});return Wr.map((lr,Ba)=>{let Wo=lr.date.toDateString()===ya.toDateString(),_n=(xe?typeof xe=="string"?new Date(xe):xe:null)?.toDateString()===lr.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:lr.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:Wo&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(pe.id,{[Z]:lr.date}),ue(null);},children:lr.day},Ba)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Ft(pe)})});case "assignees":if(j)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let de=a.filter(oe=>pe.assignees?.some(rt=>rt.id?rt.id===oe.id:rt.name===oe.name||rt.initials===oe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:oe=>oe.stopPropagation(),children:jsxRuntime.jsx(Co,{assignedUsers:de,availableUsers:a,onChange:oe=>{let rt=oe.map(pt=>({id:pt.id,name:pt.name,initials:pt.initials,color:pt.color}));x?.(pe.id,{assignees:rt});}})});case "status":if(j){let oe=pe.progress===100?"\u2713":pe.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:oe})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:oe=>oe.stopPropagation(),children:jsxRuntime.jsx(sp,{status:pe.status||"todo",onChange:oe=>{x?.(pe.id,{status:oe,progress:oe==="completed"?100:pe.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${pe.progress}%`,backgroundColor:pe.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[pe.progress,"%"]})]});case "priority":let _={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ke={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},st=_[pe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:oe=>oe.stopPropagation(),children:jsxRuntime.jsx(wo,{priority:st,onChange:oe=>{oe&&x?.(pe.id,{priority:ke[oe]||"medium"});}})});default:return null}},_r=se=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>p(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:tr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:tr.SortDesc,onClick:()=>{}}],pr=se=>{let pe=se.subtasks&&se.subtasks.length>0,ft=Po(e),j=Fe.size>1&&Fe.has(se.id),fe=j?ft.filter(T=>Fe.has(T.id)):[se],Q=fe.map(T=>T.id),$=fe.filter(T=>!(T.subtasks&&T.subtasks.length>0)),Z=j?` (${Q.length})`:"",xe=()=>{F?F(Q,se.name):w?.(Q);};return pe?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(se.id);}},{id:"duplicate",label:(I?.contextMenu?.duplicateTask||"Duplicate Task")+Z,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(I?.contextMenu?.deleteTask||"Delete Task")+Z,icon:tr.Delete,onClick:xe}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{l?.(se);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(I?.contextMenu?.markIncomplete||"Mark Incomplete")+Z,icon:tr.MarkIncomplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(T=>T.status==="todo")},{id:"setInProgress",label:(I?.contextMenu?.setInProgress||"Set In Progress")+Z,icon:tr.SetInProgress,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"in-progress"}));},disabled:$.length===0||$.every(T=>T.status==="in-progress")},{id:"markComplete",label:(I?.contextMenu?.markComplete||"Mark Complete")+Z,icon:tr.MarkComplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(T=>T.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(I?.contextMenu?.duplicateTask||"Duplicate Task")+Z,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(I?.contextMenu?.deleteTask||"Delete Task")+Z,icon:tr.Delete,onClick:xe}]},Kr=u.filter(se=>se.visible),sa=Kr.reduce((se,pe)=>se+pe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:sa},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${rr}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Kr.map((se,pe)=>{let ft=pe===Kr.length-1,j=se.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(j?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:j&&Kr.length===1?1:0,flexGrow:j&&Kr.length===1?1:0,borderRight:ft?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Ye({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:se.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.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&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:Y===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),Ee(se.id),Be(fe.clientX),Le(se.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:Y===se.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxRuntime.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:[jsxRuntime.jsx(Xi,{columns:u,onToggleColumn:p,theme:t}),jsxRuntime.jsx("button",{onClick:()=>V(!_e),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),_e&&jsxRuntime.jsxs("div",{ref:ye,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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>V(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:ar},children:gt.map(({task:se,level:pe},ft)=>{let j=dt(se.id),fe=Mr(ft),Q=je===se.id,$=Q&&Ct==="above",Z=Q&&Ct==="below",xe=Q&&Ct==="child",T={};return xe&&(T.backgroundColor=`${t.accent}15`,T.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${le===se.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:xe?`${t.accent}15`:ft%2===0?t.bgPrimary:t.bgGrid,opacity:ee?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...T},onMouseEnter:()=>H(se.id),onMouseLeave:()=>H(null),onClick:U=>{let _=Po(e).map(oe=>oe.id),st=navigator.platform.toUpperCase().indexOf("MAC")>=0?U.metaKey:U.ctrlKey;Ue(se.id,_,st,U.shiftKey),o?.(se.id),!st&&!U.shiftKey&&s?.(se);},onDoubleClick:U=>{U.stopPropagation(),l?.(se);},onContextMenu:U=>{U.preventDefault(),Ye({isOpen:true,x:U.clientX,y:U.clientY,type:"task",task:se}),i?.(se,U);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Z&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Kr.map((U,de)=>{let _=de===Kr.length-1,ke=U.id==="name",st=!!(se.subtasks&&se.subtasks.length>0),oe=U.id==="assignees"||U.id==="startDate"||U.id==="endDate"?U.id:null,pt=!!oe&&!st&&Ae===se.id&&!B,Ut=fe&&!!B&&B.column===U.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${ke?"justify-start":"justify-center"}`,style:{position:"relative",width:`${U.width}px`,minWidth:`${U.minWidth??(ke?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:ke&&Kr.length===1?1:0,flexGrow:ke&&Kr.length===1?1:0,borderRight:_?"none":`1px solid ${Ae===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Ut?`${t.accent}22`:void 0,boxShadow:Ut?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ha(U,se,ke?pe:0),pt&&oe&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Qt=>_t(Qt,se.id,oe,ft),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}-${U.id}`)})]},se.id)})}),jsxRuntime.jsx(is,{isOpen:$e.isOpen,x:$e.x,y:$e.y,items:$e.type==="header"&&$e.columnId?_r($e.columnId):$e.type==="task"&&$e.task?pr($e.task):[],onClose:()=>Ye({...$e,isOpen:false}),theme:t}),ct&&St&&le&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:St.x+12,top:St.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=gt.find(pe=>pe.task.id===le)?.task;return se?jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function zm(e,t){let[r,a]=react.useState("none"),[n,s]=react.useState(0),[o,c]=react.useState(e),[l,i]=react.useState(t),[d,m]=react.useState(null),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(0),[w,C]=react.useState(0),[P,L]=react.useState(null),[k,D]=react.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:f,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:P,setHoveredSegmentIndex:L,isHovered:k,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(ee,I)=>{a("none"),m(null),p(null),c(ee),i(I),C(0),b(null),v(0);}}}function Zi({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:f,onHoverChange:x,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:v=false,onProgressChange:w}){let C=zm(t,a),P=react.useRef(null),L=react.useRef(false),k=react.useRef(null),D=react.useRef(null),{dragMode:F,setDragMode:E,dragOffset:G,setDragOffset:O,ghostX:ee,setGhostX:I,ghostWidth:Ae,setGhostWidth:H,connectionLine:ge,setConnectionLine:N,hoveredTaskId:De,setHoveredTaskId:Xe,activeZone:He,setActiveZone:Y,draggedSegmentIndex:Ee,setDraggedSegmentIndex:te,draggedSegmentStartX:Be,setDraggedSegmentStartX:Se,segmentDragOffsetX:Le,setSegmentDragOffsetX:$e,hoveredSegmentIndex:Ye,setHoveredSegmentIndex:le,isHovered:Qe,setIsHovered:je,isDragging:Ie,isResizing:Ct,isConnecting:it,resetDragState:qe}=C,Pe=18,xt=!!n.executionBarBg,St=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Re=xt?3:6,ct=e.subtasks&&e.subtasks.length>0,A=react.useRef(null),[X,B]=(()=>{let j=react.useRef(null),[,fe]=react.useState(0);return [j.current,Q=>{j.current=Q,fe($=>$+1);}]})(),q=!!w&&!v&&!ct&&!e.segments&&!!e.startDate&&!!e.endDate,ce=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<j})()&&e.progress<100,ue=y&&e.isCriticalPath,_e=n.name==="neutral"||n.today==="#1C1917",V=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ue=y&&e.isCriticalPath||ce?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:n.taskBarPrimary,dt=v?"default":Ie?it?"crosshair":Ct?"ew-resize":"grabbing":"grab",Ze=v?"default":"ew-resize",gt=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),rr=a<50,ar=a<40;react.useEffect(()=>{x&&(!Qe||Ie||e.segments)&&x(null);},[Qe,Ie,e.segments,x]);let Er=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),_t=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Mr=j=>Math.round(j/s)*s,Ft=j=>{let fe=Math.round(j/s),Q=new Date(o);return Q.setDate(Q.getDate()+fe),Q},Pr=(j,fe)=>{for(let Q of p){if(Q.id===e.id)continue;let $=5;if(j>=Q.x-$&&j<=Q.x+Q.width+$&&fe>=Q.y-$&&fe<=Q.y+Q.height+$)return Q.id}return null},Kt=react.useCallback((j,fe,Q)=>{if(v)return;j.preventDefault(),j.stopPropagation();let $=P.current?.ownerSVGElement;if(!$)return;let Z=$.createSVGPoint();Z.x=j.clientX,Z.y=j.clientY;let xe=Z.matrixTransform($.getScreenCTM()?.inverse()),T=Q!==void 0?Q:t,U=fe;if(!U){let de=xe.x-T;j.shiftKey?(U="connect",N({x:t+a,y:r+Pe/2})):j.ctrlKey||j.metaKey?U="move":j.altKey?U=de<a/2?"resize-start":"resize-end":ar?de<a/2?U="move":U="resize-end":rr?de<=gt/2?U="resize-start":de>=a-gt/2?U="resize-end":U="move":de<=gt?U="resize-start":de>=a-gt?U="resize-end":U="move";}L.current=false,E(U),je(false),Y(null),U==="move"?O(xe.x-T):U==="connect"?N({x:t+a,y:r+Pe/2}):O(0),I(T),H(a);},[t,a,r,Pe,v]),qt=react.useCallback(j=>{let fe=P.current?.ownerSVGElement;if(!fe)return;let Q=fe.closest(".gantt-timeline-scroll");if(!Q)return;let $=Q.getBoundingClientRect(),Z=60,xe=15,T=0;if(j.clientX<$.left+Z){let U=$.left+Z-j.clientX;T=-Math.min(xe,U/2);}else if(j.clientX>$.right-Z){let U=j.clientX-($.right-Z);T=Math.min(xe,U/2);}return T!==0&&(Q.scrollLeft+=T),T!==0},[]),ea=react.useCallback(j=>{if(F==="none")return;L.current=true,D.current=j;let fe=P.current?.ownerSVGElement;if(!fe)return;if(F==="move"||F==="resize-start"||F==="resize-end"){let Z=qt(j);Z&&!k.current?k.current=window.setInterval(()=>{D.current&&(qt(D.current),ea(D.current));},16):!Z&&k.current&&(window.clearInterval(k.current),k.current=null);}let Q=fe.createSVGPoint();Q.x=j.clientX,Q.y=j.clientY;let $=Q.matrixTransform(fe.getScreenCTM()?.inverse());if(F==="connect"){N({x:$.x,y:$.y});let Z=Pr($.x,$.y);Xe(Z);}else if(F==="move"){let Z=$.x-G,xe=Mr(Z);I(xe),H(a);let T=Math.round((xe-t)/s);if(f?.(e.id,T,true),e.segments&&e.segments.length>0&&Ee!==null){let U=xe-Be;$e(U);}}else if(F==="resize-start"){let Z=$.x,xe=Mr(Z),T=t+a-xe;T>=s&&(I(xe),H(T));}else if(F==="resize-end"){let Z=$.x,T=Mr(Z)-t;T>=s&&H(T);}},[F,t,a,s,G,e,Mr,Ee,Be,Pr,Xe,N,I,H,$e,f,qt]),pa=react.useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),D.current=null,F!=="none"){if(F==="connect")De&&u&&u(e,De),N(null),Xe(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),fe,Q,$=true;if(F==="move"){if(fe=Ft(ee),Q=new Date(fe.getTime()+j),e.segments&&e.segments.length>0&&Ee!==null){let Z=Math.round(Le/s),xe=e.segments.map((_,ke)=>{if(ke===Ee){let st=new Date(_.startDate),oe=new Date(_.endDate);return st.setDate(st.getDate()+Z),oe.setDate(oe.getDate()+Z),{startDate:st,endDate:oe}}return _}),T=xe.flatMap(_=>[_.startDate,_.endDate]),U=new Date(Math.min(...T.map(_=>_.getTime()))),de=new Date(Math.max(...T.map(_=>_.getTime())));m?.({...e,segments:xe},U,de),qe(t,a);return}}else F==="resize-start"?(fe=Ft(ee),Q=e.endDate,fe>Q&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):F==="resize-end"?(fe=e.startDate,Q=Ft(ee+Ae),Q.setDate(Q.getDate()-1),Q<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&fe&&Q&&(Q.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,Q));}f?.(e.id,0,false),qe(t,a);}},[F,ee,Ae,e,m,De,u,t,a,s,Ft,Le,Ee,qe,f]);react.useEffect(()=>{if(F==="none")return;let j=Q=>{ea(Q);},fe=()=>{pa();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",fe),k.current&&(window.clearInterval(k.current),k.current=null);}},[F,ea,pa]);let et=Ie&&!it?ee:t,Ke=Ie&&!it?Ae:a,ha=c.taskClass(e),_r=24,pr=y?e.isCriticalPath?1:.25:1,Kr=react.useCallback(j=>{if(!q)return;j.stopPropagation(),j.preventDefault();let Q=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:Q,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),B(e.progress||0);},[q,e.progress,B]),sa=react.useCallback(j=>{let fe=A.current;if(!fe)return;let $=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!$||$.width<=0)return;let Z=(j.clientX-$.left)/$.width,xe=Math.round(Math.max(0,Math.min(1,Z))*100);j.shiftKey&&(xe=Math.round(xe/25)*25),B(xe);},[B]),se=react.useCallback(j=>{let fe=A.current;if(!fe)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let Q=X;A.current=null,B(null),Q!=null&&Q!==fe.initialPct&&w&&w(e,Q);},[X,w,e,B]),pe=react.useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),ft=X??(e.progress||0);return jsxRuntime.jsxs("g",{ref:P,"data-task-bar":"true",style:{opacity:pr,transition:"opacity 300ms ease"},onClick:()=>{!Ie&&!L.current&&l?.(e),L.current=false;},onDoubleClick:j=>{!Ie&&!L.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),d?.(e,j);},onMouseEnter:()=>!Ie&&je(true),onMouseMove:j=>{x&&Qe&&!Ie&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Pe,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{Ie||(je(false),Y(null));},children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a+_r,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),Qe&&!Ie&&!rr&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:gt,height:Pe,fill:He==="resize-start"?n.accent:"transparent",opacity:He==="resize-start"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>Y("resize-start"),onMouseDown:j=>Kt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+gt,y:r,width:a-gt*2,height:Pe,fill:He==="move"?n.accent:"transparent",opacity:He==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:j=>Kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-gt,y:r,width:gt,height:Pe,fill:He==="resize-end"?n.accent:"transparent",opacity:He==="resize-end"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:j=>Kt(j,"resize-end")})]}),Qe&&!Ie&&ar&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Pe,fill:He==="move"?n.accent:"transparent",opacity:He==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:j=>Kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Pe,fill:He==="resize-end"?n.accent:"transparent",opacity:He==="resize-end"?.2:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:j=>Kt(j,"resize-end")}),Qe&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Pe-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!it&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ee,y:r,width:Ae,height:Pe,rx:Re,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"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let j=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),Q=o.getTime(),$=864e5,Z=(j-Q)/$,xe=(fe-j)/$,T=Z*s,U=Math.max(xe*s,s),de=et+Ke,_=T+U,ke=e.endDate?.getTime()??0,st=Math.ceil((ke-fe)/$),oe=st>0,rt=st<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:T,y:r,width:U,height:Pe,rx:Re,fill:"none",stroke:St?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),oe&&de>_&&jsxRuntime.jsx("rect",{x:_,y:r,width:de-_,height:Pe,rx:0,fill:"#EF4444",opacity:.2}),oe&&jsxRuntime.jsxs("text",{x:Math.max(de,_)+6,y:r+Pe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",st,"d"]}),rt&&jsxRuntime.jsxs("text",{x:de+6,y:r+Pe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[st,"d"]})]})})(),!e.segments&&xt&&ct&&(()=>{let fe=r+(Pe-8)/2,Q=4,$=e.progress||0,Z=new Date;Z.setHours(0,0,0,0);let xe=e.startDate&&Z>=e.startDate,T=e.endDate&&(()=>{let oe=new Date(e.endDate);return oe.setHours(0,0,0,0),Z>oe})(),U=e.startDate&&Z<e.startDate,de=1;if(xe&&e.startDate&&e.endDate&&!U){let oe=new Date(e.startDate);oe.setHours(0,0,0,0);let rt=new Date(e.endDate);rt.setHours(0,0,0,0);let pt=Math.max(1,(rt.getTime()-oe.getTime())/(1e3*60*60*24)),Qt=Math.min((Z.getTime()-oe.getTime())/(1e3*60*60*24),pt)/pt*100;de=Qt>0?$/Qt:1;}let _;$>=100?_="#00E5CC":U?_="#4B5563":T&&$<100?_="#EF4444":de>=.95?_="#22C55E":de>=.8?_="#F59E0B":_="#EF4444";let ke=Math.max($/100*Ke,$>0?Q*2:0),st=Ke>100&&$>0;return jsxRuntime.jsxs("g",{"data-task-class":ha,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:et,y:fe,width:Ke,height:8,rx:Q,fill:"rgba(255,255,255,0.10)"}),$>0&&jsxRuntime.jsx("rect",{x:et,y:fe,width:ke,height:8,rx:Q,fill:_}),st&&jsxRuntime.jsxs("text",{x:et+ke+6,y:fe+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($),"%"]})]})})(),!e.segments&&xt&&!ct&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et,y:r,width:Ke,height:Pe,rx:Re,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ha,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!it?.15:e.parentId?.6:1,scale:Qe&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Kt(j),style:{cursor:dt,pointerEvents:"all"}}),!e.segments&&!xt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et,y:r,width:Ke,height:Pe,rx:Re,fill:Ue,"data-task-class":ha,initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!it?.15:e.parentId?.6:Qe?.9:.8,scale:Qe&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ct?void 0:j=>Kt(j),style:{cursor:ct?"default":dt,pointerEvents:"all"}}),xt&&(ce||ue)&&!e.segments&&jsxRuntime.jsx("rect",{x:et,y:r,width:Ke,height:Pe,rx:Re,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&ft>0&&!ct&&jsxRuntime.jsx("rect",{x:et,y:r,width:Math.max(Ke*(ft/100),Re*2),height:Pe,rx:Re,fill:Ue,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!ct&&e.progress<100&&(()=>{let j=e.progress>0?Ke*(e.progress/100):0,fe=et+j,Q=Ke-j,$=e.progress===0?Re:0,Z=e.progress===0?et:fe,xe=e.progress===0?Ke:Q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Z,y:r,width:xe,height:Pe,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Z,y:r,width:xe,height:Pe,rx:$,fill:"none",stroke:Ue,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),xt&&!e.segments&&e.progress>0&&e.progress<100&&!ct&&!Ie&&X===null&&(()=>{let j=et+Ke*(e.progress/100),fe=8,Q=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:j,cy:r+Pe/2,r:fe,fill:Q?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:j,y:r+Pe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Q?.initials||Q?.name?.charAt(0)?.toUpperCase()||""})]})})(),q&&!Ie&&Ke>=40&&(X!==null||ft<88)&&(()=>{let j=et+Ke*(ft/100),fe=r+Pe/2,Q=X!==null,$=Q?7:Qe?6:5,Z=Q||Qe?1:.35,xe=et+Ke-j,T=Math.max(4,Math.min(12,xe-10)),U=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-U,y:fe-12,width:U+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Kr,onPointerMove:sa,onPointerUp:se,onPointerCancel:se,onClick:pe,onDoubleClick:pe,onMouseDown:de=>de.stopPropagation()}),jsxRuntime.jsx("circle",{cx:j,cy:fe,r:$,fill:"#FFFFFF",stroke:Ue,strokeWidth:2,opacity:Z,style:{pointerEvents:"none",filter:Q?`drop-shadow(0 0 4px ${Ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Q&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:j-20,y:fe-28,width:40,height:18,rx:4,fill:St?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ue,strokeWidth:1}),jsxRuntime.jsxs("text",{x:j,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:St?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((j,fe)=>{let Q=(j.startDate.getTime()-o.getTime())/864e5*s,Z=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-Q+s,xe=Ie&&F==="move"&&Ee===fe,T=Ye===fe,U=xe?Q+Le:Q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Ie&&le(fe),onMouseLeave:()=>!Ie&&le(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:U,y:r,width:Z,height:Pe,rx:Re,fill:Ue,initial:{opacity:0,scale:.95},animate:{opacity:xe||e.parentId?.6:T?.9:.8,scale:T&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:de=>{de.stopPropagation(),te(fe),Se(Q),Kt(de,void 0,Q);},style:{cursor:dt,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:U,y:r,width:Z*(e.progress/100),height:Pe,rx:Re,fill:Ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),_e&&(ce||ue)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ue&&!ce&&jsxRuntime.jsx("rect",{x:et,y:r,width:Ke,height:Pe,rx:Re,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ce&&jsxRuntime.jsx("rect",{x:et,y:r,width:Ke,height:Pe,rx:Re,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ke>60&&!e.segments&&!(xt&&ct)&&(()=>{let j=c.taskLabel(e),fe=typeof j=="string"?j:e.name,Q=fe.length>Math.floor(Ke/8)?`${fe.substring(0,Math.floor(Ke/8))}...`:fe;return jsxRuntime.jsx("text",{x:et+8,y:r+Pe/2,dominantBaseline:"middle",fill:V?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:V?"line-through":"none"},children:Q})})(),!Ie&&!e.segments&&!ct&&e.progress>0&&e.progress<100&&(xt?jsxRuntime.jsxs("text",{x:et+Ke+6,y:r+Pe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ke>100?jsxRuntime.jsxs("text",{x:et+Ke-12,y:r+Pe/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Ke>80&&!Ie&&!e.segments&&!(xt&&ct)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:et+Ke-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:et+Ke-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Qe||Ct)&&!it&&!e.segments&&!ct&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:et-2,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>Y("resize-start"),onMouseLeave:()=>Y(null),onMouseDown:j=>{j.stopPropagation(),Kt(j,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et+4,y:r+8,width:3,height:Pe-16,rx:1.5,fill:He==="resize-start"||F==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:et+Ke-14,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>Y("resize-end"),onMouseLeave:()=>Y(null),onMouseDown:j=>{j.stopPropagation(),Kt(j,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et+Ke-7,y:r+8,width:3,height:Pe-16,rx:1.5,fill:He==="resize-end"||F==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Qe&&!Ie&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+a+10,cy:r+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Y("connect"),onMouseLeave:()=>Y(null),onMouseDown:j=>{j.stopPropagation(),Kt(j,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+10,cy:r+Pe/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:He==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),it&&ge&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Pe/2,x2:ge.x,y2:ge.y,stroke:De?n.statusCompleted:n.accent,strokeWidth:De?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:De?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:ge.x,cy:ge.y,r:De?8:6,fill:De?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),De&&jsxRuntime.jsx(framerMotion.motion.text,{x:ge.x+15,y:ge.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ge.x+10},animate:{opacity:1,x:ge.x+15},transition:{duration:.2},children:"Connect"})]}),(Qe||Ie)&&!it&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et-1,y:r-1,width:Ke+2,height:Pe+2,rx:Re+1,fill:"none",stroke:Ie?n.accent:xt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:xt?1:2,opacity:Ie||xt?.6:.4,initial:{opacity:0},animate:{opacity:Ie||xt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ct&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:ee,y1:0,x2:ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:ee+Ae,y1:0,x2:ee+Ae,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Qe&&!Ie&&!e.segments&&!x&&(()=>{let Q=r<100,$=Q?r+Pe+13:r-82-13,Z=Q?`M ${et+Ke/2-6} ${r+Pe+3} L ${et+Ke/2} ${r+Pe+13} L ${et+Ke/2+6} ${r+Pe+3}`:`M ${et+Ke/2-6} ${r-13} L ${et+Ke/2} ${r-3} L ${et+Ke/2+6} ${r-13}`,xe=$+22,T=$+40,U=$+55,de=$+70,_=Q?$+82-5:r-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Z,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:et+Ke/2-120,y:$,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))"}),jsxRuntime.jsx("text",{x:et+Ke/2,y:xe,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}),jsxRuntime.jsx("text",{x:et+Ke/2-110,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:et+Ke/2-70,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Er(e.startDate)}),jsxRuntime.jsx("text",{x:et+Ke/2-110,y:U,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:et+Ke/2-70,y:U,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Er(e.endDate)}),jsxRuntime.jsx("text",{x:et+Ke/2+10,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:et+Ke/2+65,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:_t()}),jsxRuntime.jsx("text",{x:et+Ke/2+10,y:U,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:et+Ke/2+65,y:U,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:et+Ke/2-110,y:de,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:et+Ke/2-50,y:de,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ke=>ke.name).join(", ").substring(0,30),e.assignees.map(ke=>ke.name).join(", ").length>30?"...":""]})]}),!Q&&jsxRuntime.jsx("text",{x:et+Ke/2,y:_,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ar?"Left: move \u2022 Right: resize":rr?"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 cd=260,ds=8,jm=16,uw=-12;function _m({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:C}=e,P=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,L=v.lastActivity!=null,k=(P?155:105)+(L?28:0),D=w+jm,F=C+uw-k;D+cd>window.innerWidth-ds&&(D=w-cd-jm),D<ds&&(D=ds);let E=F<ds;E&&(F=C+20),F+k>window.innerHeight-ds&&(F=window.innerHeight-ds-k),s({left:D,top:F,showBelow:E});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let F=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${F} d\xEDa${F!==1?"s":""}`:`${F} day${F!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),C=F=>`${F.getFullYear()}-${String(F.getMonth()+1).padStart(2,"0")}-${String(F.getDate()).padStart(2,"0")}`,P=0,L=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;L.getTime()<=k.getTime();){let F=L.getDay();v[F]&&!w.has(C(L))&&P++,L.setDate(L.getDate()+1);}let D=Math.max(0,P);return r==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),C=v%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxRuntime.jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:cd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(el,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(el,{label:l.duration,value:d(),labelColor:u,valueColor:p}),jsxRuntime.jsx(el,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(el,{label:l.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxRuntime.jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.tags,": "]}),jsxRuntime.jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(v=>jsxRuntime.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}55`,whiteSpace:"nowrap"},children:v.name},v.id))})]}),c&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxRuntime.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:o.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return reactDom.createPortal(h,document.body)}function Qi({label:e,value:t,labelColor:r,valueColor:a}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:r},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Ks({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:c=false,onHoverChange:l,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:m,glowFilter:u}){let[,p]=react.useState(false),[f,x]=react.useState(null),y=a-t,b=y>0,h=Math.abs(y)<5,v=20,w=!h&&r<=e,C,M,F=r-e,k=e+F/2;M=k;let N=8;if(o==="squared")if(h)C=`M ${e} ${t} L ${r} ${a}`;else if(w){let Ne=e+15,Me=r-v,Re=b?t+20:t-20;M=Me;let Qe=b?1:-1;C=`M ${e} ${t} L ${Ne-N} ${t} Q ${Ne} ${t} ${Ne} ${t+Qe*N} L ${Ne} ${Re-Qe*N} Q ${Ne} ${Re} ${Ne-N} ${Re} L ${Me+N} ${Re} Q ${Me} ${Re} ${Me} ${Re+Qe*N} L ${Me} ${a-Qe*N} Q ${Me} ${a} ${Me+N} ${a} L ${r} ${a}`;}else {M=r-v;let Ue=b?1:-1;C=`M ${e} ${t} L ${M-N} ${t} Q ${M} ${t} ${M} ${t+Ue*N} L ${M} ${a-Ue*N} Q ${M} ${a} ${M+N} ${a} L ${r} ${a}`;}else C=`M ${e} ${t} C ${k} ${t}, ${k} ${a}, ${r} ${a}`;let P=6,D=5,K=`M ${r} ${a} L ${r-P} ${a-D/2} L ${r-P} ${a+D/2} Z`,H=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ee=d||(H?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),A=m||1,Ee=n.dependencyHover||(H?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),O="#f87171",U="rgba(248, 113, 113, 0.15)",R=M,Ae=(t+a)/2;if(f)if(o==="squared")if(h)R=Math.max(e+10,Math.min(r-10,f.x)),Ae=t;else if(w){let Ue=e+15,Ne=r-v,Me=b?t+20:t-20,Re=[[e,t,Ue,t],[Ue,t,Ue,Me],[Ue,Me,Ne,Me],[Ne,Me,Ne,a],[Ne,a,r,a]],Qe=1/0,ie={x:R,y:Ae};for(let et of Re){let Ve=Je(f.x,f.y,et[0],et[1],et[2],et[3]),Oe=Math.hypot(f.x-Ve.x,f.y-Ve.y);Oe<Qe&&(Qe=Oe,ie=Ve);}R=ie.x,Ae=ie.y;}else {let Ue=[[e,t,M,t],[M,t,M,a],[M,a,r,a]],Ne=1/0,Me={x:R,y:Ae};for(let Re of Ue){let Qe=Je(f.x,f.y,Re[0],Re[1],Re[2],Re[3]),ie=Math.hypot(f.x-Qe.x,f.y-Qe.y);ie<Ne&&(Ne=ie,Me=Qe);}R=Me.x,Ae=Me.y;}else {let Ue=k,Ne=t,Me=k,Re=a,Qe=1/0,ie=R,et=Ae;for(let Ve=0;Ve<=1;Ve+=.02){let Oe=1-Ve,ut=Oe*Oe*Oe*e+3*Oe*Oe*Ve*Ue+3*Oe*Ve*Ve*Me+Ve*Ve*Ve*r,pt=Oe*Oe*Oe*t+3*Oe*Oe*Ve*Ne+3*Oe*Ve*Ve*Re+Ve*Ve*Ve*a,Ge=Math.hypot(f.x-ut,f.y-pt);Ge<Qe&&(Qe=Ge,ie=ut,et=pt);}R=ie,Ae=et;}function Je(Ue,Ne,Me,Re,Qe,ie){let et=Qe-Me,Ve=ie-Re,Oe=et*et+Ve*Ve;if(Oe===0)return {x:Me,y:Re};let ut=((Ue-Me)*et+(Ne-Re)*Ve)/Oe;return ut=Math.max(0,Math.min(1,ut)),{x:Me+ut*et,y:Re+ut*Ve}}let $e=Ue=>{let Ne=Ue.currentTarget.ownerSVGElement;if(!Ne)return;let Me=Ne.getScreenCTM();if(!Me)return;let Re=Me.inverse();x({x:Re.a*Ue.clientX+Re.c*Ue.clientY+Re.e,y:Re.b*Ue.clientX+Re.d*Ue.clientY+Re.f});},J=()=>{p(false),x(null),l?.(false);},De=()=>{p(true),l?.(true);},oe=Ue=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ue,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ne=>{Ne.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:R,cy:Ae,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:R,cy:Ae,r:9,fill:U,stroke:O,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R-3,y1:Ae-3,x2:R+3,y2:Ae+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R+3,y1:Ae-3,x2:R-3,y2:Ae+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return c?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:J,onMouseMove:$e,children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ee,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ee,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:K,fill:Ee,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:4,fill:Ee,opacity:.9,style:{pointerEvents:"none"}}),oe({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:De,onMouseLeave:J,onMouseMove:$e,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ee,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:K,fill:Ee,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:3.5,fill:Ee,style:{pointerEvents:"none"}}),oe({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:De,onMouseLeave:J,onMouseMove:$e,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:ee,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:u||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:K,fill:ee,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:ee,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function rl({task:e,x:t,y:r,theme:a,onClick:n}){let[s,o]=react.useState(false),c=16,l=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Ce={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(d=>{d.dependencies&&a.set(d.id,d.dependencies),d.subtasks&&n(d.subtasks);});};n(e);let s=a.get(r)||[];a.set(r,[...s,t]);let o=new Set,c=new Set,l=i=>{if(!o.has(i)){o.add(i),c.add(i);let d=a.get(i)||[];for(let m of d){if(!o.has(m)&&l(m))return true;if(c.has(m))return true}}return c.delete(i),false};return l(r)},flattenTasks:e=>{let t=[],r=a=>{[...a].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&r(s.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Ce.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Ce.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=Ce.findTaskById(e,n);if(s)r.unshift(s),n=s.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=Ce.flattenTasks(e),a=[["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(";")||""];a.push(s.join(","));}),a.join(`
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=
|
|
130
|
+
`})]});return reactDom.createPortal(y,document.body)}function el({label:e,value:t,labelColor:r,valueColor:a}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:r},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Ys({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:c=false,onHoverChange:l,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:m,glowFilter:u}){let[,p]=react.useState(false),[f,x]=react.useState(null),h=a-t,b=h>0,y=Math.abs(h)<5,v=20,w=!y&&r<=e,C,P,L=r-e,k=e+L/2;P=k;let D=8;if(o==="squared")if(y)C=`M ${e} ${t} L ${r} ${a}`;else if(w){let Se=e+15,Le=r-v,$e=b?t+20:t-20;P=Le;let Ye=b?1:-1;C=`M ${e} ${t} L ${Se-D} ${t} Q ${Se} ${t} ${Se} ${t+Ye*D} L ${Se} ${$e-Ye*D} Q ${Se} ${$e} ${Se-D} ${$e} L ${Le+D} ${$e} Q ${Le} ${$e} ${Le} ${$e+Ye*D} L ${Le} ${a-Ye*D} Q ${Le} ${a} ${Le+D} ${a} L ${r} ${a}`;}else {P=r-v;let Be=b?1:-1;C=`M ${e} ${t} L ${P-D} ${t} Q ${P} ${t} ${P} ${t+Be*D} L ${P} ${a-Be*D} Q ${P} ${a} ${P+D} ${a} L ${r} ${a}`;}else C=`M ${e} ${t} C ${k} ${t}, ${k} ${a}, ${r} ${a}`;let F=6,E=5,G=`M ${r} ${a} L ${r-F} ${a-E/2} L ${r-F} ${a+E/2} Z`,O=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ee=d||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),I=m||1,Ae=n.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),H="#f87171",ge="rgba(248, 113, 113, 0.15)",N=P,De=(t+a)/2;if(f)if(o==="squared")if(y)N=Math.max(e+10,Math.min(r-10,f.x)),De=t;else if(w){let Be=e+15,Se=r-v,Le=b?t+20:t-20,$e=[[e,t,Be,t],[Be,t,Be,Le],[Be,Le,Se,Le],[Se,Le,Se,a],[Se,a,r,a]],Ye=1/0,le={x:N,y:De};for(let Qe of $e){let je=Xe(f.x,f.y,Qe[0],Qe[1],Qe[2],Qe[3]),Ie=Math.hypot(f.x-je.x,f.y-je.y);Ie<Ye&&(Ye=Ie,le=je);}N=le.x,De=le.y;}else {let Be=[[e,t,P,t],[P,t,P,a],[P,a,r,a]],Se=1/0,Le={x:N,y:De};for(let $e of Be){let Ye=Xe(f.x,f.y,$e[0],$e[1],$e[2],$e[3]),le=Math.hypot(f.x-Ye.x,f.y-Ye.y);le<Se&&(Se=le,Le=Ye);}N=Le.x,De=Le.y;}else {let Be=k,Se=t,Le=k,$e=a,Ye=1/0,le=N,Qe=De;for(let je=0;je<=1;je+=.02){let Ie=1-je,Ct=Ie*Ie*Ie*e+3*Ie*Ie*je*Be+3*Ie*je*je*Le+je*je*je*r,it=Ie*Ie*Ie*t+3*Ie*Ie*je*Se+3*Ie*je*je*$e+je*je*je*a,qe=Math.hypot(f.x-Ct,f.y-it);qe<Ye&&(Ye=qe,le=Ct,Qe=it);}N=le,De=Qe;}function Xe(Be,Se,Le,$e,Ye,le){let Qe=Ye-Le,je=le-$e,Ie=Qe*Qe+je*je;if(Ie===0)return {x:Le,y:$e};let Ct=((Be-Le)*Qe+(Se-$e)*je)/Ie;return Ct=Math.max(0,Math.min(1,Ct)),{x:Le+Ct*Qe,y:$e+Ct*je}}let He=Be=>{let Se=Be.currentTarget.ownerSVGElement;if(!Se)return;let Le=Se.getScreenCTM();if(!Le)return;let $e=Le.inverse();x({x:$e.a*Be.clientX+$e.c*Be.clientY+$e.e,y:$e.b*Be.clientX+$e.d*Be.clientY+$e.f});},Y=()=>{p(false),x(null),l?.(false);},Ee=()=>{p(true),l?.(true);},te=Be=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Be,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Se=>{Se.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:N,cy:De,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:N,cy:De,r:9,fill:ge,stroke:H,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N-3,y1:De-3,x2:N+3,y2:De+3,stroke:H,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+3,y1:De-3,x2:N-3,y2:De+3,stroke:H,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return c?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:Y,onMouseMove:He,children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:G,fill:Ae,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:4,fill:Ae,opacity:.9,style:{pointerEvents:"none"}}),te({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Ee,onMouseLeave:Y,onMouseMove:He,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:Ae,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:G,fill:Ae,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:3.5,fill:Ae,style:{pointerEvents:"none"}}),te({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:Ee,onMouseLeave:Y,onMouseMove:He,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:ee,strokeWidth:I,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:u||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:G,fill:ee,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:ee,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function nl({task:e,x:t,y:r,theme:a,onClick:n}){let[s,o]=react.useState(false),c=16,l=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Te={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(d=>{d.dependencies&&a.set(d.id,d.dependencies),d.subtasks&&n(d.subtasks);});};n(e);let s=a.get(r)||[];a.set(r,[...s,t]);let o=new Set,c=new Set,l=i=>{if(!o.has(i)){o.add(i),c.add(i);let d=a.get(i)||[];for(let m of d){if(!o.has(m)&&l(m))return true;if(c.has(m))return true}}return c.delete(i),false};return l(r)},flattenTasks:e=>{let t=[],r=a=>{[...a].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&r(s.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Te.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Te.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=Te.findTaskById(e,n);if(s)r.unshift(s),n=s.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=Te.flattenTasks(e),a=[["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(";")||""];a.push(s.join(","));}),a.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=Te.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=Te.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.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)=>Te.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=Te.findTaskById(e,t);return !r||!r.dependencies?[]:Te.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>Te.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>Te.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Te.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let s=t[n];if(!r||s===void 0||s>=r.length||(a=r[s],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>Te.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,s=Te.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(l=>{let i=l.startDate&&l.endDate?Te.calculateDuration(l.startDate,l.endDate):0;return [l.name,l.startDate?Te.formatDate(l.startDate):"N/A",l.endDate?Te.formatDate(l.endDate):"N/A",i>0?`${i} days`:"N/A",`${l.progress}%`,l.status||"N/A"]});a(n,{head:o,body:c,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}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t,r)=>{let a=await import('xlsx'),n=Te.flattenTasks(e),s=r?.rateMap,o=r?.defaultRate||0,c=h=>{if(!s||!h.assignees||h.assignees.length===0)return o;let b=h.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return b.length===0?o:b.reduce((y,v)=>y+v,0)/b.length},l=new Map,i=(h,b="")=>{[...h].sort((v,w)=>(v.position??0)-(w.position??0)).forEach((v,w)=>{let C=b?`${b}.${w+1}`:`${w+1}`;l.set(v.id,C),v.subtasks?.length&&i(v.subtasks,C);});};i(e);let d=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),m=n.map(h=>{let b=h.startDate&&h.endDate?Te.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,v=h.timeLoggedMinutes,w=h.soldEffortMinutes,C=typeof y=="number"?+(y/60).toFixed(1):0,P=typeof v=="number"?+(v/60).toFixed(1):0,L=typeof w=="number"?+(w/60).toFixed(1):0,k=h._costRate>0?h._costRate:c(h),D={WBS:l.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Te.formatDate(h.startDate):"","End Date":h.endDate?Te.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(E=>E.name).join(", ")||"","Estimated (h)":C||"","Logged (h)":P||"","Quoted (h)":L||""};d&&(D["$ Estimated"]=C>0&&k>0?Math.round(C*k):"",D["$ Executed"]=P>0&&k>0?Math.round(P*k):"",D["$ Quoted"]=L>0&&k>0?Math.round(L*k):"",D["Rate ($/h)"]=k>0?k:"");let F=h.weight;return D["Weight (%)"]=typeof F=="number"&&F>0?F:"",D["Is Milestone"]=h.isMilestone?"Yes":"No",D}),u=r?.projectName||"";if(u||m.length>0){let h=0,b=0,y=0,v=0,w=0,C=0,P=0,L=0,k=n.filter(E=>E.startDate).map(E=>E.startDate.getTime()),D=n.filter(E=>E.endDate).map(E=>E.endDate.getTime());for(let E of m)typeof E["Estimated (h)"]=="number"&&(h+=E["Estimated (h)"]),typeof E["Logged (h)"]=="number"&&(b+=E["Logged (h)"]),typeof E["Quoted (h)"]=="number"&&(y+=E["Quoted (h)"]),d&&(typeof E["$ Estimated"]=="number"&&(v+=E["$ Estimated"]),typeof E["$ Executed"]=="number"&&(w+=E["$ Executed"]),typeof E["$ Quoted"]=="number"&&(C+=E["$ Quoted"])),typeof E["Progress (%)"]=="number"&&(P+=E["Progress (%)"],L++);let F={WBS:"0","Task Name":`\u{1F4CB} ${u||"PROJECT TOTAL"}`,"Start Date":k.length>0?Te.formatDate(new Date(Math.min(...k))):"","End Date":D.length>0?Te.formatDate(new Date(Math.max(...D))):"","Duration (days)":k.length>0&&D.length>0?Te.calculateDuration(new Date(Math.min(...k)),new Date(Math.max(...D))):"","Progress (%)":L>0?Math.round(P/L):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};d&&(F["$ Estimated"]=v||"",F["$ Executed"]=w||"",F["$ Quoted"]=C||"",F["Rate ($/h)"]=""),F["Is Milestone"]="No",m.unshift(F);}let p=a.utils.json_to_sheet(m),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...d?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];p["!cols"]=f;let x=a.utils.book_new();if(a.utils.book_append_sheet(x,p,"Gantt Tasks"),!t){let h=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}a.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=Te.flattenTasks(e),n=new Map;a.forEach((u,p)=>{n.set(u.id,p+1);});let s=u=>u.toISOString().replace("Z",""),o=Te.getEarliestStartDate(e)||new Date,c=Te.getLatestEndDate(e)||new Date,l=a.map((u,p)=>{let f=n.get(u.id),x=u.startDate&&u.endDate?Te.calculateDuration(u.startDate,u.endDate):0,h=(u.dependencies||[]).filter(b=>n.has(b)).map(b=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${n.get(b)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
211
211
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
212
212
|
<IsPublished>1</IsPublished>
|
|
213
|
-
<CommitmentType>0</CommitmentType>${
|
|
213
|
+
<CommitmentType>0</CommitmentType>${h}
|
|
214
214
|
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
215
215
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
216
216
|
<SaveVersion>14</SaveVersion>
|
|
@@ -358,14 +358,14 @@
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${l}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(d),m.download=r,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Ce.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let d=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let f=t.find(x=>x.id===p);if(f){n(f);let x=a.get(p)?.ef||0;m=Math.max(m,x);}}let u=m+d;a.set(i.id,{es:m,ef:u});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,c=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),u=s;if(m.length>0)for(let f of m){c(f);let x=o.get(f.id)?.ls||0;u=Math.min(u,x);}let p=u-d;o.set(i.id,{ls:p,lf:u});};r.forEach(c);let l=[];for(let i of r){let d=a.get(i.id),m=o.get(i.id);if(d&&m){let u=m.ls-d.es;Math.abs(u)<.01&&l.push(i.id);}}return l},calculateCriticalPathFull:e=>{let t=new Map,a=Ce.flattenTasks(e).filter(u=>u.startDate&&u.endDate);if(a.length===0)return t;let n=new Map(a.map(u=>[u.id,u])),s=new Map;for(let u of a)s.has(u.id)||s.set(u.id,[]);for(let u of a)if(u.dependencies){for(let p of u.dependencies)if(n.has(p)){let f=s.get(p);f&&f.push(u.id);}}let o=new Map;for(let u of a)o.set(u.id,0);for(let u of a)if(u.dependencies)for(let p of u.dependencies)n.has(p)&&o.set(u.id,(o.get(u.id)||0)+1);let c=new Map,l=[],i=[];for(let u of a)(o.get(u.id)||0)===0&&i.push(u.id);for(;i.length>0;){let u=i.shift();l.push(u);let p=n.get(u);if(!p||!p.startDate||!p.endDate)continue;let f=Ce.calculateDuration(p.startDate,p.endDate),x=0;if(p.dependencies)for(let b of p.dependencies){let h=c.get(b);h&&(x=Math.max(x,h.ef));}c.set(u,{es:x,ef:x+f});let y=s.get(u)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(l.length<a.length)return t;let d=Math.max(...Array.from(c.values()).map(u=>u.ef)),m=new Map;for(let u=l.length-1;u>=0;u--){let p=l[u];if(!p)continue;let f=n.get(p);if(!f||!f.startDate||!f.endDate)continue;let x=Ce.calculateDuration(f.startDate,f.endDate),y=s.get(p)||[],b=d;if(y.length>0)for(let h of y){let v=m.get(h);v&&(b=Math.min(b,v.ls));}m.set(p,{ls:b-x,lf:b});}for(let u of l){let p=c.get(u),f=m.get(u),x=f.ls-p.es,y=s.get(u)||[],b;y.length>0?b=Math.min(...y.map(h=>c.get(h).es))-p.ef:b=d-p.ef,t.set(u,{earlyStart:p.es,earlyFinish:p.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=Ce.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Ce.calculateCriticalPath(e).includes(t))return 0;let n=Ce.getDependentTasks(e,t);if(n.length===0){let c=Ce.getLatestEndDate(e);if(!c)return null;let l=Ce.calculateDuration(r.endDate,c);return Math.max(0,l)}let s=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,l)=>c-l)[0];if(!s)return null;let o=Ce.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ce.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Ce.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ce.getDependentTasks(e,t);if(o.length===0)return e;let c=[...e];for(let l of o){if(n.has(l.id)||!l.startDate||!l.endDate)continue;let i=Ce.calculateDuration(l.startDate,l.endDate),d;if(r!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let p=new Date(s.endDate),f=new Date(p);f.setDate(f.getDate()+1),d<f&&(d=f);}let m=Ce.calculateEndDate(d,i),u=p=>p.map(f=>f.id===l.id?{...f,startDate:d,endDate:m}:f.subtasks?{...f,subtasks:u(f.subtasks)}:f);c=u(c),c=Ce.autoScheduleDependents(c,l.id,r,n);}return c},calculateCascadePreview:(e,t,r,a,n,s,o,c)=>{if(r===0)return [];let l=[],i=n.getTime(),d=1e3*60*60*24,m=Ce.findTaskById(e,t);if(!m||!m.endDate)return [];let u=(p,f,x=new Set)=>{if(x.has(p))return;x.add(p);let y=Ce.getDependentTasks(e,p);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=a.findIndex(D=>D.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),C=(b.endDate.getTime()-v)/d,F=(v-i)/d*s,k=F+f*s,N=Math.max(C*s,s),P=c+h*o+(o-18)/2;l.push({taskId:b.id,taskName:b.name,originalX:F,previewX:k,width:N,y:P,rowIndex:h,daysDelta:f,color:b.color}),u(b.id,f,x);}};return u(t,r),l},splitTask:(e,t,r,a=3)=>{let n=Ce.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let l=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:c}],i=d=>d.map(m=>m.id===n.id?{...m,endDate:c,segments:l}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function al({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:c="en",templates:l,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:m,onTaskDblClick:u,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:C,onTaskProgressDrag:M,workingDaysConfig:F}){let N=qa(),P=react.useRef(null),[D,K]=react.useState([]),[H,ee]=react.useState(null),[A,Ee]=react.useState(null),[O,U]=react.useState(null),R=react.useRef(false),[Ae,Je]=react.useState(new Set),[$e,J]=react.useState(null),De=react.useCallback(B=>{if(O&&!R.current){let Y=B.target,re=false;for(;Y&&Y!==B.currentTarget;){if(Y.getAttribute?.("data-dependency-line")==="true"||Y.getAttribute?.("data-dependency-hover-overlay")==="true"){re=true;break}Y=Y.parentElement;}re||U(null);}},[O]),oe=react.useCallback(B=>{Ee(B);},[]),Ue=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Ne=a==="day"?60:a==="week"?20:8,Me=Ue*Ne*o,Re=B=>{let Y=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),re=Y.getUTCDay()||7;Y.setUTCDate(Y.getUTCDate()+4-re);let he=new Date(Date.UTC(Y.getUTCFullYear(),0,1));return Math.ceil(((Y.getTime()-he.getTime())/864e5+1)/7)},Qe=B=>{let Y=B.getDay();return Y===0||Y===6},ie=react.useMemo(()=>{let B=F?.holidayDates;return B?B instanceof Set?B:new Set(B):null},[F?.holidayDates]),et=B=>{if(!ie)return false;let Y=`${B.getFullYear()}-${String(B.getMonth()+1).padStart(2,"0")}-${String(B.getDate()).padStart(2,"0")}`;return ie.has(Y)},Ve=react.useCallback(B=>{let Y=Math.round(B/(Ne*o)),re=new Date(n);return re.setDate(re.getDate()+Y),re},[n,Ne,o]),Oe=react.useCallback((B,Y)=>{if(Y.startDate&&Y.endDate)return;let re=B.currentTarget.ownerSVGElement;if(!re)return;let he=re.createSVGPoint();he.x=B.clientX,he.y=B.clientY;let qe=he.matrixTransform(re.getScreenCTM()?.inverse()),j=Ve(qe.x),ye=new Date(j);ye.setDate(ye.getDate()+1),J(null),f?.(Y,j,ye);},[Ve,f]),ut=react.useCallback((B,Y,re)=>{let he=B.currentTarget.ownerSVGElement;if(!he)return;let qe=he.createSVGPoint();qe.x=B.clientX,qe.y=B.clientY;let j=qe.matrixTransform(he.getScreenCTM()?.inverse()),ye=Ve(j.x),Ie=Math.round(j.x/(Ne*o))*Ne*o;J({taskId:Y.id,x:Ie,y:re*r+r/2,date:ye});},[Ve,Ne,o,r]),pt=react.useCallback(()=>{J(null);},[]),Ge=react.useMemo(()=>{let B=qe=>qe.map(j=>{if(j.subtasks&&j.subtasks.length>0){let ye=B(j.subtasks),Fe=ye.filter(Ie=>Ie.startDate&&Ie.endDate);if(Fe.length>0){let Ie=Fe.map(ft=>ft.startDate.getTime()),Ct=Fe.map(ft=>ft.endDate.getTime()),Ze=new Date(Math.min(...Ie)),Tt=new Date(Math.max(...Ct));return {...j,subtasks:ye,startDate:Ze,endDate:Tt}}return {...j,subtasks:ye}}return j}),Y=(qe,j=[])=>{let ye=[...qe].sort((Fe,Ie)=>(Fe.position??0)-(Ie.position??0));for(let Fe of ye)j.push(Fe),Fe.subtasks&&Fe.subtasks.length>0&&(Fe.isExpanded===void 0||Fe.isExpanded)&&Y(Fe.subtasks,j);return j},re=B(e);return Y(re)},[e]),Pe=react.useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let Y=B.startDate.getTime(),re=B.endDate.getTime(),he=n.getTime(),qe=(Y-he)/(1e3*60*60*24),j=(re-Y)/(1e3*60*60*24)+1,ye=qe*Ne*o,Fe=Math.max(Ne*o,40),Ie=Math.max(j*Ne*o,Fe);return {x:ye,width:Ie}},[n,Ne,o]),ot=react.useMemo(()=>Ge.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:Y,width:re}=Pe(B),qe=Ge.findIndex(j=>j.id===B.id)*r+(r-18)/2;return {id:B.id,x:Y,y:qe,width:re,height:18}}),[Ge,Pe]),$t=react.useCallback((B,Y,re)=>{if(!re){K([]),ee(null);return}if(ee({taskId:B,daysDelta:Y}),Y===0){K([]);return}let he=Ce.calculateCascadePreview(e,B,Y,Ge,n,Ne*o,r,48);K(he);},[e,Ge,n,Ne,o,r,48]),Be=react.useCallback((B,Y)=>{if(!H)return Y;let re=Ne*o,he=H.daysDelta*re;if(B===H.taskId)return {x:Y.x+he,width:Y.width};let qe=D.find(j=>j.taskId===B);return qe?{x:qe.previewX,width:qe.width}:Y},[H,D,Ne,o]),st=react.useMemo(()=>{let B=[],Y=new Date(n);for(;Y<=s;){let qe=(Y.getTime()-n.getTime())/864e5*Ne*o;if(a==="day")B.push({date:new Date(Y),label:Y.toLocaleDateString(c,{day:"numeric",month:"short"}),x:qe}),Y.setDate(Y.getDate()+1);else if(a==="week"){let j=Re(Y);B.push({date:new Date(Y),label:`${N.labels.week} ${j}`,x:qe}),Y.setDate(Y.getDate()+7);}else B.push({date:new Date(Y),label:Y.toLocaleDateString(c,{month:"short",year:"numeric"}),x:qe}),Y.setMonth(Y.getMonth()+1);}return B},[n,s,a,Ne,o,c,N.labels.week]),L=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Ne*o,[n,Ne,o]),X=Math.max(Ge.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.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:jsxRuntime.jsxs("svg",{width:Math.max(Me,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Me,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),st.map((B,Y)=>jsxRuntime.jsxs("g",{children:[Y>0&&jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:B.x+8,y:48/2,fill:a==="day"&&!Qe(B.date)&&et(B.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${Y}`)),L>=0&&L<=Me&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:L,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:L,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${L-18}, 2)`,children:[jsxRuntime.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}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:N.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max(Me,1e3),height:X,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:De,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.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"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Me,1e3),height:X,fill:t.bgPrimary}),Ge.map((B,Y)=>jsxRuntime.jsx("rect",{x:0,y:Y*r,width:Math.max(Me,1e3),height:r,fill:Y%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${B.id}`)),st.map((B,Y)=>Y>0?jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:Ge.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${Y}`):null),st.map((B,Y)=>{let re=st[Y+1]?.x||Me,he=w&&Qe(B.date),qe=a==="day"&&!Qe(B.date)&&et(B.date);return he||qe?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:B.x,y:0,width:re-B.x,height:Ge.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:B.x,y:0,width:re-B.x,height:Ge.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${Y}`):null}),Ge.map((B,Y)=>{let re=B.startDate&&B.endDate;return jsxRuntime.jsx("g",{children:!re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:Y*r,width:Me,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:he=>Oe(he,B),onMouseMove:he=>ut(he,B,Y),onMouseLeave:()=>{pt();}},`clickable-${B.id}`),$e&&$e.taskId===B.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:$e.x,y1:Y*r+4,x2:$e.x,y2:Y*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:$e.x,cy:$e.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:$e.x,cy:$e.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${$e.x}, ${Y*r-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:$e.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!$e||$e.taskId!==B.id)&&jsxRuntime.jsx("text",{x:L>0?L:100,y:Y*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:N.labels.clickToSetDates},`placeholder-${B.id}`)]})},`row-group-${B.id}`)}),Ge.map((B,Y)=>{if(!B.startDate||!B.endDate)return null;let{x:re,width:he}=Pe(B),qe=Y*r+(r-18)/2,j=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;if(B.isMilestone)return jsxRuntime.jsx(rl,{task:B,x:re+he/2,y:qe+12,theme:t,onClick:m},B.id);if(j){let ye=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Fe=8,Ie=qe+(r-18)/2+(18-Fe)/2,Ct=4,Ze=B.progress||0,Tt=new Date;Tt.setHours(0,0,0,0);let ft=B.startDate&&Tt>=B.startDate,zt=B.endDate&&(()=>{let Qt=new Date(B.endDate);return Qt.setHours(0,0,0,0),Tt>Qt})(),rr=B.startDate&&Tt<B.startDate,da=1;if(ft&&B.startDate&&B.endDate&&!rr){let Qt=new Date(B.startDate);Qt.setHours(0,0,0,0);let zr=new Date(B.endDate);zr.setHours(0,0,0,0);let ua=Math.max(1,(zr.getTime()-Qt.getTime())/(1e3*60*60*24)),Ke=Math.min((Tt.getTime()-Qt.getTime())/(1e3*60*60*24),ua)/ua*100;da=Ke>0?Ze/Ke:1;}let Vt;Ze>=100?Vt="#00E5CC":rr?Vt="#4B5563":zt&&Ze<100?Vt="#EF4444":da>=.95?Vt="#22C55E":da>=.8?Vt="#F59E0B":Vt="#EF4444";let gr=Math.max(Ze/100*he,Ze>0?Ct*2:0),Bt=he>100&&Ze>0,_r=B.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>m?.(B),onContextMenu:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),p?.(B,Qt);},onMouseMove:Qt=>{oe({task:B,x:re,y:Ie,width:he,height:Fe,showBelow:Ie<100,mouseX:Qt.clientX,mouseY:Qt.clientY});},onMouseLeave:()=>oe(null),style:{cursor:"default",opacity:h?_r?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:re,y:qe,width:he,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:re,y:Ie,width:he,height:Fe,rx:Ct,fill:ye?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ze>0&&jsxRuntime.jsx("rect",{x:re,y:Ie,width:gr,height:Fe,rx:Ct,fill:Vt}),h&&_r&&jsxRuntime.jsx("rect",{x:re,y:Ie,width:he,height:Fe,rx:Ct,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Bt&&jsxRuntime.jsxs("text",{x:re+gr+6,y:Ie+Fe/2,dominantBaseline:"central",fill:ye?"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(Ze),"%"]})]},B.id)}return jsxRuntime.jsx(Ji,{task:B,x:re,y:qe,width:he,theme:t,dayWidth:Ne*o,startDate:n,templates:l,onClick:m,onDoubleClick:u,onContextMenu:p,onDateChange:f,onDependencyCreate:x,allTaskPositions:ot,onDragMove:$t,onHoverChange:oe,showBaseline:b,showTaskBarLabels:d,showCriticalPath:h,readOnly:C?!C(B):false,onProgressChange:M},B.id)}),v&&Ge.map((B,Y)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(re=>{let he=Ge.find(Vt=>Vt.id===re);if(!he||!he.startDate||!he.endDate)return null;let qe=Ge.findIndex(Vt=>Vt.id===re),j=Be(he.id,Pe(he)),ye=Be(B.id,Pe(B)),Fe=j.x+j.width,Ie=qe*r+26,Ct=ye.x,Ze=Y*r+26,Tt=`dep-${re}-${B.id}`;if(Ae.has(Tt))return null;let ft=h&&B.isCriticalPath&&he.isCriticalPath;return jsxRuntime.jsx(Ks,{x1:Fe,y1:Ie,x2:Ct,y2:Ze,theme:t,lineStyle:i,colorOverride:h?ft?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?ft?2:1:void 0,glowFilter:ft?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(B.id,re),onHoverChange:Vt=>{R.current=Vt,Vt&&U({key:Tt,fromId:re,toId:B.id,exitX:Fe,exitY:Ie,enterX:Ct,enterY:Ze});}},Tt)})),D.map(B=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:18,rx:6,fill:B.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(B.daysDelta)>0&&jsxRuntime.jsx("text",{x:B.previewX+B.width/2,y:B.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),v&&O&&jsxRuntime.jsx(Ks,{x1:O.exitX,y1:O.exitY,x2:O.enterX,y2:O.enterY,theme:t,lineStyle:i,onDelete:()=>{let B=O.key;U(null),R.current=false,Je(Y=>new Set(Y).add(B)),y?.(O.toId,O.fromId);},hoverOverlayOnly:true,onHoverChange:B=>{R.current=B,B||U(null);}},`${O.key}-hover-overlay`),L>=0&&L<=Me&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:L,y1:0,x2:L,y2:X,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:L,y1:0,x2:L,y2:X,stroke:t.today,strokeWidth:1,opacity:1})]})]}),A&&jsxRuntime.jsx(zm,{tooltipData:A,theme:t,locale:c==="es"?"es":"en",workingDaysConfig:F})]})}var iw=['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"'],jm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),lw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),cw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),dw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),uw=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.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:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:c,onDependencyDelete:l}){let[i,d]=react.useState(false),[m,u]=react.useState(false),[p,f]=react.useState([]),[x,y]=react.useState(""),[b,h]=react.useState(false),[v,w]=react.useState(true),[C,M]=react.useState(""),[F,k]=react.useState(-1),[N,P]=react.useState(false),[D,K]=react.useState(0),H=react.useRef(null),ee=react.useRef(null),A=react.useRef(null),Ee=react.useRef(null),{enabled:O=true,placeholder:U='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:Ae,suggestions:Je=iw,maxHistory:$e=50,persistHistory:J,mentionableUsers:De=[]}=r,oe=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ue=oe?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ne=oe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Me=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)",Re=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Qe=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ie=oe?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",et=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Ve=oe?"rgba(0, 229, 204, 0.9)":"#00E5CC",Oe=oe?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ut=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",pt=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)",Ge=oe?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Pe=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",ot=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",$t=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Be=oe?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",st=oe?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=oe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",X=oe?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",B=oe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Y="rgba(0, 229, 204, 0.04)",re=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",he=oe?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",qe=oe?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",j=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ye=oe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Fe=oe?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ie=oe?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Ct=oe?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Ze="rgba(0, 229, 204, 0.06)",Tt=oe?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",ft=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",zt=oe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",rr=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",da=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Vt=oe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gr=oe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Bt=oe?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",_r=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",jt=oe?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Qt=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",zr=oe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ua=oe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",rt=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ke=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ba=J?.storageKey||"gantt-ai-history",ir=J?.maxMessages??5,Qr=De.filter($=>{if(!C)return true;let te=C.toLowerCase();return $.name.toLowerCase().includes(te)||$.email&&$.email.toLowerCase().includes(te)}).slice(0,5),fr=react.useCallback($=>{if(y($),De.length===0)return;let te=H.current;if(!te)return;let xe=te.selectionStart||$.length,T=$.slice(0,xe),W=T.lastIndexOf("@");if(W>=0&&((W>0?T[W-1]:" ")===" "||W===0)){let _=T.slice(W+1);if(_.length<=40){M(_),k(W),P(true),K(0);return}}P(false),M(""),k(-1);},[De.length]),Ca=react.useCallback($=>{let te=x.slice(0,F),xe=x.slice(F+1+C.length),T=`${te}@${$.name} ${xe}`;y(T),P(false),M(""),k(-1),setTimeout(()=>H.current?.focus(),0);},[x,F,C]),ce=react.useCallback($=>{if(!N||Qr.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),K(te=>te<Qr.length-1?te+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),K(te=>te>0?te-1:Qr.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let te=Qr[D];return te&&Ca(te),true}return $.key==="Escape"?(P(false),true):false},[N,Qr,D,Ca]);react.useEffect(()=>{if(J?.enabled)try{let $=localStorage.getItem(ba);if($){let xe=JSON.parse($).map(T=>({...T,timestamp:new Date(T.timestamp)}));f(xe.slice(-ir));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[J?.enabled,ba,ir]),react.useEffect(()=>{if(J?.enabled&&p.length>0)try{let $=p.filter(te=>!te.isLoading).slice(-ir);localStorage.setItem(ba,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[p,J?.enabled,ba,ir]),react.useEffect(()=>{ee.current&&ee.current.scrollIntoView({behavior:"smooth"});},[p]),react.useEffect(()=>{i&&!m&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,m]);let ue=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&c?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&l?.($.taskId,$.dependencyFrom);break}},[n,s,o,c,l]),mt=react.useCallback(async $=>{if(!$.trim()||b)return;let te={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(T=>[...T.slice(-($e-1)),te]),y(""),w(false),h(true);let xe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(T=>[...T,xe]);try{if(Ae){let T=p.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),W=await Ae($,e,T);f(pe=>{let _=pe.filter(it=>!it.isLoading),ve={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [..._,ve]}),ue(W);}else f(T=>[...T.filter(pe=>!pe.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(T){f(W=>[...W.filter(_=>!_.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,$e,Ae,e,ue]),V=$=>{$.preventDefault(),mt(x);},fe=$=>{y($),H.current?.focus();};if(react.useEffect(()=>{let $=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),d(xe=>!xe),i||u(false)),te.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),react.useEffect(()=>{if(!i)return;let $=xe=>{let T=xe.target;A.current&&!A.current.contains(T)&&d(false);},te=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(te),document.removeEventListener("mousedown",$);}},[i]),!O)return null;let Q={"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 jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.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 ${Q[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ue,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ne}`,color:"#00E5CC",cursor:"pointer",boxShadow:Me,overflow:"visible"},onClick:()=>d(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Re}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(jm,{size:18}),jsxRuntime.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:Ve,background:ie,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${et}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
361
|
+
</Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(d),m.download=r,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Te.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let d=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let f=t.find(x=>x.id===p);if(f){n(f);let x=a.get(p)?.ef||0;m=Math.max(m,x);}}let u=m+d;a.set(i.id,{es:m,ef:u});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,c=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),u=s;if(m.length>0)for(let f of m){c(f);let x=o.get(f.id)?.ls||0;u=Math.min(u,x);}let p=u-d;o.set(i.id,{ls:p,lf:u});};r.forEach(c);let l=[];for(let i of r){let d=a.get(i.id),m=o.get(i.id);if(d&&m){let u=m.ls-d.es;Math.abs(u)<.01&&l.push(i.id);}}return l},calculateCriticalPathFull:e=>{let t=new Map,a=Te.flattenTasks(e).filter(u=>u.startDate&&u.endDate);if(a.length===0)return t;let n=new Map(a.map(u=>[u.id,u])),s=new Map;for(let u of a)s.has(u.id)||s.set(u.id,[]);for(let u of a)if(u.dependencies){for(let p of u.dependencies)if(n.has(p)){let f=s.get(p);f&&f.push(u.id);}}let o=new Map;for(let u of a)o.set(u.id,0);for(let u of a)if(u.dependencies)for(let p of u.dependencies)n.has(p)&&o.set(u.id,(o.get(u.id)||0)+1);let c=new Map,l=[],i=[];for(let u of a)(o.get(u.id)||0)===0&&i.push(u.id);for(;i.length>0;){let u=i.shift();l.push(u);let p=n.get(u);if(!p||!p.startDate||!p.endDate)continue;let f=Te.calculateDuration(p.startDate,p.endDate),x=0;if(p.dependencies)for(let b of p.dependencies){let y=c.get(b);y&&(x=Math.max(x,y.ef));}c.set(u,{es:x,ef:x+f});let h=s.get(u)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(l.length<a.length)return t;let d=Math.max(...Array.from(c.values()).map(u=>u.ef)),m=new Map;for(let u=l.length-1;u>=0;u--){let p=l[u];if(!p)continue;let f=n.get(p);if(!f||!f.startDate||!f.endDate)continue;let x=Te.calculateDuration(f.startDate,f.endDate),h=s.get(p)||[],b=d;if(h.length>0)for(let y of h){let v=m.get(y);v&&(b=Math.min(b,v.ls));}m.set(p,{ls:b-x,lf:b});}for(let u of l){let p=c.get(u),f=m.get(u),x=f.ls-p.es,h=s.get(u)||[],b;h.length>0?b=Math.min(...h.map(y=>c.get(y).es))-p.ef:b=d-p.ef,t.set(u,{earlyStart:p.es,earlyFinish:p.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=Te.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Te.calculateCriticalPath(e).includes(t))return 0;let n=Te.getDependentTasks(e,t);if(n.length===0){let c=Te.getLatestEndDate(e);if(!c)return null;let l=Te.calculateDuration(r.endDate,c);return Math.max(0,l)}let s=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,l)=>c-l)[0];if(!s)return null;let o=Te.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Te.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Te.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Te.getDependentTasks(e,t);if(o.length===0)return e;let c=[...e];for(let l of o){if(n.has(l.id)||!l.startDate||!l.endDate)continue;let i=Te.calculateDuration(l.startDate,l.endDate),d;if(r!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let p=new Date(s.endDate),f=new Date(p);f.setDate(f.getDate()+1),d<f&&(d=f);}let m=Te.calculateEndDate(d,i),u=p=>p.map(f=>f.id===l.id?{...f,startDate:d,endDate:m}:f.subtasks?{...f,subtasks:u(f.subtasks)}:f);c=u(c),c=Te.autoScheduleDependents(c,l.id,r,n);}return c},calculateCascadePreview:(e,t,r,a,n,s,o,c)=>{if(r===0)return [];let l=[],i=n.getTime(),d=1e3*60*60*24,m=Te.findTaskById(e,t);if(!m||!m.endDate)return [];let u=(p,f,x=new Set)=>{if(x.has(p))return;x.add(p);let h=Te.getDependentTasks(e,p);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=a.findIndex(E=>E.id===b.id);if(y===-1)continue;let v=b.startDate.getTime(),C=(b.endDate.getTime()-v)/d,L=(v-i)/d*s,k=L+f*s,D=Math.max(C*s,s),F=c+y*o+(o-18)/2;l.push({taskId:b.id,taskName:b.name,originalX:L,previewX:k,width:D,y:F,rowIndex:y,daysDelta:f,color:b.color}),u(b.id,f,x);}};return u(t,r),l},splitTask:(e,t,r,a=3)=>{let n=Te.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let l=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:c}],i=d=>d.map(m=>m.id===n.id?{...m,endDate:c,segments:l}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function ol({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:c="en",templates:l,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:m,onTaskDblClick:u,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:C,onTaskProgressDrag:P,workingDaysConfig:L}){let D=Ka(),F=react.useRef(null),[E,G]=react.useState([]),[O,ee]=react.useState(null),[I,Ae]=react.useState(null),[H,ge]=react.useState(null),N=react.useRef(false),[De,Xe]=react.useState(new Set),[He,Y]=react.useState(null),Ee=react.useCallback(B=>{if(H&&!N.current){let q=B.target,ce=false;for(;q&&q!==B.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){ce=true;break}q=q.parentElement;}ce||ge(null);}},[H]),te=react.useCallback(B=>{Ae(B);},[]),Be=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Se=a==="day"?60:a==="week"?20:8,Le=Be*Se*o,$e=B=>{let q=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),ce=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-ce);let ue=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-ue.getTime())/864e5+1)/7)},Ye=B=>{let q=B.getDay();return q===0||q===6},le=react.useMemo(()=>{let B=L?.holidayDates;return B?B instanceof Set?B:new Set(B):null},[L?.holidayDates]),Qe=B=>{if(!le)return false;let q=`${B.getFullYear()}-${String(B.getMonth()+1).padStart(2,"0")}-${String(B.getDate()).padStart(2,"0")}`;return le.has(q)},je=react.useCallback(B=>{let q=Math.round(B/(Se*o)),ce=new Date(n);return ce.setDate(ce.getDate()+q),ce},[n,Se,o]),Ie=react.useCallback((B,q)=>{if(q.startDate&&q.endDate)return;let ce=B.currentTarget.ownerSVGElement;if(!ce)return;let ue=ce.createSVGPoint();ue.x=B.clientX,ue.y=B.clientY;let _e=ue.matrixTransform(ce.getScreenCTM()?.inverse()),V=je(_e.x),ye=new Date(V);ye.setDate(ye.getDate()+1),Y(null),f?.(q,V,ye);},[je,f]),Ct=react.useCallback((B,q,ce)=>{let ue=B.currentTarget.ownerSVGElement;if(!ue)return;let _e=ue.createSVGPoint();_e.x=B.clientX,_e.y=B.clientY;let V=_e.matrixTransform(ue.getScreenCTM()?.inverse()),ye=je(V.x),Ue=Math.round(V.x/(Se*o))*Se*o;Y({taskId:q.id,x:Ue,y:ce*r+r/2,date:ye});},[je,Se,o,r]),it=react.useCallback(()=>{Y(null);},[]),qe=react.useMemo(()=>{let B=_e=>_e.map(V=>{if(V.subtasks&&V.subtasks.length>0){let ye=B(V.subtasks),Fe=ye.filter(Ue=>Ue.startDate&&Ue.endDate);if(Fe.length>0){let Ue=Fe.map(gt=>gt.startDate.getTime()),dt=Fe.map(gt=>gt.endDate.getTime()),Ze=new Date(Math.min(...Ue)),Tt=new Date(Math.max(...dt));return {...V,subtasks:ye,startDate:Ze,endDate:Tt}}return {...V,subtasks:ye}}return V}),q=(_e,V=[])=>{let ye=[..._e].sort((Fe,Ue)=>(Fe.position??0)-(Ue.position??0));for(let Fe of ye)V.push(Fe),Fe.subtasks&&Fe.subtasks.length>0&&(Fe.isExpanded===void 0||Fe.isExpanded)&&q(Fe.subtasks,V);return V},ce=B(e);return q(ce)},[e]),Pe=react.useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let q=B.startDate.getTime(),ce=B.endDate.getTime(),ue=n.getTime(),_e=(q-ue)/(1e3*60*60*24),V=(ce-q)/(1e3*60*60*24)+1,ye=_e*Se*o,Fe=Math.max(Se*o,40),Ue=Math.max(V*Se*o,Fe);return {x:ye,width:Ue}},[n,Se,o]),xt=react.useMemo(()=>qe.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:q,width:ce}=Pe(B),_e=qe.findIndex(V=>V.id===B.id)*r+(r-18)/2;return {id:B.id,x:q,y:_e,width:ce,height:18}}),[qe,Pe]),St=react.useCallback((B,q,ce)=>{if(!ce){G([]),ee(null);return}if(ee({taskId:B,daysDelta:q}),q===0){G([]);return}let ue=Te.calculateCascadePreview(e,B,q,qe,n,Se*o,r,48);G(ue);},[e,qe,n,Se,o,r,48]),Re=react.useCallback((B,q)=>{if(!O)return q;let ce=Se*o,ue=O.daysDelta*ce;if(B===O.taskId)return {x:q.x+ue,width:q.width};let _e=E.find(V=>V.taskId===B);return _e?{x:_e.previewX,width:_e.width}:q},[O,E,Se,o]),ct=react.useMemo(()=>{let B=[],q=new Date(n);for(;q<=s;){let _e=(q.getTime()-n.getTime())/864e5*Se*o;if(a==="day")B.push({date:new Date(q),label:q.toLocaleDateString(c,{day:"numeric",month:"short"}),x:_e}),q.setDate(q.getDate()+1);else if(a==="week"){let V=$e(q);B.push({date:new Date(q),label:`${D.labels.week} ${V}`,x:_e}),q.setDate(q.getDate()+7);}else B.push({date:new Date(q),label:q.toLocaleDateString(c,{month:"short",year:"numeric"}),x:_e}),q.setMonth(q.getMonth()+1);}return B},[n,s,a,Se,o,c,D.labels.week]),A=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Se*o,[n,Se,o]),X=Math.max(qe.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.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:jsxRuntime.jsxs("svg",{width:Math.max(Le,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Le,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ct.map((B,q)=>jsxRuntime.jsxs("g",{children:[q>0&&jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:B.x+8,y:48/2,fill:a==="day"&&!Ye(B.date)&&Qe(B.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${q}`)),A>=0&&A<=Le&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:A,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:A,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${A-18}, 2)`,children:[jsxRuntime.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}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:D.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:F,width:Math.max(Le,1e3),height:X,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ee,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.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"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Le,1e3),height:X,fill:t.bgPrimary}),qe.map((B,q)=>jsxRuntime.jsx("rect",{x:0,y:q*r,width:Math.max(Le,1e3),height:r,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${B.id}`)),ct.map((B,q)=>q>0?jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:qe.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${q}`):null),ct.map((B,q)=>{let ce=ct[q+1]?.x||Le,ue=w&&Ye(B.date),_e=a==="day"&&!Ye(B.date)&&Qe(B.date);return ue||_e?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:B.x,y:0,width:ce-B.x,height:qe.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:B.x,y:0,width:ce-B.x,height:qe.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${q}`):null}),qe.map((B,q)=>{let ce=B.startDate&&B.endDate;return jsxRuntime.jsx("g",{children:!ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:q*r,width:Le,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ue=>Ie(ue,B),onMouseMove:ue=>Ct(ue,B,q),onMouseLeave:()=>{it();}},`clickable-${B.id}`),He&&He.taskId===B.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:He.x,y1:q*r+4,x2:He.x,y2:q*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:He.x,cy:He.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:He.x,cy:He.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${He.x}, ${q*r-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:He.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!He||He.taskId!==B.id)&&jsxRuntime.jsx("text",{x:A>0?A:100,y:q*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${B.id}`)]})},`row-group-${B.id}`)}),qe.map((B,q)=>{if(!B.startDate||!B.endDate)return null;let{x:ce,width:ue}=Pe(B),_e=q*r+(r-18)/2,V=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;if(B.isMilestone)return jsxRuntime.jsx(nl,{task:B,x:ce+ue/2,y:_e+12,theme:t,onClick:m},B.id);if(V){let ye=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Fe=8,Ue=_e+(r-18)/2+(18-Fe)/2,dt=4,Ze=B.progress||0,Tt=new Date;Tt.setHours(0,0,0,0);let gt=B.startDate&&Tt>=B.startDate,rr=B.endDate&&(()=>{let qt=new Date(B.endDate);return qt.setHours(0,0,0,0),Tt>qt})(),ar=B.startDate&&Tt<B.startDate,Er=1;if(gt&&B.startDate&&B.endDate&&!ar){let qt=new Date(B.startDate);qt.setHours(0,0,0,0);let ea=new Date(B.endDate);ea.setHours(0,0,0,0);let pa=Math.max(1,(ea.getTime()-qt.getTime())/(1e3*60*60*24)),Ke=Math.min((Tt.getTime()-qt.getTime())/(1e3*60*60*24),pa)/pa*100;Er=Ke>0?Ze/Ke:1;}let _t;Ze>=100?_t="#00E5CC":ar?_t="#4B5563":rr&&Ze<100?_t="#EF4444":Er>=.95?_t="#22C55E":Er>=.8?_t="#F59E0B":_t="#EF4444";let Mr=Math.max(Ze/100*ue,Ze>0?dt*2:0),Ft=ue>100&&Ze>0,Pr=B.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>m?.(B),onContextMenu:qt=>{qt.preventDefault(),qt.stopPropagation(),p?.(B,qt);},onMouseMove:qt=>{te({task:B,x:ce,y:Ue,width:ue,height:Fe,showBelow:Ue<100,mouseX:qt.clientX,mouseY:qt.clientY});},onMouseLeave:()=>te(null),style:{cursor:"default",opacity:y?Pr?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:ce,y:_e,width:ue,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ce,y:Ue,width:ue,height:Fe,rx:dt,fill:ye?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ze>0&&jsxRuntime.jsx("rect",{x:ce,y:Ue,width:Mr,height:Fe,rx:dt,fill:_t}),y&&Pr&&jsxRuntime.jsx("rect",{x:ce,y:Ue,width:ue,height:Fe,rx:dt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ft&&jsxRuntime.jsxs("text",{x:ce+Mr+6,y:Ue+Fe/2,dominantBaseline:"central",fill:ye?"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(Ze),"%"]})]},B.id)}return jsxRuntime.jsx(Zi,{task:B,x:ce,y:_e,width:ue,theme:t,dayWidth:Se*o,startDate:n,templates:l,onClick:m,onDoubleClick:u,onContextMenu:p,onDateChange:f,onDependencyCreate:x,allTaskPositions:xt,onDragMove:St,onHoverChange:te,showBaseline:b,showTaskBarLabels:d,showCriticalPath:y,readOnly:C?!C(B):false,onProgressChange:P},B.id)}),v&&qe.map((B,q)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(ce=>{let ue=qe.find(_t=>_t.id===ce);if(!ue||!ue.startDate||!ue.endDate)return null;let _e=qe.findIndex(_t=>_t.id===ce),V=Re(ue.id,Pe(ue)),ye=Re(B.id,Pe(B)),Fe=V.x+V.width,Ue=_e*r+26,dt=ye.x,Ze=q*r+26,Tt=`dep-${ce}-${B.id}`;if(De.has(Tt))return null;let gt=y&&B.isCriticalPath&&ue.isCriticalPath;return jsxRuntime.jsx(Ys,{x1:Fe,y1:Ue,x2:dt,y2:Ze,theme:t,lineStyle:i,colorOverride:y?gt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?gt?2:1:void 0,glowFilter:gt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(B.id,ce),onHoverChange:_t=>{N.current=_t,_t&&ge({key:Tt,fromId:ce,toId:B.id,exitX:Fe,exitY:Ue,enterX:dt,enterY:Ze});}},Tt)})),E.map(B=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:18,rx:6,fill:B.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(B.daysDelta)>0&&jsxRuntime.jsx("text",{x:B.previewX+B.width/2,y:B.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),v&&H&&jsxRuntime.jsx(Ys,{x1:H.exitX,y1:H.exitY,x2:H.enterX,y2:H.enterY,theme:t,lineStyle:i,onDelete:()=>{let B=H.key;ge(null),N.current=false,Xe(q=>new Set(q).add(B)),h?.(H.toId,H.fromId);},hoverOverlayOnly:true,onHoverChange:B=>{N.current=B,B||ge(null);}},`${H.key}-hover-overlay`),A>=0&&A<=Le&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:A,y1:0,x2:A,y2:X,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:A,y1:0,x2:A,y2:X,stroke:t.today,strokeWidth:1,opacity:1})]})]}),I&&jsxRuntime.jsx(_m,{tooltipData:I,theme:t,locale:c==="es"?"es":"en",workingDaysConfig:L})]})}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"'],Ym=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),bw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),hw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),yw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),xw=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.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 ll({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:c,onDependencyDelete:l}){let[i,d]=react.useState(false),[m,u]=react.useState(false),[p,f]=react.useState([]),[x,h]=react.useState(""),[b,y]=react.useState(false),[v,w]=react.useState(true),[C,P]=react.useState(""),[L,k]=react.useState(-1),[D,F]=react.useState(false),[E,G]=react.useState(0),O=react.useRef(null),ee=react.useRef(null),I=react.useRef(null),Ae=react.useRef(null),{enabled:H=true,placeholder:ge='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:N="bottom-right",onCommand:De,suggestions:Xe=fw,maxHistory:He=50,persistHistory:Y,mentionableUsers:Ee=[]}=r,te=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Be=te?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Se=te?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Le=te?"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)",$e=te?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ye=te?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",le=te?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Qe=te?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",je=te?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ie=te?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Ct=te?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",it=te?"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)",qe=te?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Pe=te?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",xt=te?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",St=te?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Re=te?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ct=te?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=te?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",X=te?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",B=te?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",q="rgba(0, 229, 204, 0.04)",ce=te?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ue=te?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",_e=te?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",V=te?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ye=te?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Fe=te?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ue=te?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",dt=te?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Ze="rgba(0, 229, 204, 0.06)",Tt=te?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",gt=te?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",rr=te?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ar=te?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Er=te?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",_t=te?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Mr=te?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ft=te?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Pr=te?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Kt=te?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",qt=te?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ea=te?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",pa=te?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",et=te?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ke=te?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ha=Y?.storageKey||"gantt-ai-history",_r=Y?.maxMessages??5,pr=Ee.filter($=>{if(!C)return true;let Z=C.toLowerCase();return $.name.toLowerCase().includes(Z)||$.email&&$.email.toLowerCase().includes(Z)}).slice(0,5),Kr=react.useCallback($=>{if(h($),Ee.length===0)return;let Z=O.current;if(!Z)return;let xe=Z.selectionStart||$.length,T=$.slice(0,xe),U=T.lastIndexOf("@");if(U>=0&&((U>0?T[U-1]:" ")===" "||U===0)){let _=T.slice(U+1);if(_.length<=40){P(_),k(U),F(true),G(0);return}}F(false),P(""),k(-1);},[Ee.length]),sa=react.useCallback($=>{let Z=x.slice(0,L),xe=x.slice(L+1+C.length),T=`${Z}@${$.name} ${xe}`;h(T),F(false),P(""),k(-1),setTimeout(()=>O.current?.focus(),0);},[x,L,C]),se=react.useCallback($=>{if(!D||pr.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),G(Z=>Z<pr.length-1?Z+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),G(Z=>Z>0?Z-1:pr.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let Z=pr[E];return Z&&sa(Z),true}return $.key==="Escape"?(F(false),true):false},[D,pr,E,sa]);react.useEffect(()=>{if(Y?.enabled)try{let $=localStorage.getItem(ha);if($){let xe=JSON.parse($).map(T=>({...T,timestamp:new Date(T.timestamp)}));f(xe.slice(-_r));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[Y?.enabled,ha,_r]),react.useEffect(()=>{if(Y?.enabled&&p.length>0)try{let $=p.filter(Z=>!Z.isLoading).slice(-_r);localStorage.setItem(ha,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[p,Y?.enabled,ha,_r]),react.useEffect(()=>{ee.current&&ee.current.scrollIntoView({behavior:"smooth"});},[p]),react.useEffect(()=>{i&&!m&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,m]);let pe=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&c?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&l?.($.taskId,$.dependencyFrom);break}},[n,s,o,c,l]),ft=react.useCallback(async $=>{if(!$.trim()||b)return;let Z={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(T=>[...T.slice(-(He-1)),Z]),h(""),w(false),y(true);let xe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(T=>[...T,xe]);try{if(De){let T=p.filter(de=>!de.isLoading&&de.content).slice(-6).map(de=>({role:de.role,content:de.content})),U=await De($,e,T);f(de=>{let _=de.filter(st=>!st.isLoading),ke={id:`assistant-${Date.now()}`,role:"assistant",content:U.message,timestamp:new Date,command:U};return [..._,ke]}),pe(U);}else f(T=>[...T.filter(de=>!de.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(T){f(U=>[...U.filter(_=>!_.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,He,De,e,pe]),j=$=>{$.preventDefault(),ft(x);},fe=$=>{h($),O.current?.focus();};if(react.useEffect(()=>{let $=Z=>{(Z.metaKey||Z.ctrlKey)&&Z.key==="k"&&(Z.preventDefault(),d(xe=>!xe),i||u(false)),Z.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),react.useEffect(()=>{if(!i)return;let $=xe=>{let T=xe.target;I.current&&!I.current.contains(T)&&d(false);},Z=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(Z),document.removeEventListener("mousedown",$);}},[i]),!H)return null;let Q={"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 jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.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 ${Q[N]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Be,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Se}`,color:"#00E5CC",cursor:"pointer",boxShadow:Le,overflow:"visible"},onClick:()=>d(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${$e}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Ye}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Ym,{size:18}),jsxRuntime.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:je,background:le,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Qe}`},children:"AI \xB7 \u2318K"}),jsxRuntime.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
|
-
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Q[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Oe,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ut}`,boxShadow:pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ge,borderBottom:`1px solid ${Pe}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ot,border:`1px solid ${$t}`,color:"#00E5CC"},children:jsxRuntime.jsx(jm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Be},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>u($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:st},onMouseEnter:$=>{$.currentTarget.style.background=X,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=st;},children:jsxRuntime.jsx(dw,{})}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:st},onMouseEnter:$=>{$.currentTarget.style.background=X,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=st;},children:jsxRuntime.jsx(cw,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!m&&jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[p.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:B,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Je.slice(0,4).map(($,te)=>jsxRuntime.jsx("button",{onClick:()=>fe($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Y,color:he,border:`1px solid ${re}`},onMouseEnter:xe=>{xe.currentTarget.style.borderColor=qe,xe.currentTarget.style.color="#00E5CC";},onMouseLeave:xe=>{xe.currentTarget.style.borderColor=re,xe.currentTarget.style.color=he;},children:$.length>30?$.slice(0,30)+"...":$},te))})]}),p.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?j:Fe,color:$.role==="user"?"#00E5CC":Ct,border:$.role==="user"?`1px solid ${ye}`:`1px solid ${Ie}`},children:[$.isLoading?jsxRuntime.jsx(uw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:ee})]}),jsxRuntime.jsxs("form",{onSubmit:$=>{if(N&&Qr.length>0){$.preventDefault();return}V($);},className:"p-3 relative",style:{borderTop:`1px solid ${Ze}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&Qr.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Ee,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:Bt,border:`1px solid ${_r}`,boxShadow:jt,backdropFilter:"blur(12px)"},children:Qr.map(($,te)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ca($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:te===D?Qt:"transparent",color:zr},onMouseEnter:()=>K(te),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:rt,border:`1px solid ${Ke}`,color:"#00E5CC"},children:$.name.split(" ").map(xe=>xe[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:ua},children:$.email})]})]},$.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Tt,border:`1px solid ${ft}`},children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:x,onChange:$=>fr($.target.value),onKeyDown:$=>{ce($);},placeholder:U,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:zt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?rr:"transparent",color:x.trim()?"#00E5CC":Vt,border:x.trim()?`1px solid ${da}`:"1px solid transparent"},children:jsxRuntime.jsx(lw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function _m(e,t=50){let[r,a]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((i,d=true)=>{a(m=>{let u=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:u};if(!d)return {...m,present:u};let p=[...m.past,m.present];return p.length>t&&p.shift(),{past:p,present:u,future:[]}});},[t]),o=react.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:d,future:[i.present,...i.future]}});},[]),c=react.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:m}});},[]),l=react.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:l}}function Km({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){react.useEffect(()=>{if(!n)return;let s=o=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,l=c?o.metaKey:o.ctrlKey;if(l&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!c&&l&&o.key==="y"){o.preventDefault(),t();return}if(c&&l&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var fw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ce.formatDate(e.startDate)} - ${Ce.formatDate(e.endDate)}`);let r=Ce.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,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=>Ce.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function qm(e){return {...fw,...e}}var Cw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Qm=react.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:c="comfortable",showThemeSelector:l=true,showExportButton:i=true,onExportSuccess:d,projectName:m,availableUsers:u=[],templates:p,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:v,locale:w="en",customTranslations:C,showCreateTaskButton:M=false,createTaskLabel:F,onCreateTask:k,taskFilter:N,onTaskFilterChange:P,toolbarRightContent:D,showBaseline:K,viewMode:H,onViewModeChange:ee,projectForecast:A,hideForecastHud:Ee,onThemeChange:O,onTaskClick:U,onTaskSelectionChange:R,selectedTaskId:Ae,onTaskDblClick:Je,onTaskContextMenu:$e,onTaskUpdate:J,onDependentTasksScheduled:De,onProgressChange:oe,onTaskEdit:Ue,onTaskAddSubtask:Ne,onTaskMarkIncomplete:Me,onTaskSetInProgress:Re,onDependencyCreate:Qe,onDependencyDelete:ie,onBeforeTaskAdd:et,onAfterTaskAdd:Ve,onBeforeTaskUpdate:Oe,onAfterTaskUpdate:ut,onBeforeTaskDelete:pt,onAfterTaskDelete:Ge,permissions:Pe,onCopySnapshotLink:ot}=r,Be=react.useContext(ji)?.theme,[st,L]=react.useState(Be||s||"dark"),[X,B]=react.useState(o),[Y,re]=react.useState(c),[he,qe]=react.useState(1),[j,ye]=react.useState("all"),[Fe,Ie]=react.useState(H||"execution"),Ct=H??Fe,Ze=react.useCallback(E=>{Ie(E),ee?.(E);},[ee]),Tt=K??Ct==="oracle",[ft,zt]=react.useState(r.showCriticalPath!==false),[rr,da]=react.useState(r.showDependencies!==false),[Vt,gr]=react.useState(r.highlightWeekends!==false),Bt=react.useCallback(E=>{zt(E),r.onShowCriticalPathChange?.(E);},[r.onShowCriticalPathChange]),_r=react.useCallback(E=>{da(E),r.onShowDependenciesChange?.(E);},[r.onShowDependenciesChange]),jt=react.useCallback(E=>{gr(E),r.onHighlightWeekendsChange?.(E);},[r.onHighlightWeekendsChange]);react.useEffect(()=>{r.onTimeScaleChange?.(X);},[X]),react.useEffect(()=>{r.onZoomChange?.(he);},[he]);let Qt=react.useRef(r.onDateRangeChange);Qt.current=r.onDateRangeChange;let zr=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[ua,rt]=react.useState(()=>{if(!y)return "all";try{let E=typeof y=="string"?y:"gantt-filter-state",I=localStorage.getItem(E);if(I){let z=JSON.parse(I);if(z.taskFilter)return z.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Ke=N??ua,ba=P??rt,[ir,Qr]=react.useState(()=>{if(!y)return false;try{let E=typeof y=="string"?y:"gantt-filter-state",I=localStorage.getItem(E);if(I){let z=JSON.parse(I);if(typeof z.hideCompleted=="boolean")return z.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=zr();if(E)try{let I={taskFilter:Ke,hideCompleted:ir};localStorage.setItem(E,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving filter state to localStorage:",I);}},[Ke,ir,zr]);let fr=react.useRef(h);react.useEffect(()=>{if(fr.current!==h&&h!==void 0){rt("all"),Qr(false);let E=zr();if(E)try{localStorage.removeItem(E);}catch(I){console.warn("[GanttBoard] Error clearing filter state from localStorage:",I);}}fr.current=h;},[h,zr]);let[Ca,ce]=react.useState(0),[ue,mt]=react.useState(false),[V,fe]=react.useState(null),[Q,$]=react.useState({isOpen:false,x:0,y:0,task:null}),[te,xe]=react.useState(null),[T,W]=react.useState(null);react.useEffect(()=>{Be&&Be!==st&&L(Be);},[Be]),react.useEffect(()=>{s&&s!==st&&L(s);},[s]);let pe=react.useCallback(E=>{L(E),O?.(E);},[O]),{state:_,setState:ve,undo:it,redo:ae,canUndo:lt,canRedo:bt,clearHistory:Mt}=_m(t,50),br=react.useMemo(()=>{let E=(I,z=0)=>{let q=z;for(let le of I)le.subtasks?.length&&(q=Math.max(q,E(le.subtasks,z+1)));return q};return E(_)+1},[_]),ha=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Mr=react.useRef(new Map),tn=react.useRef(false);if(!tn.current&&x){tn.current=true;let E=typeof x=="string"?x:"gantt-expanded-tasks";try{let I=localStorage.getItem(E);if(I){let z=JSON.parse(I);Array.isArray(z)&&(Mr.current=new Map(z));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let lr=react.useCallback(()=>{let E=ha();if(E)try{let I=Array.from(Mr.current.entries());localStorage.setItem(E,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[ha]),Ra=react.useRef(0),Ho=react.useRef(_);react.useEffect(()=>{Ho.current=_;},[_]);let Pn=react.useRef(false),_n=react.useCallback(E=>{ye(E),Ra.current+=1,ve(I=>{let z=(le,ge=0)=>le.map(je=>{let _e=E==="all"||ge<E-1;return je.subtasks?.length&&Mr.current.set(je.id,_e),{...je,isExpanded:_e,subtasks:je.subtasks?z(je.subtasks,ge+1):void 0}}),q=z(I);return lr(),q});},[ve,lr]);react.useEffect(()=>{if(Ra.current>0){Ra.current-=1;return}let E=z=>{let q=new Map;for(let le of z){let ge=le.id;q.get(ge)||q.set(ge,le);}return Array.from(q.values())},I=z=>z.map(q=>{let le=Mr.current.get(q.id),ge=le!==void 0?{...q,isExpanded:le}:q;if(ge.subtasks?.length){let je=E(ge.subtasks);return {...ge,subtasks:I(je)}}return ge});if(Mr.current.size>0)ve(Ya(I(t)));else {let z=q=>q.map(le=>le.subtasks?.length?{...le,subtasks:E(z(le.subtasks))}:le);ve(Ya(z(t)));}},[t,ve]);let Uo=react.useRef(t),pi=react.useRef(true);react.useEffect(()=>{if(pi.current){pi.current=false,Uo.current=_;return}if(Pn.current){Pn.current=false,Uo.current=_;return}if(!a)return;let E=JSON.stringify(Uo.current),I=JSON.stringify(_);E!==I&&(Uo.current=_,a(_));},[_,a]);let Pr=react.useMemo(()=>Kc(w,C),[w,C]),Fn=react.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}],[]),Ba=react.useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Ga,Va]=react.useState(()=>{let E=Fn(Pr);if(!b)return E;try{let I=typeof b=="string"?b:"gantt-columns-state",z=localStorage.getItem(I);if(!z)return E;let q=JSON.parse(z),le=new Map(q.map(ge=>[ge.id,ge]));return E.map(ge=>{let je=le.get(ge.id);return je?{...ge,visible:je.visible??ge.visible,width:je.width??ge.width}:ge})}catch(I){return console.warn("[GanttBoard] Error loading columns state from localStorage:",I),E}}),S=react.useRef(Ba);react.useEffect(()=>{if(S.current===Ba)return;S.current=Ba;let E=Fn(Pr);if(!Ba){Va(E);return}try{let I=localStorage.getItem(Ba);if(!I){Va(E);return}let z=JSON.parse(I),q=new Map(z.map(le=>[le.id,le]));Va(E.map(le=>{let ge=q.get(le.id);return ge?{...le,visible:ge.visible??le.visible,width:ge.width??le.width}:le}));}catch(I){console.warn("[GanttBoard] Error reloading columns state from localStorage:",I),Va(E);}},[Ba,Fn,Pr]),react.useEffect(()=>{if(Ba&&S.current===Ba)try{let E=Ga.map(I=>({id:I.id,visible:I.visible,width:I.width}));localStorage.setItem(Ba,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Ga,Ba]),react.useEffect(()=>{Va(E=>E.map(I=>({...I,label:Pr.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Pr]);let Z=react.useMemo(()=>Ga.filter(I=>I.visible).reduce((I,z)=>I+z.width,0),[Ga]),me=react.useRef(Ga.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=Ga.filter(q=>q.visible),I=E.map(q=>q.id).join(","),z=me.current;if(I!==z){let q=E.some(ge=>ge.id!=="name"),le=z.includes(",");q?!le&&q&&fe(null):fe(null),me.current=I;}},[Ga]);let we=60,ke=.6,Ye=react.useMemo(()=>{let I=Z+we,z=typeof window<"u"?window.innerWidth*ke:800,q=Math.max(I,z);return V!==null?Math.max(200,Math.min(V,q)):Math.max(200,I)},[V,Z]),se=react.useRef(null),Le=react.useRef(null),He=react.useRef(null),tt=react.useRef(null),Ot=react.useRef(null),We=react.useMemo(()=>um(st),[st]),gt=react.useMemo(()=>({theme:We,themeName:st}),[We,st]),pr=react.useMemo(()=>qm(p),[p]),hr=react.useMemo(()=>{if(!f||!ft)return _;let E=Ce.calculateCriticalPathFull(_),I=z=>z.map(q=>{let le=E.get(q.id),ge=q.subtasks?I(q.subtasks):void 0,je=ge?.some(Zt=>Zt.isCriticalPath||Zt.subtasks&&Zt.subtasks.some(Ht=>Ht.isCriticalPath))||false,_e=le?le.isCritical:je;return {...q,isCriticalPath:_e,cpmData:le||void 0,subtasks:ge}});return I(_)},[_,f,ft]),na=react.useMemo(()=>Ce.flattenTasks(_).some(I=>I.dependencies&&I.dependencies.length>0),[_]),Pt=react.useMemo(()=>{let E=(I,z="")=>[...I].sort((le,ge)=>(le.position??0)-(ge.position??0)).map((le,ge)=>{let je=ge+1,_e=z?`${z}.${je}`:`${je}.0`,Zt=z?`${z}.${je}`:`${je}`;return {...le,wbsCode:_e,subtasks:le.subtasks?.length?E(le.subtasks,Zt):le.subtasks}});return E(hr)},[hr]),_t=react.useMemo(()=>{if(Ke==="all"&&!ir)return Pt;let E=I=>{let z=[];for(let q of I){let le=q.subtasks?.length?E(q.subtasks):void 0,ge=false;if(ir)ge=q.progress<100;else switch(Ke){case "all":ge=true;break;case "incomplete":ge=q.progress<100;break;case "in_progress":ge=q.progress>0&&q.progress<100;break;case "completed":ge=q.progress===100;break}(ge||le&&le.length>0)&&z.push({...q,subtasks:le});}return z};return E(Pt)},[Pt,Ke,ir]),yt=Cw(Y);Km({undo:it,redo:ae,canUndo:lt,canRedo:bt,enabled:true}),react.useImperativeHandle(n,()=>({getTask:E=>Ce.findTaskById(_,E),addTask:(E,I)=>{ve(z=>{if(!I)return [...z,{...E,level:0}];let q=le=>le.map(ge=>ge.id===I?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:I,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:q(ge.subtasks)}:ge);return q(z)});},updateTask:(E,I)=>{ve(z=>{let q=le=>le.map(ge=>ge.id===E?{...ge,...I}:ge.subtasks?{...ge,subtasks:q(ge.subtasks)}:ge);return q(z)});},deleteTask:E=>{ve(I=>{let z=q=>q.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=z(le.subtasks)),true));return z(I)});},deleteTasks:E=>{ve(I=>rd(I,E));},duplicateTask:E=>{if(r.onTaskDuplicate){let I=Ce.findTaskById(_,E);I&&r.onTaskDuplicate(I);}else ve(I=>js(I,[E]).tasks);},splitTask:(E,I,z=3)=>{ve(q=>Ce.splitTask(q,E,I,z));},calculateEndDate:Ce.calculateEndDate,calculateDuration:Ce.calculateDuration,validateDependency:(E,I)=>!Ce.validateDependencies(_,E,I),getAllTasks:()=>Ce.flattenTasks(_),getTasksByStatus:E=>Ce.flattenTasks(_).filter(I=>I.status===E),getTasksByParent:E=>E?Ce.findTaskById(_,E)?.subtasks||[]:_.filter(z=>!z.parentId),getCriticalPath:()=>Ce.flattenTasks(_).filter(E=>E.isCriticalPath),indentTask:E=>{ve(I=>Ya(Zc(I,[E])));},outdentTask:E=>{ve(I=>Ya(ed(I,[E])));},moveTask:(E,I)=>{ve(z=>td(z,[E],I));},createSubtask:async E=>{let{tasks:I,newTask:z}=od(_,E);if(et){let q=et({...z,parentId:E});if((q instanceof Promise?await q:q)===false)return}ve(Ya(I)),Ve&&Ve({...z,parentId:E});},scrollToTask:E=>{let z=Ce.flattenTasks(_).findIndex(q=>q.id===E);if(z!==-1&&se.current){let q=z*yt;se.current.scrollTo({top:q,behavior:"smooth"}),He.current&&He.current.scrollTo({top:q,behavior:"smooth"});}},highlightTask:(E,I=2e3)=>{},expandTask:E=>{ve(I=>{let z=q=>q.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:z(le.subtasks)}:le);return z(I)});},collapseTask:E=>{ve(I=>{let z=q=>q.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:z(le.subtasks)}:le);return z(I)});},expandAll:()=>{ve(E=>{let I=z=>z.map(q=>({...q,isExpanded:true,subtasks:q.subtasks?I(q.subtasks):void 0}));return I(E)});},collapseAll:()=>{ve(E=>{let I=z=>z.map(q=>({...q,isExpanded:false,subtasks:q.subtasks?I(q.subtasks):void 0}));return I(E)});},collapseToLevel:E=>{_n(E);},undo:it,redo:ae,canUndo:()=>lt,canRedo:()=>bt,clearHistory:Mt,exportToPNG:async()=>{if(!tt.current||!se.current||!He.current)throw new Error("Gantt container not found");let E=tt.current,I=se.current,z=Le.current||I.querySelector(".gantt-grid-scroll"),q=He.current,le=z?.scrollTop||0,ge=q.scrollTop,je=E.style.overflow,_e=E.style.height,Zt=I.style.overflow;try{let Ht=z?.querySelector(".gantt-taskgrid-content"),ar=q.querySelector("svg"),ma=Ht?.scrollHeight||z?.scrollHeight||600,$a=ar?.getBoundingClientRect().height||q.scrollHeight,yo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ma,$a)+20;z&&(z.scrollTop=0),q.scrollTop=0,E.style.overflow="visible",E.style.height=`${yo}px`,I.style.overflow="visible",await new Promise(Go=>setTimeout(Go,100));let xn=await htmlToImage.toPng(E,{backgroundColor:We.bgPrimary,pixelRatio:2,filter:Go=>{if(!(Go instanceof Element))return !0;let mi=window.getComputedStyle(Go),Ns=parseInt(mi.zIndex,10);return (isNaN(Ns)||Ns<50)&&mi.position!=="fixed"}});return await(await fetch(xn)).blob()}finally{E.style.overflow=je,E.style.height=_e,I.style.overflow=Zt,z&&(z.scrollTop=le),q.scrollTop=ge;}},exportToPDF:async E=>{await Ce.exportToPDF(_,E);},exportToExcel:async E=>{await Ce.exportToExcel(_,E,Gl.current);},exportToJSON:()=>Ce.exportToJSON(_),exportToCSV:()=>Ce.exportToCSV(_),importFromJSON:E=>{let I=Ce.importFromJSON(E);ve(I);},getTasks:()=>_,refresh:()=>{ve(E=>[...E]);},clearAll:()=>{ve([]);},scrollToToday:()=>{let E=He.current,I=Ot.current;if(!E||!I)return;let q=(new Date().getTime()-I.startDate.getTime())/(1e3*60*60*24),le=I.timeScale==="day"?60:I.timeScale==="week"?20:8,ge=q*le*I.zoom,je=E.clientWidth,_e=Math.max(0,ge-je/2);E.scrollTo({left:_e,behavior:"smooth"});}}),[_,it,ae,lt,bt,Mt,We,yt]);let Ft=react.useCallback(E=>{Va(I=>I.map(z=>z.id===E?{...z,visible:!z.visible}:z));},[]),Fr=react.useCallback((E,I)=>{Va(z=>z.map(q=>{if(q.id!==E)return q;let le=q.minWidth??100,ge=q.maxWidth??800,je=Math.max(le,Math.min(ge,I));return {...q,width:je}}));},[]),ya=react.useCallback(E=>{ve(I=>{let z=nd(I,E),q=le=>{for(let ge of le){if(ge.id===E){Mr.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&q(ge.subtasks);}};return q(z),lr(),z}),r.onTaskToggleExpand?.(E);},[r,lr]),Lr=react.useCallback((E,I)=>{if(Oe&&Oe(E,I)===false)return;let q=Ce.findTaskById(_,E)?.progress,le=je=>je.map(_e=>_e.id===E?{..._e,...I}:_e.subtasks?{..._e,subtasks:le(_e.subtasks)}:_e);ve(je=>le(je));let ge=Ce.findTaskById(le(_),E);ge&&(J?.(ge),ut?.(ge),I.progress!==void 0&&q!==void 0&&I.progress!==q&&oe?.(E,q,I.progress));},[_,J,Oe,ut,oe]),pa=react.useCallback((E,I,z)=>{if(E.length===0)return;let q=new Set(E),le=ge=>ge.map(je=>{let _e=q.has(je.id)?{...je,[I]:z}:je;return _e.subtasks?{..._e,subtasks:le(_e.subtasks)}:_e});ve(ge=>{let je=le(ge);return r.onBulkFill?.(E,I,z,je),je});},[r]),Kr=react.useCallback(E=>{E.length!==0&&(Ra.current+=1,Pn.current=true,ve(I=>Ya(Zc(I,E))),r.onTaskIndent?.(E[0]));},[r]),bo=react.useCallback(E=>{E.length!==0&&(Ra.current+=1,Pn.current=true,ve(I=>Ya(ed(I,E))),r.onTaskOutdent?.(E[0]));},[r]),Cs=react.useCallback((E,I,z)=>{Ra.current+=1,Pn.current=true,ve(q=>Ya(Am(q,E,I,z))),r.onTaskReparent?.(E,I,z);},[r]),ho=react.useCallback((E,I)=>{E.length!==0&&(Ra.current+=1,Pn.current=true,ve(z=>td(z,E,I)),r.onTaskMove?.(E[0],I));},[r]),Ul=react.useCallback(async E=>{let I=[];for(let z of E)pt&&await Promise.resolve(pt(z))===false||I.push(z);I.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(I):(ve(z=>Ya(rd(z,I))),I.forEach(z=>r.onTaskDelete?.(z))),Ge&&I.forEach(z=>Ge(z)));},[r,pt,Ge]),Zf=react.useCallback(E=>{r.onTaskDuplicate?E.forEach(I=>{let z=Ce.findTaskById(_,I);z&&r.onTaskDuplicate(z);}):ve(I=>js(I,E).tasks);},[r,_]),eb=react.useCallback((E,I)=>{ve(z=>{let{tasks:q,newTask:le}=Lm(z,E,I);return et&&et(le)===false?z:(r.onTaskCreate?.(le.parentId,le.position||0),Ve?.(le),q)});},[r,et,Ve]),tb=react.useCallback((E,I)=>{ve(z=>ad(z,E,I)),r.onTaskRename?.(E,I);},[r]),Wl=react.useCallback(E=>{let{onTaskAddSubtask:I}=r;if(I){let z=ss(_,E);if(z){I(z);return}}ve(z=>{let{tasks:q}=od(z,E);return r.onTaskCreate?.(E,0),q});},[r,_]),rb=react.useCallback((E,I)=>{let z=Math.max(0,Math.min(100,Math.round(I))),q={progress:z};z===100?q.status="completed":z>0?q.status="in-progress":q.status="todo",Lr(E.id,q);},[Lr]),ab=react.useCallback((E,I,z)=>{let q=!E.startDate&&!E.endDate,le=E.startDate?Math.round((I.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=Ht=>Ht.map(ar=>ar.id===E.id?{...ar,startDate:I,endDate:z,...E.segments&&{segments:E.segments}}:ar.subtasks?{...ar,subtasks:ge(ar.subtasks)}:ar),je=ge(_),_e=je;je=Ce.autoScheduleDependents(je,E.id,le),je=Ya(je),ve(je);let Zt={...E,startDate:I,endDate:z};if(q&&r?.onTaskDateChange?r.onTaskDateChange(E,I,z):J?.(Zt),De&&le!==0){let Ht=Ce.flattenTasks(_e),ar=Ce.flattenTasks(je),ma=[];for(let $a of ar){if($a.id===E.id)continue;let Kn=Ht.find(xn=>xn.id===$a.id);if(!Kn)continue;let zo=$a.startDate?.getTime()!==Kn.startDate?.getTime(),yo=$a.endDate?.getTime()!==Kn.endDate?.getTime();(zo||yo)&&ma.push($a);}ma.length>0&&De(ma);}},[_,J,De,r]),nb=react.useCallback((E,I)=>{$e?.(E,I),$({isOpen:true,x:I.clientX,y:I.clientY,task:E});},[$e]),ob=react.useCallback((E,I)=>{let z=Ce.splitTask(_,E.id,I);ve(z),$({isOpen:false,x:0,y:0,task:null});},[_]),yu=react.useCallback(E=>{let I=Ce.findTaskById(_,E.id)||E;Je?.(I),Ue||xe(I);},[_,Je,Ue]),xu=react.useCallback((E,I,z)=>{let q=new Map,le=Ht=>{Ht.forEach(ar=>{ar.dependencies&&q.set(ar.id,ar.dependencies),ar.subtasks&&le(ar.subtasks);});};le(z);let ge=q.get(I)||[];q.set(I,[...ge,E]);let je=new Set,_e=new Set,Zt=Ht=>{if(!je.has(Ht)){je.add(Ht),_e.add(Ht);let ar=q.get(Ht)||[];for(let ma of ar){if(!je.has(ma)&&Zt(ma))return true;if(_e.has(ma))return true}}return _e.delete(Ht),false};return Zt(I)},[]),vu=react.useCallback((E,I)=>{if(xu(E.id,I,Ho.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Q[N]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ie,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Ct}`,boxShadow:it},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:qe,borderBottom:`1px solid ${Pe}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:xt,border:`1px solid ${St}`,color:"#00E5CC"},children:jsxRuntime.jsx(Ym,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Re},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>u($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:ct},onMouseEnter:$=>{$.currentTarget.style.background=X,$.currentTarget.style.color=A;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=ct;},children:jsxRuntime.jsx(yw,{})}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ct},onMouseEnter:$=>{$.currentTarget.style.background=X,$.currentTarget.style.color=A;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=ct;},children:jsxRuntime.jsx(hw,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!m&&jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[p.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:B,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Xe.slice(0,4).map(($,Z)=>jsxRuntime.jsx("button",{onClick:()=>fe($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:q,color:ue,border:`1px solid ${ce}`},onMouseEnter:xe=>{xe.currentTarget.style.borderColor=_e,xe.currentTarget.style.color="#00E5CC";},onMouseLeave:xe=>{xe.currentTarget.style.borderColor=ce,xe.currentTarget.style.color=ue;},children:$.length>30?$.slice(0,30)+"...":$},Z))})]}),p.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?V:Fe,color:$.role==="user"?"#00E5CC":dt,border:$.role==="user"?`1px solid ${ye}`:`1px solid ${Ue}`},children:[$.isLoading?jsxRuntime.jsx(xw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:ee})]}),jsxRuntime.jsxs("form",{onSubmit:$=>{if(D&&pr.length>0){$.preventDefault();return}j($);},className:"p-3 relative",style:{borderTop:`1px solid ${Ze}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&pr.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Ae,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:Ft,border:`1px solid ${Pr}`,boxShadow:Kt,backdropFilter:"blur(12px)"},children:pr.map(($,Z)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>sa($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Z===E?qt:"transparent",color:ea},onMouseEnter:()=>G(Z),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:et,border:`1px solid ${Ke}`,color:"#00E5CC"},children:$.name.split(" ").map(xe=>xe[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:pa},children:$.email})]})]},$.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Tt,border:`1px solid ${gt}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:x,onChange:$=>Kr($.target.value),onKeyDown:$=>{se($);},placeholder:ge,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:rr,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?ar:"transparent",color:x.trim()?"#00E5CC":_t,border:x.trim()?`1px solid ${Er}`:"1px solid transparent"},children:jsxRuntime.jsx(bw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Mr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Xm(e,t=50){let[r,a]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((i,d=true)=>{a(m=>{let u=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:u};if(!d)return {...m,present:u};let p=[...m.past,m.present];return p.length>t&&p.shift(),{past:p,present:u,future:[]}});},[t]),o=react.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:d,future:[i.present,...i.future]}});},[]),c=react.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:m}});},[]),l=react.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:l}}function Jm({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){react.useEffect(()=>{if(!n)return;let s=o=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,l=c?o.metaKey:o.ctrlKey;if(l&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!c&&l&&o.key==="y"){o.preventDefault(),t();return}if(c&&l&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var Cw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Te.formatDate(e.startDate)} - ${Te.formatDate(e.endDate)}`);let r=Te.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,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=>Te.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Qm(e){return {...Cw,...e}}var Fw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},rg=react.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:c="comfortable",showThemeSelector:l=true,showExportButton:i=true,onExportSuccess:d,projectName:m,availableUsers:u=[],templates:p,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:v,locale:w="en",customTranslations:C,showCreateTaskButton:P=false,createTaskLabel:L,onCreateTask:k,taskFilter:D,onTaskFilterChange:F,toolbarRightContent:E,showBaseline:G,viewMode:O,onViewModeChange:ee,projectForecast:I,hideForecastHud:Ae,onThemeChange:H,onTaskClick:ge,onTaskSelectionChange:N,selectedTaskId:De,onTaskDblClick:Xe,onTaskContextMenu:He,onTaskUpdate:Y,onDependentTasksScheduled:Ee,onProgressChange:te,onTaskEdit:Be,onTaskAddSubtask:Se,onTaskMarkIncomplete:Le,onTaskSetInProgress:$e,onDependencyCreate:Ye,onDependencyDelete:le,onBeforeTaskAdd:Qe,onAfterTaskAdd:je,onBeforeTaskUpdate:Ie,onAfterTaskUpdate:Ct,onBeforeTaskDelete:it,onAfterTaskDelete:qe,permissions:Pe,onCopySnapshotLink:xt}=r,Re=react.useContext(Ki)?.theme,[ct,A]=react.useState(Re||s||"dark"),[X,B]=react.useState(o),[q,ce]=react.useState(c),[ue,_e]=react.useState(1),[V,ye]=react.useState("all"),[Fe,Ue]=react.useState(O||"execution"),dt=O??Fe,Ze=react.useCallback(M=>{Ue(M),ee?.(M);},[ee]),Tt=G??dt==="oracle",[gt,rr]=react.useState(r.showCriticalPath!==false),[ar,Er]=react.useState(r.showDependencies!==false),[_t,Mr]=react.useState(r.highlightWeekends!==false),Ft=react.useCallback(M=>{rr(M),r.onShowCriticalPathChange?.(M);},[r.onShowCriticalPathChange]),Pr=react.useCallback(M=>{Er(M),r.onShowDependenciesChange?.(M);},[r.onShowDependenciesChange]),Kt=react.useCallback(M=>{Mr(M),r.onHighlightWeekendsChange?.(M);},[r.onHighlightWeekendsChange]);react.useEffect(()=>{r.onTimeScaleChange?.(X);},[X]),react.useEffect(()=>{r.onZoomChange?.(ue);},[ue]);let qt=react.useRef(r.onDateRangeChange);qt.current=r.onDateRangeChange;let ea=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[pa,et]=react.useState(()=>{if(!h)return "all";try{let M=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(M);if(R){let W=JSON.parse(R);if(W.taskFilter)return W.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Ke=D??pa,ha=F??et,[_r,pr]=react.useState(()=>{if(!h)return false;try{let M=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(M);if(R){let W=JSON.parse(R);if(typeof W.hideCompleted=="boolean")return W.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=ea();if(M)try{let R={taskFilter:Ke,hideCompleted:_r};localStorage.setItem(M,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Ke,_r,ea]);let Kr=react.useRef(y);react.useEffect(()=>{if(Kr.current!==y&&y!==void 0){et("all"),pr(false);let M=ea();if(M)try{localStorage.removeItem(M);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}Kr.current=y;},[y,ea]);let[sa,se]=react.useState(0),[pe,ft]=react.useState(false),[j,fe]=react.useState(null),[Q,$]=react.useState({isOpen:false,x:0,y:0,task:null}),[Z,xe]=react.useState(null),[T,U]=react.useState(null);react.useEffect(()=>{Re&&Re!==ct&&A(Re);},[Re]),react.useEffect(()=>{s&&s!==ct&&A(s);},[s]);let de=react.useCallback(M=>{A(M),H?.(M);},[H]),{state:_,setState:ke,undo:st,redo:oe,canUndo:rt,canRedo:pt,clearHistory:Ut}=Xm(t,50),Qt=react.useMemo(()=>{let M=(R,W=0)=>{let K=W;for(let ie of R)ie.subtasks?.length&&(K=Math.max(K,M(ie.subtasks,W+1)));return K};return M(_)+1},[_]),ya=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Wr=react.useRef(new Map),Ga=react.useRef(false);if(!Ga.current&&x){Ga.current=true;let M=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(M);if(R){let W=JSON.parse(R);Array.isArray(W)&&(Wr.current=new Map(W));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let lr=react.useCallback(()=>{let M=ya();if(M)try{let R=Array.from(Wr.current.entries());localStorage.setItem(M,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[ya]),Ba=react.useRef(0),Wo=react.useRef(_);react.useEffect(()=>{Wo.current=_;},[_]);let Pn=react.useRef(false),_n=react.useCallback(M=>{ye(M),Ba.current+=1,ke(R=>{let W=(ie,be=0)=>ie.map(Ge=>{let Ve=M==="all"||be<M-1;return Ge.subtasks?.length&&Wr.current.set(Ge.id,Ve),{...Ge,isExpanded:Ve,subtasks:Ge.subtasks?W(Ge.subtasks,be+1):void 0}}),K=W(R);return lr(),K});},[ke,lr]);react.useEffect(()=>{if(Ba.current>0){Ba.current-=1;return}let M=W=>{let K=new Map;for(let ie of W){let be=ie.id;K.get(be)||K.set(be,ie);}return Array.from(K.values())},R=W=>W.map(K=>{let ie=Wr.current.get(K.id),be=ie!==void 0?{...K,isExpanded:ie}:K;if(be.subtasks?.length){let Ge=M(be.subtasks);return {...be,subtasks:R(Ge)}}return be});if(Wr.current.size>0)ke(qa(R(t)));else {let W=K=>K.map(ie=>ie.subtasks?.length?{...ie,subtasks:M(W(ie.subtasks))}:ie);ke(qa(W(t)));}},[t,ke]);let zo=react.useRef(t),gi=react.useRef(true);react.useEffect(()=>{if(gi.current){gi.current=false,zo.current=_;return}if(Pn.current){Pn.current=false,zo.current=_;return}if(!a)return;let M=JSON.stringify(zo.current),R=JSON.stringify(_);M!==R&&(zo.current=_,a(_));},[_,a]);let qr=react.useMemo(()=>Xc(w,C),[w,C]),ho=react.useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),xa=react.useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[en,tn]=react.useState(()=>{let M=ho(qr);if(!b)return M;try{let R=typeof b=="string"?b:"gantt-columns-state",W=localStorage.getItem(R);if(!W)return M;let K=JSON.parse(W),ie=new Map(K.map(be=>[be.id,be]));return M.map(be=>{let Ge=ie.get(be.id);return Ge?{...be,visible:Ge.visible??be.visible,width:Ge.width??be.width}:be})}catch(R){return console.warn("[GanttBoard] Error loading columns state from localStorage:",R),M}}),Kn=react.useRef(xa);react.useEffect(()=>{if(Kn.current===xa)return;Kn.current=xa;let M=ho(qr);if(!xa){tn(M);return}try{let R=localStorage.getItem(xa);if(!R){tn(M);return}let W=JSON.parse(R),K=new Map(W.map(ie=>[ie.id,ie]));tn(M.map(ie=>{let be=K.get(ie.id);return be?{...ie,visible:be.visible??ie.visible,width:be.width??ie.width}:ie}));}catch(R){console.warn("[GanttBoard] Error reloading columns state from localStorage:",R),tn(M);}},[xa,ho,qr]),react.useEffect(()=>{if(xa&&Kn.current===xa)try{let M=en.map(R=>({id:R.id,visible:R.visible,width:R.width}));localStorage.setItem(xa,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[en,xa]),react.useEffect(()=>{tn(M=>M.map(R=>({...R,label:qr.columns[R.id==="name"?"taskName":R.id]||R.label})));},[qr]);let S=react.useMemo(()=>en.filter(R=>R.visible).reduce((R,W)=>R+W.width,0),[en]),J=react.useRef(en.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=en.filter(K=>K.visible),R=M.map(K=>K.id).join(","),W=J.current;if(R!==W){let K=M.some(be=>be.id!=="name"),ie=W.includes(",");K?!ie&&K&&fe(null):fe(null),J.current=R;}},[en]);let me=60,ve=.6,Ce=react.useMemo(()=>{let R=S+me,W=typeof window<"u"?window.innerWidth*ve:800,K=Math.max(R,W);return j!==null?Math.max(200,Math.min(j,K)):Math.max(200,R)},[j,S]),We=react.useRef(null),re=react.useRef(null),we=react.useRef(null),ze=react.useRef(null),at=react.useRef(null),tt=react.useMemo(()=>fm(ct),[ct]),bt=react.useMemo(()=>({theme:tt,themeName:ct}),[tt,ct]),mt=react.useMemo(()=>Qm(p),[p]),mr=react.useMemo(()=>{if(!f||!gt)return _;let M=Te.calculateCriticalPathFull(_),R=W=>W.map(K=>{let ie=M.get(K.id),be=K.subtasks?R(K.subtasks):void 0,Ge=be?.some(Zt=>Zt.isCriticalPath||Zt.subtasks&&Zt.subtasks.some(Ot=>Ot.isCriticalPath))||false,Ve=ie?ie.isCritical:Ge;return {...K,isCriticalPath:Ve,cpmData:ie||void 0,subtasks:be}});return R(_)},[_,f,gt]),xr=react.useMemo(()=>Te.flattenTasks(_).some(R=>R.dependencies&&R.dependencies.length>0),[_]),zr=react.useMemo(()=>{let M=(R,W="")=>[...R].sort((ie,be)=>(ie.position??0)-(be.position??0)).map((ie,be)=>{let Ge=be+1,Ve=W?`${W}.${Ge}`:`${Ge}.0`,Zt=W?`${W}.${Ge}`:`${Ge}`;return {...ie,wbsCode:Ve,subtasks:ie.subtasks?.length?M(ie.subtasks,Zt):ie.subtasks}});return M(mr)},[mr]),$t=react.useMemo(()=>{if(Ke==="all"&&!_r)return zr;let M=R=>{let W=[];for(let K of R){let ie=K.subtasks?.length?M(K.subtasks):void 0,be=false;if(_r)be=K.progress<100;else switch(Ke){case "all":be=true;break;case "incomplete":be=K.progress<100;break;case "in_progress":be=K.progress>0&&K.progress<100;break;case "completed":be=K.progress===100;break}(be||ie&&ie.length>0)&&W.push({...K,subtasks:ie});}return W};return M(zr)},[zr,Ke,_r]),Wt=Fw(q);Jm({undo:st,redo:oe,canUndo:rt,canRedo:pt,enabled:true}),react.useImperativeHandle(n,()=>({getTask:M=>Te.findTaskById(_,M),addTask:(M,R)=>{ke(W=>{if(!R)return [...W,{...M,level:0}];let K=ie=>ie.map(be=>be.id===R?{...be,subtasks:[...be.subtasks||[],{...M,parentId:R,level:(be.level||0)+1}],isExpanded:true}:be.subtasks?{...be,subtasks:K(be.subtasks)}:be);return K(W)});},updateTask:(M,R)=>{ke(W=>{let K=ie=>ie.map(be=>be.id===M?{...be,...R}:be.subtasks?{...be,subtasks:K(be.subtasks)}:be);return K(W)});},deleteTask:M=>{ke(R=>{let W=K=>K.filter(ie=>ie.id===M?false:(ie.subtasks&&(ie.subtasks=W(ie.subtasks)),true));return W(R)});},deleteTasks:M=>{ke(R=>od(R,M));},duplicateTask:M=>{if(r.onTaskDuplicate){let R=Te.findTaskById(_,M);R&&r.onTaskDuplicate(R);}else ke(R=>Ks(R,[M]).tasks);},splitTask:(M,R,W=3)=>{ke(K=>Te.splitTask(K,M,R,W));},calculateEndDate:Te.calculateEndDate,calculateDuration:Te.calculateDuration,validateDependency:(M,R)=>!Te.validateDependencies(_,M,R),getAllTasks:()=>Te.flattenTasks(_),getTasksByStatus:M=>Te.flattenTasks(_).filter(R=>R.status===M),getTasksByParent:M=>M?Te.findTaskById(_,M)?.subtasks||[]:_.filter(W=>!W.parentId),getCriticalPath:()=>Te.flattenTasks(_).filter(M=>M.isCriticalPath),indentTask:M=>{ke(R=>qa(rd(R,[M])));},outdentTask:M=>{ke(R=>qa(ad(R,[M])));},moveTask:(M,R)=>{ke(W=>nd(W,[M],R));},createSubtask:async M=>{let{tasks:R,newTask:W}=ld(_,M);if(Qe){let K=Qe({...W,parentId:M});if((K instanceof Promise?await K:K)===false)return}ke(qa(R)),je&&je({...W,parentId:M});},scrollToTask:M=>{let W=Te.flattenTasks(_).findIndex(K=>K.id===M);if(W!==-1&&We.current){let K=W*Wt;We.current.scrollTo({top:K,behavior:"smooth"}),we.current&&we.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(M,R=2e3)=>{},expandTask:M=>{ke(R=>{let W=K=>K.map(ie=>ie.id===M?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie);return W(R)});},collapseTask:M=>{ke(R=>{let W=K=>K.map(ie=>ie.id===M?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie);return W(R)});},expandAll:()=>{ke(M=>{let R=W=>W.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?R(K.subtasks):void 0}));return R(M)});},collapseAll:()=>{ke(M=>{let R=W=>W.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?R(K.subtasks):void 0}));return R(M)});},collapseToLevel:M=>{_n(M);},undo:st,redo:oe,canUndo:()=>rt,canRedo:()=>pt,clearHistory:Ut,exportToPNG:async()=>{if(!ze.current||!We.current||!we.current)throw new Error("Gantt container not found");let M=ze.current,R=We.current,W=re.current||R.querySelector(".gantt-grid-scroll"),K=we.current,ie=W?.scrollTop||0,be=K.scrollTop,Ge=M.style.overflow,Ve=M.style.height,Zt=R.style.overflow;try{let Ot=W?.querySelector(".gantt-taskgrid-content"),nr=K.querySelector("svg"),ga=Ot?.scrollHeight||W?.scrollHeight||600,$a=nr?.getBoundingClientRect().height||K.scrollHeight,xo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ga,$a)+20;W&&(W.scrollTop=0),K.scrollTop=0,M.style.overflow="visible",M.style.height=`${xo}px`,R.style.overflow="visible",await new Promise(jo=>setTimeout(jo,100));let xn=await htmlToImage.toPng(M,{backgroundColor:tt.bgPrimary,pixelRatio:2,filter:jo=>{if(!(jo instanceof Element))return !0;let fi=window.getComputedStyle(jo),Ss=parseInt(fi.zIndex,10);return (isNaN(Ss)||Ss<50)&&fi.position!=="fixed"}});return await(await fetch(xn)).blob()}finally{M.style.overflow=Ge,M.style.height=Ve,R.style.overflow=Zt,W&&(W.scrollTop=ie),K.scrollTop=be;}},exportToPDF:async M=>{await Te.exportToPDF(_,M);},exportToExcel:async M=>{await Te.exportToExcel(_,M,_l.current);},exportToJSON:()=>Te.exportToJSON(_),exportToCSV:()=>Te.exportToCSV(_),importFromJSON:M=>{let R=Te.importFromJSON(M);ke(R);},getTasks:()=>_,refresh:()=>{ke(M=>[...M]);},clearAll:()=>{ke([]);},scrollToToday:()=>{let M=we.current,R=at.current;if(!M||!R)return;let K=(new Date().getTime()-R.startDate.getTime())/(1e3*60*60*24),ie=R.timeScale==="day"?60:R.timeScale==="week"?20:8,be=K*ie*R.zoom,Ge=M.clientWidth,Ve=Math.max(0,be-Ge/2);M.scrollTo({left:Ve,behavior:"smooth"});}}),[_,st,oe,rt,pt,Ut,tt,Wt]);let Et=react.useCallback(M=>{tn(R=>R.map(W=>W.id===M?{...W,visible:!W.visible}:W));},[]),Lt=react.useCallback((M,R)=>{tn(W=>W.map(K=>{if(K.id!==M)return K;let ie=K.minWidth??100,be=K.maxWidth??800,Ge=Math.max(ie,Math.min(be,R));return {...K,width:Ge}}));},[]),Fr=react.useCallback(M=>{ke(R=>{let W=id(R,M),K=ie=>{for(let be of ie){if(be.id===M){Wr.current.set(M,be.isExpanded??true);return}be.subtasks?.length&&K(be.subtasks);}};return K(W),lr(),W}),r.onTaskToggleExpand?.(M);},[r,lr]),kr=react.useCallback((M,R)=>{if(Ie&&Ie(M,R)===false)return;let K=Te.findTaskById(_,M)?.progress,ie=Ge=>Ge.map(Ve=>Ve.id===M?{...Ve,...R}:Ve.subtasks?{...Ve,subtasks:ie(Ve.subtasks)}:Ve);ke(Ge=>ie(Ge));let be=Te.findTaskById(ie(_),M);be&&(Y?.(be),Ct?.(be),R.progress!==void 0&&K!==void 0&&R.progress!==K&&te?.(M,K,R.progress));},[_,Y,Ie,Ct,te]),Ta=react.useCallback((M,R,W)=>{if(M.length===0)return;let K=new Set(M),ie=be=>be.map(Ge=>{let Ve=K.has(Ge.id)?{...Ge,[R]:W}:Ge;return Ve.subtasks?{...Ve,subtasks:ie(Ve.subtasks)}:Ve});ke(be=>{let Ge=ie(be);return r.onBulkFill?.(M,R,W,Ge),Ge});},[r]),ma=react.useCallback(M=>{M.length!==0&&(Ba.current+=1,Pn.current=true,ke(R=>qa(rd(R,M))),r.onTaskIndent?.(M[0]));},[r]),Yr=react.useCallback(M=>{M.length!==0&&(Ba.current+=1,Pn.current=true,ke(R=>qa(ad(R,M))),r.onTaskOutdent?.(M[0]));},[r]),yo=react.useCallback((M,R,W)=>{Ba.current+=1,Pn.current=true,ke(K=>qa($m(K,M,R,W))),r.onTaskReparent?.(M,R,W);},[r]),Ns=react.useCallback((M,R)=>{M.length!==0&&(Ba.current+=1,Pn.current=true,ke(W=>nd(W,M,R)),r.onTaskMove?.(M[0],R));},[r]),Fn=react.useCallback(async M=>{let R=[];for(let W of M)it&&await Promise.resolve(it(W))===false||R.push(W);R.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(R):(ke(W=>qa(od(W,R))),R.forEach(W=>r.onTaskDelete?.(W))),qe&&R.forEach(W=>qe(W)));},[r,it,qe]),ib=react.useCallback(M=>{r.onTaskDuplicate?M.forEach(R=>{let W=Te.findTaskById(_,R);W&&r.onTaskDuplicate(W);}):ke(R=>Ks(R,M).tasks);},[r,_]),lb=react.useCallback((M,R)=>{ke(W=>{let{tasks:K,newTask:ie}=Bm(W,M,R);return Qe&&Qe(ie)===false?W:(r.onTaskCreate?.(ie.parentId,ie.position||0),je?.(ie),K)});},[r,Qe,je]),cb=react.useCallback((M,R)=>{ke(W=>sd(W,M,R)),r.onTaskRename?.(M,R);},[r]),Vl=react.useCallback(M=>{let{onTaskAddSubtask:R}=r;if(R){let W=ls(_,M);if(W){R(W);return}}ke(W=>{let{tasks:K}=ld(W,M);return r.onTaskCreate?.(M,0),K});},[r,_]),db=react.useCallback((M,R)=>{let W=Math.max(0,Math.min(100,Math.round(R))),K={progress:W};W===100?K.status="completed":W>0?K.status="in-progress":K.status="todo",kr(M.id,K);},[kr]),ub=react.useCallback((M,R,W)=>{let K=!M.startDate&&!M.endDate,ie=M.startDate?Math.round((R.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,be=Ot=>Ot.map(nr=>nr.id===M.id?{...nr,startDate:R,endDate:W,...M.segments&&{segments:M.segments}}:nr.subtasks?{...nr,subtasks:be(nr.subtasks)}:nr),Ge=be(_),Ve=Ge;Ge=Te.autoScheduleDependents(Ge,M.id,ie),Ge=qa(Ge),ke(Ge);let Zt={...M,startDate:R,endDate:W};if(K&&r?.onTaskDateChange?r.onTaskDateChange(M,R,W):Y?.(Zt),Ee&&ie!==0){let Ot=Te.flattenTasks(Ve),nr=Te.flattenTasks(Ge),ga=[];for(let $a of nr){if($a.id===M.id)continue;let qn=Ot.find(xn=>xn.id===$a.id);if(!qn)continue;let Vo=$a.startDate?.getTime()!==qn.startDate?.getTime(),xo=$a.endDate?.getTime()!==qn.endDate?.getTime();(Vo||xo)&&ga.push($a);}ga.length>0&&Ee(ga);}},[_,Y,Ee,r]),pb=react.useCallback((M,R)=>{He?.(M,R),$({isOpen:true,x:R.clientX,y:R.clientY,task:M});},[He]),mb=react.useCallback((M,R)=>{let W=Te.splitTask(_,M.id,R);ke(W),$({isOpen:false,x:0,y:0,task:null});},[_]),ku=react.useCallback(M=>{let R=Te.findTaskById(_,M.id)||M;Xe?.(R),Be||xe(R);},[_,Xe,Be]),Cu=react.useCallback((M,R,W)=>{let K=new Map,ie=Ot=>{Ot.forEach(nr=>{nr.dependencies&&K.set(nr.id,nr.dependencies),nr.subtasks&&ie(nr.subtasks);});};ie(W);let be=K.get(R)||[];K.set(R,[...be,M]);let Ge=new Set,Ve=new Set,Zt=Ot=>{if(!Ge.has(Ot)){Ge.add(Ot),Ve.add(Ot);let nr=K.get(Ot)||[];for(let ga of nr){if(!Ge.has(ga)&&Zt(ga))return true;if(Ve.has(ga))return true}}return Ve.delete(Ot),false};return Zt(R)},[]),Tu=react.useCallback((M,R)=>{if(Cu(M.id,R,Wo.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let z=q=>q.map(le=>{if(le.id===I){let ge=le.dependencies||[];if(!ge.includes(E.id))return {...le,dependencies:[...ge,E.id]}}return le.subtasks?{...le,subtasks:z(le.subtasks)}:le});Ra.current+=1,ve(q=>z(q)),Qe?.(E.id,I);},[Qe,xu]),wu=react.useCallback((E,I)=>{let z=q=>q.map(le=>{if(le.id===E&&le.dependencies){let ge=le.dependencies.filter(je=>je!==I);return {...le,dependencies:ge}}return le.subtasks?{...le,subtasks:z(le.subtasks)}:le});Ra.current+=1,ve(q=>z(q)),ie?.(E,I);},[ie]),{startDate:Ln,endDate:zl}=react.useMemo(()=>{let E=_.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,je=new Date(ge);je.setDate(je.getDate()-30);let _e=new Date(ge);return _e.setDate(_e.getDate()+60),{startDate:je,endDate:_e}}let I=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),z=new Date(Math.min(...I.map(ge=>ge.getTime()))),q=new Date(Math.max(...I.map(ge=>ge.getTime()))),le=X==="day"?7:X==="week"?14:30;return z.setDate(z.getDate()-le),q.setDate(q.getDate()+le),{startDate:z,endDate:q}},[_,X]);react.useEffect(()=>{Qt.current?.(Ln,zl);},[Ln,zl]);let sb=react.useCallback(async()=>{if(!tt.current||!se.current||!He.current)return;await new Promise(yo=>setTimeout(yo,200));let E=tt.current,I=se.current,z=Le.current||I.querySelector(".gantt-grid-scroll"),q=He.current,le=z?.scrollTop||0,ge=z?.scrollLeft||0,je=q.scrollTop,_e=q.scrollLeft,Zt=E.style.overflow,Ht=E.style.height,ar=z?.style.overflow||"",ma=q.style.overflow,$a=I.style.overflow,Kn=E.style.width,zo=q.style.width;try{let yo=z?.querySelector(".gantt-taskgrid-content"),xn=q.querySelector("svg"),_l=xn?.getAttribute("height")?parseInt(xn.getAttribute("height"),10):xn?.getBoundingClientRect().height||0,Go=yo?.scrollHeight||z?.scrollHeight||600,mi=Math.max(_l,q.scrollHeight),Ns=xn?.getAttribute("width")?parseInt(xn.getAttribute("width"),10):xn?.getBoundingClientRect().width||q.scrollWidth,gb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Kl=Math.max(Go,mi,_l),Nu=gb+Kl+50,Du=(z?.offsetWidth||I.offsetWidth||300)+Ns+10;z&&(z.scrollTop=0,z.scrollLeft=0),q.scrollTop=0,q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Nu}px`,E.style.width=`${Du}px`,I.style.overflow="visible",z&&(z.style.overflow="visible",z.style.height=`${Kl+50}px`),q.style.overflow="visible",q.style.height=`${Kl+50}px`,q.style.width=`${Ns+10}px`,await new Promise(gi=>setTimeout(gi,150));let fb=await htmlToImage.toPng(E,{backgroundColor:We.bgPrimary,pixelRatio:2,width:Du,height:Nu,skipFonts:!1,filter:gi=>{if(!(gi instanceof Element))return !0;let Su=window.getComputedStyle(gi),Eu=parseInt(Su.zIndex,10);return !(!isNaN(Eu)&&Eu>=50||Su.position==="fixed")}}),ql=document.createElement("a");ql.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ql.href=fb,ql.click();}finally{E.style.overflow=Zt,E.style.height=Ht,E.style.width=Kn,I.style.overflow=$a,z&&(z.style.overflow=ar,z.style.height="",z.scrollTop=le,z.scrollLeft=ge),q.style.overflow=ma,q.style.height="",q.style.width=zo,q.scrollTop=je,q.scrollLeft=_e;}d?.("png");},[We,d]),ib=react.useCallback(async()=>{await Ce.exportToPDF(_),d?.("pdf");},[_,d]),Gl=react.useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m});Gl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m};let lb=react.useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let E=new Date,I=le=>String(le).padStart(2,"0"),z=`${E.getFullYear()}-${I(E.getMonth()+1)}-${I(E.getDate())}_${I(E.getHours())}${I(E.getMinutes())}`,q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ce.exportToExcel(_,`${q}_${z}.xlsx`,Gl.current),d?.("excel");},[_,m,d,r.onExportExcel]),cb=react.useCallback(()=>{let E=Ce.exportToCSV(_),I=new Blob([E],{type:"text/csv;charset=utf-8;"}),z=document.createElement("a");z.href=URL.createObjectURL(I),z.download="gantt-chart.csv",z.click(),URL.revokeObjectURL(z.href),d?.("csv");},[_,d]),db=react.useCallback(()=>{let E=Ce.exportToJSON(_),I=new Blob([E],{type:"application/json;charset=utf-8;"}),z=document.createElement("a");z.href=URL.createObjectURL(I),z.download="gantt-chart.json",z.click(),URL.revokeObjectURL(z.href),d?.("json");},[_,d]),ub=react.useCallback(()=>{Ce.exportToMSProject(_,"Gantt Project","project.xml"),d?.("msproject");},[_,d]),pb=E=>{E.preventDefault(),mt(true);},Wo=react.useRef(false),[Vl,ku]=react.useState(false),Ts=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=He.current,I=se.current?.querySelector(".gantt-grid-scroll");if(!E||!I)return;let z=()=>{if(Wo.current)return;Wo.current=true;let _e=E.scrollTop;ce(_e),I.scrollTop=_e,requestAnimationFrame(()=>{Wo.current=false;});},q=()=>{if(Wo.current)return;Wo.current=true;let _e=I.scrollTop;ce(_e),E.scrollTop=_e,requestAnimationFrame(()=>{Wo.current=false;});},le=_e=>{if(ue&&I){let Ht=I.parentElement?.getBoundingClientRect()?.left||0,ar=_e.clientX-Ht,ma=200,$a=Z+we,Kn=window.innerWidth*ke,zo=Math.max($a,Kn);ar>=ma&&ar<=zo&&fe(ar);}if(Vl&&E){let Zt=_e.clientX-Ts.current.x,Ht=_e.clientY-Ts.current.y;E.scrollLeft=Ts.current.scrollLeft-Zt,E.scrollTop=Ts.current.scrollTop-Ht;}},ge=()=>{mt(false),ku(false);},je=_e=>{if(_e.button!==0)return;let Zt=_e.target;Zt.closest("[data-task-bar]")||Zt.closest("[data-dependency-line]")||Zt.closest("button")||Zt.closest('[role="button"]')||Zt.tagName==="rect"&&Zt.getAttribute("data-clickable")==="true"||(ku(true),Ts.current={x:_e.clientX,y:_e.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},_e.preventDefault());};return E.addEventListener("scroll",z),I.addEventListener("scroll",q),E.addEventListener("mousedown",je),document.addEventListener("mousemove",le),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",z),I.removeEventListener("scroll",q),E.removeEventListener("mousedown",je),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ge);}},[ue,Vl,Z]),Ot.current={startDate:Ln,timeScale:X,zoom:he};let jl=r.onTodayVisibilityChange,Cu=react.useRef(null);react.useEffect(()=>{if(!jl)return;let E=He.current;if(!E)return;let I=X==="day"?60:X==="week"?20:8,z=()=>{let ge=(new Date().getTime()-Ln.getTime())/(1e3*60*60*24)*I*he,je=E.scrollLeft,_e=je+E.clientWidth,Zt=ge>=je&&ge<=_e;Cu.current!==Zt&&(Cu.current=Zt,jl(Zt));};return z(),E.addEventListener("scroll",z,{passive:true}),window.addEventListener("resize",z),()=>{E.removeEventListener("scroll",z),window.removeEventListener("resize",z);}},[jl,Ln,X,he]);let Tu=react.useRef(false),mb=react.useRef(null);return react.useLayoutEffect(()=>{if(Tu.current||_.length===0||!He.current)return;Tu.current=true,mb.current=Ln;let E=He.current,I=new Date,z=X==="day"?60:X==="week"?20:8,q=(I.getTime()-Ln.getTime())/(1e3*60*60*24),le=E.clientWidth,je=q*z*he-le/2;q>=0&&le>0&&(E.scrollLeft=Math.max(0,je));},[_.length,Ln,X,he]),jsxRuntime.jsx(rs.Provider,{value:Pr,children:jsxRuntime.jsx(Zl.Provider,{value:gt,children:jsxRuntime.jsxs("div",{ref:tt,className:"flex flex-col h-full w-full",style:{backgroundColor:We.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...We.dotGrid&&{backgroundImage:`radial-gradient(circle, ${We.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Ki,{theme:We,timeScale:X,onTimeScaleChange:B,zoom:he,onZoomChange:qe,currentTheme:st,onThemeChange:pe,rowDensity:Y,onRowDensityChange:re,showThemeSelector:l,showCreateTaskButton:M&&Pe?.canCreateTask!==false&&!Pe?.canCreateSubtaskOnly,createTaskLabel:F,onCreateTask:k,taskFilter:Ke,onTaskFilterChange:ba,hideCompleted:ir,onHideCompletedChange:Qr,toolbarRightContent:D,wbsLevel:j,onWbsLevelChange:_n,maxWbsDepth:br,viewMode:Ct,onViewModeChange:Ze,projectForecast:A,hideForecastHud:Ee,onExportPNG:i?sb:void 0,onExportPDF:i?ib:void 0,onExportExcel:i?lb:void 0,onExportCSV:i?cb:void 0,onExportJSON:i?db:void 0,onExportMSProject:i?ub:void 0,showCriticalPath:ft,onShowCriticalPathChange:Bt,showDependencies:rr,onShowDependenciesChange:_r,highlightWeekends:Vt,onHighlightWeekendsChange:jt,showBaseline:Tt,onShowBaselineChange:E=>{E&&Ct!=="oracle"&&Ze("oracle"),!E&&Ct==="oracle"&&Ze("execution");},onCopySnapshotLink:ot,hasDependencies:na})}),jsxRuntime.jsxs("div",{ref:se,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Le,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ye,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Xi,{tasks:_t,allTasks:Pt,theme:We,rowHeight:yt,availableUsers:u,templates:pr,showCriticalPath:ft,onTaskClick:U,onTaskSelectionChange:R,selectedTaskId:Ae,onTaskDblClick:yu,onTaskContextMenu:$e,onTaskToggle:ya,scrollTop:Ca,columns:Ga,onToggleColumn:Ft,onColumnResize:Fr,onTaskUpdate:Lr,onBulkFill:pa,onTaskIndent:Kr,onTaskOutdent:bo,onTaskMove:ho,onMultiTaskDelete:Ul,onTaskDuplicate:Zf,onTaskCreate:eb,onTaskRename:tb,onCreateSubtask:Wl,onOpenTaskModal:U?E=>U(E):void 0,onDeleteRequest:(E,I)=>W({taskIds:E,taskName:I}),onTaskReparent:Cs,scrollContainerRef:Le})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:We.border,zIndex:15},onMouseDown:pb}),jsxRuntime.jsx("div",{ref:He,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Vl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(al,{tasks:_t,theme:We,rowHeight:yt,timeScale:X,startDate:Ln,endDate:zl,zoom:he,locale:w,templates:pr,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:U,onTaskDblClick:yu,onTaskContextMenu:nb,onTaskDateChange:ab,onTaskProgressDrag:rb,onDependencyCreate:vu,onDependencyDelete:wu,showBaseline:Tt,showCriticalPath:ft,showDependencies:rr,highlightWeekends:Vt,canEditTask:Pe?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),Q.task&&jsxRuntime.jsx(os,{isOpen:Q.isOpen,x:Q.x,y:Q.y,theme:We,onClose:()=>$({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Q.task;if(!E)return [];let I=Ce.findTaskById(_,E.id)||E,z=I.subtasks&&I.subtasks.length>0,q=Pe?.canCreateTask!==false,le=Pe?.canDeleteTask!==false;if(z){let Ht=[],ar=Pe?.canDuplicateTask!==false;return q&&Ht.push({id:"addSubtask",label:Pr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Ne?Ne(I):Wl(I.id);}}),ar&&Ht.push({id:"duplicate",label:Pr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(I):ve(ma=>js(ma,[I.id]).tasks),$({isOpen:false,x:0,y:0,task:null});}}),le&&(Ht.length>0&&Ht.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ht.push({id:"delete",label:Pr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{W({taskIds:[I.id],taskName:I.name});}})),Ht}let ge=Pe?.canUpdateTask!==false,je=Pe?.canDuplicateTask!==false,_e=[];return ge&&_e.push({id:"edit",label:Pr.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{Ue?Ue(I):xe(I);}}),q&&_e.push({id:"addSubtask",label:Pr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Ne?Ne(I):Wl(I.id);}}),_e.length>0&&ge&&_e.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(_e.push({id:"markIncomplete",label:Pr.contextMenu?.markIncomplete||"Mark Incomplete",icon:tr.MarkIncomplete,onClick:()=>{Me?Me(I):Lr(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"}),_e.push({id:"setInProgress",label:Pr.contextMenu?.setInProgress||"Set In Progress",icon:tr.SetInProgress,onClick:()=>{Re?Re(I):Lr(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"}),_e.push({id:"markComplete",label:Pr.contextMenu?.markComplete||"Mark Complete",icon:tr.MarkComplete,onClick:()=>{Lr(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"})),(je||ge&&I.startDate&&I.endDate)&&_e.length>0&&_e.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),je&&_e.push({id:"duplicate",label:Pr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(I):ve(Ht=>js(Ht,[I.id]).tasks),$({isOpen:false,x:0,y:0,task:null});}}),ge&&I.startDate&&I.endDate&&_e.push({id:"split",label:Pr.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{let Ht=I.startDate.getTime(),ar=I.endDate.getTime(),ma=Ht+(ar-Ht)/2,$a=new Date(ma);ob(I,$a);}}),le&&(_e.length>0&&_e.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),_e.push({id:"delete",label:Pr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{W({taskIds:[I.id],taskName:I.name});}})),_e})()}),jsxRuntime.jsx(No,{task:te,isOpen:!!te,onClose:()=>xe(null),onTaskUpdate:E=>{te&&(Lr(te.id,E),xe(null));},theme:st==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.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:()=>W(null),children:jsxRuntime.jsxs(framerMotion.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:We.bgSecondary,border:`1px solid ${We.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${We.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:We.textPrimary,fontFamily:"Inter, sans-serif"},children:[Pr.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:We.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("p",{className:"text-sm leading-relaxed",style:{color:We.textSecondary,fontFamily:"Inter, sans-serif"},children:T.taskIds.length>1?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:We.textPrimary},children:[T.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:We.textPrimary},children:['"',T.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:We.bgPrimary,borderTop:`1px solid ${We.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>W(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:We.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=We.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ul(T.taskIds),W(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:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsxRuntime.jsx(sl,{tasks:_,theme:We,config:v,onTasksUpdate:ve,onTaskUpdate:Lr,onTaskCreate:E=>{ve(I=>[...I,E]);},onTaskDelete:E=>{Ul([E]);},onDependencyCreate:(E,I)=>{let z=Ce.findTaskById(_,E);z&&vu(z,I);},onDependencyDelete:wu})]})})})});function Iw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Rw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[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 ld=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],cd=[{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 tg({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:c=r?"edit":"create",theme:l="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:m,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:f,defaultStatus:x}){let y=[...ld,...i.filter(L=>!ld.some(X=>X.id===L.id))],b=ct[l]||ct.dark,[h,v]=react.useState(false),[w,C]=react.useState(false),[M,F]=react.useState(false),[k,N]=react.useState(false),[P,D]=react.useState({top:0,left:0}),[K,H]=react.useState(null),[ee,A]=react.useState(new Date),[Ee,O]=react.useState({top:0,left:0}),[U,R]=react.useState(false),[Ae,Je]=react.useState([]),[$e,J]=react.useState(false),[De,oe]=react.useState(""),Ue=react.useRef(null),Ne=react.useRef(null),Me=react.useRef(null),Re=react.useRef(null),Qe=react.useRef(null),[ie,et]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Ve,Oe]=react.useState({});react.useEffect(()=>{r?(et({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&R(true)):(et({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),Je([]));},[r,e,x]),react.useEffect(()=>{let L=X=>{Ue.current&&!Ue.current.contains(X.target)&&v(false),Ne.current&&!Ne.current.contains(X.target)&&C(false),Me.current&&!Me.current.contains(X.target)&&F(false),Re.current&&!Re.current.contains(X.target)&&N(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let ut=()=>{let L={};return ie.name.trim()||(L.name="El nombre es requerido"),ie.startDate&&ie.endDate&&ie.startDate>ie.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Oe(L),Object.keys(L).length===0},pt=async L=>{if(L.preventDefault(),!!ut())try{let X=c==="create"&&Ae.length>0?{...ie,pendingFiles:Ae}:ie;await s(X),Je([]),t();}catch(X){console.error("Error submitting task:",X);}},Ge=(L,X)=>{et(B=>{let Y={...B,[L]:X};if(L==="status"){let re=X;re==="todo"?Y.progress=0:re==="in-progress"?(B.progress===0||B.progress===100)&&(Y.progress=50):re==="completed"||re==="closed"?Y.progress=100:(re==="in-review"||re==="review")&&(Y.progress=75);}if(L==="progress"){let re=typeof X=="number"?X:parseInt(X,10);re===100&&B.status!=="completed"?Y.status="completed":re>0&&re<100&&B.status==="todo"?Y.status="in-progress":re===0&&B.status!=="todo"&&(Y.status="todo");}return Y}),Ve[L]&&Oe(B=>{let Y={...B};return delete Y[L],Y});},Pe=y.find(L=>L.id===ie.status)??ld[0],ot=cd.find(L=>L.id===ie.priority)??cd[1],$t=To.find(L=>L.value===ie.color)??To[0],Be=l==="dark",st={backgroundColor:Be?"#1d1f27":b.bgSecondary,border:`1px solid ${Be?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Be?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":l,style:{backgroundColor:Be?"#0a0a0a":b.bgPrimary,border:`1px solid ${Be?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Be?"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:jsxRuntime.jsxs("form",{onSubmit:pt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:ie.name,onChange:L=>Ge("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Ve.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Ve.name]}),jsxRuntime.jsx("textarea",{value:ie.description||"",onChange:L=>Ge("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:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Ue,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...st,borderColor:Pe.color,backgroundColor:`${Pe.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Pe.color}}),jsxRuntime.jsx("span",{style:{color:Pe.color},children:Pe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Pe.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(L=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("status",L.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,ie.status===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),jsxRuntime.jsxs("div",{ref:Ne,className:"relative",children:[jsxRuntime.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:st,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsxRuntime.jsx("span",{children:ot.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:cd.map(L=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("priority",L.id),C(false);},children:[jsxRuntime.jsx("span",{children:L.icon}),L.label,ie.priority===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:Me,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&F(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[ie.assignees&&ie.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ie.assignees.slice(0,3).map((L,X)=>jsxRuntime.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||b.accent,borderColor:b.bgSecondary},children:L.initials},X))}),ie.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",ie.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsx(framerMotion.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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let X=ie.assignees?.some(B=>B.name===L.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{let B=X?(ie.assignees||[]).filter(Y=>Y.name!==L.name):[...ie.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(Y=>Y[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Ge("assignees",B);},children:[jsxRuntime.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:b.accent},children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},L.id)})})})]}),jsxRuntime.jsxs("div",{ref:Re,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(k)N(false);else {if(Re.current){let L=Re.current.getBoundingClientRect(),X=window.innerHeight,B=120,re=X-L.bottom<B?L.top-B-8:L.bottom+8;D({top:re,left:L.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ie.color}}),jsxRuntime.jsx("span",{children:$t.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(false)}),jsxRuntime.jsx(framerMotion.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:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:To.slice(0,18).map(L=>{let X=ie.color===L.value;return jsxRuntime.jsx("button",{type:"button",onClick:B=>{B.preventDefault(),B.stopPropagation(),Ge("color",L.value),N(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:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:X?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),d.length>0||m?jsxRuntime.jsx(Ko,{selectedTags:ie.tags||[],availableTags:d,onChange:L=>Ge("tags",L),onCreateTag:m,theme:b,disabled:o}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Be?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Be?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:Qe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!ie.isMilestone)if(K==="start")H(null);else {if(Qe.current){let L=Qe.current.getBoundingClientRect();O({top:L.bottom+8,left:Math.max(16,L.left-40)});}H("start"),A(ie.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...st,opacity:ie.isMilestone?.5:1,cursor:ie.isMilestone?"not-allowed":"pointer"},disabled:o||ie.isMilestone,children:ie.startDate?ie.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!ie.isMilestone)if(K==="end")H(null);else {if(Qe.current){let L=Qe.current.getBoundingClientRect();O({top:L.bottom+8,left:Math.max(16,L.left-40)});}H("end"),A(ie.endDate||ie.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...st,opacity:ie.isMilestone?.5:1,cursor:ie.isMilestone?"not-allowed":"pointer"},disabled:o||ie.isMilestone,children:ie.endDate?ie.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.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:`${Ee.top}px`,left:`${Ee.left}px`,zIndex:99999,backgroundColor:Be?"#0a0a0a":b.bgPrimary,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Be?"#262626":b.border}`},children:[(()=>{let L=new Date,X=new Date(L);X.setDate(L.getDate()+1);let B=new Date(L);B.setDate(L.getDate()+7);let Y=new Date(L);return Y.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:B},{label:"2 semanas",date:Y}].map((he,qe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(Ge("startDate",he.date),(!ie.endDate||he.date>ie.endDate)&&Ge("endDate",he.date),H("end")):(Ge("endDate",he.date),(!ie.startDate||he.date<ie.startDate)&&Ge("startDate",he.date),H(null));},children:he.label},qe))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.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=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("startDate",void 0),Ge("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(ee.getFullYear(),ee.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ee.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(ee.getFullYear(),ee.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,X)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:L},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=ee.getFullYear(),X=ee.getMonth(),B=new Date(L,X,1).getDay(),Y=new Date(L,X+1,0).getDate(),re=new Date,he=[];for(let j=B-1;j>=0;j--)he.push({day:new Date(L,X,-j).getDate(),date:new Date(L,X-1,new Date(L,X,-j).getDate()),isCurrentMonth:false});for(let j=1;j<=Y;j++)he.push({day:j,date:new Date(L,X,j),isCurrentMonth:true});let qe=42-he.length;for(let j=1;j<=qe;j++)he.push({day:j,date:new Date(L,X+1,j),isCurrentMonth:false});return he.map((j,ye)=>{let Fe=j.date.toDateString()===re.toDateString(),Ie=ie.startDate?.toDateString()===j.date.toDateString(),Ct=ie.endDate?.toDateString()===j.date.toDateString(),Ze=ie.startDate&&ie.endDate&&j.date>=ie.startDate&&j.date<=ie.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:j.isCurrentMonth?Ie||Ct?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Ie?b.accent:Ct?"#7C3AED":Ze?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ie&&!Ct?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{K==="start"?(Ge("startDate",j.date),ie.endDate&&j.date>ie.endDate&&Ge("endDate",j.date),H("end")):(Ge("endDate",j.date),ie.startDate&&j.date<ie.startDate&&Ge("startDate",j.date),H(null));},children:j.day},ye)})})()})]})]})]})})]}),Ve.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ve.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[ie.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Be?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let X=L.currentTarget.getBoundingClientRect(),B=Math.round((L.clientX-X.left)/X.width*100/5)*5;Ge("progress",Math.max(0,Math.min(100,B)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ie.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Be?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(!U),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${U?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ie.effortMinutes?Iw(ie.effortMinutes):"",onChange:L=>{let X=Rw(L.target.value);Ge("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ie.parentId||"",onChange:L=>Ge("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(L=>L.id!==r?.id).map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ie.location||"",onChange:L=>Ge("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ie.equipment||"",onChange:L=>Ge("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(p||u.length>0||c==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.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"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",c==="create"?Ae.length>0&&`(${Ae.length})`:u.length>0&&`(${u.length})`]})]}),c==="create"?jsxRuntime.jsx(Jo,{cardId:"pending",attachments:Ae.map((L,X)=>({id:`pending-${X}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>Je(X=>[...X,...L]),onDelete:L=>{let X=parseInt(L.replace("pending-",""),10);Je(B=>B.filter((Y,re)=>re!==X));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Jo,{cardId:r?.id||"new",attachments:u,onUpload:p&&r?.id?L=>p(r.id,L):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),c==="create"&&Ae.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[Ae.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ie.isMilestone,onChange:L=>Ge("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ie.dependencies&&ie.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ie.dependencies.map(L=>{let X=a.find(B=>B.id===L);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[X?.name||L.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let B=(ie.dependencies||[]).filter(Y=>Y!==L);Ge("dependencies",B);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},L)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{J(!$e),oe("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{J(false),oe("");}}),jsxRuntime.jsxs(framerMotion.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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:De,onChange:L=>oe(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(L=>L.id!==r?.id).filter(L=>De===""||L.name.toLowerCase().includes(De.toLowerCase())).map(L=>{let X=ie.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let B=ie.dependencies||[],Y;X?Y=B.filter(re=>re!==L.id):Y=[...B,L.id],Ge("dependencies",Y);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${b.accent}10`:"transparent"},onMouseEnter:B=>{X||(B.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=X?`${b.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?b.accent:"transparent",borderColor:X?b.accent:b.borderLight},children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:L.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),a.filter(L=>L.id!==r?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Be?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Be?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=b.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsxRuntime.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?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var rg=`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 W=K=>K.map(ie=>{if(ie.id===R){let be=ie.dependencies||[];if(!be.includes(M.id))return {...ie,dependencies:[...be,M.id]}}return ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie});Ba.current+=1,ke(K=>W(K)),Ye?.(M.id,R);},[Ye,Cu]),Nu=react.useCallback((M,R)=>{let W=K=>K.map(ie=>{if(ie.id===M&&ie.dependencies){let be=ie.dependencies.filter(Ge=>Ge!==R);return {...ie,dependencies:be}}return ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie});Ba.current+=1,ke(K=>W(K)),le?.(M,R);},[le]),{startDate:Ln,endDate:jl}=react.useMemo(()=>{let M=_.filter(be=>be.startDate&&be.endDate);if(M.length===0){let be=new Date,Ge=new Date(be);Ge.setDate(Ge.getDate()-30);let Ve=new Date(be);return Ve.setDate(Ve.getDate()+60),{startDate:Ge,endDate:Ve}}let R=M.flatMap(be=>[be.startDate,be.endDate]).filter(be=>be!==void 0),W=new Date(Math.min(...R.map(be=>be.getTime()))),K=new Date(Math.max(...R.map(be=>be.getTime()))),ie=X==="day"?7:X==="week"?14:30;return W.setDate(W.getDate()-ie),K.setDate(K.getDate()+ie),{startDate:W,endDate:K}},[_,X]);react.useEffect(()=>{qt.current?.(Ln,jl);},[Ln,jl]);let gb=react.useCallback(async()=>{if(!ze.current||!We.current||!we.current)return;await new Promise(xo=>setTimeout(xo,200));let M=ze.current,R=We.current,W=re.current||R.querySelector(".gantt-grid-scroll"),K=we.current,ie=W?.scrollTop||0,be=W?.scrollLeft||0,Ge=K.scrollTop,Ve=K.scrollLeft,Zt=M.style.overflow,Ot=M.style.height,nr=W?.style.overflow||"",ga=K.style.overflow,$a=R.style.overflow,qn=M.style.width,Vo=K.style.width;try{let xo=W?.querySelector(".gantt-taskgrid-content"),xn=K.querySelector("svg"),Yl=xn?.getAttribute("height")?parseInt(xn.getAttribute("height"),10):xn?.getBoundingClientRect().height||0,jo=xo?.scrollHeight||W?.scrollHeight||600,fi=Math.max(Yl,K.scrollHeight),Ss=xn?.getAttribute("width")?parseInt(xn.getAttribute("width"),10):xn?.getBoundingClientRect().width||K.scrollWidth,kb=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Xl=Math.max(jo,fi,Yl),Mu=kb+Xl+50,Pu=(W?.offsetWidth||R.offsetWidth||300)+Ss+10;W&&(W.scrollTop=0,W.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Mu}px`,M.style.width=`${Pu}px`,R.style.overflow="visible",W&&(W.style.overflow="visible",W.style.height=`${Xl+50}px`),K.style.overflow="visible",K.style.height=`${Xl+50}px`,K.style.width=`${Ss+10}px`,await new Promise(bi=>setTimeout(bi,150));let Cb=await htmlToImage.toPng(M,{backgroundColor:tt.bgPrimary,pixelRatio:2,width:Pu,height:Mu,skipFonts:!1,filter:bi=>{if(!(bi instanceof Element))return !0;let Fu=window.getComputedStyle(bi),Lu=parseInt(Fu.zIndex,10);return !(!isNaN(Lu)&&Lu>=50||Fu.position==="fixed")}}),Jl=document.createElement("a");Jl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Jl.href=Cb,Jl.click();}finally{M.style.overflow=Zt,M.style.height=Ot,M.style.width=qn,R.style.overflow=$a,W&&(W.style.overflow=nr,W.style.height="",W.scrollTop=ie,W.scrollLeft=be),K.style.overflow=ga,K.style.height="",K.style.width=Vo,K.scrollTop=Ge,K.scrollLeft=Ve;}d?.("png");},[tt,d]),fb=react.useCallback(async()=>{await Te.exportToPDF(_),d?.("pdf");},[_,d]),_l=react.useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m});_l.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m};let bb=react.useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let M=new Date,R=ie=>String(ie).padStart(2,"0"),W=`${M.getFullYear()}-${R(M.getMonth()+1)}-${R(M.getDate())}_${R(M.getHours())}${R(M.getMinutes())}`,K=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Te.exportToExcel(_,`${K}_${W}.xlsx`,_l.current),d?.("excel");},[_,m,d,r.onExportExcel]),hb=react.useCallback(()=>{let M=Te.exportToCSV(_),R=new Blob([M],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(R),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href),d?.("csv");},[_,d]),yb=react.useCallback(()=>{let M=Te.exportToJSON(_),R=new Blob([M],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(R),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href),d?.("json");},[_,d]),xb=react.useCallback(()=>{Te.exportToMSProject(_,"Gantt Project","project.xml"),d?.("msproject");},[_,d]),vb=M=>{M.preventDefault(),ft(true);},Go=react.useRef(false),[Kl,Du]=react.useState(false),Ds=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=we.current,R=We.current?.querySelector(".gantt-grid-scroll");if(!M||!R)return;let W=()=>{if(Go.current)return;Go.current=true;let Ve=M.scrollTop;se(Ve),R.scrollTop=Ve,requestAnimationFrame(()=>{Go.current=false;});},K=()=>{if(Go.current)return;Go.current=true;let Ve=R.scrollTop;se(Ve),M.scrollTop=Ve,requestAnimationFrame(()=>{Go.current=false;});},ie=Ve=>{if(pe&&R){let Ot=R.parentElement?.getBoundingClientRect()?.left||0,nr=Ve.clientX-Ot,ga=200,$a=S+me,qn=window.innerWidth*ve,Vo=Math.max($a,qn);nr>=ga&&nr<=Vo&&fe(nr);}if(Kl&&M){let Zt=Ve.clientX-Ds.current.x,Ot=Ve.clientY-Ds.current.y;M.scrollLeft=Ds.current.scrollLeft-Zt,M.scrollTop=Ds.current.scrollTop-Ot;}},be=()=>{ft(false),Du(false);},Ge=Ve=>{if(Ve.button!==0)return;let Zt=Ve.target;Zt.closest("[data-task-bar]")||Zt.closest("[data-dependency-line]")||Zt.closest("button")||Zt.closest('[role="button"]')||Zt.tagName==="rect"&&Zt.getAttribute("data-clickable")==="true"||(Du(true),Ds.current={x:Ve.clientX,y:Ve.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},Ve.preventDefault());};return M.addEventListener("scroll",W),R.addEventListener("scroll",K),M.addEventListener("mousedown",Ge),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",be),()=>{M.removeEventListener("scroll",W),R.removeEventListener("scroll",K),M.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",be);}},[pe,Kl,S]),at.current={startDate:Ln,timeScale:X,zoom:ue};let ql=r.onTodayVisibilityChange,Su=react.useRef(null);react.useEffect(()=>{if(!ql)return;let M=we.current;if(!M)return;let R=X==="day"?60:X==="week"?20:8,W=()=>{let be=(new Date().getTime()-Ln.getTime())/(1e3*60*60*24)*R*ue,Ge=M.scrollLeft,Ve=Ge+M.clientWidth,Zt=be>=Ge&&be<=Ve;Su.current!==Zt&&(Su.current=Zt,ql(Zt));};return W(),M.addEventListener("scroll",W,{passive:true}),window.addEventListener("resize",W),()=>{M.removeEventListener("scroll",W),window.removeEventListener("resize",W);}},[ql,Ln,X,ue]);let Eu=react.useRef(false),wb=react.useRef(null);return react.useLayoutEffect(()=>{if(Eu.current||_.length===0||!we.current)return;Eu.current=true,wb.current=Ln;let M=we.current,R=new Date,W=X==="day"?60:X==="week"?20:8,K=(R.getTime()-Ln.getTime())/(1e3*60*60*24),ie=M.clientWidth,Ge=K*W*ue-ie/2;K>=0&&ie>0&&(M.scrollLeft=Math.max(0,Ge));},[_.length,Ln,X,ue]),jsxRuntime.jsx(ns.Provider,{value:qr,children:jsxRuntime.jsx(rc.Provider,{value:bt,children:jsxRuntime.jsxs("div",{ref:ze,className:"flex flex-col h-full w-full",style:{backgroundColor:tt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...tt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${tt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Yi,{theme:tt,timeScale:X,onTimeScaleChange:B,zoom:ue,onZoomChange:_e,currentTheme:ct,onThemeChange:de,rowDensity:q,onRowDensityChange:ce,showThemeSelector:l,showCreateTaskButton:P&&Pe?.canCreateTask!==false&&!Pe?.canCreateSubtaskOnly,createTaskLabel:L,onCreateTask:k,taskFilter:Ke,onTaskFilterChange:ha,hideCompleted:_r,onHideCompletedChange:pr,toolbarRightContent:E,wbsLevel:V,onWbsLevelChange:_n,maxWbsDepth:Qt,viewMode:dt,onViewModeChange:Ze,projectForecast:I,hideForecastHud:Ae,onExportPNG:i?gb:void 0,onExportPDF:i?fb:void 0,onExportExcel:i?bb:void 0,onExportCSV:i?hb:void 0,onExportJSON:i?yb:void 0,onExportMSProject:i?xb:void 0,showCriticalPath:gt,onShowCriticalPathChange:Ft,showDependencies:ar,onShowDependenciesChange:Pr,highlightWeekends:_t,onHighlightWeekendsChange:Kt,showBaseline:Tt,onShowBaselineChange:M=>{M&&dt!=="oracle"&&Ze("oracle"),!M&&dt==="oracle"&&Ze("execution");},onCopySnapshotLink:xt,hasDependencies:xr})}),jsxRuntime.jsxs("div",{ref:We,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:re,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ce,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Qi,{tasks:$t,allTasks:zr,theme:tt,rowHeight:Wt,availableUsers:u,templates:mt,showCriticalPath:gt,onTaskClick:ge,onTaskSelectionChange:N,selectedTaskId:De,onTaskDblClick:ku,onTaskContextMenu:He,onTaskToggle:Fr,scrollTop:sa,columns:en,onToggleColumn:Et,onColumnResize:Lt,onTaskUpdate:kr,onBulkFill:Ta,onTaskIndent:ma,onTaskOutdent:Yr,onTaskMove:Ns,onMultiTaskDelete:Fn,onTaskDuplicate:ib,onTaskCreate:lb,onTaskRename:cb,onCreateSubtask:Vl,onOpenTaskModal:ge?M=>ge(M):void 0,onDeleteRequest:(M,R)=>U({taskIds:M,taskName:R}),onTaskReparent:yo,scrollContainerRef:re})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:tt.border,zIndex:15},onMouseDown:vb}),jsxRuntime.jsx("div",{ref:we,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Kl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(ol,{tasks:$t,theme:tt,rowHeight:Wt,timeScale:X,startDate:Ln,endDate:jl,zoom:ue,locale:w,templates:mt,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:ge,onTaskDblClick:ku,onTaskContextMenu:pb,onTaskDateChange:ub,onTaskProgressDrag:db,onDependencyCreate:Tu,onDependencyDelete:Nu,showBaseline:Tt,showCriticalPath:gt,showDependencies:ar,highlightWeekends:_t,canEditTask:Pe?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),Q.task&&jsxRuntime.jsx(is,{isOpen:Q.isOpen,x:Q.x,y:Q.y,theme:tt,onClose:()=>$({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=Q.task;if(!M)return [];let R=Te.findTaskById(_,M.id)||M,W=R.subtasks&&R.subtasks.length>0,K=Pe?.canCreateTask!==false,ie=Pe?.canDeleteTask!==false;if(W){let Ot=[],nr=Pe?.canDuplicateTask!==false;return K&&Ot.push({id:"addSubtask",label:qr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Se?Se(R):Vl(R.id);}}),nr&&Ot.push({id:"duplicate",label:qr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(R):ke(ga=>Ks(ga,[R.id]).tasks),$({isOpen:false,x:0,y:0,task:null});}}),ie&&(Ot.length>0&&Ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ot.push({id:"delete",label:qr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{U({taskIds:[R.id],taskName:R.name});}})),Ot}let be=Pe?.canUpdateTask!==false,Ge=Pe?.canDuplicateTask!==false,Ve=[];return be&&Ve.push({id:"edit",label:qr.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{Be?Be(R):xe(R);}}),K&&Ve.push({id:"addSubtask",label:qr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Se?Se(R):Vl(R.id);}}),Ve.length>0&&be&&Ve.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),be&&(Ve.push({id:"markIncomplete",label:qr.contextMenu?.markIncomplete||"Mark Incomplete",icon:tr.MarkIncomplete,onClick:()=>{Le?Le(R):kr(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),Ve.push({id:"setInProgress",label:qr.contextMenu?.setInProgress||"Set In Progress",icon:tr.SetInProgress,onClick:()=>{$e?$e(R):kr(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),Ve.push({id:"markComplete",label:qr.contextMenu?.markComplete||"Mark Complete",icon:tr.MarkComplete,onClick:()=>{kr(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Ge||be&&R.startDate&&R.endDate)&&Ve.length>0&&Ve.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&Ve.push({id:"duplicate",label:qr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(R):ke(Ot=>Ks(Ot,[R.id]).tasks),$({isOpen:false,x:0,y:0,task:null});}}),be&&R.startDate&&R.endDate&&Ve.push({id:"split",label:qr.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{let Ot=R.startDate.getTime(),nr=R.endDate.getTime(),ga=Ot+(nr-Ot)/2,$a=new Date(ga);mb(R,$a);}}),ie&&(Ve.length>0&&Ve.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ve.push({id:"delete",label:qr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{U({taskIds:[R.id],taskName:R.name});}})),Ve})()}),jsxRuntime.jsx(Do,{task:Z,isOpen:!!Z,onClose:()=>xe(null),onTaskUpdate:M=>{Z&&(kr(Z.id,M),xe(null));},theme:ct==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>U(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:tt.bgSecondary,border:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${tt.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:tt.textPrimary,fontFamily:"Inter, sans-serif"},children:[qr.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("p",{className:"text-sm leading-relaxed",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:T.taskIds.length>1?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:tt.textPrimary},children:[T.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:tt.textPrimary},children:['"',T.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:tt.bgPrimary,borderTop:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>U(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=tt.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Fn(T.taskIds),U(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsxRuntime.jsx(ll,{tasks:_,theme:tt,config:v,onTasksUpdate:ke,onTaskUpdate:kr,onTaskCreate:M=>{ke(R=>[...R,M]);},onTaskDelete:M=>{Fn([M]);},onDependencyCreate:(M,R)=>{let W=Te.findTaskById(_,M);W&&Tu(W,R);},onDependencyDelete:Nu})]})})})});function zw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Gw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[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 ud=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],pd=[{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 og({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:c=r?"edit":"create",theme:l="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:m,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:f,defaultStatus:x}){let h=[...ud,...i.filter(A=>!ud.some(X=>X.id===A.id))],b=lt[l]||lt.dark,[y,v]=react.useState(false),[w,C]=react.useState(false),[P,L]=react.useState(false),[k,D]=react.useState(false),[F,E]=react.useState({top:0,left:0}),[G,O]=react.useState(null),[ee,I]=react.useState(new Date),[Ae,H]=react.useState({top:0,left:0}),[ge,N]=react.useState(false),[De,Xe]=react.useState([]),[He,Y]=react.useState(false),[Ee,te]=react.useState(""),Be=react.useRef(null),Se=react.useRef(null),Le=react.useRef(null),$e=react.useRef(null),Ye=react.useRef(null),[le,Qe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[je,Ie]=react.useState({});react.useEffect(()=>{r?(Qe({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&N(true)):(Qe({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),N(false),Xe([]));},[r,e,x]),react.useEffect(()=>{let A=X=>{Be.current&&!Be.current.contains(X.target)&&v(false),Se.current&&!Se.current.contains(X.target)&&C(false),Le.current&&!Le.current.contains(X.target)&&L(false),$e.current&&!$e.current.contains(X.target)&&D(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let Ct=()=>{let A={};return le.name.trim()||(A.name="El nombre es requerido"),le.startDate&&le.endDate&&le.startDate>le.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie(A),Object.keys(A).length===0},it=async A=>{if(A.preventDefault(),!!Ct())try{let X=c==="create"&&De.length>0?{...le,pendingFiles:De}:le;await s(X),Xe([]),t();}catch(X){console.error("Error submitting task:",X);}},qe=(A,X)=>{Qe(B=>{let q={...B,[A]:X};if(A==="status"){let ce=X;ce==="todo"?q.progress=0:ce==="in-progress"?(B.progress===0||B.progress===100)&&(q.progress=50):ce==="completed"||ce==="closed"?q.progress=100:(ce==="in-review"||ce==="review")&&(q.progress=75);}if(A==="progress"){let ce=typeof X=="number"?X:parseInt(X,10);ce===100&&B.status!=="completed"?q.status="completed":ce>0&&ce<100&&B.status==="todo"?q.status="in-progress":ce===0&&B.status!=="todo"&&(q.status="todo");}return q}),je[A]&&Ie(B=>{let q={...B};return delete q[A],q});},Pe=h.find(A=>A.id===le.status)??ud[0],xt=pd.find(A=>A.id===le.priority)??pd[1],St=No.find(A=>A.value===le.color)??No[0],Re=l==="dark",ct={backgroundColor:Re?"#1d1f27":b.bgSecondary,border:`1px solid ${Re?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Re?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":l,style:{backgroundColor:Re?"#0a0a0a":b.bgPrimary,border:`1px solid ${Re?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Re?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:it,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:le.name,onChange:A=>qe("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),je.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),je.name]}),jsxRuntime.jsx("textarea",{value:le.description||"",onChange:A=>qe("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&v(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ct,borderColor:Pe.color,backgroundColor:`${Pe.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Pe.color}}),jsxRuntime.jsx("span",{style:{color:Pe.color},children:Pe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Pe.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.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:Re?"#0a0a0a":b.bgPrimary,backdropFilter:Re?"blur(16px)":void 0,border:`1px solid ${Re?"#262626":b.border}`,boxShadow:Re?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(A=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("status",A.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,le.status===A.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.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:ct,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{children:xt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.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:Re?"#0a0a0a":b.bgPrimary,backdropFilter:Re?"blur(16px)":void 0,border:`1px solid ${Re?"#262626":b.border}`,boxShadow:Re?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:pd.map(A=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("priority",A.id),C(false);},children:[jsxRuntime.jsx("span",{children:A.icon}),A.label,le.priority===A.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:Le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&L(!P),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:o,children:[le.assignees&&le.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:le.assignees.slice(0,3).map((A,X)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:A.color||b.accent,borderColor:b.bgSecondary},children:A.initials},X))}),le.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",le.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsx(framerMotion.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:Re?"#0a0a0a":b.bgPrimary,backdropFilter:Re?"blur(16px)":void 0,border:`1px solid ${Re?"#262626":b.border}`,boxShadow:Re?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let X=le.assignees?.some(B=>B.name===A.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{let B=X?(le.assignees||[]).filter(q=>q.name!==A.name):[...le.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(q=>q[0]).join("").toUpperCase().slice(0,2),color:b.accent}];qe("assignees",B);},children:[jsxRuntime.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:b.accent},children:A.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},A.id)})})})]}),jsxRuntime.jsxs("div",{ref:$e,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(k)D(false);else {if($e.current){let A=$e.current.getBoundingClientRect(),X=window.innerHeight,B=120,ce=X-A.bottom<B?A.top-B-8:A.bottom+8;E({top:ce,left:A.left});}D(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:le.color}}),jsxRuntime.jsx("span",{children:St.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(false)}),jsxRuntime.jsx(framerMotion.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:`${F.top}px`,left:`${F.left}px`,zIndex:99999,backgroundColor:Re?"#0a0a0a":b.bgPrimary,backdropFilter:Re?"blur(16px)":void 0,border:`1px solid ${Re?"#262626":b.border}`,boxShadow:Re?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:No.slice(0,18).map(A=>{let X=le.color===A.value;return jsxRuntime.jsx("button",{type:"button",onClick:B=>{B.preventDefault(),B.stopPropagation(),qe("color",A.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:A.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:X?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),d.length>0||m?jsxRuntime.jsx(Yo,{selectedTags:le.tags||[],availableTags:d,onChange:A=>qe("tags",A),onCreateTag:m,theme:b,disabled:o}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Re?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Re?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:Ye,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!le.isMilestone)if(G==="start")O(null);else {if(Ye.current){let A=Ye.current.getBoundingClientRect();H({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("start"),I(le.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ct,opacity:le.isMilestone?.5:1,cursor:le.isMilestone?"not-allowed":"pointer"},disabled:o||le.isMilestone,children:le.startDate?le.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!le.isMilestone)if(G==="end")O(null);else {if(Ye.current){let A=Ye.current.getBoundingClientRect();H({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("end"),I(le.endDate||le.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ct,opacity:le.isMilestone?.5:1,cursor:le.isMilestone?"not-allowed":"pointer"},disabled:o||le.isMilestone,children:le.endDate?le.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.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:`${Ae.top}px`,left:`${Ae.left}px`,zIndex:99999,backgroundColor:Re?"#0a0a0a":b.bgPrimary,border:`1px solid ${Re?"#262626":b.border}`,boxShadow:Re?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Re?"#262626":b.border}`},children:[(()=>{let A=new Date,X=new Date(A);X.setDate(A.getDate()+1);let B=new Date(A);B.setDate(A.getDate()+7);let q=new Date(A);return q.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:B},{label:"2 semanas",date:q}].map((ue,_e)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:V=>V.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:V=>V.currentTarget.style.backgroundColor="transparent",onClick:()=>{G==="start"?(qe("startDate",ue.date),(!le.endDate||ue.date>le.endDate)&&qe("endDate",ue.date),O("end")):(qe("endDate",ue.date),(!le.startDate||ue.date<le.startDate)&&qe("startDate",ue.date),O(null));},children:ue.label},_e))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("startDate",void 0),qe("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I(new Date(ee.getFullYear(),ee.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ee.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>I(new Date(ee.getFullYear(),ee.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,X)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:A},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=ee.getFullYear(),X=ee.getMonth(),B=new Date(A,X,1).getDay(),q=new Date(A,X+1,0).getDate(),ce=new Date,ue=[];for(let V=B-1;V>=0;V--)ue.push({day:new Date(A,X,-V).getDate(),date:new Date(A,X-1,new Date(A,X,-V).getDate()),isCurrentMonth:false});for(let V=1;V<=q;V++)ue.push({day:V,date:new Date(A,X,V),isCurrentMonth:true});let _e=42-ue.length;for(let V=1;V<=_e;V++)ue.push({day:V,date:new Date(A,X+1,V),isCurrentMonth:false});return ue.map((V,ye)=>{let Fe=V.date.toDateString()===ce.toDateString(),Ue=le.startDate?.toDateString()===V.date.toDateString(),dt=le.endDate?.toDateString()===V.date.toDateString(),Ze=le.startDate&&le.endDate&&V.date>=le.startDate&&V.date<=le.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:V.isCurrentMonth?Ue||dt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Ue?b.accent:dt?"#7C3AED":Ze?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ue&&!dt?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{G==="start"?(qe("startDate",V.date),le.endDate&&V.date>le.endDate&&qe("endDate",V.date),O("end")):(qe("endDate",V.date),le.startDate&&V.date<le.startDate&&qe("startDate",V.date),O(null));},children:V.day},ye)})})()})]})]})]})})]}),je.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:je.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[le.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Re?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let X=A.currentTarget.getBoundingClientRect(),B=Math.round((A.clientX-X.left)/X.width*100/5)*5;qe("progress",Math.max(0,Math.min(100,B)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${le.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Re?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>N(!ge),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${ge?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:le.effortMinutes?zw(le.effortMinutes):"",onChange:A=>{let X=Gw(A.target.value);qe("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:le.parentId||"",onChange:A=>qe("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(A=>A.id!==r?.id).map(A=>jsxRuntime.jsx("option",{value:A.id,children:A.name},A.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:le.location||"",onChange:A=>qe("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:le.equipment||"",onChange:A=>qe("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(p||u.length>0||c==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.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"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",c==="create"?De.length>0&&`(${De.length})`:u.length>0&&`(${u.length})`]})]}),c==="create"?jsxRuntime.jsx(Zo,{cardId:"pending",attachments:De.map((A,X)=>({id:`pending-${X}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>Xe(X=>[...X,...A]),onDelete:A=>{let X=parseInt(A.replace("pending-",""),10);Xe(B=>B.filter((q,ce)=>ce!==X));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Zo,{cardId:r?.id||"new",attachments:u,onUpload:p&&r?.id?A=>p(r.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),c==="create"&&De.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[De.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:le.isMilestone,onChange:A=>qe("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),le.dependencies&&le.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:le.dependencies.map(A=>{let X=a.find(B=>B.id===A);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[X?.name||A.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let B=(le.dependencies||[]).filter(q=>q!==A);qe("dependencies",B);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},A)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{Y(!He),te("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:He&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Y(false),te("");}}),jsxRuntime.jsxs(framerMotion.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:Re?"#0a0a0a":b.bgPrimary,backdropFilter:Re?"blur(16px)":void 0,border:`1px solid ${Re?"#262626":b.border}`,boxShadow:Re?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:A=>te(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(A=>A.id!==r?.id).filter(A=>Ee===""||A.name.toLowerCase().includes(Ee.toLowerCase())).map(A=>{let X=le.dependencies?.includes(A.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let B=le.dependencies||[],q;X?q=B.filter(ce=>ce!==A.id):q=[...B,A.id],qe("dependencies",q);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${b.accent}10`:"transparent"},onMouseEnter:B=>{X||(B.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=X?`${b.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?b.accent:"transparent",borderColor:X?b.accent:b.borderLight},children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:A.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),a.filter(A=>A.id!==r?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Re?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Re?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=b.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsxRuntime.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:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.currentTarget.style.filter="brightness(1)"),children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var sg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -406,39 +406,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 ig(e){return `CURRENT TASKS:
|
|
410
|
+
${lg(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",s=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",o=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${s}, ${a.progress}%, ${a.status||"todo"}) ${o}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function ng(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=ng(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let s=r.find(c=>c.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return o.every(i=>l.includes(i))})}function dd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.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 p={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(p!==void 0){let f=new Date(a),x=f.getDay(),y=p-x;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),f=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?f.setDate(f.getDate()+u):p==="week"||p==="semana"||p==="semanas"?f.setDate(f.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&f.setMonth(f.getMonth()+u),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let u=parseInt(c[1],10),p=parseInt(c[2],10)-1,f=parseInt(c[3],10);return new Date(f,p,u)}let l={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),p=l[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,u)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let u=d[m[1].toLowerCase()],p=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,p)}return null}function ud(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function pd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function og(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 sg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Un(t,i),u=dd(d);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:f},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Un(t,i),u=ud(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),m=Un(t,i),u=pd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Un(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),d=c[2].trim(),m=Un(t,i),u=Un(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let i=l[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function ig(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 Bw(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 $w(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function cl(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>cl(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},c=o(e.startDate),l=o(e.endDate),i=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:Bw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function lg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:$w(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>cl(a,e,t))}var md={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"}},gd={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"}},dl={en:md,es:gd};function fd(e){return dl[e]||dl.en}function ul(e,t){let r=fd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var bd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function dg(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 ug({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let p=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=dg(e),i=bd[0],d=bd.find(p=>p.value===l)??i,m=d.icon,u=p=>{switch(dg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:bd.map(p=>{let f=p.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",l===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var hd=[{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 mg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let d=m=>{c.current&&!c.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let l=hd.find(d=>d.value===e)??hd[4],i=a==="es"?"es":"en";return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:hd.map(d=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function Qs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function yd(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]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function xd({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,c]=react.useState(false),[l,i]=react.useState(""),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{let x=y=>{d.current&&!d.current.contains(y.target)&&(c(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),p=x=>e.some(y=>y.name===x),f=x=>{if(r){if(p(x.name))r(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Qs(x.name),color:x.color||yd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,y]);}c(false),i("");}};return s||!r?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,y)=>jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&yd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),c(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,y)=>jsxRuntime.jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&yd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:m,type:"text",value:l,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,y)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(h=>h.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${y}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let y=p(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Qs(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function xg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:c=false,placeholder:l}){let[i,d]=react.useState(false),[m,u]=react.useState(n),[p,f]=react.useState(()=>{let D=n==="start"?e:t;if(D){let K=D instanceof Date?D:new Date(D);return new Date(K.getFullYear(),K.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),y=react.useRef(null),b=react.useRef(null),[h,v]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=K=>{let H=K.target;x.current&&x.current.contains(H)||b.current&&b.current.contains(H)||d(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useLayoutEffect(()=>{if(!i){v(null);return}let D=()=>{let K=y.current?.getBoundingClientRect();if(!K)return;let H=520,ee=360,A=window.innerHeight-K.bottom,Ee=A<ee&&K.top>A,O=Ee?K.top-4:K.bottom+4,U=Math.min(Math.max(K.left,8),window.innerWidth-H-8);v({top:O,left:U,flipUp:Ee});};return D(),window.addEventListener("scroll",D,true),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,true),window.removeEventListener("resize",D);}},[i]),react.useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let M=D=>D?D.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):l||"-",F=react.useCallback(()=>{let D=p.getFullYear(),K=p.getMonth(),H=new Date(D,K,1),A=new Date(D,K+1,0).getDate(),Ee=H.getDay(),O=[],R=new Date(D,K,0).getDate();for(let Je=Ee-1;Je>=0;Je--)O.push({date:new Date(D,K-1,R-Je),isCurrentMonth:false});for(let Je=1;Je<=A;Je++)O.push({date:new Date(D,K,Je),isCurrentMonth:true});let Ae=42-O.length;for(let Je=1;Je<=Ae;Je++)O.push({date:new Date(D,K+1,Je),isCurrentMonth:false});return O},[p]),k=D=>{if(a)n==="start"?r(D,C||void 0):r(w||void 0,D),d(false);else if(m==="start"){let K=C&&D>C?D:C;r(D,K||void 0),u("end");}else {let K=w&&D<w?D:w;r(K||void 0,D),d(false);}},N=()=>{let D=new Date,K=new Date(D);K.setDate(D.getDate()+1);let H=new Date(D);H.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let ee=new Date(D);ee.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let A=new Date(D);A.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Ee=new Date(D);Ee.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:H,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ee,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:Ee,display:Ee.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let D=a&&n==="start"?w:C;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(D)})]})}let P=a&&n==="start"?w:C;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,onClick:D=>{D.stopPropagation(),d(!i);let K=n==="start"?w:C;K&&f(new Date(K.getFullYear(),K.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:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&h&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:b,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:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((D,K)=>jsxRuntime.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:()=>k(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},K)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,C||void 0):r(w||void 0,void 0):r(void 0,void 0),d(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:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!a&&jsxRuntime.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:m==="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"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:p.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.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"}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.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(D=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:F().map((D,K)=>{let H=D.date.toDateString()===new Date().toDateString(),ee=w?.toDateString()===D.date.toDateString(),A=C?.toDateString()===D.date.toDateString(),Ee=ee||A,O=!a&&w&&C&&D.date>=w&&D.date<=C;return jsxRuntime.jsx("button",{onClick:()=>k(new Date(D.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),H&&"ring-2 ring-[#00E5CC]",ee&&"bg-[#00E5CC] text-white",A&&!ee&&"bg-[#7C3AED] text-white",O&&!Ee&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ee&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},K)})})]})]}),document.body)]})}function fl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(xg,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:c||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function ms(e=600){let[t,r]=react.useState(false),a=react.useRef(null),n=react.useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return react.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function bl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=react.useState(e),[c,l]=react.useState(false),i=react.useRef(e),d=react.useRef([]);return react.useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,f=a/n;l(true);for(let x=1;x<=n;x++){let y=setTimeout(()=>{let b=x/n,h=1-Math.pow(1-b,3),v=Math.round(m+p*h);o(v),x===n&&(l(false),o(u));},f*x);d.current.push(y);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:c}}function vg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=react.useState(null),[o,c]=react.useState(0),l=react.useRef(null),i=react.useRef(null),d=react.useCallback(p=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(p),c(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,y=Math.min(x/r*100,100);c(y);},16),l.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),c(0);},r);},[r,e]),m=react.useCallback(()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(null),c(0),a?.();},[a]);return react.useEffect(()=>()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function kg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,c]=react.useState(false),[l,i]=react.useState(""),d=react.useRef(null),{isFlashing:m,triggerFlash:u}=ms(),{displayValue:p,isAnimating:f}=bl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),M=w.clientX-C.left,F=Math.round(M/C.width*100),k=Math.max(0,Math.min(100,F));k!==e&&(t(k),s&&u());},y=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),c(true));},[a,t,e]);react.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=react.useCallback(()=>{c(false);let w=parseInt(l,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&u());}},[l,t,e,s,u]),h=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&c(false);},[b]),v=p??e;return jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),o?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:d,value:l,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:y,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Ng({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=react.useState(false),[c,l]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{l(e);},[e]);let d=()=>{c!==e&&t?.(c),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(l(e),o(false));};return n||!t?jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:c,onChange:u=>l(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Eg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:c=true,enableSaveFlash:l=true}){let[i,d]=react.useState(false),[m,u]=react.useState(e?.toString()||""),p=react.useRef(null),{isFlashing:f,triggerFlash:x}=ms(),{displayValue:y,isAnimating:b}=bl(e,{enabled:c&&!i});react.useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),react.useEffect(()=>{u(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(m);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),l&&x());}d(false);},v=w=>{w.key==="Enter"?h():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:a}):i?jsxRuntime.jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:h,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:a})}function Mg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,c]=react.useState(false),l=react.useRef(null);return react.useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&c(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),c(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),c(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Fg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:c,progress:l,startChange:i,cancelChange:d}=vg(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?c?d():i(!e):t(!e));},u=c?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:m,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&u&&"ring-green-500/50",c&&!u&&"ring-red-500/50",c&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[c&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${l/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"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:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Ig({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsxRuntime.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&&jsxRuntime.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 wk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function kk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}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 Aa({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=react.useState(false),[p,f]=react.useState(""),x=react.useRef(null),{isFlashing:y,triggerFlash:b}=ms(),h=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=h&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:wk(e,a);react.useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),N=e%60;k>0&&N>0?f(`${k}h ${N}m`):k>0?f(`${k}h`):f(`${N}m`);}else f("");},[e,m]);let C=()=>{let k=kk(p);k!==e&&(t?.(k),o&&b()),u(false);},M=k=>{k.key==="Enter"?C():k.key==="Escape"&&u(false);};if(c)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let F=h?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(F,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsxRuntime.jsx("input",{ref:x,type:"text",value:p,onChange:k=>f(k.target.value),onBlur:C,onKeyDown:M,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),u(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",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",y&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(F,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function Og({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function Ug({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,m=O=>d?`$${Math.round(O*l).toLocaleString("en-US")}`:`${O}h`,[u,p]=react.useState(false),[f,x]=react.useState(false),[y,b]=react.useState(null),h=react.useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,M=Math.round(v/60*10)/10,F=Math.round(w/60*10)/10,k=w>0?v/w*100:0,N=k>100?Math.round((v-w)/60*10)/10:0,P=k>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!y)return;let O=U=>{h.current&&!h.current.contains(U.target)&&(x(false),b(null));};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[f,y]);let D=O=>{if(O.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(U=>!U),b(null);return}o&&o(e);},K=O=>{x(false),b(O);},H=async(O,U)=>{y==="log"&&a&&O?a(e,O,U):y==="estimate"&&n?n(e,O):y==="quoted"&&s&&s(e,O),b(null);},ee=a||n||s||o,A=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(O=>O.show),Ee=y==="estimate"?w:y==="quoted"?C:void 0;return w===0&&v===0&&C===0?jsxRuntime.jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:O=>O.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&ee&&jsxRuntime.jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:O=>{O.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",O.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:O=>{O.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",O.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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(O=>jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),K(O.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:U=>{U.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.target.style.background="transparent";},children:[jsxRuntime.jsx(O.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),O.label]},O.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:y,locale:r,isDark:t,currentValue:Ee||void 0,onSave:H,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:O=>O.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.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 O=v===0,R=(w>0?v/w:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:O?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(F)]}),N>0&&jsxRuntime.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:["+",m(N)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),ee&&jsxRuntime.jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:O=>{O.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",O.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:O=>{O.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",O.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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(O=>jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),K(O.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:U=>{U.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.target.style.background="transparent";},children:[jsxRuntime.jsx(O.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),O.label]},O.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:y,locale:r,isDark:t,currentValue:Ee||void 0,onSave:H,onClose:()=>b(null)})})})})]})}function Mk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Pk(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 Wg({assignee:e,size:t=28,isDark:r}){let a=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?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function zg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Mk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsxRuntime.jsx(Wg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Pk(c):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Wg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[c,"% LOAD"]})]})}var Fk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Vg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Fk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function _k(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Kk(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function Jg({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:y}){let b=react.useRef(null),h=a==="es"?Kg.es:Kg.en,[v,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let N=b.current;if(!N)return;let P=N.getBoundingClientRect(),D=8,K=e.x,H=e.y;e.y+P.height>window.innerHeight-D&&(H=Math.max(D,e.y-P.height)),e.x+P.width>window.innerWidth-D&&(K=Math.max(D,window.innerWidth-P.width-D)),(K!==e.x||H!==e.y)&&w({left:K,top:H});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let N=D=>{b.current&&!b.current.contains(D.target)&&t();},P=D=>{D.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),c&&(N.push({id:"status",label:h.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),N.push({id:"priority",label:h.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&N.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let D=e.task.assignees||[],H=D.some(ee=>ee.name===P.name)?D.filter(ee=>ee.name!==P.name):[...D,{name:P.name,initials:_k(P.name),color:P.color||Kk(P.name),avatar:P.avatarUrl}];c({...e.task,assignees:H}),t();}}))})),m&&N.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&N.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&N.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),N.push({id:"sep2",label:"",icon:null,separator:true}),s&&N.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||y)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:h.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:h.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&N.push({id:"indent",label:h.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&N.push({id:"outdent",label:h.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&N.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),N},M=()=>{if(!e.columnId)return [];let N=[];return i&&(N.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),N.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),N},F=e.type==="task"?C():M(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:k,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:F.map(N=>N.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsxRuntime.jsx(qk,{item:N,isDark:r},N.id):jsxRuntime.jsxs("button",{onClick:N.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",N.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(N.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function qk({item:e,isDark:t}){let[r,a]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsxRuntime.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(c=>jsxRuntime.jsxs("button",{onClick:c.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var Kg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var o0={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},u1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function i0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=react.useState(""),[d,m]=react.useState(null),[u,p]=react.useState(null),f=react.useRef(null),x=c==="es"?s0.es:s0.en;react.useLayoutEffect(()=>{if(!e||!f.current)return;let F=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let K=k.getBoundingClientRect();p({top:K.bottom+4,right:window.innerWidth-K.right});}let N=f.current.getBoundingClientRect(),D=window.innerHeight-N.top-20;m(Math.max(300,D));};return requestAnimationFrame(F),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[e]),react.useEffect(()=>{if(!e)return;let F=setTimeout(()=>{let k=P=>{f.current&&!f.current.contains(P.target)&&t();},N=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",N),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(F),f._cleanup&&f._cleanup();}},[e,t]);let y=react.useMemo(()=>{let F=new Set([...u1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&F.add(k.type);}),Array.from(F)},[r]);if(!e)return null;let b=F=>{let k=x.columns[F];if(k)return k;let N=r.find(P=>P.type===F);return N?.label?N.label:F},h=F=>{if(F==="name")return;let k=r.map(N=>N.id===F?{...N,visible:!N.visible}:N);n(k);},v=(F,k)=>{let N=r.find(D=>D.type===F&&(!k||D.customFieldId===k));if(N){h(N.id);return}let P={id:k||F,type:F,label:k?a.find(D=>D.id===k)?.name||F:b(F),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,P]);},w=y.filter(F=>F!=="assignees"&&b(F).toLowerCase().includes(l.toLowerCase())),C=a.filter(F=>F.name.toLowerCase().includes(l.toLowerCase())),M=o?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:f,style:{...d?{maxHeight:`${d}px`}:{},...u?{top:u.top,right:u.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",F.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:l,onChange:F=>i(F.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"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:F=>{F&&F.style.setProperty("--focus-border",M);},onFocus:F=>{F.currentTarget.style.borderColor=M,F.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:F=>{F.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",F.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:w.map(F=>{let k=r.find(D=>D.type===F&&!D.customFieldId),N=k?.visible??false,P=F==="name";return jsxRuntime.jsxs("button",{onClick:()=>{P||(k?h(k.id):v(F));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:D=>{P||(D.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:N?M:"transparent",border:N?`1.5px solid ${M}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${M}40`:"none"},children:N&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:N?M:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:o0[F]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:N?500:400,color:N?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(F),children:b(F)})]},F)})})]}),C.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(F=>{let N=r.find(P=>P.customFieldId===F.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(F.type,F.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:N?M:"transparent",border:N?`1.5px solid ${M}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${M}40`:"none"},children:N&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:N?M:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:o0[F.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:F.name})]},F.id)})})]})]})]})}var s0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var v1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function d0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[c,l]=react.useState("text"),[i,d]=react.useState([""]),m=n==="es"?c0.es:c0.en;react.useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let u=()=>{if(!s.trim())return;let y={name:s.trim(),type:c};c==="dropdown"&&(y.options=i.filter(b=>b.trim())),r(y),t();},p=()=>{d([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,d(h);},x=y=>{i.length>1&&d(i.filter((b,h)=>h!==y));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:v1.map(y=>jsxRuntime.jsxs("button",{onClick:()=>l(y.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:y.icon}),jsxRuntime.jsx("span",{className:g("text-xs",c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[y.type]})]},y.type))})]}),c==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsxRuntime.jsx("button",{onClick:u,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:m.create})]})]})]}):null}var c0={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 m0={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 g0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=react.useState(false),l=react.useRef(null),i=react.useRef(0),d=s==="es"?m0.es:m0.en;react.useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},f=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),c(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",u&&(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:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),d.filters,u&&jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(p.value),a(false),c(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:[jsxRuntime.jsx("span",{className:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsxRuntime.jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),c(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:[jsxRuntime.jsx(lucideReact.EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function f0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function mo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function b0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxRuntime.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:[jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsxRuntime.jsx("button",{onClick:a,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:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.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 l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=l-d,u=l>0?Math.round(m/l*100):0,p=l-i,f=l>0?Math.round(p/l*100):0,x=l>0?Math.min(Math.round(d/l*100),120):0,y=d>l&&l>0,b=y?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(l)})]}),(()=>{let h=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=v>0||w>0,M=(F,k)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:F}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(k)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(i)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",h),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let h=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=v>0||w>0,M=(F,k)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:F}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(k)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:mo(d)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",h),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),l>0&&jsxRuntime.jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(x,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=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:[jsxRuntime.jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxRuntime.jsxs("div",{className:"text-base",children:[p>=0?"+":"",mo(p),l>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsxRuntime.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"})]}),jsxRuntime.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:[m>=0?`+${mo(m)} ${o?"disponible (caja)":"available (cash)"}`:`${mo(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,l>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,p=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:f0(l)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:f0(i)})]}),i>0&&jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.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}),jsxRuntime.jsxs("div",{children:[jsxRuntime.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"}),jsxRuntime.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&&jsxRuntime.jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxRuntime.jsxs("button",{onClick:()=>s?.(l.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:[jsxRuntime.jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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 l=e.scheduleVarianceDays??0,i=l>0,d=l<0,m=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.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"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var B1=[{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 T0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...T0(n.subtasks,t+1,s));}return a}function $1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function xs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=xs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ys(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function O1({value:e,onChange:t,isDark:r}){let[a,n]=react.useState(false),[s,o]=react.useState(String(e||""));return a?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.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",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function k0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Bd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Bd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function N0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:w=true,enableContextMenu:C=true,showCreateTaskButton:M=false,onCreateTask:F,persistFilter:k=false,financialBlur:N,healthSidebar:P,lens:D="hours",hourlyRate:K=0,rateMap:H,aggregateParentHours:ee=false,showProjectTotals:A=false,totalsDollarOverride:Ee}=t,O=ul(f,x),U=p==="dark",R=S=>{if(!H||!S.assignees||S.assignees.length===0)return K;let Z=0,me=0;for(let ke of S.assignees){let Ye=ke.id?H[ke.id]:void 0;if(Ye==null||Ye<=0)continue;let se=typeof ke.estimatedMinutes=="number"?ke.estimatedMinutes:0;se>0&&(Z+=Ye*se,me+=se);}if(me>0)return Z/me;let we=S.assignees.map(ke=>ke.id?H[ke.id]:void 0).filter(ke=>ke!=null&&ke>0);return we.length===0?K:we.reduce((ke,Ye)=>ke+Ye,0)/we.length},Ae=S=>{let Z=0,me=0,we=0,ke=Ye=>{for(let se of Ye)if(se.subtasks&&se.subtasks.length>0){let Le={s:Z,a:me,q:we};if(ke(se.subtasks),Z-Le.s+(me-Le.a)+(we-Le.q)===0){let tt=R(se);Z+=(se.timeLoggedMinutes??0)/60*tt,me+=(se.effortMinutes??0)/60*tt,we+=(se.soldEffortMinutes??0)/60*tt;}}else {let Le=R(se);Z+=(se.timeLoggedMinutes??0)/60*Le,me+=(se.effortMinutes??0)/60*Le,we+=(se.soldEffortMinutes??0)/60*Le;}};return S.subtasks&&ke(S.subtasks),{dollarSpent:Z,dollarAllocated:me,dollarQuoted:we}},Je=react.useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(k);if(S){let Z=JSON.parse(S);return {statusFilter:Z.statusFilter||"all",hideCompleted:Z.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[k]),$e=react.useMemo(()=>{function S(Z){let me=0,we=0,ke=0,Ye=0,se=0,Le=0;for(let He of Z)if(He.subtasks&&He.subtasks.length>0){let tt=S(He.subtasks);if(tt.spent+tt.allocated+tt.quoted>0)me+=tt.spent,we+=tt.allocated,ke+=tt.quoted,Ye+=tt.dollarSpent,se+=tt.dollarAllocated,Le+=tt.dollarQuoted;else {let We=He.timeLoggedMinutes??0,gt=He.effortMinutes??0,pr=He.soldEffortMinutes??0;me+=We,we+=gt,ke+=pr;let hr=R(He);Ye+=We/60*hr,se+=gt/60*hr,Le+=pr/60*hr;}}else {let tt=He.timeLoggedMinutes??0,Ot=He.effortMinutes??0,We=He.soldEffortMinutes??0;me+=tt,we+=Ot,ke+=We;let gt=R(He);Ye+=tt/60*gt,se+=Ot/60*gt,Le+=We/60*gt;}return {spent:me,allocated:we,quoted:ke,dollarSpent:Ye,dollarAllocated:se,dollarQuoted:Le}}return S(e)},[e]),J=react.useMemo(()=>{let S=new Map;function Z(me){let we=0;for(let ke of me)if(ke.subtasks&&ke.subtasks.length>0){let Ye=Z(ke.subtasks);S.set(ke.id,Ye),we+=Ye;}else we+=ke.weight||0;return we}return Z(e),S},[e]),De=react.useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:$e.spent,totalHoursAllocatedMinutes:$e.allocated}},[P,$e]),[oe,Ue]=react.useState(true),[Ne,Me]=react.useState(null),[Re,Qe]=react.useState("position"),[ie,et]=react.useState("asc"),[Ve,Oe]=react.useState(""),[ut,pt]=react.useState(()=>Je().statusFilter),[Ge,Pe]=react.useState(()=>Je().hideCompleted),[ot,$t]=react.useState(h||B1),[Be,st]=react.useState(false),[L,X]=react.useState(false),[B,Y]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[re,he]=react.useState(null),[qe,j]=react.useState(false),[ye,Fe]=react.useState(null),[Ie,Ct]=react.useState(null),[Ze,Tt]=react.useState(null),ft=react.useRef(0),zt=react.useRef(false),rr=!!(r.onTaskMove||r.onTaskReparent),[da,Vt]=react.useState(null),[gr,Bt]=react.useState(null),_r=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,jt=react.useRef([]),Qt=react.useCallback((S,Z)=>{rr&&(Z.preventDefault(),ft.current=Z.clientY,he(S),zt.current=false,j(false),Tt({x:Z.clientX,y:Z.clientY}));},[rr]),zr=react.useCallback(S=>{if(!re||(Math.abs(S.clientY-ft.current)>5&&!zt.current&&(zt.current=true,j(true)),Tt({x:S.clientX,y:S.clientY}),!zt.current))return;let me=document.querySelectorAll("[data-listview-row]"),we=null,ke=null;me.forEach(Ye=>{let se=Ye.getBoundingClientRect(),Le=Ye.getAttribute("data-listview-row");if(Le&&Le!==re&&S.clientY>=se.top&&S.clientY<=se.bottom){we=Le;let He=S.clientY-se.top,tt=se.height;ke=He<tt*.25?"above":He>tt*.75?"below":"child";}}),Fe(we),Ct(ke);},[re]),ua=react.useCallback(()=>{if(zt.current&&re&&ye&&Ie){if(Ie==="child"&&r.onTaskReparent)r.onTaskReparent(re,ye);else if(Ie==="above"||Ie==="below"){let S=(we,ke,Ye=null)=>{for(let se of we){if(se.id===ke)return Ye;if(se.subtasks){let Le=S(se.subtasks,ke,se.id);if(Le!==void 0)return Le}}},Z=S(e,re,null),me=S(e,ye,null);if(r.onTaskReparent){let we=(tt,Ot)=>{if(Ot===null)return tt;for(let We of tt){if(We.id===Ot)return We.subtasks||[];if(We.subtasks){let gt=we(We.subtasks,Ot);if(gt.length>0||We.subtasks.some(pr=>pr.id===Ot))return gt}}return []},ke=we(e,me??null),Ye=ke.findIndex(tt=>tt.id===ye),se=Z===me,Le=se?ke.findIndex(tt=>tt.id===re):-1,He=Ie==="below"?Ye+1:Ye;se&&Le!==-1&&Le<Ye&&(He-=1),r.onTaskReparent(re,me??null,Math.max(0,He));}}}he(null),Fe(null),Ct(null),Tt(null),zt.current=false,j(false);},[re,ye,Ie,e,r]),rt=(S,Z)=>Z==="assignees"?S.assignees:Z==="startDate"?S.startDate:S.endDate,Ke=(S,Z,me,we)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ke=Array.from(document.querySelectorAll("[data-listview-row]")),Ye=ke.map(yt=>yt.getAttribute("data-listview-row")||""),se=Math.max(0,Ye.indexOf(Z)),Le=yt=>Ye.slice(se,yt+1);Bt({sourceTaskId:Z,column:me,sourceIndex:we,targetIndex:we,rangeIds:new Set([Z])});let tt=(yt=>{let Ft=yt?.parentElement??null;for(;Ft;){let Lr=window.getComputedStyle(Ft).overflowY;if((Lr==="auto"||Lr==="scroll")&&Ft.scrollHeight>Ft.clientHeight)return Ft;Ft=Ft.parentElement;}let Fr=document.scrollingElement;return Fr&&Fr.scrollHeight>Fr.clientHeight?Fr:null})(S.currentTarget),Ot=yt=>{let Ft=se,Fr=false;ke.forEach((Lr,pa)=>{let Kr=Lr.getBoundingClientRect();yt>=Kr.top&&yt<=Kr.bottom&&(Ft=pa,Fr=true);});let ya=ke[ke.length-1];if(!Fr&&ya){let Lr=ya.getBoundingClientRect();yt>Lr.bottom&&(Ft=ke.length-1);}return Ft<se&&(Ft=se),Ft},We=S.clientY,gt=null,pr=()=>{gt!==null&&(cancelAnimationFrame(gt),gt=null);},hr=()=>{let yt=Ot(We),Ft=new Set(Le(yt));Bt(Fr=>Fr&&{...Fr,targetIndex:yt,rangeIds:Ft});},na=()=>{if(pr(),!tt)return;let yt=tt,Fr=yt===document.scrollingElement?{top:0,bottom:window.innerHeight}:yt.getBoundingClientRect(),ya=60,Lr=12,pa=We-Fr.top,Kr=Fr.bottom-We,bo=yt.scrollHeight-yt.clientHeight;if(Kr<ya&&yt.scrollTop<bo){let Cs=Math.max(1,Math.round(Lr*(1-Math.max(0,Kr)/ya))),ho=()=>{yt.scrollTop+=Cs,hr(),yt.scrollTop<yt.scrollHeight-yt.clientHeight&&(gt=requestAnimationFrame(ho));};gt=requestAnimationFrame(ho);}else if(pa<ya&&yt.scrollTop>0){let Cs=Math.max(1,Math.round(Lr*(1-Math.max(0,pa)/ya))),ho=()=>{yt.scrollTop-=Cs,hr(),yt.scrollTop>0&&(gt=requestAnimationFrame(ho));};gt=requestAnimationFrame(ho);}},Pt=yt=>{We=yt.clientY,hr(),na();},_t=yt=>{window.removeEventListener("mousemove",Pt),window.removeEventListener("mouseup",_t),pr(),document.body.style.cursor="",document.body.style.userSelect="",Bt(null);let Ft=Ot(yt.clientY),Fr=new Map(jt.current.map(Kr=>[Kr.id,Kr])),ya=Fr.get(Z);if(!ya)return;let Lr=rt(ya,me),pa=[];for(let Kr of Le(Ft)){if(Kr===Z)continue;let bo=Fr.get(Kr);bo&&(bo.subtasks&&bo.subtasks.length>0||pa.push(Kr));}pa.length>0&&r.onBulkFill?.(pa,me,Lr);};window.addEventListener("mousemove",Pt),window.addEventListener("mouseup",_t);},ba=S=>gr?gr.rangeIds.has(S):false;react.useEffect(()=>{if(re)return document.addEventListener("mousemove",zr),document.addEventListener("mouseup",ua),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",zr),document.removeEventListener("mouseup",ua),document.body.style.cursor="",document.body.style.userSelect="";}},[re,zr,ua]);let[ir,Qr]=react.useState("all"),[fr,Ca]=react.useState(false),ce=react.useRef(null),ue=react.useRef(null),mt=react.useMemo(()=>{let S=0;function Z(me,we){for(let ke of me)we>S&&(S=we),ke.subtasks?.length&&Z(ke.subtasks,we+1);}return Z(e,1),S},[e]);react.useEffect(()=>{if(!fr)return;let S=Z=>{ce.current?.contains(Z.target)||ue.current?.contains(Z.target)||Ca(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[fr]),react.useEffect(()=>{if(ir==="all"){let me=function(we){for(let ke of we)ke.subtasks?.length&&(ke.isExpanded===false&&r.onTaskToggleExpand?.(ke.id),me(ke.subtasks));};me(e);}else {let me=function(we,ke){for(let Ye of we)if(Ye.subtasks?.length){let se=ke<ir,Le=Ye.isExpanded!==false;se!==Le&&r.onTaskToggleExpand?.(Ye.id),me(Ye.subtasks,ke+1);}};me(e,1);}},[ir]);let[V,fe]=react.useState(null),[Q,$]=react.useState(0),[te,xe]=react.useState(0),T=react.useRef(null),[W,pe]=react.useState(null),[_,ve]=react.useState(null);react.useEffect(()=>{h&&$t(S=>{if(S.length===h.length){let Z=true;for(let me=0;me<S.length;me++){let we=S[me],ke=h[me];if(!we||!ke||we.id!==ke.id||we.visible!==ke.visible||we.width!==ke.width||we.label!==ke.label){Z=false;break}}if(Z)return S}return h});},[h]),react.useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:ut,hideCompleted:Ge}));}catch(S){console.error("Error persisting filter state:",S);}},[k,ut,Ge]);let it=react.useMemo(()=>{let S=new Set;function Z(me){for(let we of me)we.subtasks?.length&&(we.isExpanded!==false&&S.add(we.id),Z(we.subtasks));}return Z(e),S},[e]),ae=react.useMemo(()=>ot.filter(S=>S.visible),[ot]),lt=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),bt=react.useCallback(S=>{Re===S?et(Z=>Z==="asc"?"desc":"asc"):(Qe(S),et("asc")),r.onSortChange?.({column:S,direction:ie==="asc"?"desc":"asc"});},[Re,ie,r]),Mt=react.useCallback(S=>{$t(S),r.onColumnsChange?.(S);},[r]),br=react.useCallback(S=>{let Z=ot.map(me=>me.id===S?{...me,visible:false}:me);Mt(Z);},[ot,Mt]),ha=react.useCallback((S,Z)=>{Qe(S),et(Z);},[]),Mr=react.useCallback((S,Z,me)=>{C&&(S.preventDefault(),Y({isOpen:true,x:S.clientX,y:S.clientY,type:Z?"task":"header",task:Z,columnId:me}));},[C]),tn=react.useCallback(()=>{Y(S=>({...S,isOpen:false}));},[]),lr=react.useCallback((S,Z)=>{if(!w)return;S.preventDefault(),S.stopPropagation();let me=ot.find(we=>we.id===Z);me&&(fe(Z),$(S.clientX),xe(me.width));},[ot,w]);react.useEffect(()=>{if(!V)return;let S=ot,Z=we=>{let ke=we.clientX-Q,Ye=Math.max(50,te+ke);S=S.map(se=>se.id===V?{...se,width:Ye}:se),$t(S);},me=()=>{r.onColumnsChange?.(S),fe(null);};return document.addEventListener("mousemove",Z),document.addEventListener("mouseup",me),()=>{document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",me);}},[V,Q,te,r]);let Ra=react.useCallback((S,Z)=>{if(Z==="name"){S.preventDefault();return}pe(Z),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Z),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Ho=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),pe(null),ve(null);},[]),Pn=react.useCallback((S,Z)=>{S.preventDefault(),Z!=="name"&&(S.dataTransfer.dropEffect="move",ve(Z));},[]),_n=react.useCallback(()=>{ve(null);},[]),Uo=react.useCallback((S,Z)=>{if(S.preventDefault(),!W||W===Z||Z==="name")return;let me=[...ot],we=me.findIndex(se=>se.id===W),ke=me.findIndex(se=>se.id===Z);if(we===-1||ke===-1)return;let Ye=me.splice(we,1);Ye[0]&&(me.splice(ke,0,Ye[0]),Mt(me),pe(null),ve(null));},[W,ot,Mt]),pi=react.useCallback(async S=>{if(r.onCreateCustomField){let Z={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(Z);}X(false);},[r]),Pr=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Fn=react.useMemo(()=>{let S=T0(e);if(Ve.trim()){let Z=Ve.toLowerCase();S=S.filter(me=>me.name.toLowerCase().includes(Z));}if(ut!=="all"){let Z=new Set(S.filter(me=>Pr(me)===ut).flatMap(me=>me.parentPath));S=S.filter(me=>Z.has(me.id));}if(Ge){let Z=new Set(S.filter(me=>Pr(me)!=="completed").flatMap(me=>me.parentPath));S=S.filter(me=>Z.has(me.id));}return S.sort((Z,me)=>{let we,ke;switch(Re){case "name":we=Z.name.toLowerCase(),ke=me.name.toLowerCase();break;case "startDate":we=Z.startDate?.getTime()||0,ke=me.startDate?.getTime()||0;break;case "endDate":we=Z.endDate?.getTime()||0,ke=me.endDate?.getTime()||0;break;case "progress":we=Z.progress||0,ke=me.progress||0;break;case "status":we=Z.status||"todo",ke=me.status||"todo";break;case "priority":let Ye={urgent:0,high:1,medium:2,low:3,none:4};we=Ye[Z.priority]??4,ke=Ye[me.priority]??4;break;case "position":return 0;default:return 0}return we<ke?ie==="asc"?-1:1:we>ke?ie==="asc"?1:-1:0}),S},[e,Ve,ut,Ge,Re,ie,Pr]);jt.current=Fn;let Ba=react.useCallback((S,Z)=>{let me=Ye=>{r.onTaskUpdate?.({...S,...Ye});},we=Ye=>Ye?S.customFields?.find(Le=>Le.fieldId===Ye)?.value:void 0,ke=(Ye,se)=>{if(!Ye)return;let He=[...S.customFields||[]],tt=He.findIndex(Ot=>Ot.fieldId===Ye);tt>=0?He[tt]={fieldId:Ye,value:se}:He.push({fieldId:Ye,value:se}),me({customFields:He});};switch(Z.type){case "name":return null;case "status":return jsxRuntime.jsx(ug,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:se=>{me({status:se,progress:se==="completed"?100:se==="in-progress"?50:0});},isDark:U,locale:f,translations:O.status});case "priority":return jsxRuntime.jsx(mg,{value:S.priority,onChange:se=>me({priority:se}),isDark:U,locale:f});case "assignees":{let se=S.hasChildren,Le=S.assignees||[];if(se&&S.subtasks?.length){let He=new Map,tt=Ot=>{(Ot||[]).forEach(We=>{(We.assignees||[]).forEach(gt=>{He.has(gt.name)||He.set(gt.name,gt);}),We.subtasks?.length&&tt(We.subtasks);});};tt(S.subtasks),Le=Array.from(He.values());}else se&&(Le=[]);return jsxRuntime.jsx(xd,{value:Le,availableUsers:c,onChange:He=>me({assignees:He}),isDark:U,locale:f,disabled:se})}case "startDate":return jsxRuntime.jsx(fl,{value:S.startDate,onChange:se=>me({startDate:se}),isDark:U,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(fl,{value:S.endDate,onChange:se=>me({endDate:se}),isDark:U,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let se=!!(S.subtasks&&S.subtasks.length>0),Le=se?k0(Bd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(kg,{value:Le,onChange:se?void 0:He=>{let tt=He===100?"completed":He>0?"in-progress":"todo";me({progress:He,status:tt});},isDark:U,disabled:se})}case "tags":return jsxRuntime.jsx(Ig,{value:S.tags||[],isDark:U});case "text":return jsxRuntime.jsx(Ng,{value:we(Z.customFieldId)||"",onChange:se=>ke(Z.customFieldId,se),isDark:U});case "number":return jsxRuntime.jsx(Eg,{value:we(Z.customFieldId)||0,onChange:se=>ke(Z.customFieldId,se),isDark:U});case "date":let Ye=we(Z.customFieldId);return jsxRuntime.jsx(fl,{value:Ye?new Date(Ye):void 0,onChange:se=>ke(Z.customFieldId,se),isDark:U,locale:f});case "dropdown":return jsxRuntime.jsx(Mg,{value:we(Z.customFieldId)||"",options:Z.options||[],onChange:se=>ke(Z.customFieldId,se),isDark:U});case "checkbox":return jsxRuntime.jsx(Fg,{value:we(Z.customFieldId)||false,onChange:se=>ke(Z.customFieldId,se),isDark:U});case "estimatedTime":{let se=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Aa,{value:S.estimatedTime,onChange:Le=>me({estimatedTime:Le}),isDark:U,locale:f,disabled:se,lens:D,hourlyRate:R(S)})}case "quotedTime":{let se=S.status==="completed"||S.progress===100,Le=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsxRuntime.jsx(Aa,{value:S.quotedTime,onChange:He=>me({quotedTime:He}),isDark:U,locale:f,disabled:se,isBlurred:Le,lens:D,hourlyRate:R(S)})}case "elapsedTime":{let se=S.status==="completed"||S.progress===100,Le=S.executedDollarsCanonical;return jsxRuntime.jsx(Aa,{value:S.elapsedTime,onChange:He=>me({elapsedTime:He}),isDark:U,locale:f,disabled:se,lens:D,hourlyRate:R(S),financialOverride:Le})}case "effortMinutes":{if(ee&&S.subtasks&&S.subtasks.length>0){let{allocated:Ot}=xs(S);if(D==="financial"){let We=Ae(S),gt=Math.round(We.dollarAllocated),pr=Math.round(We.dollarQuoted),hr=pr-gt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[gt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",gt.toLocaleString("es-CO")]}):null,hr!==0&>>0&&pr>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",hr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[hr>0?"+":"",Math.abs(hr)>=1e3?`$${(hr/1e3).toFixed(1)}K`:`$${hr}`]})]})}return jsxRuntime.jsx(Aa,{value:Ot>0?Ot:void 0,isDark:U,locale:f,disabled:true,lens:D,hourlyRate:K})}let se=S.status==="completed"||S.progress===100,Le=S.effortMinutes||0,He=S.soldEffortMinutes||0,tt=R(S);if(D==="financial"&&tt&&Le>0&&He>0){let Ot=Math.round(Le/60*tt),gt=Math.round(He/60*tt)-Ot;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Aa,{value:Le,onChange:pr=>me({effortMinutes:pr}),isDark:U,locale:f,disabled:se,lens:D,hourlyRate:R(S)}),gt!==0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gt>0?"+":"",Math.abs(gt)>=1e3?`$${(gt/1e3).toFixed(1)}K`:`$${gt}`]})]})}return jsxRuntime.jsx(Aa,{value:Le,onChange:Ot=>me({effortMinutes:Ot}),isDark:U,locale:f,disabled:se,lens:D,hourlyRate:R(S)})}case "timeLoggedMinutes":{let se=S.executedDollarsCanonical;if(ee&&S.subtasks&&S.subtasks.length>0){let{spent:He}=xs(S);return jsxRuntime.jsx(Aa,{value:He>0?He:void 0,isDark:U,locale:f,disabled:true,lens:D,hourlyRate:R(S),financialOverride:se})}let Le=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Aa,{value:S.timeLoggedMinutes,onChange:r.onLogTime?He=>{r.onLogTime?.(S,He);}:void 0,isDark:U,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Le,lens:D,hourlyRate:R(S),financialOverride:se})}case "soldEffortMinutes":{if(ee&&S.subtasks&&S.subtasks.length>0){let{quoted:He}=xs(S),tt=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Aa,{value:He>0?He:void 0,isDark:U,locale:f,disabled:true,isBlurred:tt,lens:D,hourlyRate:R(S)})}let se=S.status==="completed"||S.progress===100,Le=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Aa,{value:S.soldEffortMinutes,onChange:He=>me({soldEffortMinutes:He}),isDark:U,locale:f,disabled:se,isBlurred:Le,lens:D,hourlyRate:R(S)})}case "scheduleVariance":{let se=S.effortMinutes||0,Le=S.soldEffortMinutes||0,He=S.timeLoggedMinutes||0,tt=se>0||Le>0||He>0;return jsxRuntime.jsx(Og,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:U,locale:f,hasTimeAllocated:tt})}case "hoursBar":{if(ee&&S.hasChildren){let{spent:se,allocated:Le,quoted:He}=xs(S),tt=se>Le&&Le>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",U?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",tt?"text-[#FF453A]":U?"text-white/80":"text-gray-800"),children:ys(se)}),Le>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:U?"text-white/60":"text-gray-600",children:ys(Le)})]}),He>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:U?"text-amber-400/70":"text-amber-600",children:ys(He)})]})]})}return jsxRuntime.jsx(Ug,{task:S,isDark:U,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:D,hourlyRate:R(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsxRuntime.jsx(zg,{task:S,isDark:U,locale:f}):jsxRuntime.jsx(xd,{value:S.assignees||[],availableUsers:c,onChange:Le=>{r.onTaskUpdate?.({...S,assignees:Le});},isDark:U,locale:f});case "blockers":return jsxRuntime.jsx(Vg,{blockers:S.blockers,isDark:U,locale:f});case "weight":{let se=J.get(S.id);if(se!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",se>0?U?"text-white/50":"text-gray-400":U?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?`${Number(se.toFixed(2))}%`:"\u2014"});let Le=S.weight||0;return jsxRuntime.jsx(O1,{value:Le,onChange:He=>me({weight:He}),isDark:U})}default:return jsxRuntime.jsx("span",{className:g("text-sm",U?"text-white/60":"text-gray-500"),children:"-"})}},[r,U,f,c,O,ee,J]),Ga=react.useCallback(S=>{let me={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof me=="string"?me:String(me||S.type)},[O,f]),Va=react.useMemo(()=>{let me=ae.reduce((ke,Ye)=>ke+Ye.width,0)+(v?48:0),we={};for(let ke of ae)we[ke.id]=`${ke.width/me*100}%`;return we},[ae,v]);return a?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:T,className:g(U?"bg-[#0D0D0D]":"bg-white",V&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsxRuntime.jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",U?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:[Fn.length," ",O.pagination.tasks]}),y&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",U?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Ve,onChange:S=>Oe(S.target.value),placeholder:O.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",U?"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")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&mt>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:ce,onClick:()=>Ca(!fr),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",U?fr?"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]":fr?"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:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),ir==="all"?f==="es"?"Todos":"All":`L${ir}`]}),fr&&jsxRuntime.jsx("div",{ref:ue,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",U?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(mt,5)},(S,Z)=>({value:Z+1,label:`L${Z+1}`}))].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{Qr(S.value),Ca(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",U?ir===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":ir===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:S.label}),ir===S.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(g0,{value:ut,hideCompleted:Ge,onChange:pt,onHideCompletedChange:Pe,isDark:U,locale:f}),De?.enabled&&De.data&&!oe&&jsxRuntime.jsx("button",{onClick:()=>Ue(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",U?"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:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,M&&F&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:F,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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:O.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",U?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[rr&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),ae.map(S=>{let Z=S.id!=="name",me=_===S.id&&W!==S.id;return jsxRuntime.jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",U?"text-white/60":"text-gray-500",Z&&"cursor-grab",S.type!=="name"&&"justify-center",W===S.id&&"opacity-50",me&&(U?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Va[S.id],minWidth:S.minWidth},draggable:Z,onDragStart:Z?we=>Ra(we,S.id):void 0,onDragEnd:Z?Ho:void 0,onDragOver:Z?we=>Pn(we,S.id):void 0,onDragLeave:Z?_n:void 0,onDrop:Z?we=>Uo(we,S.id):void 0,onContextMenu:we=>Mr(we,void 0,S.id),children:[Z&&jsxRuntime.jsx(lucideReact.GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",U?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxRuntime.jsxs("button",{draggable:false,onClick:we=>{let ke=we.currentTarget.getBoundingClientRect();d(S.id,ke);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ga(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),Re===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>bt(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ga(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",Re===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ga(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),w&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",V===S.id&&"bg-[#00E5CC]"),onMouseDown:we=>lr(we,S.id)})]},S.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),st(Z=>!Z);},className:g("p-0.5 rounded transition-colors",U?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Be&&(U?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(i0,{isOpen:Be,onClose:()=>st(false),columns:ot,customFields:l,onColumnsChange:Mt,onCreateCustomField:()=>{st(false),X(true);},isDark:U,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Fn.map((S,Z)=>{let me=it.has(S.id),we=Math.min(Z*.01,.2),ke=S.hasChildren&&S.level===0,Ye=S.subtasks?.length||0;if(ke){let{spent:We,allocated:gt,quoted:pr}=xs(S),hr=$1(S);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:we},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",U?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Ne===S.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[rr&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),ae.map(na=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",na.type!=="name"&&"justify-center"),style:{width:Va[na.id],minWidth:na.minWidth},children:na.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Pt=>{Pt.stopPropagation(),lt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Pt=>{Pt.stopPropagation(),lt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:me?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:U?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",U?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",U?"text-white/30":"text-gray-500"),children:["(",Ye," ",f==="es"?Ye===1?"Tarea":"Tareas":Ye===1?"Item":"Items",")"]}),hr!==null&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",hr>=1?"text-[#32D74B] bg-[#32D74B]/10":hr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",hr.toFixed(2)]})]})]}):na.type==="timeLoggedMinutes"?D==="financial"?(()=>{let Pt=S.executedDollarsCanonical,_t=Pt!=null?Math.round(Pt):Math.round(Ae(S).dollarSpent);return _t>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",_t.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Aa,{value:We>0?We:void 0,isDark:U,locale:f,disabled:true,lens:D,hourlyRate:R(S)}):na.type==="soldEffortMinutes"?D==="financial"?(()=>{let Pt=Ae(S),_t=Math.round(Pt.dollarQuoted);return _t>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",_t.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Aa,{value:pr>0?pr:void 0,isDark:U,locale:f,disabled:true,lens:D,hourlyRate:R(S)}):na.type==="effortMinutes"?D==="financial"?(()=>{let Pt=Ae(S),_t=Math.round(Pt.dollarAllocated),yt=Math.round(Pt.dollarQuoted),Ft=yt-_t;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[_t>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",_t.toLocaleString("es-CO")]}):null,Ft!==0&&_t>0&&yt>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`]})]})})():jsxRuntime.jsx(Aa,{value:gt>0?gt:void 0,isDark:U,locale:f,disabled:true,lens:D,hourlyRate:R(S)}):Ba(S,na)},na.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let se=re===S.id,Le=ye===S.id,He=Le&&Ie==="above",tt=Le&&Ie==="below",Ot=Le&&Ie==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:we},className:g("flex items-center border-b transition-colors relative group",U?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Ne===S.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:se?.4:1,backgroundColor:Ot?U?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Ot?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:We=>Mr(We,S),onMouseEnter:()=>Vt(S.id),onMouseLeave:()=>Vt(We=>We===S.id?null:We),children:[He&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),tt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),rr&&jsxRuntime.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:We=>Qt(S.id,We),style:{color:U?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),ae.map(We=>{let gt=!!(S.subtasks&&S.subtasks.length>0),pr=_r(We.type),na=!!pr&&!gt&&da===S.id&&!gr,Pt=!!gr&&!!pr&&gr.column===pr&&ba(S.id);return jsxRuntime.jsxs("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",We.type!=="name"&&"justify-center"),style:{width:Va[We.id],minWidth:We.minWidth,position:"relative",backgroundColor:Pt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Pt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[We.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsxRuntime.jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsxRuntime.jsx("button",{onClick:_t=>{_t.stopPropagation(),lt(S.id);},className:g("p-0.5 rounded flex-shrink-0",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",U?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?U?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?U?"text-white":"text-gray-900":U?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):Ba(S,We),na&&pr&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:_t=>Ke(_t,S.id,pr,Z),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},We.id)}),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),A&&Fn.length>0&&(()=>{let{spent:S,allocated:Z,quoted:me}=$e,we=Z-S,ke=we<0,Ye=ke?`+${ys(Math.abs(we))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ys(we)} ${f==="es"?"AHORRADO":"SAVED"}`,se=D==="financial"&&K>0,Le=Ee?.breakdown,He=!!Le&&((Le.equipment??0)>0||(Le.travel??0)>0),tt=Le?.laborSpent!=null?Le.laborSpent:Ee?.spent!=null?Ee.spent:$e.dollarSpent,Ot=Le?.laborAllocated!=null?Le.laborAllocated:Ee?.allocated!=null?Ee.allocated:$e.dollarAllocated,We=Ee?.quoted!=null?Ee.quoted:$e.dollarQuoted,gt=(Pt,_t)=>{if(se){let yt=_t??Pt/60*K;return `$${Math.round(yt).toLocaleString("es-CO")}`}return ys(Pt)},pr=se?Math.abs(Ot-tt):0,hr=se?`+$${pr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ke?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:Ye,na=se&&He?f==="es"?"solo mano de obra":"labor only":void 0;return jsxRuntime.jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",U?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:U?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[rr&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),ae.map(Pt=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Pt.type!=="name"&&"justify-center"),style:{width:Va[Pt.id],minWidth:Pt.minWidth},children:Pt.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),na&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",U?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),na]})]}):Pt.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(S,se?tt:void 0)}),jsxRuntime.jsx("span",{className:g("text-[11px]",U?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:g("text-[11px]",U?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(Z,se?Ot:void 0)})]}),Z>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:se?hr:Ye})]}):Pt.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?gt(me,se?We:void 0):"\u2013"}):Pt.type==="effortMinutes"?(()=>{if(se&&me>0&&Z>0){let _t=Math.round(We),yt=Math.round(Ot),Ft=_t-yt,Fr=_t>0?Math.round(Ft/_t*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(Z,Ot)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>=0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Fr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Z>0?gt(Z,se?Ot:void 0):"\u2013"})})():Pt.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?gt(S,se?tt:void 0):"\u2013"}):Pt.type==="progress"?(()=>{let _t=k0(Bd(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_t,"%"]})})():Pt.type==="weight"?(()=>{let _t=e||[],yt=[],Ft=pa=>{for(let Kr of pa)yt.push(Kr),Kr.subtasks?.length&&Ft(Kr.subtasks);};Ft(_t);let ya=yt.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,Kr)=>pa+(Kr.weight||0),0),Lr=Math.abs(ya-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Lr?U?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ya.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",U?"text-white/30":"text-gray-300"),children:"\u2013"})},Pt.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Fn.length===0&&Ve&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:g("w-12 h-12 mx-auto mb-4",U?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(U?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),De?.enabled&&De.data&&oe&&jsxRuntime.jsx(b0,{data:De.data,isDark:U,locale:f,onClose:()=>Ue(false),lens:t?.lens,onUnassignedTaskClick:S=>{let Z=document.querySelector(`[data-task-id="${S}"]`);Z&&(Z.scrollIntoView({behavior:"smooth",block:"center"}),Me(S),setTimeout(()=>Me(null),2e3));}})]}),jsxRuntime.jsx(Jg,{state:B,onClose:tn,isDark:U,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:br,onColumnSort:ha,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),qe&&Ze&&re&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ze.x+12,top:Ze.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Z=Ce.flattenTasks(e).find(me=>me.id===re);return Z?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:U?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${U?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:U?"#e6edf3":"#111827"},children:Z.name})]}):null})()}),document.body),jsxRuntime.jsx(d0,{isOpen:L,onClose:()=>X(false),onSave:pi,isDark:U,locale:f})]})}var D0=[{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}],S0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],E0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var $d={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"},Od={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"},Hd={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"},Cl={dark:$d,light:Od,neutral:Hd};function M0(e){return Cl[e]||Cl.dark}function Tl(e,t,r,a,n=5){let s=[],o=[],c=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of c){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),y=0;for(;(s[y]||[]).some(([b,h])=>!(x<b||f>h));)y++;(s[y]=s[y]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:y,contL:p.startSerial<r,contR:p.endSerial>a});}let l={};for(let p=r;p<=a;p++)l[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)l[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],y=[];for(let b=0;b<n;b++)l[f].has(b)||y.push(b);if(x.length<=y.length)x.forEach((b,h)=>i.push({it:b,day:f,lane:y[h]}));else {let b=Math.max(y.length-1,0);x.slice(0,b).forEach((h,v)=>i.push({it:h,day:f,lane:y[v]})),d.push({day:f,lane:y[b]!=null?y[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var H1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],U1=["MON","TUE","WED","THU","FRI","SAT","SUN"];function P0(e){return e==="es"?H1:U1}function F0(e){return (e.getDay()+6)%7}function L0(e,t){let r=new Date(e,t,1),a=F0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},c=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function ai(e,t){return F0(e.serialToDate(t))>=5}function W1(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function A0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function I0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Nl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=W1(t),c=42,l=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=A0(d.startDate),f=A0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),y=r.dateToSerial(f);if(y<1||x>c)continue;let b=d.effortMinutes??0,h=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?I0(v):I0(h*n),C=d.assignees?.[0],M=C?.initials||(C?.name?V1(C.name):void 0),F=d.displayId||d.wbsCode||"",k=G1(F||d.id)?"":F||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,startSerial:Math.max(x,1),endSerial:Math.min(y,c),hrs:h,cost:w,critical:!!d.isCriticalPath,who:M,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var z1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function G1(e){return z1.test(e)||/^task-\d+/.test(e)}function V1(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 j1=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],_1=["January","February","March","April","May","June","July","August","September","October","November","December"];function R0(e,t,r){return `${(r==="es"?j1:_1)[t]} ${e}`}var Ud=26,K1={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Dl({locale:e}){let t=P0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Sl({bar:e,ws:t,money:r,projColor:a,slotH:n=Ud}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"nom",children:s.name}),c>=3?jsxRuntime.jsx("span",{className:"val",children:i}):null]})}function El({chip:e,ws:t,slotH:r=Ud}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:K1[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Ml({more:e,ws:t,slotH:r=Ud,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function B0({projects:e}){return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito / Desembolso"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var J1=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function $0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxRuntime.jsxs("div",{className:"cal-topbar",children:[jsxRuntime.jsxs("div",{className:"cal-projsel",children:[s,jsxRuntime.jsx("span",{className:"caret",children:"\u25BE"})]}),jsxRuntime.jsx("div",{className:"cal-spacer"}),jsxRuntime.jsx("div",{className:"cal-seg",children:J1.map(o=>jsxRuntime.jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsxRuntime.jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function O0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=react.useState(false),x=react.useRef(null),y=d==="es";react.useEffect(()=>{if(!p)return;let h=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[p]);let b=l==="all"?y?"Todas":"All":c?.find(h=>h.id===l)?.name??(y?"Todas":"All");return jsxRuntime.jsxs("div",{className:"cal-toolbar",children:[jsxRuntime.jsxs("div",{className:"cal-nav-arrows",children:[jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:y?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxRuntime.jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(h=>!h),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsxRuntime.jsx("b",{children:y?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxRuntime.jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsxRuntime.jsx("span",{className:"nm",children:y?"Todas las fases":"All phases"})}),c.map(h=>jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===h.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(h.id),f(false);},children:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name})},h.id))]}):null]}):null,m,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",y?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var Q1=[{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 / Desembolsos",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 H0({off:e,onToggle:t}){let r=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:Q1.map(a=>{let n=r.includes(a.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:a.nm}),jsxRuntime.jsx("div",{className:"sub",children:a.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var tC={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 W0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=react.useRef(null);react.useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxRuntime.jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsxRuntime.jsx("span",{className:"tk",children:d.taskId}):null,jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsxRuntime.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,jsxRuntime.jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"ico",style:{color:rC[d.type]},children:tC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var U0={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 z0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=U0[r]||U0.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:n.title}),jsxRuntime.jsxs("p",{children:[n.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),a?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsxRuntime.jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function V0(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 G0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function sC(e){return G0[e%G0.length]}function iC(e){return e>1?"over":e>=.9?"warn":"ok"}var Wd="\xA0";function Ao(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function j0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(V0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:sC(l),initials:oC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((l.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function _0({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=V0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,m="cal-cap-cell "+(o?"off":iC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:m,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:u,onClick:p=>{!l||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!l||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!l?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${Wd}/${Wd}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[Ao(c.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",Wd,Ao(c.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:l?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function K0({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxRuntime.jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Ao(s),"h asignadas / ",Ao(o),"h"]}),c?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",Ao(l),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsxRuntime.jsx("span",{className:"nm",title:i.name,children:i.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[Ao(i.hours),"h / ",Ao(i.capacity),"h"]})]},i.name)})})]})}var zd=28,cC=182;function Y0({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=c==="es";return jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsxRuntime.jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(dC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),l&&l[x]?jsxRuntime.jsx(_0,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function dC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=react.useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),m=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${cC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:p,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),y=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ai(e,f)&&(b+=" wknd"),y||(b+=" out"),f===c&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsxRuntime.jsx("div",{onClick:()=>l?.(f.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Sl,{bar:f,ws:t,money:s,projColor:o,slotH:zd})},`b${x}`)),d.chips.map((f,x)=>jsxRuntime.jsx(El,{chip:f,ws:t,slotH:zd},`c${x}`)),d.more.map((f,x)=>jsxRuntime.jsx(Ml,{more:f,ws:t,slotH:zd,onClick:()=>i(f.day,f.items,a.filter(y=>y.startSerial<=f.day&&y.endSerial>=f.day))},`m${x}`))]})]})}var uC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pC(e){return uC.test(e)||/^task-\d+/.test(e)}function mC(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 X0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function gC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function J0(e,t){let r=gC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?X0(c):X0(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?mC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=pC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function Q0({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:"Arrastra al calendario"}),jsxRuntime.jsx("span",{children:e.length})]}),e.length===0?jsxRuntime.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(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:s.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:o}),s.who?jsxRuntime.jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function Z0({onExpand:e}){return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function ws(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function ef({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=react.useRef(null),i=n==="es";react.useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${ws(r.oldProjectEnd,n)} \u2192 ${ws(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[ws(r.oldStart,n)," \u2013 ",ws(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[ws(r.newStart,n)," \u2013 ",ws(r.newEnd,n)]})]})]}),d?jsxRuntime.jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxRuntime.jsxs("div",{className:"cal-impact",children:[jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var yC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function tf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=react.useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxRuntime.jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsxRuntime.jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsxRuntime.jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxRuntime.jsxs("div",{className:"cal-agenda-day",children:[jsxRuntime.jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>c?.(u.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:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,flex:"none"}}),u.critical?jsxRuntime.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,u.id?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxRuntime.jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsxRuntime.jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:yC[u.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function xC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Pl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Gd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function rf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Pl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Pl(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=c(f);x>u&&(u=x);}let p=Gd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function af(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Pl(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Gd(p)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Pl(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Fl(e,t,r,a){let n=xC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=rf(n,new Map),i=af(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=rf(d,new Map([[t,r.getTime()]])),u=af(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let h=l.start.get(b.id),v=m.start.get(b.id);if(h!=null&&v!=null&&Math.abs(v-h)>=864e5/2){let w=Gd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-l.projectEnd)/864e5),y=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:y}}function nf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var kC=132,Ll=26,CC="#5B7FD4";function of({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:y=[],timesheetSettings:b,onVisibleRangeChange:h}){let[v,w]=react.useState("mes"),[C,M]=react.useState(()=>{let j=new Date,ye={y:j.getFullYear(),m:j.getMonth()},Fe=(e??[]).map(Ze=>Ze.startDate?new Date(Ze.startDate):null).filter(Ze=>!!Ze&&!isNaN(Ze.getTime()));if(Fe.length===0||(e??[]).some(Ze=>{let Tt=Ze.startDate?new Date(Ze.startDate):null,ft=Ze.endDate?new Date(Ze.endDate):Tt;if(!Tt||isNaN(Tt.getTime()))return false;let zt=new Date(ye.y,ye.m,1),rr=new Date(ye.y,ye.m+1,0,23,59,59);return Tt<=rr&&(ft??Tt)>=zt}))return ye;let Ct=Fe.reduce((Ze,Tt)=>Ze<Tt?Ze:Tt);return {y:Ct.getFullYear(),m:Ct.getMonth()}}),[F,k]=react.useState(false),[N,P]=react.useState([]),[D,K]=react.useState("all"),[H,ee]=react.useState(null),[A,Ee]=react.useState(null),[O,U]=react.useState(false),[R,Ae]=react.useState(null),[Je,$e]=react.useState(false),J=react.useMemo(()=>L0(C.y,C.m),[C.y,C.m]),De=a||CC,oe=react.useMemo(()=>{let j=new Set;for(let ye of y){let Fe=new Date(`${ye}T12:00:00`),Ie=J.dateToSerial(Fe);Ie>=1&&Ie<=42&&j.add(Ie);}return j},[y,J]);react.useEffect(()=>{h?.({start:nf(J.serialToDate(1)),end:nf(J.serialToDate(42))});},[C.y,C.m]);let Ue=x.length,Ne=react.useMemo(()=>{let j=b?.hoursPerDay;if(!j)return 8;let ye=[j.monday,j.tuesday,j.wednesday,j.thursday,j.friday].map(Fe=>Fe||0).filter(Fe=>Fe>0);return ye.length?Math.round(ye.reduce((Fe,Ie)=>Fe+Ie,0)/ye.length*10)/10:8},[b]),Me=react.useMemo(()=>Nl({tasks:e,grid:J,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,J,De,o,r]),Re=react.useMemo(()=>{if(d===false)return [];let j=new Map;for(let ye of Me.calTasks)ye.phaseId&&ye.phaseName&&j.set(ye.phaseId,ye.phaseName);return [...j.entries()].map(([ye,Fe])=>({id:ye,name:Fe})).sort((ye,Fe)=>ye.name.localeCompare(Fe.name))},[Me.calTasks,d]),Qe=!N.includes("tareas"),ie=!N.includes("cpm"),et=react.useMemo(()=>{let j=Qe?Me.calTasks:[];return D!=="all"&&(j=j.filter(ye=>ye.phaseId===D)),ie||(j=j.map(ye=>ye.critical?{...ye,critical:false}:ye)),j},[Me.calTasks,Qe,ie,D]),Ve=react.useMemo(()=>{let j=new Set;return N.includes("hitos")&&(j.add("hito"),j.add("desembolso")),N.includes("ext")&&j.add("ext"),N.includes("aus")&&j.add("aus"),Me.dayItems.filter(ye=>!j.has(ye.type))},[Me.dayItems,N]),Oe=!N.includes("festivos"),ut=new Date,pt=J.dateToSerial(new Date(ut.getFullYear(),ut.getMonth(),ut.getDate())),Ge=j=>P(ye=>ye.includes(j)?ye.filter(Fe=>Fe!==j):[...ye,j]),Pe=()=>M(j=>{let ye=new Date(j.y,j.m-1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),ot=()=>M(j=>{let ye=new Date(j.y,j.m+1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),$t=()=>{let j=new Date;M({y:j.getFullYear(),m:j.getMonth()});},Be=(j,ye,Fe)=>{if(!p||ye===0)return;let Ie=Me.calTasks.find(zt=>zt.uid===j);if(!Ie)return;let Ct=ye*864e5,Ze=new Date(Ie.realStart.getTime()+Ct),Tt=new Date(Ie.realEnd.getTime()+Ct),ft=Fl(e,j,Ze,Tt);ft&&Ae({uid:j,taskId:Ie.id,taskName:Ie.name,sim:ft,anchor:Fe});},st=async()=>{if(!R||!f)return;$e(true);let j=[{id:R.uid,startDate:R.sim.newStart,endDate:R.sim.newEnd},...R.sim.movedSuccessors.map(Fe=>({id:Fe.id,startDate:Fe.newStart,endDate:Fe.newEnd}))],ye=await f(j);$e(false),ye&&Ae(null);},L=R0(C.y,C.m,n),X=[{id:"",name:t,color:De}],B=react.useMemo(()=>J0(e,o),[e,o]),Y=react.useMemo(()=>{if(v==="lookahead"){let j=J.weeks.find(Fe=>pt>=Fe.ws&&pt<=Fe.we)??J.weeks[0],ye=J.weeks.indexOf(j);return J.weeks.slice(ye,ye+2)}return v==="semana"?[J.weeks.find(ye=>pt>=ye.ws&&pt<=ye.we)??J.weeks[0]]:[]},[v,J.weeks,pt]),re=react.useMemo(()=>{let j={};return Y.forEach((ye,Fe)=>{let Ie=[];for(let Ze=ye.ws;Ze<=ye.we;Ze++)Ie.push({serial:Ze,date:J.serialToDate(Ze),isWeekend:ai(J,Ze),isHoliday:oe.has(Ze)});let Ct=j0(x,Ie,Ne);j[Fe]={days:Ie,capByDay:Ct};}),j},[Y,J,oe,x,Ne]),he=v==="semana"||v==="lookahead",qe=v==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsxRuntime.jsx($0,{view:v,onViewChange:w,money:c==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:j=>l(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsxRuntime.jsx(O0,{monthLabel:L,onPrev:Pe,onNext:ot,onToday:$t,layersOpen:F,onToggleLayers:()=>k(j=>!j),layersOff:N,phases:Re,phaseFilter:D,onPhaseChange:K,locale:n,children:F?jsxRuntime.jsx(H0,{off:N,onToggle:Ge}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:qe?"hidden":void 0},children:[qe?jsxRuntime.jsx(tf,{grid:J,tasks:et,items:Ve,money:c,projColor:De,todaySerial:pt,locale:n,onTaskOpen:i}):he?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dl,{locale:n}),jsxRuntime.jsx(Y0,{grid:J,weeks:Y,tasks:et,items:Ve,money:c,projColor:De,todaySerial:pt,locale:n,capRows:re,teamSize:Ue,onTaskOpen:i,onMore:(j,ye,Fe)=>ee({day:j,items:ye,tasks:Fe}),onCapDay:(j,ye,Fe)=>{for(let Ie of Object.keys(re)){let Ct=re[+Ie].capByDay.get(j);if(Ct){Ee({dayLabel:ye,perPerson:Ct.perPerson,anchor:Fe.getBoundingClientRect()});break}}}})]}):Me.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:J.weeks.map(j=>jsxRuntime.jsx(sf,{grid:J,ws:j.ws,we:j.we,todaySerial:pt,showFestivos:Oe,holidaySerials:oe,locale:n,deadlineDays:new Set},j.ws))}),jsxRuntime.jsx(z0,{monthLabel:L,locale:n,onCreateTask:u})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:J.weeks.map(j=>jsxRuntime.jsx(TC,{grid:J,ws:j.ws,we:j.we,tasks:et,items:Ve,money:c,projColor:De,todaySerial:pt,showFestivos:Oe,holidaySerials:oe,locale:n,onTaskOpen:i,onMore:(ye,Fe,Ie)=>ee({day:ye,items:Fe,tasks:Ie}),canReschedule:p,onDragReschedule:Be,pendingGhost:R?{uid:R.uid,days:Math.round((R.sim.newStart.getTime()-R.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),H?jsxRuntime.jsx(W0,{dayLabel:`${J.serialToDate(H.day).getDate()}`,items:H.items,tasks:H.tasks.map(j=>({swatch:De,taskId:j.id,label:j.name,critical:j.critical,value:c==="$"?j.cost:`${j.hrs}h`})),onClose:()=>ee(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,A?jsxRuntime.jsx(K0,{dayLabel:A.dayLabel,perPerson:A.perPerson,onClose:()=>Ee(null),style:{position:"fixed",top:`${A.anchor.top-8}px`,left:`${A.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,R?jsxRuntime.jsx(ef,{taskName:R.taskName,taskId:R.sim.taskId,sim:R.sim,busy:Je,locale:n,onConfirm:st,onCancel:()=>Ae(null),style:{position:"fixed",top:`${R.anchor.top+12}px`,left:`${Math.min(R.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),O?jsxRuntime.jsx(Q0,{items:B,money:c,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>U(false)}):jsxRuntime.jsx(Z0,{onExpand:()=>U(true)})]}),jsxRuntime.jsx(B0,{projects:X})]})}function sf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsxRuntime.jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,m=n&&s.has(l),u="cal-day";return ai(e,l)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),l===a&&(u+=" today"),o.has(l)&&(u+=" deadline-day"),jsxRuntime.jsxs("div",{className:u,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let y=react.useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(F=>F.type==="deadline").map(F=>F.serial)),[n]),h=Math.max(kC,y.laneCount*Ll+36),v=react.useRef(null),[w,C]=react.useState(null),M=(F,k)=>{if(!p||!f){m?.(k);return}F.preventDefault();let N=v.current;if(!N)return;let P=N.getBoundingClientRect().width/7,D=F.clientX,K=0,H=A=>{let Ee=Math.round((A.clientX-D)/P);K=Ee,C({id:k,days:Ee});},ee=A=>{if(window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",ee),C(null),K===0){m?.(k);return}let Ee=new DOMRect(A.clientX,A.clientY,0,0);f(k,K,Ee);};window.addEventListener("pointermove",H),window.addEventListener("pointerup",ee);};return jsxRuntime.jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${h}px`},children:[jsxRuntime.jsx(sf,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[y.bars.map((F,k)=>{let N=w?.id===F.t.uid?w.days:null,P=x?.uid===F.t.uid?x.days:null,D=N??P??0,K=N==null&&P!=null,H=D!==0?{...F,s:F.s+D,e:F.e+D}:F;return jsxRuntime.jsx("div",{onPointerDown:ee=>M(ee,F.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:K?.6:1},children:jsxRuntime.jsx(Sl,{bar:H,ws:t,money:s,projColor:o,slotH:Ll})},`b${k}`)}),y.chips.map((F,k)=>jsxRuntime.jsx(El,{chip:F,ws:t,slotH:Ll},`c${k}`)),y.more.map((F,k)=>jsxRuntime.jsx(Ml,{more:F,ws:t,slotH:Ll,onClick:()=>u(F.day,F.items,a.filter(N=>N.startSerial<=F.day&&N.endSerial>=F.day))},`m${k}`))]})]})}function DC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=react.useState(false),d=react.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=react.useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),y=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:y}},[d]),u=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.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:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:m.totalCards}),jsxRuntime.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"]})]}),l&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[m.uniqueAssignees," assignees"]})]}),m.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[m.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:d.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:d.map(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var cf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function oi(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 si(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 df(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 uf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=react.useMemo(()=>({...cf,...o}),[o]),[i,d]=react.useState(new Set),m=react.useRef(null),u=react.useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],C=h.get(w);C?C.push(v):h.set(w,[v]);}),Array.from(h.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((C,M)=>M.timestamp.getTime()-C.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=react.useMemo(()=>{let h=new Set,v=new Set;return e.forEach(w=>{h.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{d(v=>{let w=new Set(v);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),C=Math.floor(w/6e4),M=Math.floor(w/36e5),F=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:M<24?`${M}h ago`:F<7?`${F}d ago`:h.toLocaleDateString()},b=react.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 react.useEffect(()=>{if(s&&m.current){let h=m.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:g("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:g("history-timeline",l.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxRuntime.jsxs("option",{value:h,children:[si(h)," ",h.replace("_"," ")]},h))]}),p.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),p.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>r({...t,searchTerm:h.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:m,children:u.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[l.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((v,w)=>{let C=i.has(v.id),M=s===v.id,F=df(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",C&&"expanded",M&&"selected"),onClick:()=>n?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:F},children:l.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:si(v.type)})}),w<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:F}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[l.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:oi(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},k)),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([k,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function mf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],m=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:g("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:g("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:m&&si(m.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:m&&oi(m)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:m&&m.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>c(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsxRuntime.jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>c(f),title:oi(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(p=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>l(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:m&&m.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxRuntime.jsxs("div",{className:g("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function jd(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 _d(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 gf(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 ff(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function LC(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,y=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(y*y);d.vx+=f/y*b,d.vy+=x/y*b;});}),t.forEach(d=>{let m=c.get(typeof d.source=="string"?d.source:d.source.id),u=c.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,y=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*y,m.vy+=f*y,u.vx-=p*y,u.vy-=f*y;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function bf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=react.useRef(null),[d,m]=react.useState([]),[u,p]=react.useState(null),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(1),[w,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let H=LC(e,t,r.width,r.height,r,150);m(H);},[e,t,r]);let M=react.useCallback((H,ee)=>{r.enableDragging&&(ee.stopPropagation(),p(H));},[r.enableDragging]),F=react.useCallback(H=>{if(!u||!i.current)return;let A=i.current.getBoundingClientRect(),Ee=(H.clientX-A.left-w.x)/h,O=(H.clientY-A.top-w.y)/h;m(U=>U.map(R=>R.id===u?{...R,x:Ee,y:O,fx:Ee,fy:O}:R));},[u,h,w]),k=react.useCallback(()=>{p(null);},[]),N=react.useCallback((H,ee)=>{ee.stopPropagation(),c?.({type:"node-click",node:H,position:{x:ee.clientX,y:ee.clientY}});},[c]),P=react.useCallback((H,ee)=>{ee.stopPropagation(),c?.({type:"edge-click",edge:H,position:{x:ee.clientX,y:ee.clientY}});},[c]),D=react.useCallback(H=>{let ee=d.find(A=>A.id===H);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[d]),K=react.useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ee=H.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:g("relationships-graph-empty",l),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:g("relationships-graph",l),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.min(H+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:jd(H)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[gf(H)," ",_d(H)]})]},H))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:F,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let ee=D(typeof H.source=="string"?H.source:H.source.id),A=D(typeof H.target=="string"?H.target:H.target.id),Ee=ff(H.type),O=y===H.id,U=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",O&&"hovered",U&&"critical"),onMouseEnter:()=>b(H.id),onMouseLeave:()=>b(null),onClick:R=>P(H,R),children:[jsxRuntime.jsx("line",{x1:ee.x,y1:ee.y,x2:A.x,y2:A.y,stroke:jd(H.type),strokeWidth:U?r.edgeWidth*2:r.edgeWidth,strokeOpacity:O?1:.6,markerEnd:Ee?"url(#arrowhead)":void 0}),r.showEdgeLabels&&O&&jsxRuntime.jsx("text",{x:(ee.x+A.x)/2,y:(ee.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_d(H.type)})]},H.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map(H=>{let ee=f===H.id,A=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",ee&&"hovered",A&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:Ee=>M(H.id,Ee),onMouseEnter:()=>x(H.id),onMouseLeave:()=>x(null),onClick:Ee=>N(H,Ee),children:[jsxRuntime.jsx("circle",{r:A?r.nodeSize*1.2:r.nodeSize,fill:K(H),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:ee?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function xf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[c,l]=react.useState(false),[i,d]=react.useState(null),[m,u]=react.useState(null),p=react.useRef(null),f=c||n;react.useEffect(()=>{e&&p.current&&p.current.focus();},[e]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},y=async()=>{if(!(!s.trim()||f)){l(true),d(null),u(null);try{let h=await a(s.trim());u(h);}catch(h){d(h instanceof Error?h.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{m&&(r(m),x());};return e?jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:m?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),m.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((h,v)=>jsxRuntime.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},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((h,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.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})]})},v)),m.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:p,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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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,v)=>jsxRuntime.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},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,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"}),m?jsxRuntime.jsx("button",{onClick:b,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"}):jsxRuntime.jsx("button",{onClick:y,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 Kd={"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 IC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},RC={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 BC(e,t,r){let a=Kd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ii(e){return `$${e.toFixed(4)}`}var qd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=BC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),c=r.filter(m=>m.success),l=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Ro=new qd;function kf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(Ro.getStats()),[s,o]=react.useState(Ro.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let l=setInterval(()=>{n(Ro.getStats()),o(Ro.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),react.useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=Ro.getRecentOperations(5);return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:l=>l.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ii(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,m=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:l.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(d)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},l)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(l=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(l.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.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 Nf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=react.useState(""),[l,i]=react.useState(""),[d,m]=react.useState(""),[u,p]=react.useState(false),[f,x]=react.useState(null),[y,b]=react.useState(null),[h,v]=react.useState(null),w=react.useRef(null),C=u||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let P=D=>{D.key==="Escape"&&!C&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,C]);let M=()=>{C||(c(""),i(""),m(""),x(null),b(null),v(null),t());},F=async()=>{if(!(!o.trim()||C)){p(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{p(false);}}},k=()=>{y&&(r(y),M());};if(!e)return null;let N=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:M,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.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?jsxRuntime.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)"]}):jsxRuntime.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"}),jsxRuntime.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&&jsxRuntime.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"]}),jsxRuntime.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:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,D)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:w,value:o,onChange:P=>c(P.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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:P=>i(P.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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:P=>m(P.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&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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((P,D)=>jsxRuntime.jsx("button",{onClick:()=>c(P),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:P},D))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:M,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"}),y?jsxRuntime.jsx("button",{onClick:k,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"}):jsxRuntime.jsx("button",{onClick:F,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 Rl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(y=>{t&&yi(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(y,b,h)=>{a(v=>{let w=v.cards.find(P=>P.id===y);if(!w)return v;let C=w.columnId,M={...w,columnId:b,position:h},F=v.cards.map(P=>P.id===y?M:P),k=v.columns.map(P=>{if(P.id===C)return {...P,cardIds:P.cardIds.filter(D=>D!==y)};if(P.id===b){let D=F.filter(K=>K.columnId===b).sort((K,H)=>K.position-H.position);return {...P,cardIds:D.map(K=>K.id)}}return P}),N={...v,cards:F,columns:k};return n(N),N});},[n]),o=react.useCallback(async(y,b)=>{a(h=>{let v=h.cards.map(C=>C.id===y?{...C,...b}:C),w={...h,cards:v};return n(w),w});},[n]),c=react.useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b},w=h.columns.map(M=>M.id===y.columnId?{...M,cardIds:[...M.cardIds,b]}:M),C={...h,cards:[...h.cards,v],columns:w};return n(C),C});},[n]),l=react.useCallback(async y=>{a(b=>{let h=b.cards.find(M=>M.id===y);if(!h)return b;let v=b.cards.filter(M=>M.id!==y),w=b.columns.map(M=>M.id===h.columnId?{...M,cardIds:M.cardIds.filter(F=>F!==y)}:M),C={...b,cards:v,columns:w};return n(C),C});},[n]),i=react.useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,v]};return n(w),w});},[n]),d=react.useCallback(async(y,b)=>{a(h=>{let v=h.columns.map(C=>C.id===y?{...C,...b}:C),w={...h,columns:v};return n(w),w});},[n]),m=react.useCallback(async y=>{a(b=>{let h=b.cards.filter(C=>C.columnId!==y),v=b.columns.filter(C=>C.id!==y),w={...b,cards:h,columns:v};return n(w),w});},[n]),u=react.useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),b},[c]),p=react.useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=react.useCallback(()=>{a(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:l,deleteColumn:m,clearBoard:f}}}function Sf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Rl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(m=>m.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:react.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var li={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Mf={by:"none",order:"asc"};function Pf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...li,...e}),[s,o]=react.useState({...Mf,...t}),c=react.useCallback(x=>{n(y=>({...y,...x}));},[]),l=react.useCallback(x=>{o(y=>({...y,...x}));},[]),i=react.useCallback(()=>{n(li),o(Mf);},[]),d=react.useCallback(()=>{r&&n({...li,assignees:[r]});},[r]),m=react.useCallback(()=>{n({...li,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{n({...li,priorities:["HIGH","URGENT"]});},[]),p=react.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=react.useCallback(x=>{let y=[...x];if(a.search){let b=a.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),C=`${h}-${v}-${w}`;y=y.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let F=M.endDate||M.dueDate;if(!F)return false;let k;if(typeof F=="string")k=F.split("T")[0]||F;else {let N=F.getUTCFullYear(),P=String(F.getUTCMonth()+1).padStart(2,"0"),D=String(F.getUTCDate()).padStart(2,"0");k=`${N}-${P}-${D}`;}switch(a.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let N=new Date(C+"T00:00:00"),P=new Date(k+"T00:00:00"),D=new Date(N);return D.setDate(D.getDate()+7),P>=N&&P<=D;case "custom":if(a.dateRange){let K=typeof F=="string"?new Date(F):F;return K>=a.dateRange.start&&K<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(y=y.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>a.labels.includes(h)))),a.columns.length>0&&(y=y.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,C=h.createdAt?new Date(h.createdAt).getTime():0;v=w-C;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},F=M[b.priority||"LOW"],k=M[h.priority||"LOW"];v=F-k;break;case "dueDate":let N=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!N)return 1;if(!P)return -1;let D=typeof N=="string"?new Date(N).getTime():N.getTime(),K=typeof P=="string"?new Date(P).getTime():P.getTime();v=D-K;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let H=b.estimatedTime||0,ee=h.estimatedTime||0;v=H-ee;break;default:v=0;}return s.order==="asc"?v:-v}),y},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var Lf,Af;if(typeof window<"u")try{let e=fi("ai");Lf=e.generateObject,Af=e.generateText;}catch{}function If(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(Lf&&Af&&e.apiKey),o=react.useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),c=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),l=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(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(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function Xd(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function Rf(e){let{cards:t}=e,[r,a]=Xd(),n=react.useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=react.useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),y=t.find(b=>b.id===r.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,N)=>k.position-N.position),h=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===m),[w,C]=h<v?[h,v]:[v,h],M=b.slice(w,C+1).map(k=>k.id),F=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:F,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=react.useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=react.useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=react.useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Bf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function $f(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...Bf,...r}),[r]),[s,o]=react.useState([]),c=react.useCallback((x,y,b,h,v)=>{if(y.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:x,cardIds:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),l=react.useCallback(x=>{o(y=>y.filter(b=>b.id!==x));},[]),i=react.useCallback(x=>{o(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=react.useCallback((x,y)=>{o(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),m=react.useCallback((x,y)=>{o(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(w=>w!==y);return v.length<n.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),u=react.useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),p=react.useCallback(async x=>{let y=t.filter(C=>C.columnId===x);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(M=>{h.has(M)||h.set(M,[]),h.get(M).push(C);});}),h.forEach((C,M)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:C.map(F=>F.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${M}"`,confidence:.85});});let v=new Map;y.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(M=>{v.has(M)||v.set(M,[]),v.get(M).push(C);});}),v.forEach((C,M)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:C.map(F=>F.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,M)=>{if(C.length>=n.minCardsPerStack){let F={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${F} ${M} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${M} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let C of y){let F=(await a.findSimilar(C,y)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(F.length>=n.minCardsPerStack-1){let k=[C.id,...F.map(P=>P.card.id)],N=F.reduce((P,D)=>P+D.similarity,0)/F.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${F.length+1} similar tasks`,confidence:N});}}return b.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,M)=>M.confidence-C.confidence).slice(0,5)},[t,n,a]),f=react.useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await p(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var Of=react.createContext(null);function Hf({children:e,initialData:t,onStateChange:r}){let a=react.useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=fi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=fi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=fi("@libxai/core");c=new l(t.board);}a.current=new core.BoardStore({board:c,columns:s,cards:o});}let n=a.current;return react.useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(Of.Provider,{value:{store:n},children:e})}function Bl(){let e=react.useContext(Of);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function di(){let e=Bl(),[t,r]=react.useState(e.getBoard()),[a,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),l=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,v)=>{e.updateColumn(h,v);},[e]),d=react.useCallback(h=>{e.deleteColumn(h);},[e]),m=react.useCallback(h=>e.getColumn(h),[e]),u=react.useCallback(h=>{e.addCard(h);},[e]),p=react.useCallback((h,v)=>{e.updateCard(h,v);},[e]),f=react.useCallback(h=>{e.deleteCard(h);},[e]),x=react.useCallback((h,v,w)=>{e.moveCard(h,v,w);},[e]),y=react.useCallback(h=>e.getCard(h),[e]),b=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:y,getCardsByColumn:b}}function Wf(e){let{cards:t}=di();return react.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function zf(e="position",t="asc"){let{cards:r}=di();return react.useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-i;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}),[r,e,t])}var $l=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Fu.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},ZC=new $l;function Vf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:n,children:jsxRuntime.jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let y=l?l(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},y)})})})}function jf(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Kf({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=react.useRef(null),m=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:p,className:s,children:jsxRuntime.jsx("div",{style:f,children:u.map(x=>{let y=e[x.index];if(!y)return null;let b=l?l(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":x.index,children:n(y,x.index)},b)})})})}function qf(e){let t=reactVirtual.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 Yf(e,t=10){return e>t}var eu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},tu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ru={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},au={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},nu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},ou={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},su={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},iu={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)"},lu={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)"},cu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},du={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}},uu={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}},Ol={spacing:eu,borderRadius:tu,fontSize:ru,fontWeight:au,lineHeight:nu,zIndex:ou,duration:su,easing:iu,shadows:lu,opacity:cu,kanban:du,gantt:uu};function Xf(e,t,r){return e[t]??r}function pu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?pu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function r5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function mu(e="asakaa"){let t=pu(Ol),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=r5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function lg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=lg(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let s=r.find(c=>c.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return o.every(i=>l.includes(i))})}function md(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.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 p={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(p!==void 0){let f=new Date(a),x=f.getDay(),h=p-x;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),f=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?f.setDate(f.getDate()+u):p==="week"||p==="semana"||p==="semanas"?f.setDate(f.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&f.setMonth(f.getMonth()+u),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let u=parseInt(c[1],10),p=parseInt(c[2],10)-1,f=parseInt(c[3],10);return new Date(f,p,u)}let l={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),p=l[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,u)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let u=d[m[1].toLowerCase()],p=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,p)}return null}function gd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function fd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function cg(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 dg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Un(t,i),u=md(d);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:f},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Un(t,i),u=gd(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),m=Un(t,i),u=fd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Un(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),d=c[2].trim(),m=Un(t,i),u=Un(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let i=l[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function ug(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 Vw(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 jw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ul(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>ul(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},c=o(e.startDate),l=o(e.endDate),i=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:Vw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function pg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:jw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function mg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>ul(a,e,t))}var bd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},hd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},pl={en:bd,es:hd};function yd(e){return pl[e]||pl.en}function ml(e,t){let r=yd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var xd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function gg(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 fg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let p=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=gg(e),i=xd[0],d=xd.find(p=>p.value===l)??i,m=d.icon,u=p=>{switch(gg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:xd.map(p=>{let f=p.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",l===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var vd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function hg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let d=m=>{c.current&&!c.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let l=vd.find(d=>d.value===e)??vd[4],i=a==="es"?"es":"en";return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",l.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:vd.map(d=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function ei(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wd(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]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function bl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,c]=react.useState(false),[l,i]=react.useState(""),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{let x=h=>{d.current&&!d.current.contains(h.target)&&(c(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),p=x=>e.some(h=>h.name===x),f=x=>{if(r){if(p(x.name))r(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ei(x.name),color:x.color||wd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,h]);}c(false),i("");}};return s||!r?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&wd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ei(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),c(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&wd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ei(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:m,type:"text",value:l,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ei(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(y=>y.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let h=p(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{h||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ei(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Cg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:c=false,placeholder:l}){let[i,d]=react.useState(false),[m,u]=react.useState(n),[p,f]=react.useState(()=>{let E=n==="start"?e:t;if(E){let G=E instanceof Date?E:new Date(E);return new Date(G.getFullYear(),G.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null),[y,v]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let E=G=>{let O=G.target;x.current&&x.current.contains(O)||b.current&&b.current.contains(O)||d(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),react.useLayoutEffect(()=>{if(!i){v(null);return}let E=()=>{let G=h.current?.getBoundingClientRect();if(!G)return;let O=520,ee=360,I=window.innerHeight-G.bottom,Ae=I<ee&&G.top>I,H=Ae?G.top-4:G.bottom+4,ge=Math.min(Math.max(G.left,8),window.innerWidth-O-8);v({top:H,left:ge,flipUp:Ae});};return E(),window.addEventListener("scroll",E,true),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E);}},[i]),react.useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let P=E=>E?E.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):l||"-",L=react.useCallback(()=>{let E=p.getFullYear(),G=p.getMonth(),O=new Date(E,G,1),I=new Date(E,G+1,0).getDate(),Ae=O.getDay(),H=[],N=new Date(E,G,0).getDate();for(let Xe=Ae-1;Xe>=0;Xe--)H.push({date:new Date(E,G-1,N-Xe),isCurrentMonth:false});for(let Xe=1;Xe<=I;Xe++)H.push({date:new Date(E,G,Xe),isCurrentMonth:true});let De=42-H.length;for(let Xe=1;Xe<=De;Xe++)H.push({date:new Date(E,G+1,Xe),isCurrentMonth:false});return H},[p]),k=E=>{if(a)n==="start"?r(E,C||void 0):r(w||void 0,E),d(false);else if(m==="start"){let G=C&&E>C?E:C;r(E,G||void 0),u("end");}else {let G=w&&E<w?E:w;r(G||void 0,E),d(false);}},D=()=>{let E=new Date,G=new Date(E);G.setDate(E.getDate()+1);let O=new Date(E);O.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let ee=new Date(E);ee.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Ae=new Date(E);Ae.setDate(E.getDate()+14);let H=new Date(E);return H.setDate(E.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:G,display:G.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ee,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:Ae,display:Ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let E=a&&n==="start"?w:C;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:P(E)})]})}let F=a&&n==="start"?w:C;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,onClick:E=>{E.stopPropagation(),d(!i);let G=n==="start"?w:C;G&&f(new Date(G.getFullYear(),G.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:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:P(F)})]}),i&&y&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:b,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:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((E,G)=>jsxRuntime.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:()=>k(E.date),children:[jsxRuntime.jsx("span",{children:E.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:E.display})]},G)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,C||void 0):r(w||void 0,void 0):r(void 0,void 0),d(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:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!a&&jsxRuntime.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:m==="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"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:p.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.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"}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.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(E=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:L().map((E,G)=>{let O=E.date.toDateString()===new Date().toDateString(),ee=w?.toDateString()===E.date.toDateString(),I=C?.toDateString()===E.date.toDateString(),Ae=ee||I,H=!a&&w&&C&&E.date>=w&&E.date<=C;return jsxRuntime.jsx("button",{onClick:()=>k(new Date(E.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",ee&&"bg-[#00E5CC] text-white",I&&!ee&&"bg-[#7C3AED] text-white",H&&!Ae&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ae&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:E.date.getDate()},G)})})]})]}),document.body)]})}function yl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Cg,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:c||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function fs(e=600){let[t,r]=react.useState(false),a=react.useRef(null),n=react.useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return react.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function xl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=react.useState(e),[c,l]=react.useState(false),i=react.useRef(e),d=react.useRef([]);return react.useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,f=a/n;l(true);for(let x=1;x<=n;x++){let h=setTimeout(()=>{let b=x/n,y=1-Math.pow(1-b,3),v=Math.round(m+p*y);o(v),x===n&&(l(false),o(u));},f*x);d.current.push(h);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:c}}function Tg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=react.useState(null),[o,c]=react.useState(0),l=react.useRef(null),i=react.useRef(null),d=react.useCallback(p=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(p),c(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,h=Math.min(x/r*100,100);c(h);},16),l.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),c(0);},r);},[r,e]),m=react.useCallback(()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(null),c(0),a?.();},[a]);return react.useEffect(()=>()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function Dg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,c]=react.useState(false),[l,i]=react.useState(""),d=react.useRef(null),{isFlashing:m,triggerFlash:u}=fs(),{displayValue:p,isAnimating:f}=xl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),P=w.clientX-C.left,L=Math.round(P/C.width*100),k=Math.max(0,Math.min(100,L));k!==e&&(t(k),s&&u());},h=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),c(true));},[a,t,e]);react.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=react.useCallback(()=>{c(false);let w=parseInt(l,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&u());}},[l,t,e,s,u]),y=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&c(false);},[b]),v=p??e;return jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),o?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:d,value:l,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Mg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=react.useState(false),[c,l]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{l(e);},[e]);let d=()=>{c!==e&&t?.(c),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(l(e),o(false));};return n||!t?jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:c,onChange:u=>l(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Lg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:c=true,enableSaveFlash:l=true}){let[i,d]=react.useState(false),[m,u]=react.useState(e?.toString()||""),p=react.useRef(null),{isFlashing:f,triggerFlash:x}=fs(),{displayValue:h,isAnimating:b}=xl(e,{enabled:c&&!i});react.useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),react.useEffect(()=>{u(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(m);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),l&&x());}d(false);},v=w=>{w.key==="Enter"?y():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:a}):i?jsxRuntime.jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:y,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:a})}function Ag({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,c]=react.useState(false),l=react.useRef(null);return react.useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&c(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),c(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),c(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Rg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:c,progress:l,startChange:i,cancelChange:d}=Tg(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?c?d():i(!e):t(!e));},u=c?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:m,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&u&&"ring-green-500/50",c&&!u&&"ring-red-500/50",c&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[c&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${l/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"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:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Bg({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:c=2}){let[l,i]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&i(false);};return l&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]);let m=e.slice(0,c),u=e.length-m.length,p=e.length===0?n:m.join(", ")+(u>0?` +${u}`:"");if(s||!r)return jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:p});let f=h=>{let b=e.includes(h),y=b?e.filter(v=>v!==h):[...e,h];!b&&o!=null&&e.length>=o||r(y);},x=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),i(!l);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",e.length===0&&(a?"text-white/30":"text-gray-400")),children:p}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),l&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let b=e.includes(h),y=!b&&x;return jsxRuntime.jsxs("button",{disabled:y,onClick:v=>{v.stopPropagation(),f(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",y?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:h}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Lk(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 Hg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Lk(e);if(n.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:r});let s=n[0],o=n.length-1,c=o>0?`${s.name} +${o}`:s.name;return a?jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),a(s);},title:n.map(l=>l.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:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:c})]}):jsxRuntime.jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),c]})}function zg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsxRuntime.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&&jsxRuntime.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 Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}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 Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=react.useState(false),[p,f]=react.useState(""),x=react.useRef(null),{isFlashing:h,triggerFlash:b}=fs(),y=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);react.useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?f(`${k}h ${D}m`):k>0?f(`${k}h`):f(`${D}m`);}else f("");},[e,m]);let C=()=>{let k=Bk(p);k!==e&&(t?.(k),o&&b()),u(false);},P=k=>{k.key==="Enter"?C():k.key==="Escape"&&u(false);};if(c)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let L=y?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(L,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsxRuntime.jsx("input",{ref:x,type:"text",value:p,onChange:k=>f(k.target.value),onBlur:C,onKeyDown:P,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),u(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",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(L,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function _g({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function qg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,m=H=>d?`$${Math.round(H*l).toLocaleString("en-US")}`:`${H}h`,[u,p]=react.useState(false),[f,x]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(v/60*10)/10,L=Math.round(w/60*10)/10,k=w>0?v/w*100:0,D=k>100?Math.round((v-w)/60*10)/10:0,F=k>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let H=ge=>{y.current&&!y.current.contains(ge.target)&&(x(false),b(null));};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[f,h]);let E=H=>{if(H.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(ge=>!ge),b(null);return}o&&o(e);},G=H=>{x(false),b(H);},O=async(H,ge)=>{h==="log"&&a&&H?a(e,H,ge):h==="estimate"&&n?n(e,H):h==="quoted"&&s&&s(e,H),b(null);},ee=a||n||s||o,I=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(H=>H.show),Ae=h==="estimate"?w:h==="quoted"?C:void 0;return w===0&&v===0&&C===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:H=>H.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&ee&&jsxRuntime.jsx("button",{onClick:E,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:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",H.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",H.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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:I.map(H=>jsxRuntime.jsxs("button",{onClick:ge=>{ge.stopPropagation(),G(H.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:ge=>{ge.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ge=>{ge.target.style.background="transparent";},children:[jsxRuntime.jsx(H.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),H.label]},H.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:H=>H.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.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 H=v===0,N=(w>0?v/w:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:H?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(P)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(L)]}),D>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:N?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:N?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(D)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:F,borderRadius:2,transition:"width 0.3s"}})})]}),ee&&jsxRuntime.jsx("button",{onClick:E,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",H.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",H.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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:I.map(H=>jsxRuntime.jsxs("button",{onClick:ge=>{ge.stopPropagation(),G(H.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:ge=>{ge.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ge=>{ge.target.style.background="transparent";},children:[jsxRuntime.jsx(H.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),H.label]},H.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(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 Yg({assignee:e,size:t=28,isDark:r}){let a=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?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Xg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsxRuntime.jsx(Yg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Vk(c):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Yg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[c,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Qg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function o0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?t0.es:t0.en,[v,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=b.current;if(!D)return;let F=D.getBoundingClientRect(),E=8,G=e.x,O=e.y;e.y+F.height>window.innerHeight-E&&(O=Math.max(E,e.y-F.height)),e.x+F.width>window.innerWidth-E&&(G=Math.max(E,window.innerWidth-F.width-E)),(G!==e.x||O!==e.y)&&w({left:G,top:O});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let D=E=>{b.current&&!b.current.contains(E.target)&&t();},F=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",F),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",F);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let D=[];return n&&D.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),c&&(D.push({id:"status",label:y.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:y.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&D.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(F=>({id:`assign-${F.id}`,label:F.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:F.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],O=E.some(ee=>ee.name===F.name)?E.filter(ee=>ee.name!==F.name):[...E,{name:F.name,initials:s1(F.name),color:F.color||i1(F.name),avatar:F.avatarUrl}];c({...e.task,assignees:O}),t();}}))})),m&&D.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&D.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&D.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),f&&(D.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),D.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&D.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&D.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&D.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),D},P=()=>{if(!e.columnId)return [];let D=[];return i&&(D.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),D},L=e.type==="task"?C():P(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:k,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:L.map(D=>D.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsxRuntime.jsx(l1,{item:D,isDark:r},D.id):jsxRuntime.jsxs("button",{onClick:D.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(D.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function l1({item:e,isDark:t}){let[r,a]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsxRuntime.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(c=>jsxRuntime.jsxs("button",{onClick:c.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var t0={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 m0={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"}),multiselect:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),person:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),file:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function f0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=react.useState(""),[d,m]=react.useState(null),[u,p]=react.useState(null),f=react.useRef(null),x=c==="es"?g0.es:g0.en;react.useLayoutEffect(()=>{if(!e||!f.current)return;let L=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let G=k.getBoundingClientRect();p({top:G.bottom+4,right:window.innerWidth-G.right});}let D=f.current.getBoundingClientRect(),E=window.innerHeight-D.top-20;m(Math.max(300,E));};return requestAnimationFrame(L),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[e]),react.useEffect(()=>{if(!e)return;let L=setTimeout(()=>{let k=F=>{f.current&&!f.current.contains(F.target)&&t();},D=F=>{F.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",D),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(L),f._cleanup&&f._cleanup();}},[e,t]);let h=react.useMemo(()=>{let L=new Set([...N1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&L.add(k.type);}),Array.from(L)},[r]);if(!e)return null;let b=L=>{let k=x.columns[L];if(k)return k;let D=r.find(F=>F.type===L);return D?.label?D.label:L},y=L=>{if(L==="name")return;let k=r.map(D=>D.id===L?{...D,visible:!D.visible}:D);n(k);},v=(L,k)=>{let D=r.find(E=>E.type===L&&(!k||E.customFieldId===k));if(D){y(D.id);return}let F={id:k||L,type:L,label:k?a.find(E=>E.id===k)?.name||L:b(L),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,F]);},w=h.filter(L=>L!=="assignees"&&b(L).toLowerCase().includes(l.toLowerCase())),C=a.filter(L=>L.name.toLowerCase().includes(l.toLowerCase())),P=o?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:f,style:{...d?{maxHeight:`${d}px`}:{},...u?{top:u.top,right:u.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",L.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:l,onChange:L=>i(L.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"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:L=>{L&&L.style.setProperty("--focus-border",P);},onFocus:L=>{L.currentTarget.style.borderColor=P,L.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:L=>{L.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:w.map(L=>{let k=r.find(E=>E.type===L&&!E.customFieldId),D=k?.visible??false,F=L==="name";return jsxRuntime.jsxs("button",{onClick:()=>{F||(k?y(k.id):v(L));},disabled:F,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:F?.4:1,cursor:F?"not-allowed":"pointer"},onMouseEnter:E=>{F||(E.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?P:"transparent",border:D?`1.5px solid ${P}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${P}40`:"none"},children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?P:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:m0[L]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(L),children:b(L)})]},L)})})]}),C.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(L=>{let D=r.find(F=>F.customFieldId===L.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(L.type,L.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?P:"transparent",border:D?`1.5px solid ${P}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${P}40`:"none"},children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?P:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:m0[L.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:L.name})]},L.id)})})]})]})]})}var g0={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 I1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function y0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[c,l]=react.useState("text"),[i,d]=react.useState([""]),m=n==="es"?h0.es:h0.en;react.useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:c};c==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>l(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:c===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:g("text-xs",c===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),c==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsxRuntime.jsx("button",{onClick:u,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:m.create})]})]})]}):null}var h0={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 w0={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 k0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=react.useState(false),l=react.useRef(null),i=react.useRef(0),d=s==="es"?w0.es:w0.en;react.useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},f=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),c(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",u&&(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:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),d.filters,u&&jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(p.value),a(false),c(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:[jsxRuntime.jsx("span",{className:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsxRuntime.jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),c(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:[jsxRuntime.jsx(lucideReact.EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function C0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function go(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function T0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxRuntime.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:[jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsxRuntime.jsx("button",{onClick:a,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:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.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 l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=l-d,u=l>0?Math.round(m/l*100):0,p=l-i,f=l>0?Math.round(p/l*100):0,x=l>0?Math.min(Math.round(d/l*100),120):0,h=d>l&&l>0,b=h?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(l)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=v>0||w>0,P=(L,k)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(k)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(i)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P(o?"Mano de obra":"Labor",y),v>0&&P(o?"Activos":"Equipment",v),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=v>0||w>0,P=(L,k)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(k)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:go(d)})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[P(o?"Mano de obra":"Labor",y),v>0&&P(o?"Activos":"Equipment",v),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),l>0&&jsxRuntime.jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(x,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=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:[jsxRuntime.jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxRuntime.jsxs("div",{className:"text-base",children:[p>=0?"+":"",go(p),l>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsxRuntime.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"})]}),jsxRuntime.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:[m>=0?`+${go(m)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,l>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,p=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:C0(l)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:C0(i)})]}),i>0&&jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.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}),jsxRuntime.jsxs("div",{children:[jsxRuntime.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"}),jsxRuntime.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&&jsxRuntime.jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxRuntime.jsxs("button",{onClick:()=>s?.(l.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:[jsxRuntime.jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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 l=e.scheduleVarianceDays??0,i=l>0,d=l<0,m=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.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"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var X1=[{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 L0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...L0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ws(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ws(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function vs(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=react.useState(false),[s,o]=react.useState(String(e||""));return a?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.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",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function P0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Ud(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Ud(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function A0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,allowColumnCustomization:w=true,allowColumnResize:C=true,enableContextMenu:P=true,showCreateTaskButton:L=false,onCreateTask:k,persistFilter:D=false,financialBlur:F,healthSidebar:E,lens:G="hours",hourlyRate:O=0,rateMap:ee,aggregateParentHours:I=false,showProjectTotals:Ae=false,totalsDollarOverride:H}=t,ge=ml(f,x),N=p==="dark",De=S=>{if(!ee||!S.assignees||S.assignees.length===0)return O;let J=0,me=0;for(let Ce of S.assignees){let We=Ce.id?ee[Ce.id]:void 0;if(We==null||We<=0)continue;let re=typeof Ce.estimatedMinutes=="number"?Ce.estimatedMinutes:0;re>0&&(J+=We*re,me+=re);}if(me>0)return J/me;let ve=S.assignees.map(Ce=>Ce.id?ee[Ce.id]:void 0).filter(Ce=>Ce!=null&&Ce>0);return ve.length===0?O:ve.reduce((Ce,We)=>Ce+We,0)/ve.length},Xe=S=>{let J=0,me=0,ve=0,Ce=We=>{for(let re of We)if(re.subtasks&&re.subtasks.length>0){let we={s:J,a:me,q:ve};if(Ce(re.subtasks),J-we.s+(me-we.a)+(ve-we.q)===0){let at=De(re);J+=(re.timeLoggedMinutes??0)/60*at,me+=(re.effortMinutes??0)/60*at,ve+=(re.soldEffortMinutes??0)/60*at;}}else {let we=De(re);J+=(re.timeLoggedMinutes??0)/60*we,me+=(re.effortMinutes??0)/60*we,ve+=(re.soldEffortMinutes??0)/60*we;}};return S.subtasks&&Ce(S.subtasks),{dollarSpent:J,dollarAllocated:me,dollarQuoted:ve}},He=react.useCallback(()=>{if(!D||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(D);if(S){let J=JSON.parse(S);return {statusFilter:J.statusFilter||"all",hideCompleted:J.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[D]),Y=react.useMemo(()=>{function S(J){let me=0,ve=0,Ce=0,We=0,re=0,we=0;for(let ze of J)if(ze.subtasks&&ze.subtasks.length>0){let at=S(ze.subtasks);if(at.spent+at.allocated+at.quoted>0)me+=at.spent,ve+=at.allocated,Ce+=at.quoted,We+=at.dollarSpent,re+=at.dollarAllocated,we+=at.dollarQuoted;else {let bt=ze.timeLoggedMinutes??0,mt=ze.effortMinutes??0,mr=ze.soldEffortMinutes??0;me+=bt,ve+=mt,Ce+=mr;let xr=De(ze);We+=bt/60*xr,re+=mt/60*xr,we+=mr/60*xr;}}else {let at=ze.timeLoggedMinutes??0,tt=ze.effortMinutes??0,bt=ze.soldEffortMinutes??0;me+=at,ve+=tt,Ce+=bt;let mt=De(ze);We+=at/60*mt,re+=tt/60*mt,we+=bt/60*mt;}return {spent:me,allocated:ve,quoted:Ce,dollarSpent:We,dollarAllocated:re,dollarQuoted:we}}return S(e)},[e]),Ee=react.useMemo(()=>{let S=new Map;function J(me){let ve=0;for(let Ce of me)if(Ce.subtasks&&Ce.subtasks.length>0){let We=J(Ce.subtasks);S.set(Ce.id,We),ve+=We;}else ve+=Ce.weight||0;return ve}return J(e),S},[e]),te=react.useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:Y.spent,totalHoursAllocatedMinutes:Y.allocated}},[E,Y]),[Be,Se]=react.useState(true),[Le,$e]=react.useState(null),[Ye,le]=react.useState("position"),[Qe,je]=react.useState("asc"),[Ie,Ct]=react.useState(""),[it,qe]=react.useState(()=>He().statusFilter),[Pe,xt]=react.useState(()=>He().hideCompleted),[St,Re]=react.useState(y||X1),[ct,A]=react.useState(false),[X,B]=react.useState(false),[q,ce]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ue,_e]=react.useState(null),[V,ye]=react.useState(false),[Fe,Ue]=react.useState(null),[dt,Ze]=react.useState(null),[Tt,gt]=react.useState(null),rr=react.useRef(0),ar=react.useRef(false),Er=!!(r.onTaskMove||r.onTaskReparent),[_t,Mr]=react.useState(null),[Ft,Pr]=react.useState(null),Kt=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,qt=react.useRef([]),ea=react.useCallback((S,J)=>{Er&&(J.preventDefault(),rr.current=J.clientY,_e(S),ar.current=false,ye(false),gt({x:J.clientX,y:J.clientY}));},[Er]),pa=react.useCallback(S=>{if(!ue||(Math.abs(S.clientY-rr.current)>5&&!ar.current&&(ar.current=true,ye(true)),gt({x:S.clientX,y:S.clientY}),!ar.current))return;let me=document.querySelectorAll("[data-listview-row]"),ve=null,Ce=null;me.forEach(We=>{let re=We.getBoundingClientRect(),we=We.getAttribute("data-listview-row");if(we&&we!==ue&&S.clientY>=re.top&&S.clientY<=re.bottom){ve=we;let ze=S.clientY-re.top,at=re.height;Ce=ze<at*.25?"above":ze>at*.75?"below":"child";}}),Ue(ve),Ze(Ce);},[ue]),et=react.useCallback(()=>{if(ar.current&&ue&&Fe&&dt){if(dt==="child"&&r.onTaskReparent)r.onTaskReparent(ue,Fe);else if(dt==="above"||dt==="below"){let S=(ve,Ce,We=null)=>{for(let re of ve){if(re.id===Ce)return We;if(re.subtasks){let we=S(re.subtasks,Ce,re.id);if(we!==void 0)return we}}},J=S(e,ue,null),me=S(e,Fe,null);if(r.onTaskReparent){let ve=(at,tt)=>{if(tt===null)return at;for(let bt of at){if(bt.id===tt)return bt.subtasks||[];if(bt.subtasks){let mt=ve(bt.subtasks,tt);if(mt.length>0||bt.subtasks.some(mr=>mr.id===tt))return mt}}return []},Ce=ve(e,me??null),We=Ce.findIndex(at=>at.id===Fe),re=J===me,we=re?Ce.findIndex(at=>at.id===ue):-1,ze=dt==="below"?We+1:We;re&&we!==-1&&we<We&&(ze-=1),r.onTaskReparent(ue,me??null,Math.max(0,ze));}}}_e(null),Ue(null),Ze(null),gt(null),ar.current=false,ye(false);},[ue,Fe,dt,e,r]),Ke=(S,J)=>J==="assignees"?S.assignees:J==="startDate"?S.startDate:S.endDate,ha=(S,J,me,ve)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ce=Array.from(document.querySelectorAll("[data-listview-row]")),We=Ce.map(Et=>Et.getAttribute("data-listview-row")||""),re=Math.max(0,We.indexOf(J)),we=Et=>We.slice(re,Et+1);Pr({sourceTaskId:J,column:me,sourceIndex:ve,targetIndex:ve,rangeIds:new Set([J])});let at=(Et=>{let Lt=Et?.parentElement??null;for(;Lt;){let Ta=window.getComputedStyle(Lt).overflowY;if((Ta==="auto"||Ta==="scroll")&&Lt.scrollHeight>Lt.clientHeight)return Lt;Lt=Lt.parentElement;}let Fr=document.scrollingElement;return Fr&&Fr.scrollHeight>Fr.clientHeight?Fr:null})(S.currentTarget),tt=Et=>{let Lt=re,Fr=false;Ce.forEach((Ta,ma)=>{let Yr=Ta.getBoundingClientRect();Et>=Yr.top&&Et<=Yr.bottom&&(Lt=ma,Fr=true);});let kr=Ce[Ce.length-1];if(!Fr&&kr){let Ta=kr.getBoundingClientRect();Et>Ta.bottom&&(Lt=Ce.length-1);}return Lt<re&&(Lt=re),Lt},bt=S.clientY,mt=null,mr=()=>{mt!==null&&(cancelAnimationFrame(mt),mt=null);},xr=()=>{let Et=tt(bt),Lt=new Set(we(Et));Pr(Fr=>Fr&&{...Fr,targetIndex:Et,rangeIds:Lt});},zr=()=>{if(mr(),!at)return;let Et=at,Fr=Et===document.scrollingElement?{top:0,bottom:window.innerHeight}:Et.getBoundingClientRect(),kr=60,Ta=12,ma=bt-Fr.top,Yr=Fr.bottom-bt,yo=Et.scrollHeight-Et.clientHeight;if(Yr<kr&&Et.scrollTop<yo){let Ns=Math.max(1,Math.round(Ta*(1-Math.max(0,Yr)/kr))),Fn=()=>{Et.scrollTop+=Ns,xr(),Et.scrollTop<Et.scrollHeight-Et.clientHeight&&(mt=requestAnimationFrame(Fn));};mt=requestAnimationFrame(Fn);}else if(ma<kr&&Et.scrollTop>0){let Ns=Math.max(1,Math.round(Ta*(1-Math.max(0,ma)/kr))),Fn=()=>{Et.scrollTop-=Ns,xr(),Et.scrollTop>0&&(mt=requestAnimationFrame(Fn));};mt=requestAnimationFrame(Fn);}},$t=Et=>{bt=Et.clientY,xr(),zr();},Wt=Et=>{window.removeEventListener("mousemove",$t),window.removeEventListener("mouseup",Wt),mr(),document.body.style.cursor="",document.body.style.userSelect="",Pr(null);let Lt=tt(Et.clientY),Fr=new Map(qt.current.map(Yr=>[Yr.id,Yr])),kr=Fr.get(J);if(!kr)return;let Ta=Ke(kr,me),ma=[];for(let Yr of we(Lt)){if(Yr===J)continue;let yo=Fr.get(Yr);yo&&(yo.subtasks&&yo.subtasks.length>0||ma.push(Yr));}ma.length>0&&r.onBulkFill?.(ma,me,Ta);};window.addEventListener("mousemove",$t),window.addEventListener("mouseup",Wt);},_r=S=>Ft?Ft.rangeIds.has(S):false;react.useEffect(()=>{if(ue)return document.addEventListener("mousemove",pa),document.addEventListener("mouseup",et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",pa),document.removeEventListener("mouseup",et),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,pa,et]);let[pr,Kr]=react.useState("all"),[sa,se]=react.useState(false),pe=react.useRef(null),ft=react.useRef(null),j=react.useMemo(()=>{let S=0;function J(me,ve){for(let Ce of me)ve>S&&(S=ve),Ce.subtasks?.length&&J(Ce.subtasks,ve+1);}return J(e,1),S},[e]);react.useEffect(()=>{if(!sa)return;let S=J=>{pe.current?.contains(J.target)||ft.current?.contains(J.target)||se(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[sa]),react.useEffect(()=>{if(pr==="all"){let me=function(ve){for(let Ce of ve)Ce.subtasks?.length&&(Ce.isExpanded===false&&r.onTaskToggleExpand?.(Ce.id),me(Ce.subtasks));};me(e);}else {let me=function(ve,Ce){for(let We of ve)if(We.subtasks?.length){let re=Ce<pr,we=We.isExpanded!==false;re!==we&&r.onTaskToggleExpand?.(We.id),me(We.subtasks,Ce+1);}};me(e,1);}},[pr]);let[fe,Q]=react.useState(null),[$,Z]=react.useState(0),[xe,T]=react.useState(0),U=react.useRef(null),[de,_]=react.useState(null),[ke,st]=react.useState(null);react.useEffect(()=>{y&&Re(S=>{if(S.length===y.length){let J=true;for(let me=0;me<S.length;me++){let ve=S[me],Ce=y[me];if(!ve||!Ce||ve.id!==Ce.id||ve.visible!==Ce.visible||ve.width!==Ce.width||ve.label!==Ce.label){J=false;break}}if(J)return S}return y});},[y]),react.useEffect(()=>{if(!(!D||typeof window>"u"))try{localStorage.setItem(D,JSON.stringify({statusFilter:it,hideCompleted:Pe}));}catch(S){console.error("Error persisting filter state:",S);}},[D,it,Pe]);let oe=react.useMemo(()=>{let S=new Set;function J(me){for(let ve of me)ve.subtasks?.length&&(ve.isExpanded!==false&&S.add(ve.id),J(ve.subtasks));}return J(e),S},[e]),rt=react.useMemo(()=>St.filter(S=>S.visible),[St]),pt=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),Ut=react.useCallback(S=>{Ye===S?je(J=>J==="asc"?"desc":"asc"):(le(S),je("asc")),r.onSortChange?.({column:S,direction:Qe==="asc"?"desc":"asc"});},[Ye,Qe,r]),Qt=react.useCallback(S=>{Re(S),r.onColumnsChange?.(S);},[r]),ya=react.useCallback(S=>{let J=St.map(me=>me.id===S?{...me,visible:false}:me);Qt(J);},[St,Qt]),Wr=react.useCallback((S,J)=>{le(S),je(J);},[]),Ga=react.useCallback((S,J,me)=>{P&&(S.preventDefault(),ce({isOpen:true,x:S.clientX,y:S.clientY,type:J?"task":"header",task:J,columnId:me}));},[P]),lr=react.useCallback(()=>{ce(S=>({...S,isOpen:false}));},[]),Ba=react.useCallback((S,J)=>{if(!C)return;S.preventDefault(),S.stopPropagation();let me=St.find(ve=>ve.id===J);me&&(Q(J),Z(S.clientX),T(me.width));},[St,C]);react.useEffect(()=>{if(!fe)return;let S=St,J=ve=>{let Ce=ve.clientX-$,We=Math.max(50,xe+Ce);S=S.map(re=>re.id===fe?{...re,width:We}:re),Re(S);},me=()=>{r.onColumnsChange?.(S),Q(null);};return document.addEventListener("mousemove",J),document.addEventListener("mouseup",me),()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",me);}},[fe,$,xe,r]);let Wo=react.useCallback((S,J)=>{if(J==="name"){S.preventDefault();return}_(J),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",J),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Pn=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),_(null),st(null);},[]),_n=react.useCallback((S,J)=>{S.preventDefault(),J!=="name"&&(S.dataTransfer.dropEffect="move",st(J));},[]),zo=react.useCallback(()=>{st(null);},[]),gi=react.useCallback((S,J)=>{if(S.preventDefault(),!de||de===J||J==="name")return;let me=[...St],ve=me.findIndex(re=>re.id===de),Ce=me.findIndex(re=>re.id===J);if(ve===-1||Ce===-1)return;let We=me.splice(ve,1);We[0]&&(me.splice(Ce,0,We[0]),Qt(me),_(null),st(null));},[de,St,Qt]),qr=react.useCallback(async S=>{if(r.onCreateCustomField){let J={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(J);}B(false);},[r]),ho=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),xa=react.useMemo(()=>{let S=L0(e);if(Ie.trim()){let J=Ie.toLowerCase();S=S.filter(me=>me.name.toLowerCase().includes(J));}if(it!=="all"){let J=new Set(S.filter(me=>ho(me)===it).flatMap(me=>me.parentPath));S=S.filter(me=>J.has(me.id));}if(Pe){let J=new Set(S.filter(me=>ho(me)!=="completed").flatMap(me=>me.parentPath));S=S.filter(me=>J.has(me.id));}return S.sort((J,me)=>{let ve,Ce;switch(Ye){case "name":ve=J.name.toLowerCase(),Ce=me.name.toLowerCase();break;case "startDate":ve=J.startDate?.getTime()||0,Ce=me.startDate?.getTime()||0;break;case "endDate":ve=J.endDate?.getTime()||0,Ce=me.endDate?.getTime()||0;break;case "progress":ve=J.progress||0,Ce=me.progress||0;break;case "status":ve=J.status||"todo",Ce=me.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ve=We[J.priority]??4,Ce=We[me.priority]??4;break;case "position":return 0;default:return 0}return ve<Ce?Qe==="asc"?-1:1:ve>Ce?Qe==="asc"?1:-1:0}),S},[e,Ie,it,Pe,Ye,Qe,ho]);qt.current=xa;let en=react.useCallback((S,J)=>{let me=We=>{r.onTaskUpdate?.({...S,...We});},ve=We=>We?S.customFields?.find(we=>we.fieldId===We)?.value:void 0,Ce=(We,re)=>{if(!We)return;let ze=[...S.customFields||[]],at=ze.findIndex(tt=>tt.fieldId===We);at>=0?ze[at]={fieldId:We,value:re}:ze.push({fieldId:We,value:re}),me({customFields:ze});};switch(J.type){case "name":return null;case "status":return jsxRuntime.jsx(fg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:re=>{me({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:N,locale:f,translations:ge.status});case "priority":return jsxRuntime.jsx(hg,{value:S.priority,onChange:re=>me({priority:re}),isDark:N,locale:f});case "assignees":{let re=S.hasChildren,we=S.assignees||[];if(re&&S.subtasks?.length){let ze=new Map,at=tt=>{(tt||[]).forEach(bt=>{(bt.assignees||[]).forEach(mt=>{ze.has(mt.name)||ze.set(mt.name,mt);}),bt.subtasks?.length&&at(bt.subtasks);});};at(S.subtasks),we=Array.from(ze.values());}else re&&(we=[]);return jsxRuntime.jsx(bl,{value:we,availableUsers:c,onChange:ze=>me({assignees:ze}),isDark:N,locale:f,disabled:re})}case "startDate":return jsxRuntime.jsx(yl,{value:S.startDate,onChange:re=>me({startDate:re}),isDark:N,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(yl,{value:S.endDate,onChange:re=>me({endDate:re}),isDark:N,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let re=!!(S.subtasks&&S.subtasks.length>0),we=re?P0(Ud(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Dg,{value:we,onChange:re?void 0:ze=>{let at=ze===100?"completed":ze>0?"in-progress":"todo";me({progress:ze,status:at});},isDark:N,disabled:re})}case "tags":return jsxRuntime.jsx(zg,{value:S.tags||[],isDark:N});case "text":return jsxRuntime.jsx(Mg,{value:ve(J.customFieldId)||"",onChange:re=>Ce(J.customFieldId,re),isDark:N});case "number":return jsxRuntime.jsx(Lg,{value:ve(J.customFieldId)||0,onChange:re=>Ce(J.customFieldId,re),isDark:N});case "date":let We=ve(J.customFieldId);return jsxRuntime.jsx(yl,{value:We?new Date(We):void 0,onChange:re=>Ce(J.customFieldId,re),isDark:N,locale:f});case "dropdown":return jsxRuntime.jsx(Ag,{value:ve(J.customFieldId)||"",options:J.options||[],onChange:re=>Ce(J.customFieldId,re),isDark:N});case "checkbox":return jsxRuntime.jsx(Rg,{value:ve(J.customFieldId)||false,onChange:re=>Ce(J.customFieldId,re),isDark:N});case "multiselect":return jsxRuntime.jsx(Bg,{value:ve(J.customFieldId)||[],options:J.options||[],onChange:re=>Ce(J.customFieldId,re),isDark:N,maxSelectable:J.maxSelectable});case "person":{let re=ve(J.customFieldId)||[];return jsxRuntime.jsx(bl,{value:re.map(we=>({name:we.name,avatar:we.avatar,initials:we.initials||(we.name||"?").slice(0,2).toUpperCase(),color:we.color||"#00E5CC"})),availableUsers:c,onChange:we=>Ce(J.customFieldId,we),isDark:N,locale:f})}case "file":return jsxRuntime.jsx(Hg,{value:ve(J.customFieldId),isDark:N,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ia,{value:S.estimatedTime,onChange:we=>me({estimatedTime:we}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)})}case "quotedTime":{let re=S.status==="completed"||S.progress===100,we=F?.enabled&&(!F.columns||F.columns.includes("quotedTime"));return jsxRuntime.jsx(Ia,{value:S.quotedTime,onChange:ze=>me({quotedTime:ze}),isDark:N,locale:f,disabled:re,isBlurred:we,lens:G,hourlyRate:De(S)})}case "elapsedTime":{let re=S.status==="completed"||S.progress===100,we=S.executedDollarsCanonical;return jsxRuntime.jsx(Ia,{value:S.elapsedTime,onChange:ze=>me({elapsedTime:ze}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S),financialOverride:we})}case "effortMinutes":{if(I&&S.subtasks&&S.subtasks.length>0){let{allocated:tt}=ws(S);if(G==="financial"){let bt=Xe(S),mt=Math.round(bt.dollarAllocated),mr=Math.round(bt.dollarQuoted),xr=mr-mt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[mt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",mt.toLocaleString("es-CO")]}):null,xr!==0&&mt>0&&mr>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xr>0?"+":"",Math.abs(xr)>=1e3?`$${(xr/1e3).toFixed(1)}K`:`$${xr}`]})]})}return jsxRuntime.jsx(Ia,{value:tt>0?tt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:O})}let re=S.status==="completed"||S.progress===100,we=S.effortMinutes||0,ze=S.soldEffortMinutes||0,at=De(S);if(G==="financial"&&at&&we>0&&ze>0){let tt=Math.round(we/60*at),mt=Math.round(ze/60*at)-tt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Ia,{value:we,onChange:mr=>me({effortMinutes:mr}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)}),mt!==0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",mt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[mt>0?"+":"",Math.abs(mt)>=1e3?`$${(mt/1e3).toFixed(1)}K`:`$${mt}`]})]})}return jsxRuntime.jsx(Ia,{value:we,onChange:tt=>me({effortMinutes:tt}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)})}case "timeLoggedMinutes":{let re=S.executedDollarsCanonical;if(I&&S.subtasks&&S.subtasks.length>0){let{spent:ze}=ws(S);return jsxRuntime.jsx(Ia,{value:ze>0?ze:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S),financialOverride:re})}let we=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?ze=>{r.onLogTime?.(S,ze);}:void 0,isDark:N,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:we,lens:G,hourlyRate:De(S),financialOverride:re})}case "soldEffortMinutes":{if(I&&S.subtasks&&S.subtasks.length>0){let{quoted:ze}=ws(S),at=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ia,{value:ze>0?ze:void 0,isDark:N,locale:f,disabled:true,isBlurred:at,lens:G,hourlyRate:De(S)})}let re=S.status==="completed"||S.progress===100,we=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ia,{value:S.soldEffortMinutes,onChange:ze=>me({soldEffortMinutes:ze}),isDark:N,locale:f,disabled:re,isBlurred:we,lens:G,hourlyRate:De(S)})}case "scheduleVariance":{let re=S.effortMinutes||0,we=S.soldEffortMinutes||0,ze=S.timeLoggedMinutes||0,at=re>0||we>0||ze>0;return jsxRuntime.jsx(_g,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:N,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(I&&S.hasChildren){let{spent:re,allocated:we,quoted:ze}=ws(S),at=re>we&&we>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",N?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",at?"text-[#FF453A]":N?"text-white/80":"text-gray-800"),children:vs(re)}),we>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:N?"text-white/60":"text-gray-600",children:vs(we)})]}),ze>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:N?"text-amber-400/70":"text-amber-600",children:vs(ze)})]})]})}return jsxRuntime.jsx(qg,{task:S,isDark:N,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:G,hourlyRate:De(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsxRuntime.jsx(Xg,{task:S,isDark:N,locale:f}):jsxRuntime.jsx(bl,{value:S.assignees||[],availableUsers:c,onChange:we=>{r.onTaskUpdate?.({...S,assignees:we});},isDark:N,locale:f});case "blockers":return jsxRuntime.jsx(Qg,{blockers:S.blockers,isDark:N,locale:f});case "weight":{let re=Ee.get(S.id);if(re!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",re>0?N?"text-white/50":"text-gray-400":N?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let we=S.weight||0;return jsxRuntime.jsx(Q1,{value:we,onChange:ze=>me({weight:ze}),isDark:N})}default:return jsxRuntime.jsx("span",{className:g("text-sm",N?"text-white/60":"text-gray-500"),children:"-"})}},[r,N,f,c,ge,I,Ee]),tn=react.useCallback(S=>{let me={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)"),teamLoad:ge.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:ge.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:ge.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof me=="string"?me:String(me||S.type)},[ge,f]),Kn=react.useMemo(()=>{let me=rt.reduce((Ce,We)=>Ce+We.width,0)+(w?48:0),ve={};for(let Ce of rt)ve[Ce.id]=`${Ce.width/me*100}%`;return ve},[rt,w]);return a?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",N?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:[ge.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",N?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",N?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:ge.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:ge.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:U,className:g(N?"bg-[#0D0D0D]":"bg-white",fe&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsxRuntime.jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",N?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:[xa.length," ",ge.pagination.tasks]}),h&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",N?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Ie,onChange:S=>Ct(S.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",N?"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")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&j>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:pe,onClick:()=>se(!sa),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",N?sa?"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]":sa?"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:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),pr==="all"?f==="es"?"Todos":"All":`L${pr}`]}),sa&&jsxRuntime.jsx("div",{ref:ft,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",N?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(j,5)},(S,J)=>({value:J+1,label:`L${J+1}`}))].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{Kr(S.value),se(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",N?pr===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":pr===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:S.label}),pr===S.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(k0,{value:it,hideCompleted:Pe,onChange:qe,onHideCompletedChange:xt,isDark:N,locale:f}),te?.enabled&&te.data&&!Be&&jsxRuntime.jsx("button",{onClick:()=>Se(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",N?"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:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,L&&k&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:k,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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:ge.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",N?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Er&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),rt.map(S=>{let J=S.id!=="name",me=ke===S.id&&de!==S.id;return jsxRuntime.jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",N?"text-white/60":"text-gray-500",J&&"cursor-grab",S.type!=="name"&&"justify-center",de===S.id&&"opacity-50",me&&(N?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Kn[S.id],minWidth:S.minWidth},draggable:J,onDragStart:J?ve=>Wo(ve,S.id):void 0,onDragEnd:J?Pn:void 0,onDragOver:J?ve=>_n(ve,S.id):void 0,onDragLeave:J?zo:void 0,onDrop:J?ve=>gi(ve,S.id):void 0,onContextMenu:ve=>Ga(ve,void 0,S.id),children:[J&&jsxRuntime.jsx(lucideReact.GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",N?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxRuntime.jsxs("button",{draggable:false,onClick:ve=>{let Ce=ve.currentTarget.getBoundingClientRect();d(S.id,Ce);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[tn(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),Ye===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>Ut(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[tn(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",Ye===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[tn(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),C&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",fe===S.id&&"bg-[#00E5CC]"),onMouseDown:ve=>Ba(ve,S.id)})]},S.id)}),w&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),A(J=>!J);},className:g("p-0.5 rounded transition-colors",N?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ct&&(N?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(f0,{isOpen:ct,onClose:()=>A(false),columns:St,customFields:l,onColumnsChange:Qt,onCreateCustomField:()=>{A(false),B(true);},isDark:N,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:xa.map((S,J)=>{let me=oe.has(S.id),ve=Math.min(J*.01,.2),Ce=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(Ce){let{spent:bt,allocated:mt,quoted:mr}=ws(S),xr=J1(S);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",N?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Le===S.id&&(N?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Er&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),rt.map(zr=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",zr.type!=="name"&&"justify-center"),style:{width:Kn[zr.id],minWidth:zr.minWidth},children:zr.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:$t=>{$t.stopPropagation(),pt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",N?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",N?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:$t=>{$t.stopPropagation(),pt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:me?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:N?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:N?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:N?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",N?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",N?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),xr!==null&&v&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",xr>=1?"text-[#32D74B] bg-[#32D74B]/10":xr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",xr.toFixed(2)]})]})]}):zr.type==="timeLoggedMinutes"?G==="financial"?(()=>{let $t=S.executedDollarsCanonical,Wt=$t!=null?Math.round($t):Math.round(Xe(S).dollarSpent);return Wt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ia,{value:bt>0?bt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):zr.type==="soldEffortMinutes"?G==="financial"?(()=>{let $t=Xe(S),Wt=Math.round($t.dollarQuoted);return Wt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ia,{value:mr>0?mr:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):zr.type==="effortMinutes"?G==="financial"?(()=>{let $t=Xe(S),Wt=Math.round($t.dollarAllocated),Et=Math.round($t.dollarQuoted),Lt=Et-Wt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Wt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("es-CO")]}):null,Lt!==0&&Wt>0&&Et>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`]})]})})():jsxRuntime.jsx(Ia,{value:mt>0?mt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):en(S,zr)},zr.id)),w&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let re=ue===S.id,we=Fe===S.id,ze=we&&dt==="above",at=we&&dt==="below",tt=we&&dt==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:g("flex items-center border-b transition-colors relative group",N?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Le===S.id&&(N?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:tt?N?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:tt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:bt=>Ga(bt,S),onMouseEnter:()=>Mr(S.id),onMouseLeave:()=>Mr(bt=>bt===S.id?null:bt),children:[ze&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Er&&jsxRuntime.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:bt=>ea(S.id,bt),style:{color:N?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),rt.map(bt=>{let mt=!!(S.subtasks&&S.subtasks.length>0),mr=Kt(bt.type),zr=!!mr&&!mt&&_t===S.id&&!Ft,$t=!!Ft&&!!mr&&Ft.column===mr&&_r(S.id);return jsxRuntime.jsxs("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",bt.type!=="name"&&"justify-center"),style:{width:Kn[bt.id],minWidth:bt.minWidth,position:"relative",backgroundColor:$t?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:$t?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[bt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsxRuntime.jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsxRuntime.jsx("button",{onClick:Wt=>{Wt.stopPropagation(),pt(S.id);},className:g("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",N?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",N?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",N?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",N?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?N?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?N?"text-white":"text-gray-900":N?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):en(S,bt),zr&&mr&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Wt=>ha(Wt,S.id,mr,J),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},bt.id)}),w&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),Ae&&xa.length>0&&(()=>{let{spent:S,allocated:J,quoted:me}=Y,ve=J-S,Ce=ve<0,We=Ce?`+${vs(Math.abs(ve))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${vs(ve)} ${f==="es"?"AHORRADO":"SAVED"}`,re=G==="financial"&&O>0,we=H?.breakdown,ze=!!we&&((we.equipment??0)>0||(we.travel??0)>0),at=we?.laborSpent!=null?we.laborSpent:H?.spent!=null?H.spent:Y.dollarSpent,tt=we?.laborAllocated!=null?we.laborAllocated:H?.allocated!=null?H.allocated:Y.dollarAllocated,bt=H?.quoted!=null?H.quoted:Y.dollarQuoted,mt=($t,Wt)=>{if(re){let Et=Wt??$t/60*O;return `$${Math.round(Et).toLocaleString("es-CO")}`}return vs($t)},mr=re?Math.abs(tt-at):0,xr=re?`+$${mr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ce?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,zr=re&&ze?f==="es"?"solo mano de obra":"labor only":void 0;return jsxRuntime.jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",N?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:N?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Er&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),rt.map($t=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",$t.type!=="name"&&"justify-center"),style:{width:Kn[$t.id],minWidth:$t.minWidth},children:$t.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),zr&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",N?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),zr]})]}):$t.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(S,re?at:void 0)}),jsxRuntime.jsx("span",{className:g("text-[11px]",N?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:g("text-[11px]",N?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(J,re?tt:void 0)})]}),J>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ce?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?xr:We})]}):$t.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?mt(me,re?bt:void 0):"\u2013"}):$t.type==="effortMinutes"?(()=>{if(re&&me>0&&J>0){let Wt=Math.round(bt),Et=Math.round(tt),Lt=Wt-Et,Fr=Wt>0?Math.round(Lt/Wt*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(J,tt)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>=0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Fr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:J>0?mt(J,re?tt:void 0):"\u2013"})})():$t.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?mt(S,re?at:void 0):"\u2013"}):$t.type==="progress"?(()=>{let Wt=P0(Ud(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",N?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Wt,"%"]})})():$t.type==="weight"?(()=>{let Wt=e||[],Et=[],Lt=ma=>{for(let Yr of ma)Et.push(Yr),Yr.subtasks?.length&&Lt(Yr.subtasks);};Lt(Wt);let kr=Et.filter(ma=>!ma.subtasks?.length||ma.subtasks.length===0).reduce((ma,Yr)=>ma+(Yr.weight||0),0),Ta=Math.abs(kr-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Ta?N?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(kr.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",N?"text-white/30":"text-gray-300"),children:"\u2013"})},$t.id)),w&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),xa.length===0&&Ie&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:g("w-12 h-12 mx-auto mb-4",N?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(N?"text-white/60":"text-gray-600"),children:ge.empty.noResults})]})})]})}),te?.enabled&&te.data&&Be&&jsxRuntime.jsx(T0,{data:te.data,isDark:N,locale:f,onClose:()=>Se(false),lens:t?.lens,onUnassignedTaskClick:S=>{let J=document.querySelector(`[data-task-id="${S}"]`);J&&(J.scrollIntoView({behavior:"smooth",block:"center"}),$e(S),setTimeout(()=>$e(null),2e3));}})]}),jsxRuntime.jsx(o0,{state:q,onClose:lr,isDark:N,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:ya,onColumnSort:Wr,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),V&&Tt&&ue&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let J=Te.flattenTasks(e).find(me=>me.id===ue);return J?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:N?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${N?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:N?"#e6edf3":"#111827"},children:J.name})]}):null})()}),document.body),jsxRuntime.jsx(y0,{isOpen:X,onClose:()=>B(false),onSave:qr,isDark:N,locale:f})]})}var I0=[{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}],R0=[{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"}],B0=[{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 Wd={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"},zd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Gd={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"},Sl={dark:Wd,light:zd,neutral:Gd};function $0(e){return Sl[e]||Sl.dark}function El(e,t,r,a,n=5){let s=[],o=[],c=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of c){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let l={};for(let p=r;p<=a;p++)l[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)l[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)l[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function O0(e){return e==="es"?Z1:eC}function H0(e){return (e.getDay()+6)%7}function U0(e,t){let r=new Date(e,t,1),a=H0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},c=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function oi(e,t){return H0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function W0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function z0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Ml(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),c=42,l=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=W0(d.startDate),f=W0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>c)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?z0(v):z0(y*n),C=d.assignees?.[0],P=C?.initials||(C?.name?nC(C.name):void 0),L=d.displayId||d.wbsCode||"",k=aC(L||d.id)?"":L||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,startSerial:Math.max(x,1),endSerial:Math.min(h,c),hrs:y,cost:w,critical:!!d.isCriticalPath,who:P,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(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 oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function G0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var Vd=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Pl({locale:e}){let t=O0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Fl({bar:e,ws:t,money:r,projColor:a,slotH:n=Vd}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"nom",children:s.name}),c>=3?jsxRuntime.jsx("span",{className:"val",children:i}):null]})}function Ll({chip:e,ws:t,slotH:r=Vd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:iC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Al({more:e,ws:t,slotH:r=Vd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function V0({projects:e}){return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function j0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxRuntime.jsxs("div",{className:"cal-topbar",children:[jsxRuntime.jsxs("div",{className:"cal-projsel",children:[s,jsxRuntime.jsx("span",{className:"caret",children:"\u25BE"})]}),jsxRuntime.jsx("div",{className:"cal-spacer"}),jsxRuntime.jsx("div",{className:"cal-seg",children:uC.map(o=>jsxRuntime.jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsxRuntime.jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function _0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=react.useState(false),x=react.useRef(null),h=d==="es";react.useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=l==="all"?h?"Todas":"All":c?.find(y=>y.id===l)?.name??(h?"Todas":"All");return jsxRuntime.jsxs("div",{className:"cal-toolbar",children:[jsxRuntime.jsxs("div",{className:"cal-nav-arrows",children:[jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxRuntime.jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsxRuntime.jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxRuntime.jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsxRuntime.jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),c.map(y=>jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-u,"/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 K0({off:e,onToggle:t}){let r=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:a.nm}),jsxRuntime.jsx("div",{className:"sub",children:a.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Y0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=react.useRef(null);react.useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxRuntime.jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsxRuntime.jsx("span",{className:"tk",children:d.taskId}):null,jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsxRuntime.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,jsxRuntime.jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var q0={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 X0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=q0[r]||q0.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:n.title}),jsxRuntime.jsxs("p",{children:[n.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),a?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsxRuntime.jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function Q0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(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 J0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return J0[e%J0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var jd="\xA0";function Ro(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function Z0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(Q0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:vC(l),initials:xC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((l.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function ef({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=Q0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:m,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:u,onClick:p=>{!l||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!l||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!l?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${jd}/${jd}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[Ro(c.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",jd,Ro(c.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:l?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function tf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxRuntime.jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Ro(s),"h asignadas / ",Ro(o),"h"]}),c?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",Ro(l),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsxRuntime.jsx("span",{className:"nm",title:i.name,children:i.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[Ro(i.hours),"h / ",Ro(i.capacity),"h"]})]},i.name)})})]})}var _d=28,CC=182;function af({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=c==="es";return jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsxRuntime.jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),l&&l[x]?jsxRuntime.jsx(ef,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=react.useMemo(()=>El(a,n,t,r),[a,n,t,r]),m=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:p,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return oi(e,f)&&(b+=" wknd"),h||(b+=" out"),f===c&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsxRuntime.jsx("div",{onClick:()=>l?.(f.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Fl,{bar:f,ws:t,money:s,projColor:o,slotH:_d})},`b${x}`)),d.chips.map((f,x)=>jsxRuntime.jsx(Ll,{chip:f,ws:t,slotH:_d},`c${x}`)),d.more.map((f,x)=>jsxRuntime.jsx(Al,{more:f,ws:t,slotH:_d,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(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 nf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function of(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?nf(c):nf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function sf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:"Arrastra al calendario"}),jsxRuntime.jsx("span",{children:e.length})]}),e.length===0?jsxRuntime.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(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:s.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:o}),s.who?jsxRuntime.jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function lf({onExpand:e}){return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Cs(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function cf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=react.useRef(null),i=n==="es";react.useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Cs(r.oldProjectEnd,n)} \u2192 ${Cs(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Cs(r.oldStart,n)," \u2013 ",Cs(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Cs(r.newStart,n)," \u2013 ",Cs(r.newEnd,n)]})]})]}),d?jsxRuntime.jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxRuntime.jsxs("div",{className:"cal-impact",children:[jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function df({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=react.useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxRuntime.jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsxRuntime.jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsxRuntime.jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxRuntime.jsxs("div",{className:"cal-agenda-day",children:[jsxRuntime.jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>c?.(u.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:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,flex:"none"}}),u.critical?jsxRuntime.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,u.id?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxRuntime.jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsxRuntime.jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Il(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Kd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function uf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Il(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Il(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=c(f);x>u&&(u=x);}let p=Kd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function pf(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Il(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Kd(p)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Il(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Rl(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=uf(n,new Map),i=pf(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=uf(d,new Map([[t,r.getTime()]])),u=pf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=l.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=Kd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-l.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function mf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,Bl=26,$C="#5B7FD4";function gf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=react.useState("mes"),[C,P]=react.useState(()=>{let V=new Date,ye={y:V.getFullYear(),m:V.getMonth()},Fe=(e??[]).map(Ze=>Ze.startDate?new Date(Ze.startDate):null).filter(Ze=>!!Ze&&!isNaN(Ze.getTime()));if(Fe.length===0||(e??[]).some(Ze=>{let Tt=Ze.startDate?new Date(Ze.startDate):null,gt=Ze.endDate?new Date(Ze.endDate):Tt;if(!Tt||isNaN(Tt.getTime()))return false;let rr=new Date(ye.y,ye.m,1),ar=new Date(ye.y,ye.m+1,0,23,59,59);return Tt<=ar&&(gt??Tt)>=rr}))return ye;let dt=Fe.reduce((Ze,Tt)=>Ze<Tt?Ze:Tt);return {y:dt.getFullYear(),m:dt.getMonth()}}),[L,k]=react.useState(false),[D,F]=react.useState([]),[E,G]=react.useState("all"),[O,ee]=react.useState(null),[I,Ae]=react.useState(null),[H,ge]=react.useState(false),[N,De]=react.useState(null),[Xe,He]=react.useState(false),Y=react.useMemo(()=>U0(C.y,C.m),[C.y,C.m]),Ee=a||$C,te=react.useMemo(()=>{let V=new Set;for(let ye of h){let Fe=new Date(`${ye}T12:00:00`),Ue=Y.dateToSerial(Fe);Ue>=1&&Ue<=42&&V.add(Ue);}return V},[h,Y]);react.useEffect(()=>{y?.({start:mf(Y.serialToDate(1)),end:mf(Y.serialToDate(42))});},[C.y,C.m]);let Be=x.length,Se=react.useMemo(()=>{let V=b?.hoursPerDay;if(!V)return 8;let ye=[V.monday,V.tuesday,V.wednesday,V.thursday,V.friday].map(Fe=>Fe||0).filter(Fe=>Fe>0);return ye.length?Math.round(ye.reduce((Fe,Ue)=>Fe+Ue,0)/ye.length*10)/10:8},[b]),Le=react.useMemo(()=>Ml({tasks:e,grid:Y,projectColor:()=>Ee,hourlyRate:o,projectId:r}),[e,Y,Ee,o,r]),$e=react.useMemo(()=>{if(d===false)return [];let V=new Map;for(let ye of Le.calTasks)ye.phaseId&&ye.phaseName&&V.set(ye.phaseId,ye.phaseName);return [...V.entries()].map(([ye,Fe])=>({id:ye,name:Fe})).sort((ye,Fe)=>ye.name.localeCompare(Fe.name))},[Le.calTasks,d]),Ye=!D.includes("tareas"),le=!D.includes("cpm"),Qe=react.useMemo(()=>{let V=Ye?Le.calTasks:[];return E!=="all"&&(V=V.filter(ye=>ye.phaseId===E)),le||(V=V.map(ye=>ye.critical?{...ye,critical:false}:ye)),V},[Le.calTasks,Ye,le,E]),je=react.useMemo(()=>{let V=new Set;return D.includes("hitos")&&(V.add("hito"),V.add("desembolso")),D.includes("ext")&&V.add("ext"),D.includes("aus")&&V.add("aus"),Le.dayItems.filter(ye=>!V.has(ye.type))},[Le.dayItems,D]),Ie=!D.includes("festivos"),Ct=new Date,it=Y.dateToSerial(new Date(Ct.getFullYear(),Ct.getMonth(),Ct.getDate())),qe=V=>F(ye=>ye.includes(V)?ye.filter(Fe=>Fe!==V):[...ye,V]),Pe=()=>P(V=>{let ye=new Date(V.y,V.m-1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),xt=()=>P(V=>{let ye=new Date(V.y,V.m+1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),St=()=>{let V=new Date;P({y:V.getFullYear(),m:V.getMonth()});},Re=(V,ye,Fe)=>{if(!p||ye===0)return;let Ue=Le.calTasks.find(rr=>rr.uid===V);if(!Ue)return;let dt=ye*864e5,Ze=new Date(Ue.realStart.getTime()+dt),Tt=new Date(Ue.realEnd.getTime()+dt),gt=Rl(e,V,Ze,Tt);gt&&De({uid:V,taskId:Ue.id,taskName:Ue.name,sim:gt,anchor:Fe});},ct=async()=>{if(!N||!f)return;He(true);let V=[{id:N.uid,startDate:N.sim.newStart,endDate:N.sim.newEnd},...N.sim.movedSuccessors.map(Fe=>({id:Fe.id,startDate:Fe.newStart,endDate:Fe.newEnd}))],ye=await f(V);He(false),ye&&De(null);},A=G0(C.y,C.m,n),X=[{id:"",name:t,color:Ee}],B=react.useMemo(()=>of(e,o),[e,o]),q=react.useMemo(()=>{if(v==="lookahead"){let V=Y.weeks.find(Fe=>it>=Fe.ws&&it<=Fe.we)??Y.weeks[0],ye=Y.weeks.indexOf(V);return Y.weeks.slice(ye,ye+2)}return v==="semana"?[Y.weeks.find(ye=>it>=ye.ws&&it<=ye.we)??Y.weeks[0]]:[]},[v,Y.weeks,it]),ce=react.useMemo(()=>{let V={};return q.forEach((ye,Fe)=>{let Ue=[];for(let Ze=ye.ws;Ze<=ye.we;Ze++)Ue.push({serial:Ze,date:Y.serialToDate(Ze),isWeekend:oi(Y,Ze),isHoliday:te.has(Ze)});let dt=Z0(x,Ue,Se);V[Fe]={days:Ue,capByDay:dt};}),V},[q,Y,te,x,Se]),ue=v==="semana"||v==="lookahead",_e=v==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsxRuntime.jsx(j0,{view:v,onViewChange:w,money:c==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:V=>l(V==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsxRuntime.jsx(_0,{monthLabel:A,onPrev:Pe,onNext:xt,onToday:St,layersOpen:L,onToggleLayers:()=>k(V=>!V),layersOff:D,phases:$e,phaseFilter:E,onPhaseChange:G,locale:n,children:L?jsxRuntime.jsx(K0,{off:D,onToggle:qe}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:_e?"hidden":void 0},children:[_e?jsxRuntime.jsx(df,{grid:Y,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,locale:n,onTaskOpen:i}):ue?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pl,{locale:n}),jsxRuntime.jsx(af,{grid:Y,weeks:q,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,locale:n,capRows:ce,teamSize:Be,onTaskOpen:i,onMore:(V,ye,Fe)=>ee({day:V,items:ye,tasks:Fe}),onCapDay:(V,ye,Fe)=>{for(let Ue of Object.keys(ce)){let dt=ce[+Ue].capByDay.get(V);if(dt){Ae({dayLabel:ye,perPerson:dt.perPerson,anchor:Fe.getBoundingClientRect()});break}}}})]}):Le.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Y.weeks.map(V=>jsxRuntime.jsx(ff,{grid:Y,ws:V.ws,we:V.we,todaySerial:it,showFestivos:Ie,holidaySerials:te,locale:n,deadlineDays:new Set},V.ws))}),jsxRuntime.jsx(X0,{monthLabel:A,locale:n,onCreateTask:u})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Y.weeks.map(V=>jsxRuntime.jsx(OC,{grid:Y,ws:V.ws,we:V.we,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,showFestivos:Ie,holidaySerials:te,locale:n,onTaskOpen:i,onMore:(ye,Fe,Ue)=>ee({day:ye,items:Fe,tasks:Ue}),canReschedule:p,onDragReschedule:Re,pendingGhost:N?{uid:N.uid,days:Math.round((N.sim.newStart.getTime()-N.sim.oldStart.getTime())/864e5)}:null},V.ws))})]}),O?jsxRuntime.jsx(Y0,{dayLabel:`${Y.serialToDate(O.day).getDate()}`,items:O.items,tasks:O.tasks.map(V=>({swatch:Ee,taskId:V.id,label:V.name,critical:V.critical,value:c==="$"?V.cost:`${V.hrs}h`})),onClose:()=>ee(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,I?jsxRuntime.jsx(tf,{dayLabel:I.dayLabel,perPerson:I.perPerson,onClose:()=>Ae(null),style:{position:"fixed",top:`${I.anchor.top-8}px`,left:`${I.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,N?jsxRuntime.jsx(cf,{taskName:N.taskName,taskId:N.sim.taskId,sim:N.sim,busy:Xe,locale:n,onConfirm:ct,onCancel:()=>De(null),style:{position:"fixed",top:`${N.anchor.top+12}px`,left:`${Math.min(N.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),H?jsxRuntime.jsx(sf,{items:B,money:c,projColor:Ee,onItemClick:V=>i?.(V),onCollapse:()=>ge(false)}):jsxRuntime.jsx(lf,{onExpand:()=>ge(true)})]}),jsxRuntime.jsx(V0,{projects:X})]})}function ff({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsxRuntime.jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,m=n&&s.has(l),u="cal-day";return oi(e,l)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),l===a&&(u+=" today"),o.has(l)&&(u+=" deadline-day"),jsxRuntime.jsxs("div",{className:u,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=react.useMemo(()=>El(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(L=>L.type==="deadline").map(L=>L.serial)),[n]),y=Math.max(BC,h.laneCount*Bl+36),v=react.useRef(null),[w,C]=react.useState(null),P=(L,k)=>{if(!p||!f){m?.(k);return}L.preventDefault();let D=v.current;if(!D)return;let F=D.getBoundingClientRect().width/7,E=L.clientX,G=0,O=I=>{let Ae=Math.round((I.clientX-E)/F);G=Ae,C({id:k,days:Ae});},ee=I=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",ee),C(null),G===0){m?.(k);return}let Ae=new DOMRect(I.clientX,I.clientY,0,0);f(k,G,Ae);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",ee);};return jsxRuntime.jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(ff,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((L,k)=>{let D=w?.id===L.t.uid?w.days:null,F=x?.uid===L.t.uid?x.days:null,E=D??F??0,G=D==null&&F!=null,O=E!==0?{...L,s:L.s+E,e:L.e+E}:L;return jsxRuntime.jsx("div",{onPointerDown:ee=>P(ee,L.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:G?.6:1},children:jsxRuntime.jsx(Fl,{bar:O,ws:t,money:s,projColor:o,slotH:Bl})},`b${k}`)}),h.chips.map((L,k)=>jsxRuntime.jsx(Ll,{chip:L,ws:t,slotH:Bl},`c${k}`)),h.more.map((L,k)=>jsxRuntime.jsx(Al,{more:L,ws:t,slotH:Bl,onClick:()=>u(L.day,L.items,a.filter(D=>D.startSerial<=L.day&&D.endSerial>=L.day))},`m${k}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=react.useState(false),d=react.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=react.useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.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:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:m.totalCards}),jsxRuntime.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"]})]}),l&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[m.uniqueAssignees," assignees"]})]}),m.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[m.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:d.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:d.map(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var hf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ii(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 li(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 yf(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 xf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=react.useMemo(()=>({...hf,...o}),[o]),[i,d]=react.useState(new Set),m=react.useRef(null),u=react.useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],C=y.get(w);C?C.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((C,P)=>P.timestamp.getTime()-C.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),L=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:L<7?`${L}d ago`:y.toLocaleDateString()},b=react.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 react.useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:g("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:g("history-timeline",l.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[li(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),p.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[l.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let C=i.has(v.id),P=s===v.id,L=yf(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:L},children:l.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:li(v.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:L}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[l.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ii(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},k)),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([k,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},k))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function wf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],m=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:g("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:g("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:m&&li(m.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:m&&ii(m)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:m&&m.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>c(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsxRuntime.jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>c(f),title:ii(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(p=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>l(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:m&&m.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxRuntime.jsxs("div",{className:g("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Yd(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 Xd(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 Cf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=c.get(typeof d.source=="string"?d.source:d.source.id),u=c.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Tf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=react.useRef(null),[d,m]=react.useState([]),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(1),[w,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=_C(e,t,r.width,r.height,r,150);m(O);},[e,t,r]);let P=react.useCallback((O,ee)=>{r.enableDragging&&(ee.stopPropagation(),p(O));},[r.enableDragging]),L=react.useCallback(O=>{if(!u||!i.current)return;let I=i.current.getBoundingClientRect(),Ae=(O.clientX-I.left-w.x)/y,H=(O.clientY-I.top-w.y)/y;m(ge=>ge.map(N=>N.id===u?{...N,x:Ae,y:H,fx:Ae,fy:H}:N));},[u,y,w]),k=react.useCallback(()=>{p(null);},[]),D=react.useCallback((O,ee)=>{ee.stopPropagation(),c?.({type:"node-click",node:O,position:{x:ee.clientX,y:ee.clientY}});},[c]),F=react.useCallback((O,ee)=>{ee.stopPropagation(),c?.({type:"edge-click",edge:O,position:{x:ee.clientX,y:ee.clientY}});},[c]),E=react.useCallback(O=>{let ee=d.find(I=>I.id===O);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[d]),G=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ee=O.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:g("relationships-graph-empty",l),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:g("relationships-graph",l),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Yd(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[kf(O)," ",Xd(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:L,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let ee=E(typeof O.source=="string"?O.source:O.source.id),I=E(typeof O.target=="string"?O.target:O.target.id),Ae=Cf(O.type),H=h===O.id,ge=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",H&&"hovered",ge&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:N=>F(O,N),children:[jsxRuntime.jsx("line",{x1:ee.x,y1:ee.y,x2:I.x,y2:I.y,stroke:Yd(O.type),strokeWidth:ge?r.edgeWidth*2:r.edgeWidth,strokeOpacity:H?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&H&&jsxRuntime.jsx("text",{x:(ee.x+I.x)/2,y:(ee.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Xd(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map(O=>{let ee=f===O.id,I=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",ee&&"hovered",I&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Ae=>P(O.id,Ae),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Ae=>D(O,Ae),children:[jsxRuntime.jsx("circle",{r:I?r.nodeSize*1.2:r.nodeSize,fill:G(O),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:ee?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Sf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[c,l]=react.useState(false),[i,d]=react.useState(null),[m,u]=react.useState(null),p=react.useRef(null),f=c||n;react.useEffect(()=>{e&&p.current&&p.current.focus();},[e]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){l(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{m&&(r(m),x());};return e?jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:m?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),m.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((y,v)=>jsxRuntime.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},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((y,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.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})]})},v)),m.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:p,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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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,v)=>jsxRuntime.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},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,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"}),m?jsxRuntime.jsx("button",{onClick:b,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"}):jsxRuntime.jsx("button",{onClick:h,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 Jd={"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Jd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ci(e){return `$${e.toFixed(4)}`}var Qd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),c=r.filter(m=>m.success),l=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Qd;function Pf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState($o.getStats()),[s,o]=react.useState($o.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let l=setInterval(()=>{n($o.getStats()),o($o.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),react.useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=$o.getRecentOperations(5);return jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:l=>l.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ci(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,m=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:l.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ci(d)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},l)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(l=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ci(l.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.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 Af({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=react.useState(""),[l,i]=react.useState(""),[d,m]=react.useState(""),[u,p]=react.useState(false),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(null),w=react.useRef(null),C=u||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let F=E=>{E.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,C]);let P=()=>{C||(c(""),i(""),m(""),x(null),b(null),v(null),t());},L=async()=>{if(!(!o.trim()||C)){p(true),x(null),b(null),v(null);try{let F=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(F.tasks.tasks),v({from_cache:F.from_cache,tokens_used:F.tokens_used,mock_mode:F.mock_mode,similarity:F.similarity,tokens_saved:F.tokens_saved});}catch(F){x(F instanceof Error?F.message:"Failed to generate tasks");}finally{p(false);}}},k=()=>{h&&(r(h),P());};if(!e)return null;let D=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:P}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:P,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.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?jsxRuntime.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)"]}):jsxRuntime.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"}),jsxRuntime.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&&jsxRuntime.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"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((F,E)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",E+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:F.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),F.start," \u2192 ",F.end]}),jsxRuntime.jsxs("span",{children:[F.duration," days"]}),F.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",F.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${F.priority==="high"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:F.priority})]})},F.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:w,value:o,onChange:F=>c(F.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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:F=>i(F.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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:F=>m(F.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&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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((F,E)=>jsxRuntime.jsx("button",{onClick:()=>c(F),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:F},E))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.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"}),h?jsxRuntime.jsx("button",{onClick:k,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"}):jsxRuntime.jsx("button",{onClick:L,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 Hl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&vi(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,y)=>{a(v=>{let w=v.cards.find(F=>F.id===h);if(!w)return v;let C=w.columnId,P={...w,columnId:b,position:y},L=v.cards.map(F=>F.id===h?P:F),k=v.columns.map(F=>{if(F.id===C)return {...F,cardIds:F.cardIds.filter(E=>E!==h)};if(F.id===b){let E=L.filter(G=>G.columnId===b).sort((G,O)=>G.position-O.position);return {...F,cardIds:E.map(G=>G.id)}}return F}),D={...v,cards:L,columns:k};return n(D),D});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(C=>C.id===h?{...C,...b}:C),w={...y,cards:v};return n(w),w});},[n]),c=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(P=>P.id===h.columnId?{...P,cardIds:[...P.cardIds,b]}:P),C={...y,cards:[...y.cards,v],columns:w};return n(C),C});},[n]),l=react.useCallback(async h=>{a(b=>{let y=b.cards.find(P=>P.id===h);if(!y)return b;let v=b.cards.filter(P=>P.id!==h),w=b.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter(L=>L!==h)}:P),C={...b,cards:v,columns:w};return n(C),C});},[n]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=react.useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(C=>C.id===h?{...C,...b}:C),w={...y,columns:v};return n(w),w});},[n]),m=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(C=>C.columnId!==h),v=b.columns.filter(C=>C.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),b},[c]),p=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=react.useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:l,deleteColumn:m,clearBoard:f}}}function Rf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Hl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(m=>m.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:react.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},$f={by:"none",order:"asc"};function Of({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...di,...e}),[s,o]=react.useState({...$f,...t}),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),l=react.useCallback(x=>{o(h=>({...h,...x}));},[]),i=react.useCallback(()=>{n(di),o($f);},[]),d=react.useCallback(()=>{r&&n({...di,assignees:[r]});},[r]),m=react.useCallback(()=>{n({...di,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{n({...di,priorities:["HIGH","URGENT"]});},[]),p=react.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=react.useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),C=`${y}-${v}-${w}`;h=h.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let L=P.endDate||P.dueDate;if(!L)return false;let k;if(typeof L=="string")k=L.split("T")[0]||L;else {let D=L.getUTCFullYear(),F=String(L.getUTCMonth()+1).padStart(2,"0"),E=String(L.getUTCDate()).padStart(2,"0");k=`${D}-${F}-${E}`;}switch(a.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let D=new Date(C+"T00:00:00"),F=new Date(k+"T00:00:00"),E=new Date(D);return E.setDate(E.getDate()+7),F>=D&&F<=E;case "custom":if(a.dateRange){let G=typeof L=="string"?new Date(L):L;return G>=a.dateRange.start&&G<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;v=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},L=P[b.priority||"LOW"],k=P[y.priority||"LOW"];v=L-k;break;case "dueDate":let D=b.endDate||b.dueDate,F=y.endDate||y.dueDate;if(!D)return 1;if(!F)return -1;let E=typeof D=="string"?new Date(D).getTime():D.getTime(),G=typeof F=="string"?new Date(F).getTime():F.getTime();v=E-G;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,ee=y.estimatedTime||0;v=O-ee;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var Uf,Wf;if(typeof window<"u")try{let e=hi("ai");Uf=e.generateObject,Wf=e.generateText;}catch{}function zf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(Uf&&Wf&&e.apiKey),o=react.useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),c=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),l=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(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(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function eu(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function Gf(e){let{cards:t}=e,[r,a]=eu(),n=react.useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=react.useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,D)=>k.position-D.position),y=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===m),[w,C]=y<v?[y,v]:[v,y],P=b.slice(w,C+1).map(k=>k.id),L=Array.from(new Set([...r.selectedCardIds,...P]));a({selectedCardIds:L,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=react.useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=react.useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=react.useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Vf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function jf(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...Vf,...r}),[r]),[s,o]=react.useState([]),c=react.useCallback((x,h,b,y,v)=>{if(h.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:x,cardIds:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),l=react.useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=react.useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=react.useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=react.useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=react.useCallback(async x=>{let h=t.filter(C=>C.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.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&&b.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let v=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{v.has(P)||v.set(P,[]),v.get(P).push(C);});}),v.forEach((C,P)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.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 L={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";b.push({stack:{title:`${L} ${P} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let C of h){let L=(await a.findSimilar(C,h)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(L.length>=n.minCardsPerStack-1){let k=[C.id,...L.map(F=>F.card.id)],D=L.reduce((F,E)=>F+E.similarity,0)/L.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${L.length+1} similar tasks`,confidence:D});}}return b.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,a]),f=react.useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var _f=react.createContext(null);function Kf({children:e,initialData:t,onStateChange:r}){let a=react.useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=hi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=hi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=hi("@libxai/core");c=new l(t.board);}a.current=new core.BoardStore({board:c,columns:s,cards:o});}let n=a.current;return react.useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(_f.Provider,{value:{store:n},children:e})}function Ul(){let e=react.useContext(_f);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function pi(){let e=Ul(),[t,r]=react.useState(e.getBoard()),[a,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=react.useCallback(y=>{e.updateBoard(y);},[e]),l=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=react.useCallback(y=>{e.deleteColumn(y);},[e]),m=react.useCallback(y=>e.getColumn(y),[e]),u=react.useCallback(y=>{e.addCard(y);},[e]),p=react.useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),x=react.useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Yf(e){let{cards:t}=pi();return react.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Xf(e="position",t="asc"){let{cards:r}=pi();return react.useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-i;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}),[r,e,t])}var Wl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ru.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new Wl;function Qf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:n,children:jsxRuntime.jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=l?l(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},h)})})})}function Zf(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function tb({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=react.useRef(null),m=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:p,className:s,children:jsxRuntime.jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=l?l(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function rb(e){let t=reactVirtual.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 ab(e,t=10){return e>t}var nu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ou={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},su={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},lu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},du={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},uu={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)"},pu={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)"},mu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},gu={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}},fu={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}},zl={spacing:nu,borderRadius:ou,fontSize:su,fontWeight:iu,lineHeight:lu,zIndex:cu,duration:du,easing:uu,shadows:pu,opacity:mu,kanban:gu,gantt:fu};function nb(e,t,r){return e[t]??r}function bu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?bu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function hu(e="asakaa"){let t=bu(zl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
414
415
|
${r.join(`
|
|
415
416
|
`)}
|
|
416
|
-
}`}function
|
|
417
|
+
}`}function mi(e,t="asakaa"){let r=[],a=bu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
|
|
417
418
|
${r.join(`
|
|
418
419
|
`)}
|
|
419
|
-
}`}var
|
|
420
|
+
}`}var Gl={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"}},yu={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"}},xu={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 vu(e=Gl,t="asakaa"){let r=hu(t),a=mi(e,t);return `${r}
|
|
420
421
|
|
|
421
|
-
${a}`}function
|
|
422
|
+
${a}`}function ob(){return `/**
|
|
422
423
|
* ASAKAA Design Tokens
|
|
423
424
|
* Auto-generated from design-tokens.ts
|
|
424
425
|
* Do not edit this file directly
|
|
425
426
|
*/
|
|
426
427
|
|
|
427
|
-
${
|
|
428
|
+
${vu(Gl)}
|
|
428
429
|
|
|
429
430
|
/* Light theme */
|
|
430
431
|
[data-theme="light"] {
|
|
431
|
-
${
|
|
432
|
+
${mi(yu,"asakaa").split(`
|
|
432
433
|
`).slice(1,-1).join(`
|
|
433
434
|
`)}
|
|
434
435
|
}
|
|
435
436
|
|
|
436
437
|
/* Neutral theme */
|
|
437
438
|
[data-theme="neutral"] {
|
|
438
|
-
${
|
|
439
|
+
${mi(xu,"asakaa").split(`
|
|
439
440
|
`).slice(1,-1).join(`
|
|
440
441
|
`)}
|
|
441
442
|
}
|
|
442
|
-
`}var
|
|
443
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=
|
|
443
|
+
`}var h5=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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 jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.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 jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function sb({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=rs();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(s).map(([o,c])=>{let l=o,i=l===a;return jsxRuntime.jsxs("button",{onClick:()=>n(l),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(h5,{theme:l})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},l)})})}
|
|
444
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Pf;exports.AI_FEATURES=YC;exports.AI_MODELS=Jd;exports.AddCardButton=Nc;exports.AddColumnButton=vc;exports.AttachmentUploader=Zo;exports.BoardProvider=Kf;exports.BulkOperationsToolbar=Vi;exports.BurnDownChart=Ac;exports.CUSTOM_FIELD_TYPES=B0;exports.CalendarBoard=gf;exports.Card=An;exports.CardHistoryReplay=wf;exports.CardHistoryTimeline=xf;exports.CardRelationshipsGraph=Tf;exports.CardStack=UC;exports.CardTemplateSelector=Uc;exports.CircuitBreaker=Zl;exports.Column=qo;exports.ColumnManager=Xi;exports.CommandPalette=Ec;exports.ConfigMenu=Vc;exports.ContextMenu=is;exports.DEFAULT_SHORTCUTS=zs;exports.DEFAULT_TABLE_COLUMNS=I0;exports.DEFAULT_TEMPLATES=Hc;exports.DateRangePicker=Es;exports.DependenciesSelector=Ps;exports.DependencyLine=Ys;exports.DistributionCharts=Ic;exports.EditableColumnTitle=ic;exports.ErrorBoundary=Qo;exports.ExportDropdown=Dm;exports.ExportImportModal=zc;exports.FilterBar=Gc;exports.GANTT_AI_SYSTEM_PROMPT=sg;exports.GanttAIAssistant=ll;exports.GanttBoard=rg;exports.GanttI18nContext=ns;exports.GanttMilestone=nl;exports.GanttToolbar=Yi;exports.GenerateGanttTasksDialog=Af;exports.GeneratePlanModal=Sf;exports.GroupBySelector=$c;exports.HealthBar=mc;exports.KanbanBoard=eo;exports.KanbanToolbar=yc;exports.KanbanViewAdapter=Us;exports.KeyboardShortcutsHelp=Oc;exports.ListView=A0;exports.MenuIcons=tr;exports.PluginManager=Wl;exports.PrioritySelector=wo;exports.ProfitabilityReport=gc;exports.QuickTaskCreate=Os;exports.RATE_LIMITS=qC;exports.STANDARD_FIELDS=R0;exports.SwimlaneBoardView=Rc;exports.TagBadge=cc;exports.TagList=yp;exports.TagPicker=Yo;exports.TaskBar=Zi;exports.TaskDetailModal=Do;exports.TaskFormModal=og;exports.TaskGrid=Qi;exports.ThemeModal=qc;exports.ThemeProvider=gm;exports.ThemeSwitcher=sb;exports.TimeInputPopover=wn;exports.TimePill=dc;exports.TimePopover=uc;exports.Timeline=ol;exports.UserAssignmentSelector=Co;exports.VelocityChart=Lc;exports.VirtualGrid=tb;exports.VirtualList=Qf;exports.aiUsageTracker=$o;exports.borderRadius=ou;exports.buildCalendar=Ml;exports.calculatePosition=xi;exports.cardToGanttTask=ul;exports.cardsToGanttTasks=mg;exports.cn=g;exports.createKanbanView=qp;exports.createRetryWrapper=Pb;exports.darkTheme=jc;exports.darkTokenTheme=Gl;exports.defaultTheme=_i;exports.designTokens=zl;exports.duration=du;exports.easing=uu;exports.exportTokensToCSS=ob;exports.findTaskByName=Un;exports.fontSize=su;exports.fontWeight=iu;exports.formatCost=ci;exports.ganttEnTranslations=qi;exports.ganttEsTranslations=bm;exports.ganttTaskToCardUpdate=pg;exports.ganttThemes=lt;exports.ganttTokens=fu;exports.ganttTranslations=Yc;exports.ganttUtils=Te;exports.generateCSSVariables=hu;exports.generateCompleteCSS=vu;exports.generateInitialPositions=Db;exports.generateTasksContext=ig;exports.generateThemeVariables=mi;exports.getListViewTheme=$0;exports.getListViewTranslations=yd;exports.getToken=nb;exports.getTranslations=hm;exports.kanbanTokens=gu;exports.lightTheme=_c;exports.lightTokenTheme=yu;exports.lineHeight=lu;exports.listViewDarkTheme=Wd;exports.listViewEnTranslations=bd;exports.listViewEsTranslations=hd;exports.listViewLightTheme=zd;exports.listViewNeutralTheme=Gd;exports.listViewThemes=Sl;exports.listViewTranslations=pl;exports.mergeListViewTranslations=ml;exports.mergeTranslations=Xc;exports.neutralTheme=Kc;exports.neutralTokenTheme=xu;exports.opacity=mu;exports.parseLocalCommand=dg;exports.parseNaturalDate=md;exports.parseNaturalDuration=gd;exports.parseProgress=fd;exports.parseStatus=cg;exports.pluginManager=m5;exports.retrySyncOperation=Mb;exports.retryWithBackoff=vi;exports.shadows=pu;exports.shouldVirtualizeGrid=ab;exports.simulateReschedule=Rl;exports.spacing=nu;exports.themes=Eo;exports.useAI=zf;exports.useBoard=Rf;exports.useBoardCore=pi;exports.useBoardStore=Ul;exports.useCardStacking=jf;exports.useDragState=bc;exports.useFilteredCards=Yf;exports.useFilters=Of;exports.useGanttI18n=Ka;exports.useKanbanState=Hl;exports.useKeyboardShortcuts=um;exports.useMultiSelect=Gf;exports.useSelectionState=eu;exports.useSortedCards=Xf;exports.useTheme=rs;exports.useVirtualGrid=rb;exports.useVirtualList=Zf;exports.validateAIResponse=ug;exports.withErrorBoundary=Dc;exports.wouldCreateCircularDependency=Ci;exports.zIndex=cu;//# sourceMappingURL=index.cjs.map
|
|
444
445
|
//# sourceMappingURL=index.cjs.map
|