@libxai/board 1.5.18 → 1.5.20
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 +26 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- 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 Xc(e,t,a,r){switch(t){case "json":return
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Qc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Qc(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,b)=>{i[g]=l[b]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Qc(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Zc(e,t){switch(t){case "json":return Df(e);case "csv":return Sf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function eu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var sl=react.createContext(null);function tu(){return react.useContext(sl)}var au=react.createContext(null);function ru({children:e,themeName:t}){return jsxRuntime.jsx(au.Provider,{value:{themeName:t},children:e})}function Zo(){return react.useContext(au)}function Ot({children:e,container:t}){let[a,r]=react.useState(false),o=tu(),s=Zo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:u}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var lu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Bf="#BDC3C7",Rf=({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 So({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let g=u.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=160,f=220,y=4,w=g.right-v;w<10&&(w=g.left),w+v>h-10&&(w=h-v-10);let x=b-g.bottom,k=g.top,C;x>=f+y?C=g.bottom+y:k>=f+y?C=g.top-f-y:C=x>=k?g.bottom+y:Math.max(10,g.top-f-y),n({top:C,left:w}),o(true);};react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&!u.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let c=g=>{t(g),o(false);},d=e?lu[e]:null,m=d?.color||Bf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.label||"Set priority",children: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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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(lu).map(([g,b])=>jsxRuntime.jsxs("button",{onClick:()=>c(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Rf,{color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),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:()=>c(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Of=[{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 Pn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),m=(Zo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),x=window.innerHeight,k=window.innerWidth,C=320,D=380,T=4,R=w.left;R+C>k-10&&(R=k-C-10),R<10&&(R=10);let $=x-w.bottom,L=w.top,j;$>=D+T?j=w.bottom+T:L>=D+T?j=w.top-D-T:j=$>=L?w.bottom+T:Math.max(10,w.top-D-T),l({top:j,left:R}),s(true);};react.useEffect(()=>{let w=x=>{u.current&&!u.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let b=w=>{let x=new Date,k=R=>{let $=R.getFullYear(),L=String(R.getMonth()+1).padStart(2,"0"),j=String(R.getDate()).padStart(2,"0");return `${$}-${L}-${j}`},C=k(x),D=new Date(x);D.setDate(D.getDate()+w);let T=k(D);a(C,T),s(false);},h=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=D.split("-").map(Number);if(T.length!==3||T.some(j=>isNaN(j)))return null;let R=T[0],$=T[1],L=T[2];return R===void 0||$===void 0||L===void 0?null:new Date(R,$-1,L)},x=w(e),k=w(t);if(!x||!k||isNaN(x.getTime())||isNaN(k.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[x.getMonth()]} ${x.getDate()} \u2013 ${C[k.getMonth()]} ${k.getDate()}`},v=e&&t,y=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),w<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${h()}`:"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:h()})]}),o&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"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:m?"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:Of.map(w=>jsxRuntime.jsx("button",{onClick:()=>b(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,u]=react.useState(""),[i,c]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let y=m.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,k=300,C=380,D=4,T=y.right-k;T<10&&(T=y.left),T+k>x-10&&(T=x-k-10);let R=w-y.bottom,$=y.top,L;R>=C+D?L=y.bottom+D:$>=C+D?L=y.top-C-D:L=R>=$?y.bottom+D:Math.max(10,y.top-C-D),c({top:L,left:T}),n(true);};react.useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let b=y=>{let w=e.some(x=>x.id===y.id);a(w?e.filter(x=>x.id!==y.id):[...e,y]);},h=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.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)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(Ot,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:l,onChange:y=>u(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:h.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"}):h.map(y=>{let w=e.some(x=>x.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>b(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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Ds(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(u),false};return l(a)}function Ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,u]=react.useState(false),[i,c]=react.useState(""),[d,m]=react.useState(t.length>0),[g,b]=react.useState({top:0,left:0}),[h,v]=react.useState(null),f=react.useRef(null),y=react.useRef(null),w=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),R=window.innerHeight,$=window.innerWidth,L=300,j=d?380:120,E=4,ce=T.right-L;ce<10&&(ce=T.left),ce+L>$-10&&(ce=$-L-10);let I=R-T.bottom,X=T.top,Ce;I>=j+E?Ce=T.bottom+E:X>=j+E?Ce=T.top-j-E:Ce=I>=X?T.bottom+E:Math.max(10,T.top-j-E),b({top:Ce,left:ce}),u(true);};react.useEffect(()=>{if(!l||!y.current)return;let T=y.current.getBoundingClientRect(),R=window.innerHeight,$=window.innerWidth,L=300,j=d?380:120,E=4,ce=T.right-L;ce<10&&(ce=T.left),ce+L>$-10&&(ce=$-L-10);let I=R-T.bottom,X=T.top,Ce;I>=j+E?Ce=T.bottom+E:X>=j+E?Ce=T.top-j-E:Ce=I>=X?T.bottom+E:Math.max(10,T.top-j-E),b({top:Ce,left:ce});},[d,l]),react.useEffect(()=>{let T=R=>{f.current&&!f.current.contains(R.target)&&!y.current?.contains(R.target)&&(u(false),c(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{let T=R=>{R.key==="Escape"&&(u(false),c(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let x=T=>{let R=t.includes(T),$=a.find(L=>L.id===T);if(v(null),R){let L=t.filter(j=>j!==T);r(L),L.length===0&&m(false);}else {if(s&&Ds(a,T,e)){let j=`Cannot add "${$?.title||T}" as dependency - would create circular reference`;v(j),n?.(T,$?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},k=()=>{let T=!d;m(T),T||r([]);},C=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l?u(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[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:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),l&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),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:k,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&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"})]})}),d&&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:T=>c(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:C.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"}):C.map(T=>{let R=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>x(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&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:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),u(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 Yr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:m,transition:g,isDragging:b}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:ks.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:h,...i,...c,onClick:()=>a?.(e),children:t(e)});let v=l.filter(x=>e.assignedUserIds?.includes(x.id)),f=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),w={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:p("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(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:x=>{x.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:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,k)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),k===3&&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]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(So,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Pn,{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:(x,k)=>n?.(e.id,{startDate:x,endDate:k})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Fo,{assignedUsers:v,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:u,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Yr.displayName="Card";var Ss={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"}},yu=({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 xu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),c=[...Object.entries(Ss).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ss).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Ss[e];if(v)return {...v,id:e};let f=r.find(y=>y.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ss.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,w=180,x=280,k=4,C=v.right-w;C<10&&(C=v.left),C+w>y-10&&(C=y-w-10);let D=f-v.bottom,T=v.top,R;D>=x+k?R=v.bottom+k:T>=x+k?R=v.top-x-k:R=D>=T?v.bottom+k:Math.max(10,v.top-x-k),l({top:R,left:C}),s(true);};react.useEffect(()=>{let v=f=>{u.current&&!u.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},b=d(),h=b.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:b.label,children:jsxRuntime.jsx(yu,{icon:b.icon,color:h})}),o&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:u,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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:c.map(v=>jsxRuntime.jsxs("button",{onClick:()=>g(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(yu,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var vu={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 wu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=vu[s]||vu.en,[l,u]=react.useState(false),[i,c]=react.useState(false),[d,m]=react.useState(e),[g,b]=react.useState({top:0,left:0}),h=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(l&&v.current){let k=v.current.getBoundingClientRect();b({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),react.useEffect(()=>{let k=C=>{h.current&&!h.current.contains(C.target)&&!v.current?.contains(C.target)&&(u(false),c(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=C=>{C.key==="Escape"&&(u(false),c(false),m(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let y=()=>{c(true),m(e);},w=()=>{let k=d.trim();k&&k!==e&&t(k),c(false),u(false),m(e);},x=k=>{k.key==="Enter"?w():k.key==="Escape"&&(c(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>u(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children: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"})]})}),l&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?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:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:k=>m(k.target.value),onKeyDown:x,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):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:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),u(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:n.delete})]})]})]})})})]})}var an=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:b,onColumnDelete:h,isDeletable:v=false,className:f,renderMetrics:y,locale:w})=>{let{setNodeRef:x,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),D=c??jc(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:x,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),L=$.state==="exceeded",j=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:p("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(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:p(j()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.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"})]}),$.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"})]}),$.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"})}),$.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"})]})]}),(b||h)&&jsxRuntime.jsx(wu,{columnTitle:e.title,onRename:E=>b?.(e.id,E),onDelete:h?()=>h(e.id):void 0,isDeletable:v,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!m&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(E=>E.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"})}):D?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(E=>{let ce=t[E.index];return ce?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsxRuntime.jsx(Yr,{card:ce,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i})},ce.id):null})}):t.map(E=>jsxRuntime.jsx(Yr,{card:E,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i},E.id))})})]})});an.displayName="Column";function ul({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let u=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?u():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:u,onKeyDown:i,className:p("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:p("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function rb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Su(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let u=l.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function ob(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function nb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var sb=["\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 Eu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:h=10}){let v=l==="dark",[f,y]=react.useState(false),[w,x]=react.useState([]),[k,C]=react.useState(0),[D,T]=react.useState(null),[R,$]=react.useState(false),L=react.useRef(null),j=react.useRef(null),E=react.useRef(null),ce=react.useRef(null),I=react.useCallback((z,re)=>{let J=rb(z,re);if(T(J),J){let Ae=r.filter(he=>he.name.toLowerCase().includes(J.query)||he.email&&he.email.toLowerCase().includes(J.query)).slice(0,5);x(Ae),y(Ae.length>0),C(0);}else y(false),x([]);},[r]),X=z=>{let re=z.target.value;if(t(re),I(re,z.target.selectionStart||0),L.current){L.current.style.height="24px";let J=L.current.scrollHeight,Ae=280,he=Math.min(J,Ae);L.current.style.height=`${he}px`,L.current.style.overflowY=J>Ae?"auto":"hidden";}},Ce=()=>{L.current&&I(e,L.current.selectionStart||0);},Xe=react.useCallback(z=>{if(!D||!L.current)return;let re=e.slice(0,D.start),J=e.slice(D.end),Ae=`@${z.name.replace(/\s+/g,"")} `,he=re+Ae+J;t(he),y(false),T(null),setTimeout(()=>{if(L.current){let $e=D.start+Ae.length;L.current.selectionStart=$e,L.current.selectionEnd=$e,L.current.focus();}},0);},[D,e,t]),P=z=>{if(f&&w.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),C(re=>re<w.length-1?re+1:0);break;case "ArrowUp":z.preventDefault(),C(re=>re>0?re-1:w.length-1);break;case "Enter":{z.preventDefault();let re=w[k];re&&Xe(re);break}case "Tab":{z.preventDefault();let re=w[k];re&&Xe(re);break}case "Escape":z.preventDefault(),y(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};react.useEffect(()=>{let z=re=>{j.current&&!j.current.contains(re.target)&&L.current&&!L.current.contains(re.target)&&y(false),ce.current&&!ce.current.contains(re.target)&&$(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let G=react.useCallback(z=>{if(!L.current)return;let re=L.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),$(false),setTimeout(()=>{if(L.current){let Ae=re+z.length;L.current.selectionStart=Ae,L.current.selectionEnd=Ae,L.current.focus();}},0);},[e,t]),fe=react.useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=h*1024*1024,Ae=re.filter(he=>he.size>J?(console.warn(`File ${he.name} exceeds max size of ${h}MB`),false):true);Ae.length>0&&g(Ae),z.target.value="";},[g,h]),Ve=react.useCallback(z=>z.type.startsWith("image/")?lucideReact.Image:z.type.includes("pdf")||z.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&j.current){let z=j.current.children[k];z&&z.scrollIntoView({block:"nearest"});}},[k,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(z=>{let re=Ve(z.file),J=z.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsxRuntime.jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(re,{className:p("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-white":"text-gray-900"),children:z.file.name}),jsxRuntime.jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:nb(z.file.size)})]}),b&&jsxRuntime.jsx("button",{onClick:()=>b(z.id),className:p("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},z.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:p("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:p("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$(!R),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ce,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:sb.map(z=>jsxRuntime.jsx("button",{type:"button",onClick:()=>G(z),className:p("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:p("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:u==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:E,type:"file",multiple:true,onChange:fe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:L,value:e,onChange:X,onSelect:Ce,onKeyDown:P,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:p("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:p("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:j,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((z,re)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Xe(z),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===k?v?"bg-white/10":"bg-gray-100":v?"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:z.color||"#8B5CF6"},children:ob(z.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:p("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:z.name}),z.email&&jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function Fu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,u)=>l.type==="mention"?jsxRuntime.jsx("span",{className:p("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},u):jsxRuntime.jsx("span",{children:l.value},u))})}var As=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,u]=react.useState(false),[i,c]=react.useState(""),[d,m]=react.useState(false),[g,b]=react.useState(As[10]||"#2E94FF"),[h,v]=react.useState({top:0,left:0}),f=react.useRef(null),y=react.useRef(null),w=react.useRef(null),x=react.useRef(null),k=t.filter(L=>L.name.toLowerCase().includes(i.toLowerCase())),C=t.some(L=>L.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&y.current){let L=y.current.getBoundingClientRect();v({top:L.bottom+6,left:L.left});}},[l]),react.useEffect(()=>{let L=j=>{let E=j.target,ce=f.current?.contains(E),I=w.current?.contains(E);!ce&&!I&&(u(false),c(""),m(false));};if(l)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[l]),react.useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let D=L=>{let j=e.some(E=>E.id===L.id);a(j?e.filter(E=>E.id!==L.id):[...e,L]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let L=await r(i.trim(),g);L&&(a([...e,L]),c(""),b(As[Math.floor(Math.random()*As.length)]||"#2E94FF"));}finally{m(false);}}},R=(L,j)=>{j.stopPropagation(),a(e.filter(E=>E.id!==L));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&u(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,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(L=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${L.color}20`,color:L.color},children:L.name},L.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:h.top,left:h.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:i,onChange:L=>c(L.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:L=>{L.key==="Enter"&&i.trim()&&!C&&r&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(L=>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:`${L.color}20`,color:L.color},onClick:j=>R(L.id,j),children:[L.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},L.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(L=>{let j=e.some(E=>E.id===L.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(L),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:j?`${L.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{j||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{j||(E.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:L.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:L.name}),j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:L.color}})]},L.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!C&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:As.map(L=>jsxRuntime.jsx("button",{type:"button",onClick:()=>b(L),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:L,outline:g===L?`2px solid ${L}`:"none",outlineOffset:"2px"}},L))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?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 ml({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Pu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(ml,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Po=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Au(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function fb(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function bb({className:e}){return jsxRuntime.jsxs("svg",{className:p("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 gl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=fb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Au(e.loggedMinutes),i=e.estimateMinutes?Au(e.estimateMinutes):null,c=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:p("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(bb,{className:l[t]}),jsxRuntime.jsx("span",{children:c})]})}function hb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Is(e){let t=hb(e);return t!==null?String(t):e}function Iu(e){let a=Is(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Bs(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function vb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function wb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function kb({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 Bu({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 Cb({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 fl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:u,onDiscardTimer:i,onClose:c,className:d}){let[m,g]=react.useState(""),[b,h]=react.useState(t.estimateMinutes?Bs(t.estimateMinutes):""),[v,f]=react.useState(""),[y,w]=react.useState(false),[x,k]=react.useState(false),C=react.useRef(null);react.useEffect(()=>{C.current?.focus();},[]);let D=async()=>{let $=Iu(m);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let $=b.trim()?Iu(b):null;await n($),k(false);},R=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),D()),$.key==="Escape"&&c?.();};return jsxRuntime.jsxs("div",{className:p("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),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:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Bu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?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:vb(o)})]}),jsxRuntime.jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(kb,{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(Bu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:p("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(wb,{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(Cb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:m,onChange:$=>g($.target.value),onKeyDown:R,placeholder:"8 (=8h), 2h 30m",className:p("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:D,disabled:y||!m.trim(),className:p("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:$=>f($.target.value),onKeyDown:R,placeholder:"Note (optional)",className:p("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),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:Bs(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"}),x?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:b,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&T(),$.key==="Escape"&&k(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Bs(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:p("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:p("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&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:a.slice(0,3).map($=>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:$.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Bs($.durationMinutes)})]},$.id))})]})]})}function Eb(e){let a=Is(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Fb(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,u]=react.useState(Fb(r)),[i,c]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let b=async()=>{m(true);let w=Eb(l);await o(w&&w>0?w:null,i||void 0),m(false);},h=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b()),w.key==="Escape"&&s();},f={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:p("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"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:g,type:"text",value:l,onChange:w=>u(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:h,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Mb(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 Pb(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 hl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Mb(e.health),s=Pb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,u=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:p("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:p("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:p("h-full transition-all duration-300",o),style:{width:`${u}%`}}),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:p("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function rn(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Lb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Ib(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Bb(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 Rb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",u=a?"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:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",rn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:p("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",l),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:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",l),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:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:rn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:rn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function Ob({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:p("border-b",s,r&&p("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:p("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:p("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?rn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:rn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,rn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:p("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Ib(e.status,a),Lb(e.status,a)),children:Bb(e.status,t)})})]})}function yl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",u=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",c=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((b,h)=>b.varianceMinutes===null?1:h.varianceMinutes===null?-1:h.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:p("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:p("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:p("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:p("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:p("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Rb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:p("rounded-lg border overflow-hidden",u,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:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:p("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:p("divide-y",i),children:g.map(b=>jsxRuntime.jsx(Ob,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsxRuntime.jsx("div",{className:p("text-xs text-center",d),children:a==="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 on(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Jb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function _u(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Qb(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 Xr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:b=[],onAddComment:h,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:y,enableTimeTracking:w=false,timeTrackingSummary:x,timeEntries:k=[],isTimerRunning:C=false,timerElapsedSeconds:D=0,onTimeLog:T,onEstimateUpdate:R,onSoldEffortUpdate:$,onTimerStart:L,onTimerStop:j,onTimerDiscard:E,blurFinancials:ce=false}){let I=s==="dark",X={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)"},Ce=e&&"title"in e&&!("name"in e),Xe=e,[P,G]=react.useState(e?_u(e,l):null),[fe,Ve]=react.useState(false),[z,re]=react.useState(false),[J,Ae]=react.useState(false),[he,$e]=react.useState(null),[Ne,at]=react.useState(new Date),[ee,rt]=react.useState(false),[ue,ot]=react.useState(false),[gt,Ct]=react.useState(""),[be,ft]=react.useState(false),[tt,Qe]=react.useState(false),[H,se]=react.useState(false),[N,K]=react.useState(false),[ie,we]=react.useState(""),W=react.useRef(null),te=react.useRef(null),[ze,Te]=react.useState(""),Ie=react.useRef(null),[De,_e]=react.useState(""),[ut,mt]=react.useState(false),[Ze,et]=react.useState([]),[It,Tt]=react.useState(""),[bt,yt]=react.useState(false),dt=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 F=_u(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:F?.id,taskName:F?.name,soldEffortMinutes:F?.soldEffortMinutes,quotedMinutes:F?.quotedMinutes,effortMinutes:F?.effortMinutes,timeLoggedMinutes:F?.timeLoggedMinutes}),G(F),we(F.description||""),Te(F.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!ie)return;let F=setTimeout(()=>{let ae=te.current;ae&&(ae.style.height="auto",ae.style.height=`${Math.max(100,ae.scrollHeight)}px`);},50);return ()=>clearTimeout(F)},[t,ie]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),Ie.current&&clearTimeout(Ie.current);},[]),react.useEffect(()=>{t&&dt.current&&b.length>0&&setTimeout(()=>{dt.current&&(dt.current.scrollTop=dt.current.scrollHeight);},100);},[t,b.length]);let Ft=react.useCallback(F=>{G(F),Ce&&o&&Xe?o(Qb(F,Xe)):r&&r(F);},[Ce,Xe,o,r]),He=react.useCallback(()=>{Ve(false),re(false),Ae(false),$e(null),ot(false),Ct(""),ft(false);},[]),Be=react.useCallback((F,ae)=>{if(!P)return;let Re={...P,[F]:ae};Ft(Re);},[P,Ft]),ct=react.useCallback(()=>{let F=te.current;F&&(F.style.height="auto",F.style.height=`${Math.max(100,F.scrollHeight)}px`);},[]),ne=react.useCallback(F=>{we(F),setTimeout(ct,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(P){let ae={...P,description:F};Ft(ae);}},800);},[P,Ft,ct]),ge=react.useCallback(F=>{Te(F),Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{if(P&&F.trim()){let ae={...P,name:F.trim()};Ft(ae);}},800);},[P,Ft]),A=react.useCallback(F=>{let ae=F.map(Re=>{let Je={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Re};return Re.type.startsWith("image/")&&(Je.preview=URL.createObjectURL(Re)),Je});et(Re=>[...Re,...ae]);},[]),Y=react.useCallback(F=>{et(ae=>{let Re=ae.find(Je=>Je.id===F);return Re?.preview&&URL.revokeObjectURL(Re.preview),ae.filter(Je=>Je.id!==F)});},[]),q=react.useCallback(async()=>{if(!(!P||!De.trim()&&Ze.length===0||!h)){mt(true);try{let F=Su(De,f),ae=[];if(Ze.length>0&&y){let Re=Ze.map(Je=>Je.file);ae=await y(Re);}await h(P.id,De.trim(),F.length>0?F:void 0,ae.length>0?ae:void 0),_e(""),Ze.forEach(Re=>{Re.preview&&URL.revokeObjectURL(Re.preview);}),et([]);}finally{mt(false);}}},[P,De,Ze,h,f,y]),le=react.useCallback(()=>{if(!P||!It.trim())return;let F=P.subtasks||[],ae={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:It.trim(),progress:0,startDate:new Date,endDate:new Date,position:F.length},Re=[...F,ae],Je={...P,subtasks:Re};Ft(Je),Tt(""),yt(false);},[P,It,Ft]),Se=react.useCallback(F=>{if(!P?.subtasks)return;let ae=P.subtasks.map(Je=>Je.id===F?{...Je,progress:Je.progress===100?0:100}:Je),Re={...P,subtasks:ae};Ft(Re);},[P,Ft]),je=react.useCallback(F=>{if(!P?.subtasks)return;let ae=P.subtasks.filter(Je=>Je.id!==F),Re={...P,subtasks:ae};Ft(Re);},[P,Ft]),Ue=react.useCallback(F=>{let ae=typeof F=="string"?new Date(F):F,Je=new Date().getTime()-ae.getTime(),qt=Math.floor(Je/6e4),Bt=Math.floor(Je/36e5),Da=Math.floor(Je/864e5);return qt<1?n==="es"?"Ahora":"Just now":qt<60?n==="es"?`Hace ${qt} min`:`${qt}m ago`:Bt<24?n==="es"?`Hace ${Bt}h`:`${Bt}h ago`:Da<7?n==="es"?`Hace ${Da}d`:`${Da}d ago`:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),S=react.useCallback(F=>{if(!P)return;let ae=P.progress||0;F==="completed"?ae=100:F==="in-progress"&&ae===0?ae=10:F==="todo"&&(ae=0);let Re={...P,status:F,progress:ae};Ft(Re),Ve(false);},[P,Ft]),Z=react.useCallback((F,ae)=>{if(!P)return;let Re={...P,startDate:F,endDate:ae};Ft(Re);},[P,Ft]),pe=react.useCallback(()=>{let F=Ne.getFullYear(),ae=Ne.getMonth(),Re=new Date(F,ae,1),qt=new Date(F,ae+1,0).getDate(),Bt=Re.getDay(),Da=[],Ba=new Date(F,ae,0).getDate();for(let fa=Bt-1;fa>=0;fa--)Da.push({date:new Date(F,ae-1,Ba-fa),isCurrentMonth:false});for(let fa=1;fa<=qt;fa++)Da.push({date:new Date(F,ae,fa),isCurrentMonth:true});let Ra=42-Da.length;for(let fa=1;fa<=Ra;fa++)Da.push({date:new Date(F,ae+1,fa),isCurrentMonth:false});return Da},[Ne]),Ee=react.useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),se(false),!P||!d)return;let ae=Array.from(F.dataTransfer.files);if(ae.length!==0){K(true);try{await d(P.id,ae);}finally{K(false);}}},[P,d]),qe=react.useCallback(async F=>{if(!P||!d||!F.target.files)return;let ae=Array.from(F.target.files);if(ae.length!==0){K(true);try{await d(P.id,ae);}finally{K(false);}F.target.value="";}},[P,d]),Ke=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),se(true);},[]),B=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),se(false);},[]),V=react.useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),ke=react.useCallback(F=>F.startsWith("image/")?lucideReact.Image:F.includes("pdf")||F.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!P?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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:p("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:p("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:p("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:p("text-xs px-2 py-0.5 rounded",I?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",I?"text-[#6B7280]":"text-gray-400"),children:P.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 F=P.progress===100?0:100,Re={...P,progress:F,status:F===100?"completed":"todo"};Ft(Re);},className:p("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",P.progress===100?"bg-green-500 border-green-500":I?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:ze,onChange:F=>ge(F.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:p("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",P.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:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{He(),Ve(!fe);},className:p("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",P.progress===100||P.status==="completed"?"bg-green-500/20 text-green-400":P.progress&&P.progress>0||P.status==="in-progress"?"bg-blue-500/20 text-blue-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:P.progress===100||P.status==="completed"?n==="es"?"COMPLETADO":"DONE":P.progress&&P.progress>0||P.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ve(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>S(F.id),className:p("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",P.status===F.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:I?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{He(),Ae(!J);},className:p("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:[P.assignees&&P.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[P.assignees.slice(0,3).map((F,ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},ae)),P.assignees.length>3&&jsxRuntime.jsxs("span",{className:p("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:["+",P.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:p("text-sm",I?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ae(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(F=>{let ae=P.assignees?.some(Re=>Re.name===F.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Re=P.assignees||[],Je;ae?Je=Re.filter(qt=>qt.name!==F.name):Je=[...Re,F],Be("assignees",Je);},className:p("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",ae&&(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:F.color||"#8B5CF6"},children:F.initials||F.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p("flex-1",I?"text-white":"text-gray-900"),children:F.name}),ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},F.name)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{$e(he?null:"start"),at(P.startDate||new Date);},className:p("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:[P.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:p("mx-1",I?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),P.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:p("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",I?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,ae=new Date(F);ae.setDate(F.getDate()+1);let Re=new Date(F);Re.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let Je=new Date(F);Je.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let qt=new Date(F);qt.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let Bt=new Date(F);Bt.setDate(F.getDate()+14);let Da=new Date(F);return Da.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Re,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:qt,display:qt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Bt,display:Bt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Da,display:Da.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ra,fa)=>jsxRuntime.jsxs("button",{className:p("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(he==="start"){let ir=P.endDate&&Ra.date>P.endDate?Ra.date:P.endDate;Z(Ra.date,ir),$e("end");}else {let ir=P.startDate&&Ra.date<P.startDate?Ra.date:P.startDate;Z(ir,Ra.date),$e(null);}},children:[jsxRuntime.jsx("span",{children:Ra.label}),jsxRuntime.jsx("span",{className:p("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:Ra.display})]},fa))})(),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",I?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Z(void 0,void 0),$e(null);},className:p("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:n==="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:p("text-xs mb-3 px-2 py-1 rounded",I?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:he==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",I?"text-white":"text-gray-900"),children:Ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>at(new Date),className:p("p-1 rounded text-sm transition-colors",I?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(Ne.getFullYear(),Ne.getMonth()-1)),className:p("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:()=>at(new Date(Ne.getFullYear(),Ne.getMonth()+1)),className:p("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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(F=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",I?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:pe().map((F,ae)=>{let Re=F.date.toDateString()===new Date().toDateString(),Je=P.startDate?.toDateString()===F.date.toDateString(),qt=P.endDate?.toDateString()===F.date.toDateString(),Bt=Je||qt,Da=P.startDate&&P.endDate&&F.date>=P.startDate&&F.date<=P.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Ba=new Date(F.date);if(he==="start"){let Ra=P.endDate&&Ba>P.endDate?Ba:P.endDate;Z(Ba,Ra),$e("end");}else {let Ra=P.startDate&&Ba<P.startDate?Ba:P.startDate;Z(Ra,Ba),$e(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!F.isCurrentMonth&&(I?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(I?"text-white":"text-gray-900"),Re&&"ring-2 ring-[#2E94FF]",Je&&"bg-[#2E94FF] text-white",qt&&!Je&&"bg-[#7C3AED] text-white",Da&&!Bt&&(I?"bg-[#7C3AED]/20":"bg-purple-100"),!Bt&&(I?"hover:bg-white/10":"hover:bg-gray-100")),children:F.date.getDate()},ae)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{He(),re(!z);},className:p("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",P.priority==="high"||P.priority==="urgent"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":P.priority==="low"?"bg-green-500/20 text-green-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:P.priority?P.priority==="high"||P.priority==="urgent"?n==="es"?"Alta":"High":P.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>re(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{Be("priority",F.id),re(false);},className:p("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",P.priority===F.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:I?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:p("text-sm",I?"text-white":"text-gray-900"),children:P.startDate&&P.endDate?`${Math.ceil((P.endDate.getTime()-P.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded-full border-2",I?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:P.progress||0,onChange:F=>{let ae=parseInt(F.target.value),Re=P.status;ae===100?Re="completed":ae>0?Re="in-progress":Re="todo";let Je={...P,progress:ae,status:Re};Ft(Je);},onBlur:()=>rt(false),className:p("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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>rt(true),className:p("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",I?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",P.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${P.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:p("text-sm font-medium min-w-[40px]",I?"text-white":"text-gray-900"),children:[P.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:P.status==="completed"||P.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?on(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:on(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="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($r,{mode:"estimate",locale:n,isDark:I,currentValue:x?.estimateMinutes||null,onSave:async F=>{await R?.(P.id,F),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ce?jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",I?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):P.status==="completed"||P.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:P.quotedMinutes?on(P.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):P.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:on(P.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="quoted"&&!ce&&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($r,{mode:"quoted",locale:n,isDark:I,currentValue:P.quotedMinutes||null,onSave:async F=>{$?(await $(P.id,F),G(ae=>ae?{...ae,quotedMinutes:F}:null)):Be("quotedMinutes",F),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[P.status==="completed"||P.progress===100?jsxRuntime.jsx("div",{className:p("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:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):C?jsxRuntime.jsxs("button",{type:"button",onClick:()=>j?.(P.id),className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),Jb(D||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>L?.(P.id),className:p("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:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),P.status==="completed"||P.progress===100?jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Qe("log"),className:p("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"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":I?"text-white":"text-gray-900"),children:[on(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:p("font-normal",I?"text-[#6B7280]":"text-gray-400"),children:[" / ",on(x.estimateMinutes)]})]}),x.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:p("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="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($r,{mode:"log",locale:n,isDark:I,currentValue:null,onSave:async(F,ae)=>{F&&await T?.(P.id,{durationMinutes:F,note:ae,source:"manual"}),Qe(false);},onClose:()=>Qe(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(lo,{selectedTags:P.tags||[],availableTags:u,onChange:F=>{Be("tags",F);},onCreateTag:i,theme:X})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:p("w-4 h-4 mt-1.5",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0 mt-1",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[P.dependencies&&P.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:P.dependencies.map(F=>{let ae=g.find(Re=>Re.id===F);return jsxRuntime.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",I?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ae?.name||F.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Re=(P.dependencies||[]).filter(Je=>Je!==F);Be("dependencies",Re);},className:p("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},F)})}),jsxRuntime.jsxs("button",{onClick:()=>{He(),ot(!ue);},className:p("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:p("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ot(false),Ct("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("p-2 border-b",I?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:gt,onChange:F=>Ct(F.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("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:g.length>0?g.filter(F=>F.id!==P.id).filter(F=>gt===""||F.name.toLowerCase().includes(gt.toLowerCase())).map(F=>{let ae=P.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Re=P.dependencies||[],Je;ae?Je=Re.filter(qt=>qt!==F.id):Je=[...Re,F.id],Be("dependencies",Je);},className:p("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",ae&&(I?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ae?"bg-blue-500 border-blue-500":I?"border-white/30":"border-gray-300"),children:ae&&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:p("block truncate",I?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("span",{className:p("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{He(),ft(!be);},className:p("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:P.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:p("text-sm",I?"text-white":"text-gray-900"),children:Po.find(F=>F.value===P.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ft(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",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:Po.map(F=>{let ae=P.color===F.value;return jsxRuntime.jsx("button",{onClick:()=>{Be("color",F.value),ft(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",ae&&"ring-2 ring-offset-2",I?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:ae?F.value:void 0},title:F.name,children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:P.isMilestone||false,onChange:F=>Be("isMilestone",F.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",P.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:p("text-sm",I?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:p("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:p("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:p("text-sm font-semibold",I?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:te,value:ie,onChange:F=>ne(F.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:p("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",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:p("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:p("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",P.subtasks&&P.subtasks.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",P.subtasks.filter(F=>F.progress===100).length,"/",P.subtasks.length,")"]})]})}),P.subtasks&&P.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...P.subtasks].sort((F,ae)=>(F.position??0)-(ae.position??0)).map(F=>jsxRuntime.jsxs("div",{className:p("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:()=>Se(F.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",F.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:F.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:p("text-sm flex-1",F.progress===100?"line-through text-[#6B7280]":I?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("button",{onClick:()=>je(F.id),className:p("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"})})]},F.id))}),bt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:It,onChange:F=>Tt(F.target.value),onKeyDown:F=>{F.key==="Enter"&&It.trim()?le():F.key==="Escape"&&(yt(false),Tt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:p("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",I?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:le,disabled:!It.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",It.trim()?"bg-blue-500 hover:bg-blue-600 text-white":I?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{yt(false),Tt("");},className:p("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:()=>yt(true),className:p("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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold mb-3",I?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(F=>{let ae=ke(F.type),Re=F.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("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:[Re&&F.thumbnailUrl?jsxRuntime.jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",I?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ae,{className:p("w-5 h-5",I?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",I?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("p",{className:p("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:V(F.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(F.id),className:p("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:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ke,onDragLeave:B,onDrop:Ee,className:p("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?I?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":I?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",N&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:qe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||N}),N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:p("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:p("w-6 h-6 mx-auto mb-2",H?"text-blue-500":I?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:p("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="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"})]})}),!d&&jsxRuntime.jsx("p",{className:p("text-xs mt-1",I?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:p("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:p("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:p("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:p("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:`
|
|
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'),Cf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Gh=require('react-markdown'),Vh=require('remark-gfm'),_h=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Cf__default=/*#__PURE__*/_interopDefault(Cf);var Gh__default=/*#__PURE__*/_interopDefault(Gh);var Vh__default=/*#__PURE__*/_interopDefault(Vh);var _h__default=/*#__PURE__*/_interopDefault(_h);var Cs=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ts=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [Ts.Translate.toString(e),Ts.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function p(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ns(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 yf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ol(e,t){return e.length===0?1e3:t===0?Ns(null,e[0].position):t>=e.length?Ns(e[e.length-1].position,null):Ns(e[t-1].position,e[t].position)}function jc(e,t=100){return e>t}var xf=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 vf(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Ds(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=xf,onRetry:l}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,u===a||!n(c,u))return {error:c,attempts:i,success:false};let g=vf(u,r,o,s);if(l)try{l(c,u,g);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function wf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function kf(e,t={}){return async(...a)=>Ds(()=>e(...a),t)}var nl=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var Kc=(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))(Kc||{}),So=class So{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,o,c?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...So.globalOptions};}static configure(t){So.globalOptions={...So.globalOptions,...t};}child(t){return new So({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ss((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ss(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Kc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};So.globalOptions={};var sl=So,Ss=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Yc=new sl;function Tf(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Nf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,il(s.title),il(s.description||""),il(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function Df(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await Cf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,u=n.width/n.height,d=c-20,m=d/u;m>i-20&&(m=i-20,d=m*u);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let b=(c-d)/2;return g.addImage(l,"PNG",b,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(c.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function il(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Xc(e,t,a,r){switch(t){case "json":return Tf(e,r);case "csv":return Nf(e);case "pdf":return await Df(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Jc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Sf(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Ef(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Qc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Qc(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,b)=>{i[g]=l[b]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Qc(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Zc(e,t){switch(t){case "json":return Sf(e);case "csv":return Ef(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function eu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var ll=react.createContext(null);function tu(){return react.useContext(ll)}var au=react.createContext(null);function ru({children:e,themeName:t}){return jsxRuntime.jsx(au.Provider,{value:{themeName:t},children:e})}function en(){return react.useContext(au)}function Ot({children:e,container:t}){let[a,r]=react.useState(false),o=tu(),s=en();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var lu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Rf="#BDC3C7",Of=({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 Eo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=160,f=220,y=4,w=g.right-v;w<10&&(w=g.left),w+v>h-10&&(w=h-v-10);let x=b-g.bottom,C=g.top,k;x>=f+y?k=g.bottom+y:C>=f+y?k=g.top-f-y:k=x>=C?g.bottom+y:Math.max(10,g.top-f-y),n({top:k,left:w}),o(true);};react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&!c.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},d=e?lu[e]:null,m=d?.color||Rf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.label||"Set priority",children: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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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(lu).map(([g,b])=>jsxRuntime.jsxs("button",{onClick:()=>u(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Of,{color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var $f=[{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 Ln({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(en()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),x=window.innerHeight,C=window.innerWidth,k=320,D=380,T=4,B=w.left;B+k>C-10&&(B=C-k-10),B<10&&(B=10);let $=x-w.bottom,A=w.top,_;$>=D+T?_=w.bottom+T:A>=D+T?_=w.top-D-T:_=$>=A?w.bottom+T:Math.max(10,w.top-D-T),l({top:_,left:B}),s(true);};react.useEffect(()=>{let w=x=>{c.current&&!c.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let b=w=>{let x=new Date,C=B=>{let $=B.getFullYear(),A=String(B.getMonth()+1).padStart(2,"0"),_=String(B.getDate()).padStart(2,"0");return `${$}-${A}-${_}`},k=C(x),D=new Date(x);D.setDate(D.getDate()+w);let T=C(D);a(k,T),s(false);},h=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=D.split("-").map(Number);if(T.length!==3||T.some(_=>isNaN(_)))return null;let B=T[0],$=T[1],A=T[2];return B===void 0||$===void 0||A===void 0?null:new Date(B,$-1,A)},x=w(e),C=w(t);if(!x||!C||isNaN(x.getTime())||isNaN(C.getTime()))return "Set date";let k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${k[x.getMonth()]} ${x.getDate()} \u2013 ${k[C.getMonth()]} ${C.getDate()}`},v=e&&t,y=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),w<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${h()}`:"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:h()})]}),o&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"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:m?"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:$f.map(w=>jsxRuntime.jsx("button",{onClick:()=>b(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Mo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let y=m.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,C=300,k=380,D=4,T=y.right-C;T<10&&(T=y.left),T+C>x-10&&(T=x-C-10);let B=w-y.bottom,$=y.top,A;B>=k+D?A=y.bottom+D:$>=k+D?A=y.top-k-D:A=B>=$?y.bottom+D:Math.max(10,y.top-k-D),u({top:A,left:T}),n(true);};react.useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let b=y=>{let w=e.some(x=>x.id===y.id);a(w?e.filter(x=>x.id!==y.id):[...e,y]);},h=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.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)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(Ot,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:l,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.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"}):h.map(y=>{let w=e.some(x=>x.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>b(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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Es(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(n.has(u))return true}}return n.delete(c),false};return l(a)}function Bn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[d,m]=react.useState(t.length>0),[g,b]=react.useState({top:0,left:0}),[h,v]=react.useState(null),f=react.useRef(null),y=react.useRef(null),w=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),B=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,ue=T.right-A;ue<10&&(ue=T.left),ue+A>$-10&&(ue=$-A-10);let L=B-T.bottom,X=T.top,ee;L>=_+E?ee=T.bottom+E:X>=_+E?ee=T.top-_-E:ee=L>=X?T.bottom+E:Math.max(10,T.top-_-E),b({top:ee,left:ue}),c(true);};react.useEffect(()=>{if(!l||!y.current)return;let T=y.current.getBoundingClientRect(),B=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,ue=T.right-A;ue<10&&(ue=T.left),ue+A>$-10&&(ue=$-A-10);let L=B-T.bottom,X=T.top,ee;L>=_+E?ee=T.bottom+E:X>=_+E?ee=T.top-_-E:ee=L>=X?T.bottom+E:Math.max(10,T.top-_-E),b({top:ee,left:ue});},[d,l]),react.useEffect(()=>{let T=B=>{f.current&&!f.current.contains(B.target)&&!y.current?.contains(B.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{let T=B=>{B.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let x=T=>{let B=t.includes(T),$=a.find(A=>A.id===T);if(v(null),B){let A=t.filter(_=>_!==T);r(A),A.length===0&&m(false);}else {if(s&&Es(a,T,e)){let _=`Cannot add "${$?.title||T}" as dependency - would create circular reference`;v(_),n?.(T,$?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},C=()=>{let T=!d;m(T),T||r([]);},k=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[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:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),l&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),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:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"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.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&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:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:k.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"}):k.map(T=>{let B=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>x(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.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:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Kr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:m,transition:g,isDragging:b}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:Ts.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:h,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=l.filter(x=>e.assignedUserIds?.includes(x.id)),f=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),w={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:p("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(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:x=>{x.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:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.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]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Eo,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ln,{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:(x,C)=>n?.(e.id,{startDate:x,endDate:C})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Mo,{assignedUsers:v,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Bn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Kr.displayName="Card";var Fs={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"}},yu=({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 xu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=[...Object.entries(Fs).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Fs).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Fs[e];if(v)return {...v,id:e};let f=r.find(y=>y.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Fs.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,w=180,x=280,C=4,k=v.right-w;k<10&&(k=v.left),k+w>y-10&&(k=y-w-10);let D=f-v.bottom,T=v.top,B;D>=x+C?B=v.bottom+C:T>=x+C?B=v.top-x-C:B=D>=T?v.bottom+C:Math.max(10,v.top-x-C),l({top:B,left:k}),s(true);};react.useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},b=d(),h=b.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:b.label,children:jsxRuntime.jsx(yu,{icon:b.icon,color:h})}),o&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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:u.map(v=>jsxRuntime.jsxs("button",{onClick:()=>g(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(yu,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var vu={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 wu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=vu[s]||vu.en,[l,c]=react.useState(false),[i,u]=react.useState(false),[d,m]=react.useState(e),[g,b]=react.useState({top:0,left:0}),h=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(l&&v.current){let C=v.current.getBoundingClientRect();b({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[l]),react.useEffect(()=>{let C=k=>{h.current&&!h.current.contains(k.target)&&!v.current?.contains(k.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),react.useEffect(()=>{let C=k=>{k.key==="Escape"&&(c(false),u(false),m(e));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let y=()=>{u(true),m(e);},w=()=>{let C=d.trim();C&&C!==e&&t(C),u(false),c(false),m(e);},x=C=>{C.key==="Enter"?w():C.key==="Escape"&&(u(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children: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"})]})}),l&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?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:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:C=>m(C.target.value),onKeyDown:x,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):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:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[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:n.delete})]})]})]})})})]})}var rn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:b,onColumnDelete:h,isDeletable:v=false,className:f,renderMetrics:y,locale:w})=>{let{setNodeRef:x,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),D=u??jc(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:x,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),A=$.state==="exceeded",_=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:p("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(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:p(_()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.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"})]}),$.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"})]}),$.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"})}),$.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"})]})]}),(b||h)&&jsxRuntime.jsx(wu,{columnTitle:e.title,onRename:E=>b?.(e.id,E),onDelete:h?()=>h(e.id):void 0,isDeletable:v,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!m&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(E=>E.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"})}):D?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(E=>{let ue=t[E.index];return ue?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsxRuntime.jsx(Kr,{card:ue,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},ue.id):null})}):t.map(E=>jsxRuntime.jsx(Kr,{card:E,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},E.id))})})]})});rn.displayName="Column";function ml({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:p("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:p("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function ob(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Su(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function nb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function sb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var ib=["\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 Eu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:h=10}){let v=l==="dark",[f,y]=react.useState(false),[w,x]=react.useState([]),[C,k]=react.useState(0),[D,T]=react.useState(null),[B,$]=react.useState(false),A=react.useRef(null),_=react.useRef(null),E=react.useRef(null),ue=react.useRef(null),L=react.useCallback((z,oe)=>{let J=ob(z,oe);if(T(J),J){let Ae=r.filter(xe=>xe.name.toLowerCase().includes(J.query)||xe.email&&xe.email.toLowerCase().includes(J.query)).slice(0,5);x(Ae),y(Ae.length>0),k(0);}else y(false),x([]);},[r]),X=z=>{let oe=z.target.value;if(t(oe),L(oe,z.target.selectionStart||0),A.current){A.current.style.height="24px";let J=A.current.scrollHeight,Ae=280,xe=Math.min(J,Ae);A.current.style.height=`${xe}px`,A.current.style.overflowY=J>Ae?"auto":"hidden";}},ee=()=>{A.current&&L(e,A.current.selectionStart||0);},$e=react.useCallback(z=>{if(!D||!A.current)return;let oe=e.slice(0,D.start),J=e.slice(D.end),Ae=`@${z.name.replace(/\s+/g,"")} `,xe=oe+Ae+J;t(xe),y(false),T(null),setTimeout(()=>{if(A.current){let He=D.start+Ae.length;A.current.selectionStart=He,A.current.selectionEnd=He,A.current.focus();}},0);},[D,e,t]),R=z=>{if(f&&w.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),k(oe=>oe<w.length-1?oe+1:0);break;case "ArrowUp":z.preventDefault(),k(oe=>oe>0?oe-1:w.length-1);break;case "Enter":{z.preventDefault();let oe=w[C];oe&&$e(oe);break}case "Tab":{z.preventDefault();let oe=w[C];oe&&$e(oe);break}case "Escape":z.preventDefault(),y(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};react.useEffect(()=>{let z=oe=>{_.current&&!_.current.contains(oe.target)&&A.current&&!A.current.contains(oe.target)&&y(false),ue.current&&!ue.current.contains(oe.target)&&$(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let Y=react.useCallback(z=>{if(!A.current)return;let oe=A.current.selectionStart||e.length,J=e.slice(0,oe)+z+e.slice(oe);t(J),$(false),setTimeout(()=>{if(A.current){let Ae=oe+z.length;A.current.selectionStart=Ae,A.current.selectionEnd=Ae,A.current.focus();}},0);},[e,t]),be=react.useCallback(z=>{if(!g||!z.target.files)return;let oe=Array.from(z.target.files),J=h*1024*1024,Ae=oe.filter(xe=>xe.size>J?(console.warn(`File ${xe.name} exceeds max size of ${h}MB`),false):true);Ae.length>0&&g(Ae),z.target.value="";},[g,h]),_e=react.useCallback(z=>z.type.startsWith("image/")?lucideReact.Image:z.type.includes("pdf")||z.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&_.current){let z=_.current.children[C];z&&z.scrollIntoView({block:"nearest"});}},[C,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(z=>{let oe=_e(z.file),J=z.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsxRuntime.jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(oe,{className:p("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-white":"text-gray-900"),children:z.file.name}),jsxRuntime.jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:sb(z.file.size)})]}),b&&jsxRuntime.jsx("button",{onClick:()=>b(z.id),className:p("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},z.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:p("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:p("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$(!B),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ue,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:ib.map(z=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(z),className:p("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:p("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:E,type:"file",multiple:true,onChange:be,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:A,value:e,onChange:X,onSelect:ee,onKeyDown:R,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:p("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:p("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((z,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>$e(z),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",oe===C?v?"bg-white/10":"bg-gray-100":v?"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:z.color||"#8B5CF6"},children:nb(z.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:p("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:z.name}),z.email&&jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function Fu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:p("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var Is=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[d,m]=react.useState(false),[g,b]=react.useState(Is[10]||"#2E94FF"),[h,v]=react.useState({top:0,left:0}),f=react.useRef(null),y=react.useRef(null),w=react.useRef(null),x=react.useRef(null),C=t.filter(A=>A.name.toLowerCase().includes(i.toLowerCase())),k=t.some(A=>A.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&y.current){let A=y.current.getBoundingClientRect();v({top:A.bottom+6,left:A.left});}},[l]),react.useEffect(()=>{let A=_=>{let E=_.target,ue=f.current?.contains(E),L=w.current?.contains(E);!ue&&!L&&(c(false),u(""),m(false));};if(l)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[l]),react.useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let D=A=>{let _=e.some(E=>E.id===A.id);a(_?e.filter(E=>E.id!==A.id):[...e,A]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let A=await r(i.trim(),g);A&&(a([...e,A]),u(""),b(Is[Math.floor(Math.random()*Is.length)]||"#2E94FF"));}finally{m(false);}}},B=(A,_)=>{_.stopPropagation(),a(e.filter(E=>E.id!==A));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,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(A=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:h.top,left:h.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:i,onChange:A=>u(A.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:A=>{A.key==="Enter"&&i.trim()&&!k&&r&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(A=>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:`${A.color}20`,color:A.color},onClick:_=>B(A.id,_),children:[A.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},A.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(A=>{let _=e.some(E=>E.id===A.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(A),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${A.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{_||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{_||(E.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:A.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:A.name}),_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:A.color}})]},A.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!k&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Is.map(A=>jsxRuntime.jsx("button",{type:"button",onClick:()=>b(A),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:A,outline:g===A?`2px solid ${A}`:"none",outlineOffset:"2px"}},A))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?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 fl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Pu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(fl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Ao=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Au(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function bb(e){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 hb({className:e}){return jsxRuntime.jsxs("svg",{className:p("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 bl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=bb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Au(e.loggedMinutes),i=e.estimateMinutes?Au(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:p("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(hb,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function yb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Rs(e){let t=yb(e);return t!==null?String(t):e}function Iu(e){let a=Rs(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Os(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function wb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function kb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Cb({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 Bu({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 Tb({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 hl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:d}){let[m,g]=react.useState(""),[b,h]=react.useState(t.estimateMinutes?Os(t.estimateMinutes):""),[v,f]=react.useState(""),[y,w]=react.useState(false),[x,C]=react.useState(false),k=react.useRef(null);react.useEffect(()=>{k.current?.focus();},[]);let D=async()=>{let $=Iu(m);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let $=b.trim()?Iu(b):null;await n($),C(false);},B=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),D()),$.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:p("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),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:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Bu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?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:wb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Cb,{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(Bu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:p("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(kb,{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(Tb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:m,onChange:$=>g($.target.value),onKeyDown:B,placeholder:"8 (=8h), 2h 30m",className:p("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:D,disabled:y||!m.trim(),className:p("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:$=>f($.target.value),onKeyDown:B,placeholder:"Note (optional)",className:p("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),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:Os(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"}),x?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:b,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&T(),$.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Os(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:p("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:p("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&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:a.slice(0,3).map($=>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:$.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Os($.durationMinutes)})]},$.id))})]})]})}function Fb(e){let a=Rs(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Mb(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(Mb(r)),[i,u]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let b=async()=>{m(true);let w=Fb(l);await o(w&&w>0?w:null,i||void 0),m(false);},h=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b()),w.key==="Escape"&&s();},f={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:p("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"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:g,type:"text",value:l,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),onKeyDown:v,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:h,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Pb(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 Ab(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 xl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Pb(e.health),s=Ab(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:p("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:p("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:p("h-full transition-all duration-300",o),style:{width:`${c}%`}}),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:p("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function on(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Ib(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Bb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Rb(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 Ob({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",on(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:p("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",l),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:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",l),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:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:on(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:on(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function $b({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:p("border-b",s,r&&p("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:p("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:p("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?on(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:on(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,on(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:p("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Bb(e.status,a),Ib(e.status,a)),children:Rb(e.status,t)})})]})}function vl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((b,h)=>b.varianceMinutes===null?1:h.varianceMinutes===null?-1:h.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:p("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:p("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:p("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:p("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:p("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Ob,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:p("rounded-lg border overflow-hidden",c,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:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:p("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:p("divide-y",i),children:g.map(b=>jsxRuntime.jsx($b,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsxRuntime.jsx("div",{className:p("text-xs text-center",d),children:a==="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 nn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Qb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function _u(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Zb(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 qr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:b=[],onAddComment:h,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:y,enableTimeTracking:w=false,timeTrackingSummary:x,timeEntries:C=[],isTimerRunning:k=false,timerElapsedSeconds:D=0,onTimeLog:T,onEstimateUpdate:B,onSoldEffortUpdate:$,onTimerStart:A,onTimerStop:_,onTimerDiscard:E,blurFinancials:ue=false}){let L=s==="dark",X={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ee=e&&"title"in e&&!("name"in e),$e=e,[R,Y]=react.useState(e?_u(e,l):null),[be,_e]=react.useState(false),[z,oe]=react.useState(false),[J,Ae]=react.useState(false),[xe,He]=react.useState(null),[Ne,at]=react.useState(new Date),[te,rt]=react.useState(false),[pe,ot]=react.useState(false),[gt,Ct]=react.useState(""),[ye,ft]=react.useState(false),[tt,Qe]=react.useState(false),[H,ie]=react.useState(false),[N,j]=react.useState(false),[le,Ce]=react.useState(""),W=react.useRef(null),ae=react.useRef(null),[Ue,Te]=react.useState(""),Be=react.useRef(null),[De,je]=react.useState(""),[ut,mt]=react.useState(false),[Ze,et]=react.useState([]),[It,Tt]=react.useState(""),[bt,yt]=react.useState(false),dt=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 F=_u(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:F?.id,taskName:F?.name,soldEffortMinutes:F?.soldEffortMinutes,quotedMinutes:F?.quotedMinutes,effortMinutes:F?.effortMinutes,timeLoggedMinutes:F?.timeLoggedMinutes}),Y(F),Ce(F.description||""),Te(F.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!le)return;let F=setTimeout(()=>{let re=ae.current;re&&(re.style.height="auto",re.style.height=`${Math.max(100,re.scrollHeight)}px`);},50);return ()=>clearTimeout(F)},[t,le]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),Be.current&&clearTimeout(Be.current);},[]),react.useEffect(()=>{t&&dt.current&&b.length>0&&setTimeout(()=>{dt.current&&(dt.current.scrollTop=dt.current.scrollHeight);},100);},[t,b.length]);let Ft=react.useCallback(F=>{Y(F),ee&&o&&$e?o(Zb(F,$e)):r&&r(F);},[ee,$e,o,r]),ze=react.useCallback(()=>{_e(false),oe(false),Ae(false),He(null),ot(false),Ct(""),ft(false);},[]),Re=react.useCallback((F,re)=>{if(!R)return;let Le={...R,[F]:re};Ft(Le);},[R,Ft]),ct=react.useCallback(()=>{let F=ae.current;F&&(F.style.height="auto",F.style.height=`${Math.max(100,F.scrollHeight)}px`);},[]),se=react.useCallback(F=>{Ce(F),setTimeout(ct,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(R){let re={...R,description:F};Ft(re);}},800);},[R,Ft,ct]),fe=react.useCallback(F=>{Te(F),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(R&&F.trim()){let re={...R,name:F.trim()};Ft(re);}},800);},[R,Ft]),P=react.useCallback(F=>{let re=F.map(Le=>{let qe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Le};return Le.type.startsWith("image/")&&(qe.preview=URL.createObjectURL(Le)),qe});et(Le=>[...Le,...re]);},[]),K=react.useCallback(F=>{et(re=>{let Le=re.find(qe=>qe.id===F);return Le?.preview&&URL.revokeObjectURL(Le.preview),re.filter(qe=>qe.id!==F)});},[]),q=react.useCallback(async()=>{if(!(!R||!De.trim()&&Ze.length===0||!h)){mt(true);try{let F=Su(De,f),re=[];if(Ze.length>0&&y){let Le=Ze.map(qe=>qe.file);re=await y(Le);}await h(R.id,De.trim(),F.length>0?F:void 0,re.length>0?re:void 0),je(""),Ze.forEach(Le=>{Le.preview&&URL.revokeObjectURL(Le.preview);}),et([]);}finally{mt(false);}}},[R,De,Ze,h,f,y]),de=react.useCallback(()=>{if(!R||!It.trim())return;let F=R.subtasks||[],re={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:It.trim(),progress:0,startDate:new Date,endDate:new Date,position:F.length},Le=[...F,re],qe={...R,subtasks:Le};Ft(qe),Tt(""),yt(false);},[R,It,Ft]),Se=react.useCallback(F=>{if(!R?.subtasks)return;let re=R.subtasks.map(qe=>qe.id===F?{...qe,progress:qe.progress===100?0:100}:qe),Le={...R,subtasks:re};Ft(Le);},[R,Ft]),Ke=react.useCallback(F=>{if(!R?.subtasks)return;let re=R.subtasks.filter(qe=>qe.id!==F),Le={...R,subtasks:re};Ft(Le);},[R,Ft]),We=react.useCallback(F=>{let re=typeof F=="string"?new Date(F):F,qe=new Date().getTime()-re.getTime(),qt=Math.floor(qe/6e4),Bt=Math.floor(qe/36e5),Da=Math.floor(qe/864e5);return qt<1?n==="es"?"Ahora":"Just now":qt<60?n==="es"?`Hace ${qt} min`:`${qt}m ago`:Bt<24?n==="es"?`Hace ${Bt}h`:`${Bt}h ago`:Da<7?n==="es"?`Hace ${Da}d`:`${Da}d ago`:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),S=react.useCallback(F=>{if(!R)return;let re=R.progress||0;F==="completed"?re=100:F==="in-progress"&&re===0?re=10:F==="todo"&&(re=0);let Le={...R,status:F,progress:re};Ft(Le),_e(false);},[R,Ft]),Z=react.useCallback((F,re)=>{if(!R)return;let Le={...R,startDate:F,endDate:re};Ft(Le);},[R,Ft]),me=react.useCallback(()=>{let F=Ne.getFullYear(),re=Ne.getMonth(),Le=new Date(F,re,1),qt=new Date(F,re+1,0).getDate(),Bt=Le.getDay(),Da=[],Ba=new Date(F,re,0).getDate();for(let ga=Bt-1;ga>=0;ga--)Da.push({date:new Date(F,re-1,Ba-ga),isCurrentMonth:false});for(let ga=1;ga<=qt;ga++)Da.push({date:new Date(F,re,ga),isCurrentMonth:true});let Ra=42-Da.length;for(let ga=1;ga<=Ra;ga++)Da.push({date:new Date(F,re+1,ga),isCurrentMonth:false});return Da},[Ne]),Ee=react.useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),ie(false),!R||!d)return;let re=Array.from(F.dataTransfer.files);if(re.length!==0){j(true);try{await d(R.id,re);}finally{j(false);}}},[R,d]),Je=react.useCallback(async F=>{if(!R||!d||!F.target.files)return;let re=Array.from(F.target.files);if(re.length!==0){j(true);try{await d(R.id,re);}finally{j(false);}F.target.value="";}},[R,d]),Ye=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),ie(true);},[]),I=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),ie(false);},[]),G=react.useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),he=react.useCallback(F=>F.startsWith("image/")?lucideReact.Image:F.includes("pdf")||F.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:a,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:p("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:p("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:p("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",L?"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 F=R.progress===100?0:100,Le={...R,progress:F,status:F===100?"completed":"todo"};Ft(Le);},className:p("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":L?"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:Ue,onChange:F=>fe(F.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:p("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":L?"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:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),_e(!be);},className:p("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-blue-500/20 text-blue-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?n==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:be&&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:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>S(F.id),className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.status===F.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),Ae(!J);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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((F,re)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},re)),R.assignees.length>3&&jsxRuntime.jsxs("span",{className:p("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:p("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ae(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(F=>{let re=R.assignees?.some(Le=>Le.name===F.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Le=R.assignees||[],qe;re?qe=Le.filter(qt=>qt.name!==F.name):qe=[...Le,F],Re("assignees",qe);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",re&&(L?"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:F.color||"#8B5CF6"},children:F.initials||F.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p("flex-1",L?"text-white":"text-gray-900"),children:F.name}),re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},F.name)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{He(xe?null:"start"),at(R.startDate||new Date);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:p("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:p("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,re=new Date(F);re.setDate(F.getDate()+1);let Le=new Date(F);Le.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let qe=new Date(F);qe.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let qt=new Date(F);qt.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let Bt=new Date(F);Bt.setDate(F.getDate()+14);let Da=new Date(F);return Da.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Le,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:qe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:qt,display:qt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Bt,display:Bt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Da,display:Da.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ra,ga)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(xe==="start"){let ir=R.endDate&&Ra.date>R.endDate?Ra.date:R.endDate;Z(Ra.date,ir),He("end");}else {let ir=R.startDate&&Ra.date<R.startDate?Ra.date:R.startDate;Z(ir,Ra.date),He(null);}},children:[jsxRuntime.jsx("span",{children:Ra.label}),jsxRuntime.jsx("span",{className:p("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Ra.display})]},ga))})(),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Z(void 0,void 0),He(null);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="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:p("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:xe==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",L?"text-white":"text-gray-900"),children:Ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>at(new Date),className:p("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(Ne.getFullYear(),Ne.getMonth()-1)),className:p("p-1 rounded",L?"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:()=>at(new Date(Ne.getFullYear(),Ne.getMonth()+1)),className:p("p-1 rounded",L?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(F=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:me().map((F,re)=>{let Le=F.date.toDateString()===new Date().toDateString(),qe=R.startDate?.toDateString()===F.date.toDateString(),qt=R.endDate?.toDateString()===F.date.toDateString(),Bt=qe||qt,Da=R.startDate&&R.endDate&&F.date>=R.startDate&&F.date<=R.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Ba=new Date(F.date);if(xe==="start"){let Ra=R.endDate&&Ba>R.endDate?Ba:R.endDate;Z(Ba,Ra),He("end");}else {let Ra=R.startDate&&Ba<R.startDate?Ba:R.startDate;Z(Ra,Ba),He(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!F.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(L?"text-white":"text-gray-900"),Le&&"ring-2 ring-[#2E94FF]",qe&&"bg-[#2E94FF] text-white",qt&&!qe&&"bg-[#7C3AED] text-white",Da&&!Bt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Bt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:F.date.getDate()},re)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),oe(!z);},className:p("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":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?n==="es"?"Alta":"High":R.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>oe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{Re("priority",F.id),oe(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.priority===F.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:p("text-sm",L?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[te?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:F=>{let re=parseInt(F.target.value),Le=R.status;re===100?Le="completed":re>0?Le="in-progress":Le="todo";let qe={...R,progress:re,status:Le};Ft(qe);},onBlur:()=>rt(false),className:p("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>rt(true),className:p("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${R.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:p("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:p("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?nn(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="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($r,{mode:"estimate",locale:n,isDark:L,currentValue:x?.estimateMinutes||null,onSave:async F=>{await B?.(R.id,F),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ue?jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?nn(R.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(R.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="quoted"&&!ue&&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($r,{mode:"quoted",locale:n,isDark:L,currentValue:R.quotedMinutes||null,onSave:async F=>{$?(await $(R.id,F),Y(re=>re?{...re,quotedMinutes:F}:null)):Re("quotedMinutes",F),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:p("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):k?jsxRuntime.jsxs("button",{type:"button",onClick:()=>_?.(R.id),className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),Qb(D||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>A?.(R.id),className:p("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Qe("log"),className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"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"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[nn(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:p("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",nn(x.estimateMinutes)]})]}),x.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:p("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="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($r,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(F,re)=>{F&&await T?.(R.id,{durationMinutes:F,note:re,source:"manual"}),Qe(false);},onClose:()=>Qe(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(lo,{selectedTags:R.tags||[],availableTags:c,onChange:F=>{Re("tags",F);},onCreateTag:i,theme:X})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:p("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="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(F=>{let re=g.find(Le=>Le.id===F);return jsxRuntime.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[re?.name||F.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Le=(R.dependencies||[]).filter(qe=>qe!==F);Re("dependencies",Le);},className:p("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},F)})}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),ot(!pe);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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:p("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ot(false),Ct("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:gt,onChange:F=>Ct(F.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("w-full px-3 py-2 rounded-md text-sm outline-none",L?"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:g.length>0?g.filter(F=>F.id!==R.id).filter(F=>gt===""||F.name.toLowerCase().includes(gt.toLowerCase())).map(F=>{let re=R.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Le=R.dependencies||[],qe;re?qe=Le.filter(qt=>qt!==F.id):qe=[...Le,F.id],Re("dependencies",qe);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",re&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",re?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:re&&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:p("block truncate",L?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("span",{className:p("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),ft(!ye);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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:p("text-sm",L?"text-white":"text-gray-900"),children:Ao.find(F=>F.value===R.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ft(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"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:Ao.map(F=>{let re=R.color===F.value;return jsxRuntime.jsx("button",{onClick:()=>{Re("color",F.value),ft(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",re&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:re?F.value:void 0},title:F.name,children:re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:F=>Re("isMilestone",F.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:p("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:p("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:ae,value:le,onChange:F=>se(F.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:p("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"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:p("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(F=>F.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((F,re)=>(F.position??0)-(re.position??0)).map(F=>jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Se(F.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",F.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:p("text-sm flex-1",F.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("button",{onClick:()=>Ke(F.id),className:p("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"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"})})]},F.id))}),bt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:It,onChange:F=>Tt(F.target.value),onKeyDown:F=>{F.key==="Enter"&&It.trim()?de():F.key==="Escape"&&(yt(false),Tt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:p("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:de,disabled:!It.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",It.trim()?"bg-blue-500 hover:bg-blue-600 text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{yt(false),Tt("");},className:p("p-2 rounded-lg transition-colors",L?"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:()=>yt(true),className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(F=>{let re=he(F.type),Le=F.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Le&&F.thumbnailUrl?jsxRuntime.jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(re,{className:p("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("p",{className:p("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:G(F.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(F.id),className:p("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ye,onDragLeave:I,onDrop:Ee,className:p("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?L?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",N&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Je,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||N}),N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:p("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:p("w-6 h-6 mx-auto mb-2",H?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:p("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="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"})]})}),!d&&jsxRuntime.jsx("p",{className:p("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:p("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:p("p-1.5 rounded transition-colors",L?"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: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{ref:dt,className:p("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",I?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...b].sort((F,ae)=>{let Re=typeof F.createdAt=="string"?new Date(F.createdAt):F.createdAt,Je=typeof ae.createdAt=="string"?new Date(ae.createdAt):ae.createdAt;return Re.getTime()-Je.getTime()}).map(F=>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:F.user?.color||"#8B5CF6"},children:F.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:p("text-sm font-medium",I?"text-white":"text-gray-900"),children:F.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:p("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:Ue(F.createdAt)})]}),jsxRuntime.jsx("div",{className:p("text-sm",I?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Fu,{content:F.content,theme:s})}),F.attachments&&F.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:F.attachments.map(ae=>{let Re=ae.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:ae.url,target:"_blank",rel:"noopener noreferrer",className:p("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:[Re?jsxRuntime.jsx(lucideReact.Image,{className:p("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:p("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:p("text-xs truncate max-w-[100px]",I?"text-white":"text-gray-900"),children:ae.name})]},ae.id)})})]})]},F.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:p("w-10 h-10 mb-3",I?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:p("text-sm",I?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:p("py-4 pl-4 pr-2 border-t",I?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Eu,{value:De,onChange:_e,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!h,isSubmitting:ut,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!y,pendingFiles:Ze,onFilesSelect:A,onRemoveFile:Y})})]})]})]})})}function vl(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:u,error:i,children:c,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:h,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onTaskOpen:x,onUploadCommentAttachments:k,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:T,timerState:R,onLogTime:$,onUpdateEstimate:L,onUpdateSoldEffort:j,onStartTimer:E,onStopTimer:ce,onDiscardTimer:I,blurFinancials:X=false,sidePanel:Ce,renderColumnMetrics:Xe,suppressDetailModal:P=false}){let[G,fe]=vl(),[Ve,z]=react.useState(null),[re,J]=react.useState(false),Ae=react.useRef(null),he=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),$e=o?.theme||"dark",Ne=$e==="dark"||$e==="neutral",at=Ne?"dark":"",ee=react.useCallback((N,K)=>{t.onCardUpdate?.(N,K);},[t]),rt=react.useCallback((N,K)=>{t.onColumnUpdate?.(N,{title:K});},[t]),ue=react.useCallback(N=>{t.onColumnDelete?.(N);},[t]),ot=["todo","in-progress","completed"],gt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Ct=react.useMemo(()=>{let N=new Map;return e.columns.forEach(K=>{let ie=K.cardIds.map(we=>e.cards.find(W=>W.id===we)).filter(we=>we!==void 0).sort((we,W)=>we.position-W.position);N.set(K.id,ie);}),N},[e.cards,e.columns]);react.useEffect(()=>{let N=Ae.current;if(!N)return;let K=te=>{let ze=te.target,Te=te.button===1,Ie=ze===N||ze.classList.contains("asakaa-column")&&!ze.closest(".asakaa-card");(Te||te.button===0&&Ie&&!G.isDragging)&&(te.preventDefault(),J(true),he.current={x:te.clientX,y:te.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},ie=te=>{if(!re)return;let ze=te.clientX-he.current.x,Te=te.clientY-he.current.y;N.scrollLeft=he.current.scrollLeft-ze,N.scrollTop=he.current.scrollTop-Te;},we=()=>{re&&(J(false),N.style.cursor="",N.style.userSelect="");},W=()=>{re&&(J(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",K),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",we),N.addEventListener("mouseleave",W),()=>{N.removeEventListener("mousedown",K),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",we),N.removeEventListener("mouseleave",W);}},[re,G.isDragging]);let be=react.useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),ft=react.useCallback(N=>{let{active:K}=N,ie=e.cards.find(we=>we.id===K.id);ie&&fe({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,fe]),tt=react.useCallback(N=>{let{active:K,over:ie}=N;if(!ie||!e.cards.find(te=>te.id===K.id))return;let W=null;ie.data.current?.type==="column"?W=ie.id:ie.data.current?.type==="card"&&(W=e.cards.find(ze=>ze.id===ie.id)?.columnId||null),W&&W!==G.targetColumnId&&fe({...G,targetColumnId:W});},[e.cards,G,fe]),Qe=react.useCallback(async N=>{let{active:K,over:ie}=N;if(fe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let we=e.cards.find(Te=>Te.id===K.id);if(!we)return;let W,te;if(ie.data.current?.type==="column"){W=ie.id;let Te=Ct.get(W)||[];te=al(Te,0);}else {let Te=e.cards.find(_e=>_e.id===ie.id);if(!Te)return;W=Te.columnId;let Ie=Ct.get(W)||[],De=Ie.findIndex(_e=>_e.id===ie.id);te=al(Ie,De);}let ze=e.columns.find(Te=>Te.id===W);if(ze&&ze.wipLimit&&ze.wipLimitType==="hard"){let Te=Ct.get(W)||[];if(we.columnId!==W&&Te.length>=ze.wipLimit){t.onWipLimitExceeded?.(ze,we);return}}(we.columnId!==W||we.position!==te)&&await t.onCardMove?.(we.id,W,te);},[e.cards,e.columns,Ct,t,fe]),H=react.useCallback(N=>{P||z(N),a?.(N),x?.(N.id);},[a,x,P]),se=react.useCallback(N=>{t.onCardUpdate?.(N.id,N),z(N);},[t]);return u?jsxRuntime.jsx("div",{className:p("asakaa-board",at,n),style:l,children:jsxRuntime.jsx(ch,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:p("asakaa-board",at,n),style:l,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(ru,{themeName:$e,children:[jsxRuntime.jsxs("div",{className:p("flex h-full overflow-hidden",Ce?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:gt,collisionDetection:core$1.closestCorners,onDragStart:ft,onDragOver:tt,onDragEnd:Qe,children:[jsxRuntime.jsxs("div",{ref:Ae,className:p("asakaa-board",Ce?"flex-1":"",at,n),style:{...l,cursor:re?"grabbing":void 0},"data-theme":$e,children:[e.columns.sort((N,K)=>N.position-K.position).map(N=>{let K=Ct.get(N.id)||[],ie=!ot.includes(N.id),we=r?.renderColumnFooter?.(N);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(an,{column:N,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Xe?(W,te)=>Xe(W,te):void 0,onCardClick:H,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?rt:void 0,onColumnDelete:t.onColumnDelete?ue:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),we]},N.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:G.draggedCardId?jsxRuntime.jsx(Yr,{card:e.cards.find(N=>N.id===G.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Ce]}),!P&&jsxRuntime.jsx(Xr,{task:Ve,isOpen:!!Ve,onClose:()=>z(null),onCardUpdate:se,theme:Ne?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:Ve?g?.get(Ve.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:h,availableTasks:be,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onUploadCommentAttachments:k,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:T,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:L,onSoldEffortUpdate:j,onTimerStart:E,onTimerStop:ce,onTimerDiscard:I,blurFinancials:X})]})}function ch({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>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"})]})]},a))})}var fh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},bh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},hh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},yh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function xh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.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:a.bgSecondary,border:`1px solid ${a.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:a.textTertiary},children:r.selectColumn}),e.sort((i,c)=>i.position-c.position).map((i,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function vh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,b)=>{if(b){u(g);try{await b();}catch(h){console.error(`Export ${g} failed:`,h);}finally{u(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[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:d.map((g,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.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:l===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function wh({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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function kl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:u,translations:i,toolbarRightContent:c}){let d=r==="dark"?fh:bh,m={...o==="es"?hh:yh,...i},g=n||l||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vh,{theme:d,t:m,onExportCSV:n,onExportJSON:l,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsxRuntime.jsx(xh,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(wh,{onClick:()=>t(),label:a||m.newTask}))]})})}function Tl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,u]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),u(""),n(false));},[l,e]),c=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(u(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:p("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:l,onChange:m=>u(m.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.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:()=>{u(""),n(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:p("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,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"})]}),r]})})}function Ao({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[u,i]=react.useState(""),[c,d]=react.useState(void 0),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(false),[y,w]=react.useState(false),[x,k]=react.useState(false),[C,D]=react.useState(s||new Date),T=react.useRef(null),R=o==="es",$=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let L=react.useCallback(()=>{f(false),w(false),k(false);},[]),j=react.useCallback(()=>{i(""),d(void 0),g(null),h(null),L(),t();},[t,L]),E=react.useCallback(()=>{let X=u.trim();if(!X)return;let Ce=a.find(P=>P.id===m),Xe=b||s;e({name:X,priority:c,assignee:Ce||void 0,assigneeId:m,startDate:Xe,endDate:Xe}),i(""),d(void 0),g(null),h(null),L(),T.current?.focus();},[u,c,m,b,s,a,e,L]),ce=react.useCallback(X=>{X.key==="Enter"&&u.trim()&&(X.preventDefault(),E()),X.key==="Escape"&&j();},[E,j,u]),I=b||s||new Date;return jsxRuntime.jsxs("div",{className:p("quick-task-create",n),onClick:()=>L(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:u,onChange:X=>i(X.target.value),placeholder:R?"Nombre de la tarea...":"Task name...",className:p("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ce})}),jsxRuntime.jsxs("div",{className:p("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),f(!v),w(false),k(false);},type:"button",className:p("p-1 rounded transition-colors",c?c==="urgent"||c==="high"?"text-red-400 bg-red-500/20":c==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:R?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:R?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:R?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:R?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:R?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{d(X.id),f(false);},type:"button",className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",c===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),k(!x),f(false),w(false),D(b||s||new Date);},type:"button",className:p("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",b?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),I.toLocaleDateString(R?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:p("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Ce=new Date(X);Ce.setDate(X.getDate()+1);let Xe=new Date(X);Xe.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let P=new Date(X);P.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let G=new Date(X);G.setDate(X.getDate()+14);let fe=new Date(X);fe.setDate(X.getDate()+28);let Ve=R?"es-ES":"en-US";return [{label:R?"Hoy":"Today",date:X,display:X.toLocaleDateString(Ve,{weekday:"short"}).slice(0,3)+"."},{label:R?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(Ve,{weekday:"short"}).slice(0,3)+"."},{label:R?"Este fin de semana":"This weekend",date:Xe,display:R?"s\xE1b.":"sat."},{label:R?"Pr\xF3xima semana":"Next week",date:P,display:R?"lun.":"mon."},{label:R?"2 semanas":"2 weeks",date:G,display:G.toLocaleDateString(Ve,{day:"numeric",month:"short"})},{label:R?"4 semanas":"4 weeks",date:fe,display:fe.toLocaleDateString(Ve,{day:"numeric",month:"short"})}].map((re,J)=>jsxRuntime.jsxs("button",{type:"button",className:p("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{h(re.date),k(false);},children:[jsxRuntime.jsx("span",{children:re.label}),jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},J))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:p("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:C.toLocaleDateString(R?"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:()=>D(new Date),className:p("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:R?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(C.getFullYear(),C.getMonth()-1)),className:p("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(C.getFullYear(),C.getMonth()+1)),className:p("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children: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:(R?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:p("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=C.getFullYear(),Ce=C.getMonth(),Xe=new Date(X,Ce,1).getDay(),P=new Date(X,Ce+1,0).getDate(),G=new Date(X,Ce,0).getDate(),fe=new Date().toDateString(),Ve=[];for(let re=Xe-1;re>=0;re--)Ve.push({dayNum:G-re,isCurrent:false,date:new Date(X,Ce-1,G-re)});for(let re=1;re<=P;re++)Ve.push({dayNum:re,isCurrent:true,date:new Date(X,Ce,re)});let z=42-Ve.length;for(let re=1;re<=z;re++)Ve.push({dayNum:re,isCurrent:false,date:new Date(X,Ce+1,re)});return Ve.map((re,J)=>{let Ae=re.date.toDateString()===fe,he=(b||s)?.toDateString()===re.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Ae&&"ring-1 ring-[#007FFF]",he&&"bg-[#007FFF] text-white",!he&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{h(re.date),k(false);},children:re.dayNum},J)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),w(!y),f(false),k(false);},type:"button",className:p("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?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:a.find(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:R?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[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:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsxRuntime.jsx("div",{className:p("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:R?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:E,disabled:!u.trim(),type:"button",className:p("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",u.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:R?"Guardar":"Save"})]})]})}function Fl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[u,i]=react.useState(false),c=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[b,h]=react.useState(false),v=n==="dark",y={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!u||!c.current)return;let x=90,k=()=>{let C=c.current.getBoundingClientRect(),T=window.innerHeight-C.bottom<x+8;h(T),g({position:"fixed",...T?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[u]),react.useEffect(()=>{if(!u)return;let x=k=>{let C=k.target;d.current&&!d.current.contains(C)&&c.current&&!c.current.contains(C)&&i(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);let w=react.useCallback(x=>{t({name:x.name,columnId:e,assigneeIds:x.assigneeId?[x.assigneeId]:void 0,startDate:x.startDate,endDate:x.endDate,priority:x.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:c,className:p("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!u),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:u&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:b?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:b?4:-4,scale:.97},transition:{duration:.12},style:m,className:p("rounded-lg shadow-2xl",v?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Ao,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Wn=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(po,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ip(e={}){return new Wn(e)}var nn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):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:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.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:r.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"})]})]})}):o}};function Ml(e,t){let a=r=>jsxRuntime.jsx(nn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Al({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:u,shortcut:i="k",className:c=""}){let[d,m]=react.useState(false),[g,b]=react.useState(""),[h,v]=react.useState("home"),[f,y]=react.useState(""),[w,x]=react.useState("");react.useEffect(()=>{let T=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),m($=>!$)),R.key==="Escape"&&(m(false),v("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),react.useEffect(()=>{d||(v("home"),b(""),y(""),x(""));},[d]);let k=react.useCallback(()=>{m(false);},[]),C=react.useCallback(T=>{let[R,$]=T.split(":");switch(R){case "create-card":v("create-card");break;case "create-card-in":y($||"");break;case "navigate":$?(a?.($),k()):v("navigate");break;case "search":r?.(g),k();break;case "priority":v("priority");break;case "set-priority":w&&$&&(o?.(w,$),k());break;case "assign":v("assign");break;case "assign-user":w&&$&&(s?.(w,$),k());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":u?.(),k();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,l,u,k]),D=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),k());},[f,g,t,k]);return d?jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:b,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:h==="create-card"&&f?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&h==="create-card"&&f&&D();}}),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."}),h==="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:C,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:C,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:C,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:C,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},T.id))})]}),h==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:C,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:C,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:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),h==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:C,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(T=>{let R=e.columns.find($=>$.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:C,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map($=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:$},$))})]},T.id)})})]}),h==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:C,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:C,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:C,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:C,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 cp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsxRuntime.jsx("div",{ref:dt,className:p("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...b].sort((F,re)=>{let Le=typeof F.createdAt=="string"?new Date(F.createdAt):F.createdAt,qe=typeof re.createdAt=="string"?new Date(re.createdAt):re.createdAt;return Le.getTime()-qe.getTime()}).map(F=>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:F.user?.color||"#8B5CF6"},children:F.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:p("text-sm font-medium",L?"text-white":"text-gray-900"),children:F.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:p("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:We(F.createdAt)})]}),jsxRuntime.jsx("div",{className:p("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Fu,{content:F.content,theme:s})}),F.attachments&&F.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:F.attachments.map(re=>{let Le=re.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:re.url,target:"_blank",rel:"noopener noreferrer",className:p("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Le?jsxRuntime.jsx(lucideReact.Image,{className:p("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:p("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:p("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:re.name})]},re.id)})})]})]},F.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:p("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:p("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:p("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Eu,{value:De,onChange:je,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!h,isSubmitting:ut,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!y,pendingFiles:Ze,onFilesSelect:P,onRemoveFile:K})})]})]})]})})}function kl(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:u,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:h,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onTaskOpen:x,onUploadCommentAttachments:C,enableTimeTracking:k,timeTrackingSummary:D,timeEntries:T,timerState:B,onLogTime:$,onUpdateEstimate:A,onUpdateSoldEffort:_,onStartTimer:E,onStopTimer:ue,onDiscardTimer:L,blurFinancials:X=false,sidePanel:ee,renderColumnMetrics:$e,suppressDetailModal:R=false}){let[Y,be]=kl(),[_e,z]=react.useState(null),[oe,J]=react.useState(false),Ae=react.useRef(null),xe=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),He=o?.theme||"dark",Ne=He==="dark"||He==="neutral",at=Ne?"dark":"",te=react.useCallback((N,j)=>{t.onCardUpdate?.(N,j);},[t]),rt=react.useCallback((N,j)=>{t.onColumnUpdate?.(N,{title:j});},[t]),pe=react.useCallback(N=>{t.onColumnDelete?.(N);},[t]),ot=["todo","in-progress","completed"],gt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Ct=react.useMemo(()=>{let N=new Map;return e.columns.forEach(j=>{let le=j.cardIds.map(Ce=>e.cards.find(W=>W.id===Ce)).filter(Ce=>Ce!==void 0).sort((Ce,W)=>Ce.position-W.position);N.set(j.id,le);}),N},[e.cards,e.columns]);react.useEffect(()=>{let N=Ae.current;if(!N)return;let j=ae=>{let Ue=ae.target,Te=ae.button===1,Be=Ue===N||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Te||ae.button===0&&Be&&!Y.isDragging)&&(ae.preventDefault(),J(true),xe.current={x:ae.clientX,y:ae.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},le=ae=>{if(!oe)return;let Ue=ae.clientX-xe.current.x,Te=ae.clientY-xe.current.y;N.scrollLeft=xe.current.scrollLeft-Ue,N.scrollTop=xe.current.scrollTop-Te;},Ce=()=>{oe&&(J(false),N.style.cursor="",N.style.userSelect="");},W=()=>{oe&&(J(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",j),document.addEventListener("mousemove",le),document.addEventListener("mouseup",Ce),N.addEventListener("mouseleave",W),()=>{N.removeEventListener("mousedown",j),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Ce),N.removeEventListener("mouseleave",W);}},[oe,Y.isDragging]);let ye=react.useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(j=>typeof j=="string"?j:j.taskId):[]})),[e.cards]),ft=react.useCallback(N=>{let{active:j}=N,le=e.cards.find(Ce=>Ce.id===j.id);le&&be({isDragging:true,draggedCardId:le.id,sourceColumnId:le.columnId,targetColumnId:le.columnId});},[e.cards,be]),tt=react.useCallback(N=>{let{active:j,over:le}=N;if(!le||!e.cards.find(ae=>ae.id===j.id))return;let W=null;le.data.current?.type==="column"?W=le.id:le.data.current?.type==="card"&&(W=e.cards.find(Ue=>Ue.id===le.id)?.columnId||null),W&&W!==Y.targetColumnId&&be({...Y,targetColumnId:W});},[e.cards,Y,be]),Qe=react.useCallback(async N=>{let{active:j,over:le}=N;if(be({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!le)return;let Ce=e.cards.find(Te=>Te.id===j.id);if(!Ce)return;let W,ae;if(le.data.current?.type==="column"){W=le.id;let Te=Ct.get(W)||[];ae=ol(Te,0);}else {let Te=e.cards.find(je=>je.id===le.id);if(!Te)return;W=Te.columnId;let Be=Ct.get(W)||[],De=Be.findIndex(je=>je.id===le.id);ae=ol(Be,De);}let Ue=e.columns.find(Te=>Te.id===W);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Te=Ct.get(W)||[];if(Ce.columnId!==W&&Te.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Ce);return}}(Ce.columnId!==W||Ce.position!==ae)&&await t.onCardMove?.(Ce.id,W,ae);},[e.cards,e.columns,Ct,t,be]),H=react.useCallback(N=>{R||z(N),a?.(N),x?.(N.id);},[a,x,R]),ie=react.useCallback(N=>{t.onCardUpdate?.(N.id,N),z(N);},[t]);return c?jsxRuntime.jsx("div",{className:p("asakaa-board",at,n),style:l,children:jsxRuntime.jsx(uh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:p("asakaa-board",at,n),style:l,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(ru,{themeName:He,children:[jsxRuntime.jsxs("div",{className:p("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:gt,collisionDetection:core$1.closestCorners,onDragStart:ft,onDragOver:tt,onDragEnd:Qe,children:[jsxRuntime.jsxs("div",{ref:Ae,className:p("asakaa-board",ee?"flex-1":"",at,n),style:{...l,cursor:oe?"grabbing":void 0},"data-theme":He,children:[e.columns.sort((N,j)=>N.position-j.position).map(N=>{let j=Ct.get(N.id)||[],le=!ot.includes(N.id),Ce=r?.renderColumnFooter?.(N);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(rn,{column:N,cards:j,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:$e?(W,ae)=>$e(W,ae):void 0,onCardClick:H,onCardUpdate:te,onColumnRename:t.onColumnUpdate?rt:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:le,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ce]},N.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:Y.draggedCardId?jsxRuntime.jsx(Kr,{card:e.cards.find(N=>N.id===Y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!R&&jsxRuntime.jsx(qr,{task:_e,isOpen:!!_e,onClose:()=>z(null),onCardUpdate:ie,theme:Ne?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:_e?g?.get(_e.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:h,availableTasks:ye,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onUploadCommentAttachments:C,enableTimeTracking:k,timeTrackingSummary:D,timeEntries:T,isTimerRunning:B?.isRunning,timerElapsedSeconds:B?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:A,onSoldEffortUpdate:_,onTimerStart:E,onTimerStop:ue,onTimerDiscard:L,blurFinancials:X})]})}function uh({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>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"})]})]},a))})}var bh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},hh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},yh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},xh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function vh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.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:a.bgSecondary,border:`1px solid ${a.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:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function wh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,b)=>{if(b){c(g);try{await b();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[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:d.map((g,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.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:l===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function kh({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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Tl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u}){let d=r==="dark"?bh:hh,m={...o==="es"?yh:xh,...i},g=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wh,{theme:d,t:m,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsxRuntime.jsx(vh,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(kh,{onClick:()=>t(),label:a||m.newTask}))]})})}function Dl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),c(""),n(false));},[l,e]),u=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:p("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:l,onChange:m=>c(m.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.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:()=>{c(""),n(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:p("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,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"})]}),r]})})}function Lo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[u,d]=react.useState(void 0),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(false),[y,w]=react.useState(false),[x,C]=react.useState(false),[k,D]=react.useState(s||new Date),T=react.useRef(null),B=o==="es",$=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let A=react.useCallback(()=>{f(false),w(false),C(false);},[]),_=react.useCallback(()=>{i(""),d(void 0),g(null),h(null),A(),t();},[t,A]),E=react.useCallback(()=>{let X=c.trim();if(!X)return;let ee=a.find(R=>R.id===m),$e=b||s;e({name:X,priority:u,assignee:ee||void 0,assigneeId:m,startDate:$e,endDate:$e}),i(""),d(void 0),g(null),h(null),A(),T.current?.focus();},[c,u,m,b,s,a,e,A]),ue=react.useCallback(X=>{X.key==="Enter"&&c.trim()&&(X.preventDefault(),E()),X.key==="Escape"&&_();},[E,_,c]),L=b||s||new Date;return jsxRuntime.jsxs("div",{className:p("quick-task-create",n),onClick:()=>A(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:c,onChange:X=>i(X.target.value),placeholder:B?"Nombre de la tarea...":"Task name...",className:p("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ue})}),jsxRuntime.jsxs("div",{className:p("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),f(!v),w(false),C(false);},type:"button",className:p("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:B?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:B?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:B?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:B?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:B?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{d(X.id),f(false);},type:"button",className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),C(!x),f(false),w(false),D(b||s||new Date);},type:"button",className:p("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",b?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),L.toLocaleDateString(B?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:p("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,ee=new Date(X);ee.setDate(X.getDate()+1);let $e=new Date(X);$e.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let R=new Date(X);R.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let Y=new Date(X);Y.setDate(X.getDate()+14);let be=new Date(X);be.setDate(X.getDate()+28);let _e=B?"es-ES":"en-US";return [{label:B?"Hoy":"Today",date:X,display:X.toLocaleDateString(_e,{weekday:"short"}).slice(0,3)+"."},{label:B?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(_e,{weekday:"short"}).slice(0,3)+"."},{label:B?"Este fin de semana":"This weekend",date:$e,display:B?"s\xE1b.":"sat."},{label:B?"Pr\xF3xima semana":"Next week",date:R,display:B?"lun.":"mon."},{label:B?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(_e,{day:"numeric",month:"short"})},{label:B?"4 semanas":"4 weeks",date:be,display:be.toLocaleDateString(_e,{day:"numeric",month:"short"})}].map((oe,J)=>jsxRuntime.jsxs("button",{type:"button",className:p("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{h(oe.date),C(false);},children:[jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},J))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:p("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:k.toLocaleDateString(B?"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:()=>D(new Date),className:p("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:B?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(k.getFullYear(),k.getMonth()-1)),className:p("p-0.5 rounded",r?"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:()=>D(new Date(k.getFullYear(),k.getMonth()+1)),className:p("p-0.5 rounded",r?"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:(B?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:p("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=k.getFullYear(),ee=k.getMonth(),$e=new Date(X,ee,1).getDay(),R=new Date(X,ee+1,0).getDate(),Y=new Date(X,ee,0).getDate(),be=new Date().toDateString(),_e=[];for(let oe=$e-1;oe>=0;oe--)_e.push({dayNum:Y-oe,isCurrent:false,date:new Date(X,ee-1,Y-oe)});for(let oe=1;oe<=R;oe++)_e.push({dayNum:oe,isCurrent:true,date:new Date(X,ee,oe)});let z=42-_e.length;for(let oe=1;oe<=z;oe++)_e.push({dayNum:oe,isCurrent:false,date:new Date(X,ee+1,oe)});return _e.map((oe,J)=>{let Ae=oe.date.toDateString()===be,xe=(b||s)?.toDateString()===oe.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Ae&&"ring-1 ring-[#007FFF]",xe&&"bg-[#007FFF] text-white",!xe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{h(oe.date),C(false);},children:oe.dayNum},J)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),w(!y),f(false),C(false);},type:"button",className:p("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?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:a.find(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:B?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[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:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsxRuntime.jsx("div",{className:p("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:B?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:E,disabled:!c.trim(),type:"button",className:p("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:B?"Guardar":"Save"})]})]})}function Pl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=react.useState(false),u=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[b,h]=react.useState(false),v=n==="dark",y={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!u.current)return;let x=90,C=()=>{let k=u.current.getBoundingClientRect(),T=window.innerHeight-k.bottom<x+8;h(T),g({position:"fixed",...T?{bottom:window.innerHeight-k.top+4}:{top:k.bottom+4},left:k.left,width:k.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),react.useEffect(()=>{if(!c)return;let x=C=>{let k=C.target;d.current&&!d.current.contains(k)&&u.current&&!u.current.contains(k)&&i(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]);let w=react.useCallback(x=>{t({name:x.name,columnId:e,assigneeIds:x.assigneeId?[x.assigneeId]:void 0,startDate:x.startDate,endDate:x.endDate,priority:x.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:u,className:p("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),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:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:b?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:b?4:-4,scale:.97},transition:{duration:.12},style:m,className:p("rounded-lg shadow-2xl",v?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Lo,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Vn=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(po,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ip(e={}){return new Vn(e)}var sn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):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:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.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:r.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"})]})]})}):o}};function Al(e,t){let a=r=>jsxRuntime.jsx(sn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Il({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[d,m]=react.useState(false),[g,b]=react.useState(""),[h,v]=react.useState("home"),[f,y]=react.useState(""),[w,x]=react.useState("");react.useEffect(()=>{let T=B=>{(B.metaKey||B.ctrlKey)&&B.key===i&&(B.preventDefault(),m($=>!$)),B.key==="Escape"&&(m(false),v("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),react.useEffect(()=>{d||(v("home"),b(""),y(""),x(""));},[d]);let C=react.useCallback(()=>{m(false);},[]),k=react.useCallback(T=>{let[B,$]=T.split(":");switch(B){case "create-card":v("create-card");break;case "create-card-in":y($||"");break;case "navigate":$?(a?.($),C()):v("navigate");break;case "search":r?.(g),C();break;case "priority":v("priority");break;case "set-priority":w&&$&&(o?.(w,$),C());break;case "assign":v("assign");break;case "assign-user":w&&$&&(s?.(w,$),C());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":l?.(),C();break;case "ai-usage":c?.(),C();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,l,c,C]),D=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return d?jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:b,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:h==="create-card"&&f?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&h==="create-card"&&f&&D();}}),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."}),h==="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:k,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:k,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:k,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:k,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:k,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},T.id))})]}),h==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:k,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:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),h==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,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(T=>{let B=e.columns.find($=>$.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:k,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map($=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:$},$))})]},T.id)})})]}),h==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:k,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:k,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:k,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:k,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 cp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
max-height: 92vh !important;
|
|
31
31
|
object-fit: contain !important;
|
|
32
32
|
cursor: default !important;
|
|
33
|
-
`,l.onclick=d=>d.stopPropagation();let
|
|
33
|
+
`,l.onclick=d=>d.stopPropagation();let c=document.createElement("div");c.className="attachment-lightbox-hint",c.textContent="Click anywhere or press ESC to close",c.style.cssText=`
|
|
34
34
|
position: absolute !important;
|
|
35
35
|
bottom: 24px !important;
|
|
36
36
|
left: 50% !important;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let i=()=>{n.remove(),document.removeEventListener("keydown",
|
|
41
|
+
`;let i=()=>{n.remove(),document.removeEventListener("keydown",u);},u=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let m=r>0?r-1:a.length-1;i(),o(m);}else if(d.key==="ArrowRight"&&a.length>1){let m=r<a.length-1?r+1:0;i(),o(m);}};if(n.onclick=i,document.addEventListener("keydown",u),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=b=>{b.stopPropagation();let h=r<a.length-1?r+1:0;i(),o(h);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Rh(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Oh(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 Il(e){return e.startsWith("image/")}function Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[u,i]=react.useState(false),[c,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let b=react.useCallback((T,R)=>{R.preventDefault(),R.stopPropagation();let $=g.current.filter(E=>Il(E.type)),L=$.findIndex(E=>E.id===T.id),j=E=>{let ce=g.current.filter(X=>Il(X.type)),I=ce[E];I&&cp(I.url,I.name,ce,E,j);};cp(T.url,T.name,$,L,j);},[]),h=react.useCallback(T=>{let R=[],$=[];return e.length+T.length>s?($.push(`Maximum ${s} files allowed`),{valid:R,errors:$}):(T.forEach(L=>{if(L.size/1048576>r){$.push(`${L.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>L.type.match(E))){$.push(`${L.name} has invalid file type`);return}R.push(L);}),{valid:R,errors:$})},[e.length,s,r,o]),v=react.useCallback(async T=>{let{valid:R,errors:$}=h(T);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(L){d(L instanceof Error?L.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[h,t]),f=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),x=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let R=Array.from(T.dataTransfer.files);v(R);},[v]),k=react.useCallback(T=>{let R=T.target.files?Array.from(T.target.files):[];v(R),m.current&&(m.current.value="");},[v]),C=react.useCallback(()=>{m.current?.click();},[]),D=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:w,onDrop:x,onClick:C,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?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:n?"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 ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&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:c})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Il(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>b(T,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.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:Oh(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Rh(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(T.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"})})})]},T.id))})]})}function Bl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:h,onEstimateEffort:v,currentUserId:f="user-1"}){let[y,w]=react.useState("details"),[x,k]=react.useState(false),[C,D]=react.useState({}),[T,R]=react.useState(""),[$,L]=react.useState(false),[j,E]=react.useState({});if(!t||!e)return null;let ce=react.useCallback(()=>{k(false),D({}),w("details"),R(""),E({}),a();},[a]),I=react.useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),D({}),k(false));},[e.id,C,r]),X=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ce());},[e.id,o,ce]),Ce=react.useCallback(()=>{c&&T.trim()&&(c(e.id,T.trim()),R(""));},[e.id,T,c]),Xe=react.useCallback(async()=>{if(b){L(true);try{let z=await b(e);E(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{L(false);}}},[e,b]),P=react.useCallback(async()=>{if(h){L(true);try{let z=await h(e);E(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{L(false);}}},[e,h]),G=react.useCallback(async()=>{if(v){L(true);try{let z=await v(e);E(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{L(false);}}},[e,v]),fe={...e,...C},Ve=s.filter(z=>fe.assignedUserIds?.includes(z.id));return jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:ce,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:C.title??fe.title,onChange:z=>D({...C,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:fe.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:I,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:X,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:ce,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${y==="details"?"active":""}`,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 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${y==="comments"?"active":""}`,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 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${y==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${y==="attachments"?"active":""}`,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.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${y==="ai"?"active":""}`,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"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[y==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:C.description??fe.description??"",onChange:z=>D({...C,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:fe.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:C.assignedUserIds??fe.assignedUserIds??[],onChange:z=>{let re=Array.from(z.target.selectedOptions,J=>J.value);D({...C,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsxRuntime.jsx("option",{value:z.id,children:z.name},z.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ve.length>0?Ve.map(z=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsxRuntime.jsx("span",{children:z.name})]},z.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:C.priority??fe.priority??"",onChange:z=>D({...C,priority:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:fe.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:fe.labels&&fe.labels.length>0?fe.labels.map(z=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:z},z)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:fe.startDate?new Date(fe.startDate).toISOString().split("T")[0]:"",onChange:z=>D({...C,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.startDate?new Date(fe.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:fe.endDate?new Date(fe.endDate).toISOString().split("T")[0]:"",onChange:z=>D({...C,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.endDate?new Date(fe.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??fe.estimatedTime??"",onChange:z=>D({...C,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:fe.dependencies&&fe.dependencies.length>0?fe.dependencies.map(z=>{let re=typeof z=="string"?z:z.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:fe.createdAt?new Date(fe.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:z=>R(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Ce,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(z=>{let re=s.find(J=>J.id===z.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[re&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(z.id),className:"card-detail-comment-delete",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:z.content})]},z.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),y==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let re=s.find(J=>J.id===z.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:re?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),y==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ur,{cardId:e.id,attachments:i,onUpload:m?z=>m(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),y==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Xe,disabled:$||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:P,disabled:$||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:G,disabled:$||!v,className:"card-detail-ai-btn",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 6 12 12 16 14"})]}),"Estimate Effort"]})]}),j.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),j.assignees.map((z,re)=>{let J=s.find(Ae=>Ae.id===z.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:z.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},re)})]}),j.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),j.subtasks.map((z,re)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},re))]}),j.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[j.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(j.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.map(z=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!j.assignees&&!j.subtasks&&!j.effort&&u.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",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("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Vn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,u]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,b=4,h=d.left;h+o>g-10&&(h=g-o-10),h<10&&(h=10);let v=m-d.bottom,f=d.top,y;return v>=s+b?y=d.bottom+b:f>=s+b?y=d.top-s-b:v>=f?y=d.bottom+b:y=Math.max(10,d.top-s-b),{top:y,left:h}},[e,o,s]);return react.useEffect(()=>{t&&u(c());},[t,c]),react.useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;i.current&&!i.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var it={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var _h=["LOW","MEDIUM","HIGH","URGENT"],jh=["todo","in-progress","review","done"];function $l({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:b=[],availableLabels:h=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:y,unsplashAccessKey:w,theme:x,onSubtasksChange:k,attachments:C=[],onUploadAttachments:D,onDeleteAttachment:T}){let R=Zo(),$=x||R?.themeName||"dark",[L,j]=react.useState(e),[E,ce]=react.useState(false),[I,X]=react.useState(()=>[...e?.subtasks||[]].sort((Y,q)=>(Y.position??0)-(q.position??0))),[Ce,Xe]=react.useState(false),[P,G]=react.useState(""),[fe,Ve]=react.useState(""),[z,re]=react.useState("all"),[J,Ae]=react.useState(false),[he,$e]=react.useState(false),[Ne,at]=react.useState(false),[ee,rt]=react.useState(false),[ue,ot]=react.useState(false),[gt,Ct]=react.useState(false),be=react.useRef(null),ft=react.useRef(null),tt=react.useRef(null),Qe=react.useRef(null),H=react.useRef(null),se=react.useRef(null),N=react.useRef(null),K=react.useRef(null),ie=react.useRef(null),we=react.useRef(null),W=react.useRef(null),te=react.useRef(null);react.useEffect(()=>{if(e&&!L){j({...e});let A=[...e.subtasks||[]].sort((Y,q)=>(Y.position??0)-(q.position??0));X(A);}else if(e&&L&&e.id!==L.id){j({...e});let A=[...e.subtasks||[]].sort((Y,q)=>(Y.position??0)-(q.position??0));X(A);}},[e,L]),react.useEffect(()=>{let A=Y=>{let q=Y.target;Qe.current&&!Qe.current.contains(q)&&Ae(false),H.current&&!H.current.contains(q)&&$e(false),se.current&&!se.current.contains(q)&&at(false),N.current&&!N.current.contains(q)&&rt(false);};if(J||he||Ne||ee)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[J,he,Ne,ee]),react.useEffect(()=>{if(!t)return;let A=Y=>{let q=Y.target,le=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(Y.key==="Escape"){Y.preventDefault(),J||he||Ne||ee||ue||gt?(Ae(false),$e(false),at(false),rt(false),ot(false),Ct(false)):le||a();return}if(le&&Y.key!=="Escape")return;let Se=Y.metaKey||Y.ctrlKey;switch(Y.key.toLowerCase()){case "s":Y.preventDefault(),Ae(true);break;case "a":Y.preventDefault(),at(true);break;case "p":Y.preventDefault(),$e(true);break;case "l":Y.preventDefault(),rt(true);break;case "d":Se||(Y.preventDefault(),ot(true),setTimeout(()=>K.current?.focus(),0));break;case "e":Se||(Y.preventDefault(),Ct(true));break;case "i":Y.preventDefault(),ce(true),setTimeout(()=>ft.current?.focus(),0);break;case "t":Y.preventDefault(),Xe(true);break;case "c":Y.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,J,he,Ne,ee,ue,gt]);let ze=react.useCallback(A=>{let Y=A.currentTarget.textContent?.trim()||"";if(L&&Y!==L.title){let q={...L,title:Y};j(q),r?.(L.id,{title:Y});}},[L,r]),Te=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=L?.title||"",A.currentTarget.blur());},[L]),Ie=react.useCallback(()=>{L&&e&&L.description!==e.description&&r?.(L.id,{description:L.description}),ce(false);},[L,e,r]),De=react.useCallback(A=>{if(L){let Y={...L,columnId:A};j(Y),r?.(L.id,{columnId:A}),Ae(false);}},[L,r]),_e=react.useCallback(A=>{if(L){let Y={...L,priority:A};j(Y),r?.(L.id,{priority:A}),$e(false);}},[L,r]),ut=react.useCallback(A=>{if(L){let Y=L.assignedUserIds||[],q=Y.includes(A)?Y.filter(Se=>Se!==A):[...Y,A],le={...L,assignedUserIds:q};j(le),r?.(L.id,{assignedUserIds:q});}},[L,r]),mt=react.useCallback(A=>{if(L){let Y=L.labels||[],q=Y.includes(A)?Y.filter(Se=>Se!==A):[...Y,A],le={...L,labels:q};j(le),r?.(L.id,{labels:q});}},[L,r]),Ze=react.useCallback(A=>{if(L){let Y={...L,tags:A};j(Y),r?.(L.id,{tags:A});}},[L,r]),et=react.useCallback(A=>{if(L){let Y=A.target.value,q={...L,endDate:Y};j(q),r?.(L.id,{endDate:Y}),ot(false);}},[L,r]),It=react.useCallback(A=>{if(L){let Y={...L,estimatedTime:parseFloat(A)||0};j(Y),r?.(L.id,{estimatedTime:parseFloat(A)||0});}},[L,r]),Tt=react.useCallback(()=>{if(P.trim()&&L){let A={id:`subtask-${Date.now()}`,title:P.trim(),completed:false,position:I.length,createdAt:new Date},Y=[...I,A];X(Y),G(""),Xe(false),k?.(L.id,Y);}},[P,I,L,k]),bt=react.useCallback(A=>{let Y=I.map(q=>q.id===A?{...q,completed:!q.completed,updatedAt:new Date}:q);X(Y),L&&k?.(L.id,Y);},[I,L,k]),yt=react.useCallback(A=>{let Y=I.filter(q=>q.id!==A);X(Y),L&&k?.(L.id,Y);},[I,L,k]),dt=react.useCallback(()=>{fe.trim()&&L&&u&&(u(L.id,fe.trim()),Ve(""));},[fe,L,u]),Ft=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),dt());},[dt]),He=A=>jsxRuntime.jsx(Wh__default.default,{remarkPlugins:[Gh__default.default],rehypePlugins:[Vh__default.default],components:{a:({node:Y,...q})=>jsxRuntime.jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:A}),Be=l.filter(A=>z==="comments"?A.type.includes("COMMENT"):z==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let ct=L||e,ne=s.filter(A=>ct.assignedUserIds?.includes(A.id)),ge=I.filter(A=>A.completed).length;return jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:be,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ze,onKeyDown:Te,children:ct.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Qe,children:[jsxRuntime.jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>Ae(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.columnId||"No status"})]}),jsxRuntime.jsx(Vn,{triggerRef:ie,isOpen:J,onClose:()=>Ae(false),width:250,estimatedHeight:200,children:(b.length>0?b:jh.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ct.columnId===A.id?"active":""}`,onClick:()=>De(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxRuntime.jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>at(!Ne),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ne.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ne.map(A=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Vn,{triggerRef:we,isOpen:Ne,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ct.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>ut(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,ct.assignedUserIds?.includes(A.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>$e(!he),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.priority||"None"})]}),jsxRuntime.jsxs(Vn,{triggerRef:W,isOpen:he,onClose:()=>$e(false),width:180,estimatedHeight:220,children:[_h.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${ct.priority===A?"active":""}`,onClick:()=>_e(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>_e(""),children:"None"})]})]}),v.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(lo,{selectedTags:ct.tags||[],availableTags:v,onChange:Ze,onCreateTag:f,theme:it[$]||it.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxRuntime.jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>rt(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.labels&&ct.labels.length>0?jsxRuntime.jsx("span",{children:ct.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Vn,{triggerRef:te,isOpen:ee,onClose:()=>rt(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ct.labels?.includes(A)?"active":""}`,onClick:()=>mt(A),children:[A,ct.labels?.includes(A)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ot(!ue),setTimeout(()=>K.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.endDate?new Date(ct.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:K,type:"date",value:typeof ct.endDate=="string"?ct.endDate.split("T")[0]:ct.endDate?(()=>{let A=new Date(ct.endDate),Y=A.getUTCFullYear(),q=String(A.getUTCMonth()+1).padStart(2,"0"),le=String(A.getUTCDate()).padStart(2,"0");return `${Y}-${q}-${le}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ct(!gt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.estimatedTime?`${ct.estimatedTime}h`:"Not set"})]}),gt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ct.estimatedTime||"",onChange:A=>It(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ct(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),E?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ct.description||"",onChange:A=>{if(L){let Y={...L,description:A.target.value};j(Y);}},onBlur:Ie,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>ce(true),children:ct.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:He(ct.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),I.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ge,"/",I.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Xe(true),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:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[I.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>bt(A.id),children:A.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:A.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>yt(A.id),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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},A.id)),Ce&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:P,onChange:A=>G(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Tt(),A.key==="Escape"&&(Xe(false),G(""));},onBlur:Tt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||C.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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.jsx("h2",{children:"Attachments"}),C.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:C.length})]}),jsxRuntime.jsx(Ur,{cardId:ct.id,attachments:C,onUpload:D?A=>D(ct.id,A):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:fe,onChange:A=>Ve(A.target.value),onKeyDown:Ft,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",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.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.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",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:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",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("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:dt,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Be.map(A=>{let Y=s.find(le=>le.id===A.userId);if(A.type.includes("COMMENT")){let le=n.find(Se=>Se.id===A.metadata?.commentId);return le?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Y&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Y.color},children:Y.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:Y?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:le.content})]})]},A.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:Y?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),Be.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function ty({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((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function zl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,u)=>l+u.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:a,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(ty,{})}),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}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&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((n,l)=>n+l.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((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.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:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function cy({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((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Ul({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=l;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:jsxRuntime.jsxs(o?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(cy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?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:u>=50?"#10B981":"#F59E0B"},children:[u.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:n})]}),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 xy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},xp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function vy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:u,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Wl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||xy[u.name]||xp[e.indexOf(u)%xp.length]})),l=n.map(u=>u.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:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?vy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,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(vp,{})}),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:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[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:"#2E94FF"},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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var Ks=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[u,i]=react.useState(false),[c,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(b,{priority:x}),l(false);},v=x=>{r.onBulkMove?.(b,x),i(false),a();},f=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},y=x=>{let k=new Set;e.forEach(D=>{D.labels?.forEach(T=>k.add(T));});let C=Array.from(new Set([...k,...x]));r.onBulkUpdate?.(b,{labels:C}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};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:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsxRuntime.jsx("span",{className:p("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Ks.displayName="BulkOperationsToolbar";function Ny(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let b=a?.find(h=>h.id===g);n=`assignee-${g}`,l=b?.name||`User ${g}`,u=b?.color,i=b?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,u=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Gl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Ny(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:p("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(po,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Vl=[{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 _l({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=Vl.find(i=>i.value===e)||Vl[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"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"})})]}),r&&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:Vl.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:p("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[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-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var _n=[{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 Ey(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&l&&u}function Np(e={}){let{shortcuts:t=_n,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(u=>{o.current=[...o.current,u];},[]),l=react.useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return react.useEffect(()=>{function u(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Ey(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function My(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Py(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Ay(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Py(e),r=t?My(t):"";return a?`${a} + ${r}`:r}function Ly(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function jl({shortcuts:e=_n,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Ly(e);return jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),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:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),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(n).map(([l,u])=>u.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-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:u.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:Ay(i)})]},i.action))})]},l))})}),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 Kl=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=b=>{b.stopPropagation();let h=r<a.length-1?r+1:0;i(),o(h);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Oh(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function $h(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 Rl(e){return e.startsWith("image/")}function Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[u,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let b=react.useCallback((T,B)=>{B.preventDefault(),B.stopPropagation();let $=g.current.filter(E=>Rl(E.type)),A=$.findIndex(E=>E.id===T.id),_=E=>{let ue=g.current.filter(X=>Rl(X.type)),L=ue[E];L&&cp(L.url,L.name,ue,E,_);};cp(T.url,T.name,$,A,_);},[]),h=react.useCallback(T=>{let B=[],$=[];return e.length+T.length>s?($.push(`Maximum ${s} files allowed`),{valid:B,errors:$}):(T.forEach(A=>{if(A.size/1048576>r){$.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>A.type.match(E))){$.push(`${A.name} has invalid file type`);return}B.push(A);}),{valid:B,errors:$})},[e.length,s,r,o]),v=react.useCallback(async T=>{let{valid:B,errors:$}=h(T);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(B.length!==0){i(true),d(null);try{await t?.(B);}catch(A){d(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[h,t]),f=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),x=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let B=Array.from(T.dataTransfer.files);v(B);},[v]),C=react.useCallback(T=>{let B=T.target.files?Array.from(T.target.files):[];v(B),m.current&&(m.current.value="");},[v]),k=react.useCallback(()=>{m.current?.click();},[]),D=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:w,onDrop:x,onClick:k,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?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:n?"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 ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&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:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Rl(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>b(T,B),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.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:$h(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Oh(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(T.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"})})})]},T.id))})]})}function Ol({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:h,onEstimateEffort:v,currentUserId:f="user-1"}){let[y,w]=react.useState("details"),[x,C]=react.useState(false),[k,D]=react.useState({}),[T,B]=react.useState(""),[$,A]=react.useState(false),[_,E]=react.useState({});if(!t||!e)return null;let ue=react.useCallback(()=>{C(false),D({}),w("details"),B(""),E({}),a();},[a]),L=react.useCallback(()=>{r&&Object.keys(k).length>0&&(r(e.id,k),D({}),C(false));},[e.id,k,r]),X=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ue());},[e.id,o,ue]),ee=react.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),B(""));},[e.id,T,u]),$e=react.useCallback(async()=>{if(b){A(true);try{let z=await b(e);E(oe=>({...oe,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{A(false);}}},[e,b]),R=react.useCallback(async()=>{if(h){A(true);try{let z=await h(e);E(oe=>({...oe,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{A(false);}}},[e,h]),Y=react.useCallback(async()=>{if(v){A(true);try{let z=await v(e);E(oe=>({...oe,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{A(false);}}},[e,v]),be={...e,...k},_e=s.filter(z=>be.assignedUserIds?.includes(z.id));return jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:ue,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:k.title??be.title,onChange:z=>D({...k,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:be.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{C(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>C(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:X,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:ue,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${y==="details"?"active":""}`,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 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${y==="comments"?"active":""}`,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 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${y==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${y==="attachments"?"active":""}`,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.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${y==="ai"?"active":""}`,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"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[y==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:k.description??be.description??"",onChange:z=>D({...k,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:be.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:k.assignedUserIds??be.assignedUserIds??[],onChange:z=>{let oe=Array.from(z.target.selectedOptions,J=>J.value);D({...k,assignedUserIds:oe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsxRuntime.jsx("option",{value:z.id,children:z.name},z.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:_e.length>0?_e.map(z=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsxRuntime.jsx("span",{children:z.name})]},z.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:k.priority??be.priority??"",onChange:z=>D({...k,priority:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:be.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:be.labels&&be.labels.length>0?be.labels.map(z=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:z},z)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:k.startDate?new Date(k.startDate).toISOString().split("T")[0]:be.startDate?new Date(be.startDate).toISOString().split("T")[0]:"",onChange:z=>D({...k,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.startDate?new Date(be.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:k.endDate?new Date(k.endDate).toISOString().split("T")[0]:be.endDate?new Date(be.endDate).toISOString().split("T")[0]:"",onChange:z=>D({...k,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.endDate?new Date(be.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:k.estimatedTime??be.estimatedTime??"",onChange:z=>D({...k,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:be.dependencies&&be.dependencies.length>0?be.dependencies.map(z=>{let oe=typeof z=="string"?z:z.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",oe.slice(-4)]},oe)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:be.createdAt?new Date(be.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:z=>B(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ee,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(z=>{let oe=s.find(J=>J.id===z.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[oe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:oe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(z.id),className:"card-detail-comment-delete",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:z.content})]},z.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),y==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let oe=s.find(J=>J.id===z.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:oe?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),y==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ur,{cardId:e.id,attachments:i,onUpload:m?z=>m(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),y==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:$e,disabled:$||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:R,disabled:$||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Y,disabled:$||!v,className:"card-detail-ai-btn",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 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((z,oe)=>{let J=s.find(Ae=>Ae.id===z.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:z.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},oe)})]}),_.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((z,oe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},oe))]}),_.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[_.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(z=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",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("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function jn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,b=4,h=d.left;h+o>g-10&&(h=g-o-10),h<10&&(h=10);let v=m-d.bottom,f=d.top,y;return v>=s+b?y=d.bottom+b:f>=s+b?y=d.top-s-b:v>=f?y=d.bottom+b:y=Math.max(10,d.top-s-b),{top:y,left:h}},[e,o,s]);return react.useEffect(()=>{t&&c(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;i.current&&!i.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var it={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var jh=["LOW","MEDIUM","HIGH","URGENT"],Kh=["todo","in-progress","review","done"];function zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:b=[],availableLabels:h=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:y,unsplashAccessKey:w,theme:x,onSubtasksChange:C,attachments:k=[],onUploadAttachments:D,onDeleteAttachment:T}){let B=en(),$=x||B?.themeName||"dark",[A,_]=react.useState(e),[E,ue]=react.useState(false),[L,X]=react.useState(()=>[...e?.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0))),[ee,$e]=react.useState(false),[R,Y]=react.useState(""),[be,_e]=react.useState(""),[z,oe]=react.useState("all"),[J,Ae]=react.useState(false),[xe,He]=react.useState(false),[Ne,at]=react.useState(false),[te,rt]=react.useState(false),[pe,ot]=react.useState(false),[gt,Ct]=react.useState(false),ye=react.useRef(null),ft=react.useRef(null),tt=react.useRef(null),Qe=react.useRef(null),H=react.useRef(null),ie=react.useRef(null),N=react.useRef(null),j=react.useRef(null),le=react.useRef(null),Ce=react.useRef(null),W=react.useRef(null),ae=react.useRef(null);react.useEffect(()=>{if(e&&!A){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}else if(e&&A&&e.id!==A.id){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}},[e,A]),react.useEffect(()=>{let P=K=>{let q=K.target;Qe.current&&!Qe.current.contains(q)&&Ae(false),H.current&&!H.current.contains(q)&&He(false),ie.current&&!ie.current.contains(q)&&at(false),N.current&&!N.current.contains(q)&&rt(false);};if(J||xe||Ne||te)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[J,xe,Ne,te]),react.useEffect(()=>{if(!t)return;let P=K=>{let q=K.target,de=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(K.key==="Escape"){K.preventDefault(),J||xe||Ne||te||pe||gt?(Ae(false),He(false),at(false),rt(false),ot(false),Ct(false)):de||a();return}if(de&&K.key!=="Escape")return;let Se=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Ae(true);break;case "a":K.preventDefault(),at(true);break;case "p":K.preventDefault(),He(true);break;case "l":K.preventDefault(),rt(true);break;case "d":Se||(K.preventDefault(),ot(true),setTimeout(()=>j.current?.focus(),0));break;case "e":Se||(K.preventDefault(),Ct(true));break;case "i":K.preventDefault(),ue(true),setTimeout(()=>ft.current?.focus(),0);break;case "t":K.preventDefault(),$e(true);break;case "c":K.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[t,a,J,xe,Ne,te,pe,gt]);let Ue=react.useCallback(P=>{let K=P.currentTarget.textContent?.trim()||"";if(A&&K!==A.title){let q={...A,title:K};_(q),r?.(A.id,{title:K});}},[A,r]),Te=react.useCallback(P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur()),P.key==="Escape"&&(P.preventDefault(),P.currentTarget.textContent=A?.title||"",P.currentTarget.blur());},[A]),Be=react.useCallback(()=>{A&&e&&A.description!==e.description&&r?.(A.id,{description:A.description}),ue(false);},[A,e,r]),De=react.useCallback(P=>{if(A){let K={...A,columnId:P};_(K),r?.(A.id,{columnId:P}),Ae(false);}},[A,r]),je=react.useCallback(P=>{if(A){let K={...A,priority:P};_(K),r?.(A.id,{priority:P}),He(false);}},[A,r]),ut=react.useCallback(P=>{if(A){let K=A.assignedUserIds||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],de={...A,assignedUserIds:q};_(de),r?.(A.id,{assignedUserIds:q});}},[A,r]),mt=react.useCallback(P=>{if(A){let K=A.labels||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],de={...A,labels:q};_(de),r?.(A.id,{labels:q});}},[A,r]),Ze=react.useCallback(P=>{if(A){let K={...A,tags:P};_(K),r?.(A.id,{tags:P});}},[A,r]),et=react.useCallback(P=>{if(A){let K=P.target.value,q={...A,endDate:K};_(q),r?.(A.id,{endDate:K}),ot(false);}},[A,r]),It=react.useCallback(P=>{if(A){let K={...A,estimatedTime:parseFloat(P)||0};_(K),r?.(A.id,{estimatedTime:parseFloat(P)||0});}},[A,r]),Tt=react.useCallback(()=>{if(R.trim()&&A){let P={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:L.length,createdAt:new Date},K=[...L,P];X(K),Y(""),$e(false),C?.(A.id,K);}},[R,L,A,C]),bt=react.useCallback(P=>{let K=L.map(q=>q.id===P?{...q,completed:!q.completed,updatedAt:new Date}:q);X(K),A&&C?.(A.id,K);},[L,A,C]),yt=react.useCallback(P=>{let K=L.filter(q=>q.id!==P);X(K),A&&C?.(A.id,K);},[L,A,C]),dt=react.useCallback(()=>{be.trim()&&A&&c&&(c(A.id,be.trim()),_e(""));},[be,A,c]),Ft=react.useCallback(P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),dt());},[dt]),ze=P=>jsxRuntime.jsx(Gh__default.default,{remarkPlugins:[Vh__default.default],rehypePlugins:[_h__default.default],components:{a:({node:K,...q})=>jsxRuntime.jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:P}),Re=l.filter(P=>z==="comments"?P.type.includes("COMMENT"):z==="history"?!P.type.includes("COMMENT"):true);if(!t||!e)return null;let ct=A||e,se=s.filter(P=>ct.assignedUserIds?.includes(P.id)),fe=L.filter(P=>P.completed).length;return jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:ye,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:Te,children:ct.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Qe,children:[jsxRuntime.jsxs("button",{ref:le,className:"modal-v2-field",onClick:()=>Ae(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.columnId||"No status"})]}),jsxRuntime.jsx(jn,{triggerRef:le,isOpen:J,onClose:()=>Ae(false),width:250,estimatedHeight:200,children:(b.length>0?b:Kh.map(P=>({id:P,title:P}))).map(P=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ct.columnId===P.id?"active":""}`,onClick:()=>De(P.id),children:P.title},P.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ie,children:[jsxRuntime.jsxs("button",{ref:Ce,className:"modal-v2-field",onClick:()=>at(!Ne),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:se.map(P=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:P.color},title:P.name,children:P.initials},P.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jn,{triggerRef:Ce,isOpen:Ne,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(P=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ct.assignedUserIds?.includes(P.id)?"active":""}`,onClick:()=>ut(P.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:P.color},children:P.initials}),P.name,ct.assignedUserIds?.includes(P.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},P.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>He(!xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.priority||"None"})]}),jsxRuntime.jsxs(jn,{triggerRef:W,isOpen:xe,onClose:()=>He(false),width:180,estimatedHeight:220,children:[jh.map(P=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${P.toLowerCase()} ${ct.priority===P?"active":""}`,onClick:()=>je(P),children:P},P)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>je(""),children:"None"})]})]}),v.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(lo,{selectedTags:ct.tags||[],availableTags:v,onChange:Ze,onCreateTag:f,theme:it[$]||it.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxRuntime.jsxs("button",{ref:ae,className:"modal-v2-field",onClick:()=>rt(!te),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.labels&&ct.labels.length>0?jsxRuntime.jsx("span",{children:ct.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jn,{triggerRef:ae,isOpen:te,onClose:()=>rt(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(P=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ct.labels?.includes(P)?"active":""}`,onClick:()=>mt(P),children:[P,ct.labels?.includes(P)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},P))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ot(!pe),setTimeout(()=>j.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.endDate?new Date(ct.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:j,type:"date",value:typeof ct.endDate=="string"?ct.endDate.split("T")[0]:ct.endDate?(()=>{let P=new Date(ct.endDate),K=P.getUTCFullYear(),q=String(P.getUTCMonth()+1).padStart(2,"0"),de=String(P.getUTCDate()).padStart(2,"0");return `${K}-${q}-${de}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ct(!gt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ct.estimatedTime?`${ct.estimatedTime}h`:"Not set"})]}),gt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ct.estimatedTime||"",onChange:P=>It(P.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ct(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),E?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ct.description||"",onChange:P=>{if(A){let K={...A,description:P.target.value};_(K);}},onBlur:Be,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>ue(true),children:ct.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:ze(ct.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),L.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[fe,"/",L.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>$e(true),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:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[L.map(P=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${P.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>bt(P.id),children:P.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:P.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>yt(P.id),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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},P.id)),ee&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:P=>Y(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Tt(),P.key==="Escape"&&($e(false),Y(""));},onBlur:Tt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||k.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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.jsx("h2",{children:"Attachments"}),k.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:k.length})]}),jsxRuntime.jsx(Ur,{cardId:ct.id,attachments:k,onUpload:D?P=>D(ct.id,P):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="all"?"active":""}`,onClick:()=>oe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>oe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>oe("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:be,onChange:P=>_e(P.target.value),onKeyDown:Ft,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",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.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.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",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:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",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("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:dt,disabled:!be.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Re.map(P=>{let K=s.find(de=>de.id===P.userId);if(P.type.includes("COMMENT")){let de=n.find(Se=>Se.id===P.metadata?.commentId);return de?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:de.content})]})]},P.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)}),Re.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function ay({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((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Wl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return 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: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(ay,{})}),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}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&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((n,l)=>n+l.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((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.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:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function uy({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((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Gl({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return 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:jsxRuntime.jsxs(o?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(uy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?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:c>=50?"#10B981":"#F59E0B"},children:[c.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:n})]}),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 vy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},xp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function wy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Vl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||vy[c.name]||xp[e.indexOf(c)%xp.length]})),l=n.map(c=>c.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:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?wy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,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(vp,{})}),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:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[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:"#2E94FF"},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((c,i)=>i.value>c.value?i:c).name})]})]})]})}var qs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[u,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(b,{priority:x}),l(false);},v=x=>{r.onBulkMove?.(b,x),i(false),a();},f=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},y=x=>{let C=new Set;e.forEach(D=>{D.labels?.forEach(T=>C.add(T));});let k=Array.from(new Set([...C,...x]));r.onBulkUpdate?.(b,{labels:k}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};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:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsxRuntime.jsx("span",{className:p("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});qs.displayName="BulkOperationsToolbar";function Dy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let b=a?.find(h=>h.id===g);n=`assignee-${g}`,l=b?.name||`User ${g}`,c=b?.color,i=b?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function _l({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Dy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:p("asakaa-swimlane-view",o),children:[l.map(i=>{let u=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[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&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(po,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.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 jl=[{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 Kl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=jl.find(i=>i.value===e)||jl[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"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"})})]}),r&&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:jl.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:p("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[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-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Kn=[{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 Fy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function Np(e={}){let{shortcuts:t=Kn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),l=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Fy(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Py(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ay(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Ly(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ay(e),r=t?Py(t):"";return a?`${a} + ${r}`:r}function Iy(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Yl({shortcuts:e=Kn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Iy(e);return jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),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:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),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(n).map(([l,c])=>c.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-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.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:Ly(i)})]},i.action))})]},l))})}),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 ql=[{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 Yl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"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"})})]}),r&&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(u).map(([i,c])=>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:c.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.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:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.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 Xl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[u,i]=react.useState("json"),[c,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let h=o?.current||void 0,v=await Xc(e,u,h);Jc(v,u);},b=async h=>{let v=h.target.files?.[0];if(v){try{let f=await eu(v),y=v.name.endsWith(".json")?"json":"csv",w=Zc(f,y);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:p("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:a}),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:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="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(h=>jsxRuntime.jsxs("button",{onClick:()=>i(h),className:p("p-4 rounded-lg border-2 transition-all text-center",u===h?"border-blue-500 bg-blue-500/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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&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:m,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[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"})]})]}),c&&jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:p("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((h,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},v))})]})]})]})]})]})}var $y=["URGENT","HIGH","MEDIUM","LOW"],Hy=[{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"}],zy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Jl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:b}){let[h,v]=react.useState(true),f=react.useCallback(C=>{a({search:C.target.value});},[a]),y=react.useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=react.useCallback(C=>{r({by:C.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${h?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"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"}),k&&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)"]})]}),!h&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&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"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,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:f,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:C=>{let D=C.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),$y.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let D=C.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.map(C=>jsxRuntime.jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let D=C.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Hy.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:C=>b(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:zy.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ql({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:u}){let[i,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&c(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),c(false);};return jsxRuntime.jsxs("div",{className:p("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[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:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(()=>u?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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 Zl={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ed={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},td={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bo={dark:Zl,light:ed,neutral:td},qs="dark";var Xs=react.createContext(void 0),Xy="asakaa-theme";function Ep({children:e,defaultTheme:t=qs,storageKey:a=Xy}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,u=Bo[r];Object.entries(u.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Jy(c)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,d])=>{let m=u.colors[c];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Bo};return jsxRuntime.jsx(Xs.Provider,{value:n,children:e})}function cn(){let e=react.useContext(Xs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Jy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ad({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=cn();return e?jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",a),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(Bo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:p("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.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"]})]}),r===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}function Fp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return it[e]||it.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",it[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",it[e].bgSecondary),bgGrid:r("--theme-bg-card",it[e].bgGrid),bgWeekend:r("--theme-bg-hover",it[e].bgWeekend),border:r("--theme-border-primary",it[e].border),borderLight:r("--theme-border-subtle",it[e].borderLight),textPrimary:r("--theme-text-primary",it[e].textPrimary),textSecondary:r("--theme-text-secondary",it[e].textSecondary),textTertiary:r("--theme-text-tertiary",it[e].textTertiary),accent:r("--theme-accent-primary",it[e].accent),accentHover:r("--theme-accent-hover",it[e].accentHover),accentLight:r("--theme-accent-primary",it[e].accentLight),taskBarPrimary:r("--theme-accent-primary",it[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",it[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",it[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",it[e].dependency),dependencyHover:r("--theme-border-secondary",it[e].dependencyHover),criticalPath:r("--theme-error",it[e].criticalPath),criticalPathLight:r("--theme-error",it[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",it[e].today):e==="neutral"?r("--theme-text-primary",it[e].today):r("--theme-error",it[e].today),todayLight:e==="light"?r("--theme-accent-primary",it[e].todayLight):e==="neutral"?r("--theme-text-primary",it[e].todayLight):r("--theme-error",it[e].todayLight),milestone:r("--theme-warning",it[e].milestone),milestoneLight:r("--theme-warning",it[e].milestoneLight),statusTodo:r("--theme-text-tertiary",it[e].statusTodo),statusInProgress:r("--theme-accent-primary",it[e].statusInProgress),statusCompleted:r("--theme-success",it[e].statusCompleted),hoverBg:r("--theme-bg-hover",it[e].hoverBg),focusRing:r("--theme-accent-primary",it[e].focusRing),...it[e].dotGrid&&{dotGrid:it[e].dotGrid},...it[e].glassHeader&&{glassHeader:it[e].glassHeader},...it[e].glassToolbar&&{glassToolbar:it[e].glassToolbar},...it[e].forecastHud&&{forecastHud:it[e].forecastHud},...it[e].neonRedGlow&&{neonRedGlow:it[e].neonRedGlow},...it[e].executionBarBg&&{executionBarBg:it[e].executionBarBg}}}var Js={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"}},Mp={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"}},rd={en:Js,es:Mp};function Pp(e){return rd[e]||rd.en}function od(e,t){let a=Pp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var pn=react.createContext(Js);function Er(){return react.useContext(pn)}function ei(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,u;a==="right"?u=n.right-r:u=n.left;let i=8;u+r>window.innerWidth-i&&(u=window.innerWidth-i-r),u<i&&(u=i),s({top:l,left:u});},[t,a,e,r]),o}function Lp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[u,i]=react.useState(null),[c,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),b=Er(),h=ei(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=b.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let k=C=>{let D=C.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let y=[{id:"png",label:b.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:b.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:b.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:b.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(D){console.error(`Export ${k} failed:`,D);}finally{i(null),l(false);}}},x=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:h.top,left:h.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((k,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(k.id,k.handler),disabled:u!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[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:u===k.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"})}):k.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:c?"rgba(34,197,94,0.15)":e.accentLight,color:c?"#22C55E":e.accent},children:c?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:c?b.toolbar.copied:b.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Cx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Tx({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Ip({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),u=Er(),i=ei(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let b=g.target;n.current&&!n.current.contains(b)&&l.current&&!l.current.contains(b)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let c=[{value:"all",label:u.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?u.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${u.toolbar.wbsLevel||"Level"}: ${d}`,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:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(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-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:c.map((m,g)=>{let b=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:b?e.accentLight:"transparent",borderBottom:g<c.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:b?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:b?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:b?600:500},children:m.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Bp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),u=react.useRef(null),i=Er(),c=ei(l,s,"left");react.useEffect(()=>{if(!s)return;let b=setTimeout(()=>{let h=f=>{let y=f.target;l.current&&!l.current.contains(y)&&u.current&&!u.current.contains(y)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),u._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(b),u._cleanup&&u._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon: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-blue-500"},{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"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:b=>{b.stopPropagation(),n(h=>!h);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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-56 rounded-xl overflow-hidden",style:{top:c.top,left:c.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"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:g?"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:d.map(b=>{let h=t===b.value&&!r,v=()=>b.value==="all"?h?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(b.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:h?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${h?b.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:b.label}),h&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},b.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Nx({value:e,onChange:t,theme:a}){let r=Er(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Dx({theme:e,forecast:t}){let a=Er(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,u=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,c=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",b=t?.budgetVariancePercent,h=b!=null&&b!==0,v=b!=null?b>0?`+${b.toFixed(0)}% ${a.toolbar.budgetOver}`:`${b.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[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:a.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:[a.toolbar.expectedFinish,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:u.bg,color:u.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),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:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:c,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"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:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),h&&v&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function Sx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:u,rowDensity:i,onRowDensityChange:c,hasDependencies:d=true}){let[m,g]=react.useState(false),b=react.useRef(null),h=react.useRef(null),v=Er(),f=ei(b,m,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let C=D=>{let T=D.target;b.current&&!b.current.contains(T)&&h.current&&!h.current.contains(T)&&g(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[m]);let w=v.toolbar.visibility==="Visibilidad",x=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:u}],k=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:b,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:v.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:h,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor: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:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:x.map((C,D)=>{let T=C.icon,R=C.disabled,$=C.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!R&&C.onChange?.(!C.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:R?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:R?"not-allowed":"pointer"},whileHover:R?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},title:$,children:[jsxRuntime.jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:R?y?"rgba(255,255,255,0.2)":"#D1D5DB":C.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label}),C.active&&!R&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.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:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((C,D)=>{let T=i===C.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(C.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:(x.length+D)*.03},children:[jsxRuntime.jsx("span",{style:{color:T?e.accent||"#2E94FF":y?"rgba(255,255,255,0.85)":e.textPrimary},children:C.label}),T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.value)})]})]})}),document.body)]})}function ti({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:h=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:y,onWbsLevelChange:w,maxWbsDepth:x=4,viewMode:k="execution",onViewModeChange:C,projectForecast:D,onExportPNG:T,onExportPDF:R,onExportExcel:$,onExportCSV:L,onExportJSON:j,onExportMSProject:E,showCriticalPath:ce=true,onShowCriticalPathChange:I,showDependencies:X=true,onShowDependenciesChange:Ce,highlightWeekends:Xe=true,onHighlightWeekendsChange:P,showBaseline:G=false,onShowBaselineChange:fe,onCopySnapshotLink:Ve,hasDependencies:z=true}){let re=Er(),J=T||R||$||L||j||E,Ae=!!e.glassToolbar,[he,$e]=react.useState(false),Ne=react.useRef(null);react.useEffect(()=>{he&&Ne.current&&Ne.current.focus();},[he]);let at=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ee=[{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"})}],rt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ae){let ue=rt?"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.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:rt?"#1A1A1A":e.bgSecondary,border:`1px solid ${rt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:he?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>$e(!he),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),he&&jsxRuntime.jsx("input",{ref:Ne,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>$e(false),onKeyDown:ot=>{ot.key==="Escape"&&$e(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),C&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:rt?"#000000":e.bgSecondary,border:`1px solid ${rt?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?rt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?rt?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Nx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),w&&jsxRuntime.jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),jsxRuntime.jsx(Sx,{theme:e,showCriticalPath:ce,onShowCriticalPathChange:I,showBaseline:G,onShowBaselineChange:fe,highlightWeekends:Xe,onHighlightWeekendsChange:P,showDependencies:X,onShowDependenciesChange:Ce,rowDensity:l,onRowDensityChange:u,hasDependencies:z}),jsxRuntime.jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:R,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:Ve}),c&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${rt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${rt?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]})]})]}),D&&jsxRuntime.jsx(Dx,{theme:e,forecast:D})]})}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(Tx,{options:at,value:t,onChange:ue=>a(ue),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:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children: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(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),c&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||re.toolbar.createTask})]}),(J||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:R,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:Ve}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Cx,{options:ee,value:s,onChange:ue=>n(ue),theme:e})]})]})}function ai({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let c=u.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function fn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,m=8,g=window.innerWidth,b=window.innerHeight,h=t,v=a;t+c+m>g&&(h=t-c,h<m&&(h=m)),a+d+m>b&&(v=b-d-m,v<m&&(v=m)),u({x:h,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Kt={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 Gp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),b=react.useCallback(w=>{g.current=w;},[]),h=react.useCallback(w=>{let x=[],k=C=>{for(let D of C)x.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&k(D.subtasks);};return k(w),x},[]),v=react.useCallback(()=>{let w=h(e);for(let x of w)if(t.has(x.id))return x;return null},[e,t,h]),f=react.useCallback((w,x)=>{let k=h(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let D=k.findIndex($=>$.id===C.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=k.length)return;let R=k[T];a(R.id,x);},[e,v,h,a]),y=react.useCallback(w=>{if(!m)return;let x=w.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||g.current){w.key==="Escape"&&(x.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),R=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(R&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!R.isExpanded||w.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),l(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),u(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){R&&(w.preventDefault(),r(R.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){R&&(w.preventDefault(),r(R.id,"above"));return}if(w.key==="Enter"&&D){R&&(w.preventDefault(),d(R.id));return}if(w.key==="F2"){R&&(w.preventDefault(),i(R.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,l,u,i,c,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[m,y]),{setIsEditing:b}}function _p(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),b=m.indexOf(d);if(g===-1||b===-1){o(d);return}let h=Math.min(g,b),v=Math.max(g,b),f=m.slice(h,v+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,b)=>{b?n(d,m):g?s(d):o(d);},[o,s,n]),u=react.useCallback((d,m)=>{m?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:c}}function id(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?id(t.subtasks):t.subtasks}))}function bn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,u)=>(l.position??0)-(u.position??0));for(let l=0;l<n.length;l++){let u={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.id,s+1);}};return a(e),t}function ri(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ri(a.subtasks,t);if(r)return r}}return null}function sd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=sd(a.subtasks,t);if(r)return r}return null}function ld(e,t){if(t.length===0)return e;let a=bn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let b=[];return {tasks:m.filter(v=>{if(g.has(v.id))return b.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,b.push(...f.removed);}return true}),removed:b}},l=(m,g,b)=>m.map(h=>h.id===g?{...h,subtasks:[...h.subtasks||[],...b],isExpanded:true}:h.subtasks?{...h,subtasks:l(h.subtasks,g,b)}:h),u=new Set(t),{tasks:i,removed:c}=n(e,u),d=l(i,s.id,c);return id(d)}function dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=sd(a,r);if(!o)continue;let s=sd(a,o.id),n=(i,c,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===c&&g.subtasks){let b=g.subtasks.findIndex(h=>h.id===d);if(b!==-1){let[h]=g.subtasks.splice(b,1);return h}}if(g.subtasks){let b=n(g.subtasks,c,d);if(b)return b}}return null},l=(i,c,d)=>{let m=i.findIndex(g=>g.id===c);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,c,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?l(s.subtasks,o.id,u):l(a,o.id,u));}return id(a)}function cd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,u)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,u))return true;return false}let c=u==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],n[i]={...n[i],position:i},n[c]={...n[c],position:c},true)};return s(r,o,a),r}function ud(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Kn(e,t){let a=[...e],r=[];for(let o of t){let s=(u,i)=>u.map((c,d)=>({...c,id:`${c.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${d}`):void 0})),n=u=>{let i=u.findIndex(g=>g.id===o);if(i===-1){for(let g of u)if(g.subtasks){let b=n(g.subtasks);if(b)return b}return null}let c=u[i],d=`${c.id}-copy-${Date.now()}`,m={...c,id:d,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,d):void 0};return u.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function jp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function pd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:pd(r.subtasks,t,a)}:r)}function md(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:md(a.subtasks,t)}:a)}function gd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let b=a(g.subtasks);if(b)return b}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,u=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let b=u(g.subtasks);if(b>=0)return b}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let b=g.subtasks||[];return {...g,subtasks:[...b,c],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:c}}function Kp(e,t,a,r){if(t===a)return e;let o=ri(e,t);if(!o)return e;if(a){let l=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>{let u=l.filter(c=>c.id!==t),i=u.length<l.length;return u.map((c,d)=>{let m=i?{...c,position:d}:c;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let l=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,m=[...c];m.splice(d,0,{...o,parentId:a});let g=m.map((b,h)=>({...b,position:h}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((l,u)=>(u.startDate&&l.starts.push(new Date(u.startDate).getTime()),u.endDate&&l.ends.push(new Date(u.endDate).getTime()),l.progresses.push(u.progress??0),l),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,u)=>l+u,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ni({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:y,onTaskCreate:w,onTaskRename:x,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:R,showCriticalPath:$=false}){let L=react.useContext(pn),[j,E]=react.useState(null),[ce,I]=react.useState(null),[X,Ce]=react.useState(""),Xe=react.useRef(null),[P,G]=react.useState(null),[fe,Ve]=react.useState(0),[z,re]=react.useState(0),[J,Ae]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[he,$e]=react.useState(null),[Ne,at]=react.useState(null),[ee,rt]=react.useState(null),ue=react.useRef(0),ot=5,gt=react.useRef(false),[Ct,be]=react.useState(null),[ft,tt]=react.useState(false),Qe=react.useRef(null),[H,se]=react.useState(null),[N,K]=react.useState(false),ie=react.useRef(null);react.useEffect(()=>{function ne(ge){ie.current&&!ie.current.contains(ge.target)&&K(false);}if(N)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[N]),react.useEffect(()=>{ce&&Xe.current&&(Xe.current.focus(),Xe.current.select());},[ce]),react.useEffect(()=>{if(!P)return;let ne=A=>{let Y=A.clientX-fe,q=z+Y;m?.(P,q);},ge=()=>{G(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",ge),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[P,fe,z,m]);let{selectedTaskIds:we,handleTaskClick:W,isTaskSelected:te}=_p(),{setIsEditing:ze}=Gp({tasks:e,selectedTaskIds:we,onTaskSelect:(ne,ge)=>{let Y=bn(e).map(q=>q.id);W(ne,Y,ge||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:ne=>{let ge=bn(e).find(A=>A.id===ne);ge&&mt(ge);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:ne=>{let ge=bn(e).find(A=>A.id===ne);ge&&C&&C(ge);},enableKeyboard:true}),Te=(ne,ge=0,A="")=>{let Y=[],q=[...ne].sort((le,Se)=>(le.position??0)-(Se.position??0));for(let le=0;le<q.length;le++){let Se=q[le],je=le+1,Ue=A?`${A}.${je}`:`${je}.0`;if(Se.wbsCode=Ue,Y.push({task:Se,level:ge}),Se.subtasks&&Se.subtasks.length>0&&Se.isExpanded){let S=A?`${A}.${je}`:`${je}`;Y.push(...Te(Se.subtasks,ge+1,S));}}return Y},Ie=Te(e),De=48,_e=Math.max(Ie.length*a,600-De),ut=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,mt=ne=>{I(ne.id),Ce(ne.name),ze(true);},Ze=ne=>{X.trim()&&X!==e.find(ge=>ge.id===ne)?.name&&x?.(ne,X.trim()),I(null),Ce(""),ze(false);},et=()=>{I(null),Ce(""),ze(false);},It=(ne,ge)=>{ge.stopPropagation(),k?.(ne.id);},Tt=(ne,ge)=>{ge.preventDefault(),ue.current=ge.clientY,$e(ne),gt.current=false,tt(false),be({x:ge.clientX,y:ge.clientY});},bt=ne=>{if(!he||(Math.abs(ne.clientY-ue.current)>ot&&!gt.current&&(gt.current=true,tt(true)),be({x:ne.clientX,y:ne.clientY}),!gt.current))return;if(R?.current){let le=R.current,Se=le.getBoundingClientRect(),je=60,Ue=12;Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null);let S=ne.clientY-Se.top,Z=Se.bottom-ne.clientY;if(S<je&&le.scrollTop>0){let pe=Math.round(Ue*(1-S/je)),Ee=()=>{le.scrollTop-=pe,gt.current&&le.scrollTop>0&&(Qe.current=requestAnimationFrame(Ee));};Qe.current=requestAnimationFrame(Ee);}else if(Z<je&&le.scrollTop<le.scrollHeight-le.clientHeight){let pe=Math.round(Ue*(1-Z/je)),Ee=()=>{le.scrollTop+=pe,gt.current&&le.scrollTop<le.scrollHeight-le.clientHeight&&(Qe.current=requestAnimationFrame(Ee));};Qe.current=requestAnimationFrame(Ee);}}let A=document.querySelectorAll("[data-task-row]"),Y=null,q=null;A.forEach(le=>{let Se=le.getBoundingClientRect(),je=le.getAttribute("data-task-row");if(je&&je!==he&&ne.clientY>=Se.top&&ne.clientY<=Se.bottom){Y=je;let Ue=ne.clientY-Se.top,S=Se.height;Ue<S*.25?q="above":Ue>S*.75?q="below":q="child";}}),at(Y),rt(q);},yt=()=>{if(gt.current&&he&&Ne&&ee){if(ee==="child")T?.(he,Ne);else if(ee==="above"||ee==="below"){let ne=(q,le,Se=null)=>{for(let je of q){if(je.id===le)return Se;if(je.subtasks){let Ue=ne(je.subtasks,le,je.id);if(Ue!==void 0)return Ue}}},ge=ne(e,he,null),A=ne(e,Ne,null),Y=(q,le,Se,je)=>{let Ue=q.findIndex(pe=>pe.id===le),S=je?q.findIndex(pe=>pe.id===Se):-1,Z=ee==="below"?Ue+1:Ue;return je&&S!==-1&&S<Ue&&(Z-=1),Math.max(0,Z)};if(A===null){let le=Y(e,Ne,he,ge===null);T?.(he,null,le);}else {let q=Ie.find(le=>le.task.id===A)?.task;if(q?.subtasks){let le=ge===A,Se=Y(q.subtasks,Ne,he,le);T?.(he,A,Se);}}}}Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null),$e(null),at(null),rt(null),be(null),gt.current=false,tt(false);};react.useEffect(()=>{if(he)return document.addEventListener("mousemove",bt),document.addEventListener("mouseup",yt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",bt),document.removeEventListener("mouseup",yt),document.body.style.cursor="",document.body.style.userSelect="";}},[he,Ne,ee]);let dt=(ne,ge,A)=>{let Y=ge.subtasks&&ge.subtasks.length>0;switch(ne.id){case "name":let q=ce===ge.id,le=j===ge.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${A*20}px`},children:[T&&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:le?1:.3},onMouseDown:B=>Tt(ge.id,B),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ge.subtasks&&ge.subtasks.length>0?jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),u?.(ge.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ge.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"}),q?jsxRuntime.jsx("input",{ref:Xe,type:"text",value:X,onChange:B=>Ce(B.target.value),onKeyDown:B=>{B.key==="Enter"?Ze(ge.id):B.key==="Escape"&&et();},onBlur:()=>Ze(ge.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:B=>B.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:ge.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ge.parentId?"13px":"14px",fontWeight:ge.isMilestone?600:ge.parentId?400:600,letterSpacing:ge.parentId?"0":"-0.01em"},title:ge.name,children:[ge.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ge.wbsCode}),ge.isHighlighted&&ge.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ge.name}),ge.subtasks&&ge.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(ge.progress||0),"%"]}),$&&ge.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&ge.cpmData&&jsxRuntime.jsxs("span",{style:{color:ge.cpmData.totalFloat<=0?"#EF4444":ge.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ge.cpmData.totalFloat),"d"]})]}),le&&!q&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:B=>It(ge,B),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:B=>{B.stopPropagation(),mt(ge);},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 je=ne.id==="startDate"?"startDate":"endDate",Ue=ge[je],S=H?.taskId===ge.id&&H?.field===je,Z=B=>B?(typeof B=="string"?new Date(B):B).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:B=>B.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:Y?.5:1,cursor:Y?"default":"pointer"},title:Y?"Auto-calculated from subtasks":void 0,onClick:B=>{if(!Y)if(S)se(null);else {let V=B.currentTarget.getBoundingClientRect();se({taskId:ge.id,field:je,month:Ue?typeof Ue=="string"?new Date(Ue):Ue:new Date,position:{top:V.bottom+4,left:V.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Z(Ue)}),Y&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),S&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>se(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:H?.position.top,left:H?.position.left},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let B=new Date,V=new Date(B);V.setDate(B.getDate()+1);let ke=new Date(B);ke.setDate(B.getDate()+7);let F=new Date(B);return F.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:V},{label:"Pr\xF3xima semana",date:ke},{label:"2 semanas",date:F}].map((Re,Je)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:qt=>qt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:qt=>qt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ge.id,{[je]:Re.date}),se(null);},children:Re.label},Je))})(),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:B=>B.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ge.id,{[je]:void 0}),se(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:()=>se(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>se(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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((B,V)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:B},V))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let B=H?.month||new Date,V=B.getFullYear(),ke=B.getMonth(),F=new Date(V,ke,1).getDay(),ae=new Date(V,ke+1,0).getDate(),Re=new Date,Je=[];for(let Bt=F-1;Bt>=0;Bt--)Je.push({day:new Date(V,ke,-Bt).getDate(),date:new Date(V,ke-1,new Date(V,ke,-Bt).getDate()),isCurrentMonth:false});for(let Bt=1;Bt<=ae;Bt++)Je.push({day:Bt,date:new Date(V,ke,Bt),isCurrentMonth:true});let qt=42-Je.length;for(let Bt=1;Bt<=qt;Bt++)Je.push({day:Bt,date:new Date(V,ke+1,Bt),isCurrentMonth:false});return Je.map((Bt,Da)=>{let Ba=Bt.date.toDateString()===Re.toDateString(),fa=(Ue?typeof Ue=="string"?new Date(Ue):Ue:null)?.toDateString()===Bt.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:Bt.isCurrentMonth?fa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:fa?"#2E94FF":"transparent",boxShadow:Ba&&!fa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(ge.id,{[je]:Bt.date}),se(null);},children:Bt.day},Da)})})()})]})]})]}),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:ut(ge)})});case "assignees":if(Y)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=r.filter(B=>ge.assignees?.some(V=>V.name===B.name||V.initials===B.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx(Fo,{assignedUsers:pe,availableUsers:r,onChange:B=>{let V=B.map(ke=>({id:ke.id,name:ke.name,initials:ke.initials,color:ke.color}));g?.(ge.id,{assignees:V.length>0?V:void 0});}})});case "status":if(Y){let B=ge.progress===100?"\u2713":ge.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:B})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx(xu,{status:ge.status||"todo",onChange:B=>{g?.(ge.id,{status:B,progress:B==="completed"?100:ge.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:Y?.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:`${ge.progress}%`,backgroundColor:ge.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:[ge.progress,"%"]})]});case "priority":let Ee={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},qe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ke=Ee[ge.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx(So,{priority:Ke,onChange:B=>{B&&g?.(ge.id,{priority:qe[B]||"medium"});}})});default:return null}},Ft=ne=>[{id:"hide",label:"Hide Column",icon:Kt.Hide,onClick:()=>d(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Kt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Kt.SortDesc,onClick:()=>{}}],He=ne=>ne.subtasks&&ne.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{k?.(ne.id);}},{id:"duplicate",label:L?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{y?.([ne.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{D?D(ne.id,ne.name):f?.([ne.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{n?.(ne);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{k?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{g?.(ne.id,{status:"todo",progress:0});},disabled:ne.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{g?.(ne.id,{status:"in-progress"});},disabled:ne.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{g?.(ne.id,{status:"completed",progress:100});},disabled:ne.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:L?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{y?.([ne.id]);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{D?D(ne.id,ne.name):f?.([ne.id]);}}],Be=c.filter(ne=>ne.visible),ct=Be.reduce((ne,ge)=>ne+ge.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ct},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${De}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:Be.map((ne,ge)=>{let A=ge===Be.length-1,Y=ne.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Y?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(Y?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:A?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ae({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:ne.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:ne.label,children:ne.label}),ne.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:P===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),G(ne.id),Ve(q.clientX),re(ne.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},ne.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(ai,{columns:c,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>K(!N),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"})}),N&&jsxRuntime.jsxs("div",{ref:ie,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:ne=>ne.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:()=>K(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",style:{minHeight:_e},children:Ie.map(({task:ne,level:ge},A)=>{let Y=te(ne.id),q=Ne===ne.id,le=q&&ee==="above",Se=q&&ee==="below",je=q&&ee==="child",Ue={};return je&&(Ue.backgroundColor=`${t.accent}15`,Ue.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${he===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Y?t.accentLight:je?`${t.accent}15`:A%2===0?t.bgPrimary:t.bgGrid,opacity:$?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Ue},onMouseEnter:()=>E(ne.id),onMouseLeave:()=>E(null),onClick:S=>{let pe=bn(e).map(Ke=>Ke.id),qe=navigator.platform.toUpperCase().indexOf("MAC")>=0?S.metaKey:S.ctrlKey;W(ne.id,pe,qe,S.shiftKey),s?.(ne);},onDoubleClick:S=>{S.stopPropagation(),n?.(ne);},onContextMenu:S=>{S.preventDefault(),Ae({isOpen:true,x:S.clientX,y:S.clientY,type:"task",task:ne}),l?.(ne,S);},whileHover:{backgroundColor:Y?t.accentLight:t.hoverBg},children:[le&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((S,Z)=>{let pe=Z===Be.length-1,Ee=S.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ee?"justify-start":"justify-center"}`,style:{width:`${S.width}px`,minWidth:`${S.minWidth??(Ee?200:60)}px`,maxWidth:`${S.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:pe?"none":`1px solid ${j===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:dt(S,ne,Ee?ge:0)},`${ne.id}-${S.id}`)})]},ne.id)})}),jsxRuntime.jsx(fn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Ft(J.columnId):J.type==="task"&&J.task?He(J.task):[],onClose:()=>Ae({...J,isOpen:false}),theme:t}),ft&&Ct&&he&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ct.x+12,top:Ct.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=Ie.find(ge=>ge.task.id===he)?.task;return ne?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:ne.name})}):null})()}),document.body)]})}function Qp(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[u,i]=react.useState(t),[c,d]=react.useState(null),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(0),[x,k]=react.useState(0),[C,D]=react.useState(null),[T,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:b,setActiveZone:h,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:y,setDraggedSegmentStartX:w,segmentDragOffsetX:x,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ce,I)=>{r("none"),d(null),g(null),l(ce),i(I),k(0),f(null),w(0);}}}function li({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:b,onHoverChange:h,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:y=true,readOnly:w=false}){let x=Qp(t,r),k=react.useRef(null),C=react.useRef(false),D=react.useRef(null),T=react.useRef(null),{dragMode:R,setDragMode:$,dragOffset:L,setDragOffset:j,ghostX:E,setGhostX:ce,ghostWidth:I,setGhostWidth:X,connectionLine:Ce,setConnectionLine:Xe,hoveredTaskId:P,setHoveredTaskId:G,activeZone:fe,setActiveZone:Ve,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Ae,segmentDragOffsetX:he,setSegmentDragOffsetX:$e,hoveredSegmentIndex:Ne,setHoveredSegmentIndex:at,isHovered:ee,setIsHovered:rt,isDragging:ue,isResizing:ot,isConnecting:gt,resetDragState:Ct}=x,be=18,ft=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=ft?3:6,H=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let A=new Date;A.setHours(0,0,0,0);let Y=new Date(e.endDate);return Y.setHours(0,0,0,0),Y<A})()&&e.progress<100,N=y&&e.isCriticalPath,K=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,we={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=y&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&we[e.priority]?we[e.priority]:o.taskBarPrimary,ze=w?"default":ue?gt?"crosshair":ot?"ew-resize":"grabbing":"grab",Te=w?"default":"ew-resize",De=(A=>A>=80?20:A>=60?15:A>=50?12:10)(r),_e=r<50,ut=r<40;react.useEffect(()=>{h&&(!ee||ue||e.segments)&&h(null);},[ee,ue,e.segments,h]);let mt=A=>A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ze=()=>{let A=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${A} day${A!==1?"s":""}`},et=A=>Math.round(A/s)*s,It=A=>{let Y=Math.round(A/s),q=new Date(n);return q.setDate(q.getDate()+Y),q},Tt=(A,Y)=>{for(let q of g){if(q.id===e.id)continue;let le=5;if(A>=q.x-le&&A<=q.x+q.width+le&&Y>=q.y-le&&Y<=q.y+q.height+le)return q.id}return null},bt=react.useCallback((A,Y,q)=>{if(w)return;A.preventDefault(),A.stopPropagation();let le=k.current?.ownerSVGElement;if(!le)return;let Se=le.createSVGPoint();Se.x=A.clientX,Se.y=A.clientY;let je=Se.matrixTransform(le.getScreenCTM()?.inverse()),Ue=q!==void 0?q:t,S=Y;if(!S){let Z=je.x-Ue;A.shiftKey?(S="connect",Xe({x:t+r,y:a+be/2})):A.ctrlKey||A.metaKey?S="move":A.altKey?S=Z<r/2?"resize-start":"resize-end":ut?Z<r/2?S="move":S="resize-end":_e?Z<=De/2?S="resize-start":Z>=r-De/2?S="resize-end":S="move":Z<=De?S="resize-start":Z>=r-De?S="resize-end":S="move";}C.current=false,$(S),rt(false),Ve(null),S==="move"?j(je.x-Ue):S==="connect"?Xe({x:t+r,y:a+be/2}):j(0),ce(Ue),X(r);},[t,r,a,be,w]),yt=react.useCallback(A=>{let Y=k.current?.ownerSVGElement;if(!Y)return;let q=Y.closest(".gantt-timeline-scroll");if(!q)return;let le=q.getBoundingClientRect(),Se=60,je=15,Ue=0;if(A.clientX<le.left+Se){let S=le.left+Se-A.clientX;Ue=-Math.min(je,S/2);}else if(A.clientX>le.right-Se){let S=A.clientX-(le.right-Se);Ue=Math.min(je,S/2);}return Ue!==0&&(q.scrollLeft+=Ue),Ue!==0},[]),dt=react.useCallback(A=>{if(R==="none")return;C.current=true,T.current=A;let Y=k.current?.ownerSVGElement;if(!Y)return;if(R==="move"||R==="resize-start"||R==="resize-end"){let Se=yt(A);Se&&!D.current?D.current=window.setInterval(()=>{T.current&&(yt(T.current),dt(T.current));},16):!Se&&D.current&&(window.clearInterval(D.current),D.current=null);}let q=Y.createSVGPoint();q.x=A.clientX,q.y=A.clientY;let le=q.matrixTransform(Y.getScreenCTM()?.inverse());if(R==="connect"){Xe({x:le.x,y:le.y});let Se=Tt(le.x,le.y);G(Se);}else if(R==="move"){let Se=le.x-L,je=et(Se);ce(je),X(r);let Ue=Math.round((je-t)/s);if(b?.(e.id,Ue,true),e.segments&&e.segments.length>0&&z!==null){let S=je-J;$e(S);}}else if(R==="resize-start"){let Se=le.x,je=et(Se),Ue=t+r-je;Ue>=s&&(ce(je),X(Ue));}else if(R==="resize-end"){let Se=le.x,Ue=et(Se)-t;Ue>=s&&X(Ue);}},[R,t,r,s,L,e,et,z,J,Tt,G,Xe,ce,X,$e,b,yt]),Ft=react.useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,R!=="none"){if(R==="connect")P&&m&&m(e,P),Xe(null),G(null);else {let A=e.endDate.getTime()-e.startDate.getTime(),Y,q,le=true;if(R==="move"){if(Y=It(E),q=new Date(Y.getTime()+A),e.segments&&e.segments.length>0&&z!==null){let Se=Math.round(he/s),je=e.segments.map((pe,Ee)=>{if(Ee===z){let qe=new Date(pe.startDate),Ke=new Date(pe.endDate);return qe.setDate(qe.getDate()+Se),Ke.setDate(Ke.getDate()+Se),{startDate:qe,endDate:Ke}}return pe}),Ue=je.flatMap(pe=>[pe.startDate,pe.endDate]),S=new Date(Math.min(...Ue.map(pe=>pe.getTime()))),Z=new Date(Math.max(...Ue.map(pe=>pe.getTime())));d?.({...e,segments:je},S,Z),Ct(t,r);return}}else R==="resize-start"?(Y=It(E),q=e.endDate,Y>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),le=false)):R==="resize-end"?(Y=e.startDate,q=It(E+I),q.setDate(q.getDate()-1),q<Y&&(console.warn("Invalid date range: end date must be after or equal to start date"),le=false)):le=false;le&&Y&&q&&(q.getTime()<Y.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Y,q));}b?.(e.id,0,false),Ct(t,r);}},[R,E,I,e,d,P,m,t,r,s,It,he,z,Ct,b]);react.useEffect(()=>{if(R==="none")return;let A=q=>{dt(q);},Y=()=>{Ft();};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",Y),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",Y),D.current&&(window.clearInterval(D.current),D.current=null);}},[R,dt,Ft]);let He=ue&&!gt?E:t,Be=ue&&!gt?I:r,ct=l.taskClass(e),ne=24,ge=y?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:k,"data-task-bar":"true",style:{opacity:ge,transition:"opacity 300ms ease"},onClick:()=>{!ue&&!C.current&&u?.(e),C.current=false;},onDoubleClick:A=>{!ue&&!C.current&&(A.stopPropagation(),i?.(e));},onContextMenu:A=>{A.preventDefault(),c?.(e,A);},onMouseEnter:()=>!ue&&rt(true),onMouseMove:A=>{h&&ee&&!ue&&!e.segments&&h({task:e,x:t,y:a,width:r,height:be,showBelow:false,mouseX:A.clientX,mouseY:A.clientY});},onMouseLeave:()=>{ue||(rt(false),Ve(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+ne,height:be,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!ue&&!_e&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:be,fill:fe==="resize-start"?o.accent:"transparent",opacity:fe==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>Ve("resize-start"),onMouseDown:A=>bt(A,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:be,fill:fe==="move"?o.accent:"transparent",opacity:fe==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ve("move"),onMouseDown:A=>bt(A,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:be,fill:fe==="resize-end"?o.accent:"transparent",opacity:fe==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>Ve("resize-end"),onMouseDown:A=>bt(A,"resize-end")})]}),ee&&!ue&&ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:be,fill:fe==="move"?o.accent:"transparent",opacity:fe==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ve("move"),onMouseDown:A=>bt(A,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:be,fill:fe==="resize-end"?o.accent:"transparent",opacity:fe==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>Ve("resize-end"),onMouseDown:A=>bt(A,"resize-end")}),ee&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+be-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ue&&!gt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:a,width:I,height:be,rx:Qe,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!ue&&(()=>{let A=e.baselineStartDate.getTime(),Y=e.baselineEndDate.getTime(),q=n.getTime(),le=864e5,Se=(A-q)/le,je=(Y-A)/le,Ue=Se*s,S=Math.max(je*s,s),Z=He+Be,pe=Ue+S,Ee=e.endDate?.getTime()??0,qe=Math.ceil((Ee-Y)/le),Ke=qe>0,B=qe<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Ue,y:a,width:S,height:be,rx:Qe,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ke&&Z>pe&&jsxRuntime.jsx("rect",{x:pe,y:a,width:Z-pe,height:be,rx:0,fill:"#EF4444",opacity:.2}),Ke&&jsxRuntime.jsxs("text",{x:Math.max(Z,pe)+6,y:a+be/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",qe,"d"]}),B&&jsxRuntime.jsxs("text",{x:Z+6,y:a+be/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[qe,"d"]})]})})(),!e.segments&&ft&&H&&(()=>{let Y=a+(be-8)/2,q=4,le=e.progress||0,Se=new Date;Se.setHours(0,0,0,0);let je=e.startDate&&Se>=e.startDate,Ue=e.endDate&&(()=>{let Ke=new Date(e.endDate);return Ke.setHours(0,0,0,0),Se>Ke})(),S=e.startDate&&Se<e.startDate,Z=1;if(je&&e.startDate&&e.endDate&&!S){let Ke=new Date(e.startDate);Ke.setHours(0,0,0,0);let B=new Date(e.endDate);B.setHours(0,0,0,0);let V=Math.max(1,(B.getTime()-Ke.getTime())/(1e3*60*60*24)),F=Math.min((Se.getTime()-Ke.getTime())/(1e3*60*60*24),V)/V*100;Z=F>0?le/F:1;}let pe;le>=100?pe="#00E5CC":S?pe="#4B5563":Ue&&le<100?pe="#EF4444":Z>=.95?pe="#22C55E":Z>=.8?pe="#F59E0B":pe="#EF4444";let Ee=Math.max(le/100*Be,le>0?q*2:0),qe=Be>100&&le>0;return jsxRuntime.jsxs("g",{"data-task-class":ct,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:He,y:Y,width:Be,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),le>0&&jsxRuntime.jsx("rect",{x:He,y:Y,width:Ee,height:8,rx:q,fill:pe}),qe&&jsxRuntime.jsxs("text",{x:He+Ee+6,y:Y+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(le),"%"]})]})})(),!e.segments&&ft&&!H&&jsxRuntime.jsx(framerMotion.motion.rect,{x:He,y:a,width:Be,height:be,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!gt?.15:e.parentId?.6:1,scale:ee&&!ue?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>bt(A),style:{cursor:ze,pointerEvents:"all"}}),!e.segments&&!ft&&jsxRuntime.jsx(framerMotion.motion.rect,{x:He,y:a,width:Be,height:be,rx:Qe,fill:te,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!gt?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:A=>bt(A),style:{cursor:H?"default":ze,pointerEvents:"all"}}),ft&&(se||N)&&!e.segments&&jsxRuntime.jsx("rect",{x:He,y:a,width:Be,height:be,rx:Qe,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsxRuntime.jsx("rect",{x:He,y:a,width:Math.max(Be*(e.progress/100),Qe*2),height:be,rx:Qe,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let A=e.progress>0?Be*(e.progress/100):0,Y=He+A,q=Be-A,le=e.progress===0?Qe:0,Se=e.progress===0?He:Y,je=e.progress===0?Be:q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Se,y:a,width:je,height:be,rx:le,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Se,y:a,width:je,height:be,rx:le,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ft&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!ue&&(()=>{let A=He+Be*(e.progress/100),Y=8,q=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:A,cy:a+be/2,r:Y,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:A,y:a+be/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((A,Y)=>{let q=(A.startDate.getTime()-n.getTime())/864e5*s,Se=(A.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,je=ue&&R==="move"&&z===Y,Ue=Ne===Y,S=je?q+he:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ue&&at(Y),onMouseLeave:()=>!ue&&at(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:S,y:a,width:Se,height:be,rx:Qe,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:je||e.parentId?.6:Ue?.9:.8,scale:Ue&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>{Z.stopPropagation(),re(Y),Ae(q),bt(Z,void 0,q);},style:{cursor:ze,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:S,y:a,width:Se*(e.progress/100),height:be,rx:Qe,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Y}`)}),K&&(se||N)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[N&&!se&&jsxRuntime.jsx("rect",{x:He,y:a,width:Be,height:be,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsxRuntime.jsx("rect",{x:He,y:a,width:Be,height:be,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Be>60&&!e.segments&&!(ft&&H)&&(()=>{let A=l.taskLabel(e),Y=typeof A=="string"?A:e.name,q=Y.length>Math.floor(Be/8)?`${Y.substring(0,Math.floor(Be/8))}...`:Y;return jsxRuntime.jsx("text",{x:He+8,y:a+be/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:q})})(),!ue&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(ft?jsxRuntime.jsxs("text",{x:He+Be+6,y:a+be/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Be>100?jsxRuntime.jsxs("text",{x:He+Be-12,y:a+be/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&&Be>80&&!ue&&!e.segments&&!(ft&&H)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:He+Be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:He+Be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||ot)&&!gt&&!e.segments&&!H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:He-2,y:a,width:16,height:be,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>Ve("resize-start"),onMouseLeave:()=>Ve(null),onMouseDown:A=>{A.stopPropagation(),bt(A,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:He+4,y:a+8,width:3,height:be-16,rx:1.5,fill:fe==="resize-start"||R==="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:He+Be-14,y:a,width:16,height:be,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>Ve("resize-end"),onMouseLeave:()=>Ve(null),onMouseDown:A=>{A.stopPropagation(),bt(A,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:He+Be-7,y:a+8,width:3,height:be-16,rx:1.5,fill:fe==="resize-end"||R==="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:ee&&!ue&&!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+r+10,cy:a+be/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ve("connect"),onMouseLeave:()=>Ve(null),onMouseDown:A=>{A.stopPropagation(),bt(A,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+be/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:fe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),gt&&Ce&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+be/2,x2:Ce.x,y2:Ce.y,stroke:P?o.statusCompleted:o.accent,strokeWidth:P?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:P?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Ce.x,cy:Ce.y,r:P?8:6,fill:P?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),P&&jsxRuntime.jsx(framerMotion.motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||ue)&&!gt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:He-1,y:a-1,width:Be+2,height:be+2,rx:Qe+1,fill:"none",stroke:ue?o.accent:ft?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:ft?1:2,opacity:ue||ft?.6:.4,initial:{opacity:0},animate:{opacity:ue||ft?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ot&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:E+I,y1:0,x2:E+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&!ue&&!e.segments&&!h&&(()=>{let q=a<100,le=q?a+be+13:a-82-13,Se=q?`M ${He+Be/2-6} ${a+be+3} L ${He+Be/2} ${a+be+13} L ${He+Be/2+6} ${a+be+3}`:`M ${He+Be/2-6} ${a-13} L ${He+Be/2} ${a-3} L ${He+Be/2+6} ${a-13}`,je=le+22,Ue=le+40,S=le+55,Z=le+70,pe=q?le+82-5:a-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:Se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:He+Be/2-120,y:le,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:He+Be/2,y:je,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:He+Be/2-110,y:Ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:He+Be/2-70,y:Ue,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsxRuntime.jsx("text",{x:He+Be/2-110,y:S,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:He+Be/2-70,y:S,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsxRuntime.jsx("text",{x:He+Be/2+10,y:Ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:He+Be/2+65,y:Ue,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ze()}),jsxRuntime.jsx("text",{x:He+Be/2+10,y:S,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:He+Be/2+65,y:S,fill:o.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:He+Be/2-110,y:Z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:He+Be/2-50,y:Z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ee=>Ee.name).join(", ").substring(0,30),e.assignees.map(Ee=>Ee.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:He+Be/2,y:pe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ut?"Left: move \u2022 Right: resize":_e?"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 fd=260,hn=8,tm=16,gv=-12;function am({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:y,mouseX:w,mouseY:x}=e,C=y.effortMinutes!=null||y.timeLoggedMinutes!=null||y.soldEffortMinutes!=null?155:105,D=w+tm,T=x+gv-C;D+fd>window.innerWidth-hn&&(D=w-fd-tm),D<hn&&(D=hn);let R=T<hn;R&&(T=x+20),T+C>window.innerHeight-hn&&(T=window.innerHeight-hn-C),o({left:D,top:T,showBelow:R});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},u=y=>y.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let y=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${y} d\xEDa${y!==1?"s":""}`:`${y} day${y!==1?"s":""}`},c=y=>{if(y==null||y===0)return "N/A";let w=Math.floor(y/60),x=y%60;return w===0?`${x}m`:x===0?`${w}h`:`${w}h ${x}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",h=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:fd,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 ${v}`,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:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(di,{label:l.start,value:s.startDate?u(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(di,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsxRuntime.jsx(di,{label:l.end,value:s.endDate?u(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(di,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(y=>y.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:c(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:b,fontWeight:600},children:c(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:c(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Xl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"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"})})]}),r&&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(c).map(([i,u])=>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:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.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:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.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 Ql({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[u,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let h=o?.current||void 0,v=await Xc(e,c,h);Jc(v,c);},b=async h=>{let v=h.target.files?.[0];if(v){try{let f=await eu(v),y=v.name.endsWith(".json")?"json":"csv",w=Zc(f,y);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:p("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:a}),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:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="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(h=>jsxRuntime.jsxs("button",{onClick:()=>i(h),className:p("p-4 rounded-lg border-2 transition-all text-center",c===h?"border-blue-500 bg-blue-500/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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&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:m,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[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"})]})]}),u&&jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((h,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},v))})]})]})]})]})]})}var Hy=["URGENT","HIGH","MEDIUM","LOW"],zy=[{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"}],Uy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Zl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:b}){let[h,v]=react.useState(true),f=react.useCallback(k=>{a({search:k.target.value});},[a]),y=react.useCallback(k=>{a({dateFilter:k.target.value});},[a]),w=react.useCallback(k=>{r({by:k.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${h?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:k=>{k.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:h?"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)"]})]}),!h&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&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"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,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:f,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:k=>{let D=k.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Hy.map(k=>jsxRuntime.jsx("option",{value:k,children:k},k))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:k=>{let D=k.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(k=>jsxRuntime.jsx("option",{value:k.id,children:k.name},k.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:k=>{let D=k.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(k=>jsxRuntime.jsx("option",{value:k,children:k},k))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:zy.map(k=>jsxRuntime.jsx("option",{value:k.value,children:k.label},k.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:k=>b(k.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Uy.map(k=>jsxRuntime.jsx("option",{value:k.value,children:k.label},k.value))})}),C&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ed({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxRuntime.jsxs("div",{className:p("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[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:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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 td={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ad={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},rd={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"}},Ro={dark:td,light:ad,neutral:rd},Js="dark";var Qs=react.createContext(void 0),Jy="asakaa-theme";function Ep({children:e,defaultTheme:t=Js,storageKey:a=Jy}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Ro[r];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${Qy(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let m=c.colors[u];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Ro};return jsxRuntime.jsx(Qs.Provider,{value:n,children:e})}function un(){let e=react.useContext(Qs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Qy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function od({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=un();return e?jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",a),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(Ro).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:p("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.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"]})]}),r===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}function Fp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return it[e]||it.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",it[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",it[e].bgSecondary),bgGrid:r("--theme-bg-card",it[e].bgGrid),bgWeekend:r("--theme-bg-hover",it[e].bgWeekend),border:r("--theme-border-primary",it[e].border),borderLight:r("--theme-border-subtle",it[e].borderLight),textPrimary:r("--theme-text-primary",it[e].textPrimary),textSecondary:r("--theme-text-secondary",it[e].textSecondary),textTertiary:r("--theme-text-tertiary",it[e].textTertiary),accent:r("--theme-accent-primary",it[e].accent),accentHover:r("--theme-accent-hover",it[e].accentHover),accentLight:r("--theme-accent-primary",it[e].accentLight),taskBarPrimary:r("--theme-accent-primary",it[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",it[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",it[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",it[e].dependency),dependencyHover:r("--theme-border-secondary",it[e].dependencyHover),criticalPath:r("--theme-error",it[e].criticalPath),criticalPathLight:r("--theme-error",it[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",it[e].today):e==="neutral"?r("--theme-text-primary",it[e].today):r("--theme-error",it[e].today),todayLight:e==="light"?r("--theme-accent-primary",it[e].todayLight):e==="neutral"?r("--theme-text-primary",it[e].todayLight):r("--theme-error",it[e].todayLight),milestone:r("--theme-warning",it[e].milestone),milestoneLight:r("--theme-warning",it[e].milestoneLight),statusTodo:r("--theme-text-tertiary",it[e].statusTodo),statusInProgress:r("--theme-accent-primary",it[e].statusInProgress),statusCompleted:r("--theme-success",it[e].statusCompleted),hoverBg:r("--theme-bg-hover",it[e].hoverBg),focusRing:r("--theme-accent-primary",it[e].focusRing),...it[e].dotGrid&&{dotGrid:it[e].dotGrid},...it[e].glassHeader&&{glassHeader:it[e].glassHeader},...it[e].glassToolbar&&{glassToolbar:it[e].glassToolbar},...it[e].forecastHud&&{forecastHud:it[e].forecastHud},...it[e].neonRedGlow&&{neonRedGlow:it[e].neonRedGlow},...it[e].executionBarBg&&{executionBarBg:it[e].executionBarBg}}}var Zs={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"}},Mp={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"}},nd={en:Zs,es:Mp};function Pp(e){return nd[e]||nd.en}function sd(e,t){let a=Pp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var mn=react.createContext(Zs);function Er(){return react.useContext(mn)}function ai(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function Lp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[c,i]=react.useState(null),[u,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),b=Er(),h=ai(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=b.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let C=k=>{let D=k.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&l(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);let y=[{id:"png",label:b.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:b.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:b.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:b.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(C=>C.handler),w=async(C,k)=>{if(k){i(C);try{await k();}catch(D){console.error(`Export ${C} failed:`,D);}finally{i(null),l(false);}}},x=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:h.top,left:h.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((C,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[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:c===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:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?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:u?b.toolbar.copied:b.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Tx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Nx({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Ip({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=Er(),i=ai(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let b=g.target;n.current&&!n.current.contains(b)&&l.current&&!l.current.contains(b)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[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:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(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-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:u.map((m,g)=>{let b=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:b?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:b?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:b?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:b?600:500},children:m.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Bp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=Er(),u=ai(l,s,"left");react.useEffect(()=>{if(!s)return;let b=setTimeout(()=>{let h=f=>{let y=f.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(b),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon: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-blue-500"},{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"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:b=>{b.stopPropagation(),n(h=>!h);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"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:g?"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:d.map(b=>{let h=t===b.value&&!r,v=()=>b.value==="all"?h?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(b.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:h?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${h?b.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:b.label}),h&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},b.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Dx({value:e,onChange:t,theme:a}){let r=Er(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Sx({theme:e,forecast:t}){let a=Er(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",b=t?.budgetVariancePercent,h=b!=null&&b!==0,v=b!=null?b>0?`+${b.toFixed(0)}% ${a.toolbar.budgetOver}`:`${b.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[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:a.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:[a.toolbar.expectedFinish,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),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:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"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:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),h&&v&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function Ex({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:d=true}){let[m,g]=react.useState(false),b=react.useRef(null),h=react.useRef(null),v=Er(),f=ai(b,m,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let k=D=>{let T=D.target;b.current&&!b.current.contains(T)&&h.current&&!h.current.contains(T)&&g(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]);let w=v.toolbar.visibility==="Visibilidad",x=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],C=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:b,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:v.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:h,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor: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:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:x.map((k,D)=>{let T=k.icon,B=k.disabled,$=k.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!B&&k.onChange?.(!k.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:B?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:B?"not-allowed":"pointer"},whileHover:B?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},title:$,children:[jsxRuntime.jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:B?y?"rgba(255,255,255,0.2)":"#D1D5DB":k.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label}),k.active&&!B&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.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:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((k,D)=>{let T=i===k.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(k.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:(x.length+D)*.03},children:[jsxRuntime.jsx("span",{style:{color:T?e.accent||"#2E94FF":y?"rgba(255,255,255,0.85)":e.textPrimary},children:k.label}),T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.value)})]})]})}),document.body)]})}function ri({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:h=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:y,onWbsLevelChange:w,maxWbsDepth:x=4,viewMode:C="execution",onViewModeChange:k,projectForecast:D,onExportPNG:T,onExportPDF:B,onExportExcel:$,onExportCSV:A,onExportJSON:_,onExportMSProject:E,showCriticalPath:ue=true,onShowCriticalPathChange:L,showDependencies:X=true,onShowDependenciesChange:ee,highlightWeekends:$e=true,onHighlightWeekendsChange:R,showBaseline:Y=false,onShowBaselineChange:be,onCopySnapshotLink:_e,hasDependencies:z=true}){let oe=Er(),J=T||B||$||A||_||E,Ae=!!e.glassToolbar,[xe,He]=react.useState(false),Ne=react.useRef(null);react.useEffect(()=>{xe&&Ne.current&&Ne.current.focus();},[xe]);let at=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],te=[{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"})}],rt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ae){let pe=rt?"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.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:rt?"#1A1A1A":e.bgSecondary,border:`1px solid ${rt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:xe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>He(!xe),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),xe&&jsxRuntime.jsx("input",{ref:Ne,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>He(false),onKeyDown:ot=>{ot.key==="Escape"&&He(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),k&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:rt?"#000000":e.bgSecondary,border:`1px solid ${rt?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>k("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?rt?"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:()=>k("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?rt?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:C==="oracle"?"#2E94FF":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(Dx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),w&&jsxRuntime.jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsxRuntime.jsx(Ex,{theme:e,showCriticalPath:ue,onShowCriticalPathChange:L,showBaseline:Y,onShowBaselineChange:be,highlightWeekends:$e,onHighlightWeekendsChange:R,showDependencies:X,onShowDependenciesChange:ee,rowDensity:l,onRowDensityChange:c,hasDependencies:z}),jsxRuntime.jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:B,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:_e}),u&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${rt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${rt?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]})]})]}),D&&jsxRuntime.jsx(Sx,{theme:e,forecast:D})]})}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(Nx,{options:at,value:t,onChange:pe=>a(pe),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:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children: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(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]}),(J||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:B,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:_e}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Tx,{options:te,value:s,onChange:pe=>n(pe),theme:e})]})]})}function oi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ot,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function bn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,m=8,g=window.innerWidth,b=window.innerHeight,h=t,v=a;t+u+m>g&&(h=t-u,h<m&&(h=m)),a+d+m>b&&(v=b-d-m,v<m&&(v=m)),c({x:h,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Kt={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 Gp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),b=react.useCallback(w=>{g.current=w;},[]),h=react.useCallback(w=>{let x=[],C=k=>{for(let D of k)x.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&C(D.subtasks);};return C(w),x},[]),v=react.useCallback(()=>{let w=h(e);for(let x of w)if(t.has(x.id))return x;return null},[e,t,h]),f=react.useCallback((w,x)=>{let C=h(e);if(C.length===0)return;let k=v();if(!k){a(C[0].id,false);return}let D=C.findIndex($=>$.id===k.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=C.length)return;let B=C[T];a(B.id,x);},[e,v,h,a]),y=react.useCallback(w=>{if(!m)return;let x=w.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||g.current){w.key==="Escape"&&(x.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),B=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(B&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!B.isExpanded||w.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),l(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){B&&(w.preventDefault(),r(B.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){B&&(w.preventDefault(),r(B.id,"above"));return}if(w.key==="Enter"&&D){B&&(w.preventDefault(),d(B.id));return}if(w.key==="F2"){B&&(w.preventDefault(),i(B.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,l,c,i,u,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[m,y]),{setIsEditing:b}}function _p(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),b=m.indexOf(d);if(g===-1||b===-1){o(d);return}let h=Math.min(g,b),v=Math.max(g,b),f=m.slice(h,v+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,b)=>{b?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function dd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?dd(t.subtasks):t.subtasks}))}function hn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ni(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ni(a.subtasks,t);if(r)return r}}return null}function ld(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ld(a.subtasks,t);if(r)return r}return null}function cd(e,t){if(t.length===0)return e;let a=hn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let b=[];return {tasks:m.filter(v=>{if(g.has(v.id))return b.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,b.push(...f.removed);}return true}),removed:b}},l=(m,g,b)=>m.map(h=>h.id===g?{...h,subtasks:[...h.subtasks||[],...b],isExpanded:true}:h.subtasks?{...h,subtasks:l(h.subtasks,g,b)}:h),c=new Set(t),{tasks:i,removed:u}=n(e,c),d=l(i,s.id,u);return dd(d)}function ud(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ld(a,r);if(!o)continue;let s=ld(a,o.id),n=(i,u,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let b=g.subtasks.findIndex(h=>h.id===d);if(b!==-1){let[h]=g.subtasks.splice(b,1);return h}}if(g.subtasks){let b=n(g.subtasks,u,d);if(b)return b}}return null},l=(i,u,d)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,u,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return dd(a)}function pd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function md(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function qn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,d)=>({...u,id:`${u.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let b=n(g.subtasks);if(b)return b}return null}let u=c[i],d=`${u.id}-copy-${Date.now()}`,m={...u,id:d,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,d):void 0};return c.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function jp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return l(r),{tasks:r,newTask:n}}function gd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:gd(r.subtasks,t,a)}:r)}function fd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:fd(a.subtasks,t)}:a)}function bd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let b=a(g.subtasks);if(b)return b}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let b=c(g.subtasks);if(b>=0)return b}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let b=g.subtasks||[];return {...g,subtasks:[...b,u],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:u}}function Kp(e,t,a,r){if(t===a)return e;let o=ni(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,d)=>{let m=i?{...u,position:d}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,m=[...u];m.splice(d,0,{...o,parentId:a});let g=m.map((b,h)=>({...b,position:h}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ii({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:y,onTaskCreate:w,onTaskRename:x,onCreateSubtask:C,onOpenTaskModal:k,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:B,showCriticalPath:$=false}){let A=react.useContext(mn),[_,E]=react.useState(null),[ue,L]=react.useState(null),[X,ee]=react.useState(""),$e=react.useRef(null),[R,Y]=react.useState(null),[be,_e]=react.useState(0),[z,oe]=react.useState(0),[J,Ae]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[xe,He]=react.useState(null),[Ne,at]=react.useState(null),[te,rt]=react.useState(null),pe=react.useRef(0),ot=5,gt=react.useRef(false),[Ct,ye]=react.useState(null),[ft,tt]=react.useState(false),Qe=react.useRef(null),[H,ie]=react.useState(null),[N,j]=react.useState(false),le=react.useRef(null);react.useEffect(()=>{function se(fe){le.current&&!le.current.contains(fe.target)&&j(false);}if(N)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[N]),react.useEffect(()=>{ue&&$e.current&&($e.current.focus(),$e.current.select());},[ue]),react.useEffect(()=>{if(!R)return;let se=P=>{let K=P.clientX-be,q=z+K;m?.(R,q);},fe=()=>{Y(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[R,be,z,m]);let{selectedTaskIds:Ce,handleTaskClick:W,isTaskSelected:ae}=_p(),{setIsEditing:Ue}=Gp({tasks:e,selectedTaskIds:Ce,onTaskSelect:(se,fe)=>{let K=hn(e).map(q=>q.id);W(se,K,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:se=>{let fe=hn(e).find(P=>P.id===se);fe&&mt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:se=>{let fe=hn(e).find(P=>P.id===se);fe&&k&&k(fe);},enableKeyboard:true}),Te=(se,fe=0,P="")=>{let K=[],q=[...se].sort((de,Se)=>(de.position??0)-(Se.position??0));for(let de=0;de<q.length;de++){let Se=q[de],Ke=de+1,We=P?`${P}.${Ke}`:`${Ke}.0`;if(Se.wbsCode=We,K.push({task:Se,level:fe}),Se.subtasks&&Se.subtasks.length>0&&Se.isExpanded){let S=P?`${P}.${Ke}`:`${Ke}`;K.push(...Te(Se.subtasks,fe+1,S));}}return K},Be=Te(e),De=48,je=Math.max(Be.length*a,600-De),ut=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,mt=se=>{L(se.id),ee(se.name),Ue(true);},Ze=se=>{X.trim()&&X!==e.find(fe=>fe.id===se)?.name&&x?.(se,X.trim()),L(null),ee(""),Ue(false);},et=()=>{L(null),ee(""),Ue(false);},It=(se,fe)=>{fe.stopPropagation(),C?.(se.id);},Tt=(se,fe)=>{fe.preventDefault(),pe.current=fe.clientY,He(se),gt.current=false,tt(false),ye({x:fe.clientX,y:fe.clientY});},bt=se=>{if(!xe||(Math.abs(se.clientY-pe.current)>ot&&!gt.current&&(gt.current=true,tt(true)),ye({x:se.clientX,y:se.clientY}),!gt.current))return;if(B?.current){let de=B.current,Se=de.getBoundingClientRect(),Ke=60,We=12;Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null);let S=se.clientY-Se.top,Z=Se.bottom-se.clientY;if(S<Ke&&de.scrollTop>0){let me=Math.round(We*(1-S/Ke)),Ee=()=>{de.scrollTop-=me,gt.current&&de.scrollTop>0&&(Qe.current=requestAnimationFrame(Ee));};Qe.current=requestAnimationFrame(Ee);}else if(Z<Ke&&de.scrollTop<de.scrollHeight-de.clientHeight){let me=Math.round(We*(1-Z/Ke)),Ee=()=>{de.scrollTop+=me,gt.current&&de.scrollTop<de.scrollHeight-de.clientHeight&&(Qe.current=requestAnimationFrame(Ee));};Qe.current=requestAnimationFrame(Ee);}}let P=document.querySelectorAll("[data-task-row]"),K=null,q=null;P.forEach(de=>{let Se=de.getBoundingClientRect(),Ke=de.getAttribute("data-task-row");if(Ke&&Ke!==xe&&se.clientY>=Se.top&&se.clientY<=Se.bottom){K=Ke;let We=se.clientY-Se.top,S=Se.height;We<S*.25?q="above":We>S*.75?q="below":q="child";}}),at(K),rt(q);},yt=()=>{if(gt.current&&xe&&Ne&&te){if(te==="child")T?.(xe,Ne);else if(te==="above"||te==="below"){let se=(q,de,Se=null)=>{for(let Ke of q){if(Ke.id===de)return Se;if(Ke.subtasks){let We=se(Ke.subtasks,de,Ke.id);if(We!==void 0)return We}}},fe=se(e,xe,null),P=se(e,Ne,null),K=(q,de,Se,Ke)=>{let We=q.findIndex(me=>me.id===de),S=Ke?q.findIndex(me=>me.id===Se):-1,Z=te==="below"?We+1:We;return Ke&&S!==-1&&S<We&&(Z-=1),Math.max(0,Z)};if(P===null){let de=K(e,Ne,xe,fe===null);T?.(xe,null,de);}else {let q=Be.find(de=>de.task.id===P)?.task;if(q?.subtasks){let de=fe===P,Se=K(q.subtasks,Ne,xe,de);T?.(xe,P,Se);}}}}Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null),He(null),at(null),rt(null),ye(null),gt.current=false,tt(false);};react.useEffect(()=>{if(xe)return document.addEventListener("mousemove",bt),document.addEventListener("mouseup",yt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",bt),document.removeEventListener("mouseup",yt),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,Ne,te]);let dt=(se,fe,P)=>{let K=fe.subtasks&&fe.subtasks.length>0;switch(se.id){case "name":let q=ue===fe.id,de=_===fe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${P*20}px`},children:[T&&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:de?1:.3},onMouseDown:I=>Tt(fe.id,I),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),q?jsxRuntime.jsx("input",{ref:$e,type:"text",value:X,onChange:I=>ee(I.target.value),onKeyDown:I=>{I.key==="Enter"?Ze(fe.id):I.key==="Escape"&&et();},onBlur:()=>Ze(fe.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:I=>I.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.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(fe.progress||0),"%"]}),$&&fe.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&fe.cpmData&&jsxRuntime.jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),de&&!q&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>It(fe,I),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:I=>{I.stopPropagation(),mt(fe);},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 Ke=se.id==="startDate"?"startDate":"endDate",We=fe[Ke],S=H?.taskId===fe.id&&H?.field===Ke,Z=I=>I?(typeof I=="string"?new Date(I):I).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:I=>I.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:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!K)if(S)ie(null);else {let G=I.currentTarget.getBoundingClientRect();ie({taskId:fe.id,field:Ke,month:We?typeof We=="string"?new Date(We):We:new Date,position:{top:G.bottom+4,left:G.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Z(We)}),K&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),S&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ie(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:H?.position.top,left:H?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,G=new Date(I);G.setDate(I.getDate()+1);let he=new Date(I);he.setDate(I.getDate()+7);let F=new Date(I);return F.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:G},{label:"Pr\xF3xima semana",date:he},{label:"2 semanas",date:F}].map((Le,qe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:qt=>qt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:qt=>qt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Ke]:Le.date}),ie(null);},children:Le.label},qe))})(),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:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Ke]:void 0}),ie(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:()=>ie(I=>I?{...I,month:new Date(I.month.getFullYear(),I.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ie(I=>I?{...I,month:new Date(I.month.getFullYear(),I.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((I,G)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=H?.month||new Date,G=I.getFullYear(),he=I.getMonth(),F=new Date(G,he,1).getDay(),re=new Date(G,he+1,0).getDate(),Le=new Date,qe=[];for(let Bt=F-1;Bt>=0;Bt--)qe.push({day:new Date(G,he,-Bt).getDate(),date:new Date(G,he-1,new Date(G,he,-Bt).getDate()),isCurrentMonth:false});for(let Bt=1;Bt<=re;Bt++)qe.push({day:Bt,date:new Date(G,he,Bt),isCurrentMonth:true});let qt=42-qe.length;for(let Bt=1;Bt<=qt;Bt++)qe.push({day:Bt,date:new Date(G,he+1,Bt),isCurrentMonth:false});return qe.map((Bt,Da)=>{let Ba=Bt.date.toDateString()===Le.toDateString(),ga=(We?typeof We=="string"?new Date(We):We:null)?.toDateString()===Bt.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:Bt.isCurrentMonth?ga?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ga?"#2E94FF":"transparent",boxShadow:Ba&&!ga?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Ke]:Bt.date}),ie(null);},children:Bt.day},Da)})})()})]})]})]}),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:ut(fe)})});case "assignees":if(K)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 me=r.filter(I=>fe.assignees?.some(G=>G.name===I.name||G.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Mo,{assignedUsers:me,availableUsers:r,onChange:I=>{let G=I.map(he=>({id:he.id,name:he.name,initials:he.initials,color:he.color}));g?.(fe.id,{assignees:G.length>0?G:void 0});}})});case "status":if(K){let I=fe.progress===100?"\u2713":fe.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:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(xu,{status:fe.status||"todo",onChange:I=>{g?.(fe.id,{status:I,progress:I==="completed"?100:fe.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.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:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let Ee={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Je={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ye=Ee[fe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Eo,{priority:Ye,onChange:I=>{I&&g?.(fe.id,{priority:Je[I]||"medium"});}})});default:return null}},Ft=se=>[{id:"hide",label:"Hide Column",icon:Kt.Hide,onClick:()=>d(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Kt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Kt.SortDesc,onClick:()=>{}}],ze=se=>se.subtasks&&se.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{C?.(se.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{y?.([se.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{D?D(se.id,se.name):f?.([se.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{n?.(se);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{C?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{g?.(se.id,{status:"todo",progress:0});},disabled:se.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{g?.(se.id,{status:"in-progress"});},disabled:se.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{g?.(se.id,{status:"completed",progress:100});},disabled:se.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{y?.([se.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{D?D(se.id,se.name):f?.([se.id]);}}],Re=u.filter(se=>se.visible),ct=Re.reduce((se,fe)=>se+fe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ct},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${De}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:Re.map((se,fe)=>{let P=fe===Re.length-1,K=se.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(K?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:P?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ae({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:se.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:"8px",marginRight:"-4px",backgroundColor:R===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),Y(se.id),_e(q.clientX),oe(se.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},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(oi,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>j(!N),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"})}),N&&jsxRuntime.jsxs("div",{ref:le,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:()=>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",style:{minHeight:je},children:Be.map(({task:se,level:fe},P)=>{let K=ae(se.id),q=Ne===se.id,de=q&&te==="above",Se=q&&te==="below",Ke=q&&te==="child",We={};return Ke&&(We.backgroundColor=`${t.accent}15`,We.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 ${xe===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Ke?`${t.accent}15`:P%2===0?t.bgPrimary:t.bgGrid,opacity:$?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...We},onMouseEnter:()=>E(se.id),onMouseLeave:()=>E(null),onClick:S=>{let me=hn(e).map(Ye=>Ye.id),Je=navigator.platform.toUpperCase().indexOf("MAC")>=0?S.metaKey:S.ctrlKey;W(se.id,me,Je,S.shiftKey),s?.(se);},onDoubleClick:S=>{S.stopPropagation(),n?.(se);},onContextMenu:S=>{S.preventDefault(),Ae({isOpen:true,x:S.clientX,y:S.clientY,type:"task",task:se}),l?.(se,S);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[de&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((S,Z)=>{let me=Z===Re.length-1,Ee=S.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ee?"justify-start":"justify-center"}`,style:{width:`${S.width}px`,minWidth:`${S.minWidth??(Ee?200:60)}px`,maxWidth:`${S.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:me?"none":`1px solid ${_===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:dt(S,se,Ee?fe:0)},`${se.id}-${S.id}`)})]},se.id)})}),jsxRuntime.jsx(bn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Ft(J.columnId):J.type==="task"&&J.task?ze(J.task):[],onClose:()=>Ae({...J,isOpen:false}),theme:t}),ft&&Ct&&xe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ct.x+12,top:Ct.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Be.find(fe=>fe.task.id===xe)?.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 Qp(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[u,d]=react.useState(null),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(0),[x,C]=react.useState(0),[k,D]=react.useState(null),[T,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:b,setActiveZone:h,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:y,setDraggedSegmentStartX:w,segmentDragOffsetX:x,setSegmentDragOffsetX:C,hoveredSegmentIndex:k,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ue,L)=>{r("none"),d(null),g(null),l(ue),i(L),C(0),f(null),w(0);}}}function ci({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:b,onHoverChange:h,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:y=true,readOnly:w=false}){let x=Qp(t,r),C=react.useRef(null),k=react.useRef(false),D=react.useRef(null),T=react.useRef(null),{dragMode:B,setDragMode:$,dragOffset:A,setDragOffset:_,ghostX:E,setGhostX:ue,ghostWidth:L,setGhostWidth:X,connectionLine:ee,setConnectionLine:$e,hoveredTaskId:R,setHoveredTaskId:Y,activeZone:be,setActiveZone:_e,draggedSegmentIndex:z,setDraggedSegmentIndex:oe,draggedSegmentStartX:J,setDraggedSegmentStartX:Ae,segmentDragOffsetX:xe,setSegmentDragOffsetX:He,hoveredSegmentIndex:Ne,setHoveredSegmentIndex:at,isHovered:te,setIsHovered:rt,isDragging:pe,isResizing:ot,isConnecting:gt,resetDragState:Ct}=x,ye=18,ft=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=ft?3:6,H=e.subtasks&&e.subtasks.length>0,ie=e.endDate&&(()=>{let P=new Date;P.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<P})()&&e.progress<100,N=y&&e.isCriticalPath,j=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,Ce={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ae=y&&e.isCriticalPath||ie?"#EF4444":e.color?e.color:e.priority&&Ce[e.priority]?Ce[e.priority]:o.taskBarPrimary,Ue=w?"default":pe?gt?"crosshair":ot?"ew-resize":"grabbing":"grab",Te=w?"default":"ew-resize",De=(P=>P>=80?20:P>=60?15:P>=50?12:10)(r),je=r<50,ut=r<40;react.useEffect(()=>{h&&(!te||pe||e.segments)&&h(null);},[te,pe,e.segments,h]);let mt=P=>P.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ze=()=>{let P=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${P} day${P!==1?"s":""}`},et=P=>Math.round(P/s)*s,It=P=>{let K=Math.round(P/s),q=new Date(n);return q.setDate(q.getDate()+K),q},Tt=(P,K)=>{for(let q of g){if(q.id===e.id)continue;let de=5;if(P>=q.x-de&&P<=q.x+q.width+de&&K>=q.y-de&&K<=q.y+q.height+de)return q.id}return null},bt=react.useCallback((P,K,q)=>{if(w)return;P.preventDefault(),P.stopPropagation();let de=C.current?.ownerSVGElement;if(!de)return;let Se=de.createSVGPoint();Se.x=P.clientX,Se.y=P.clientY;let Ke=Se.matrixTransform(de.getScreenCTM()?.inverse()),We=q!==void 0?q:t,S=K;if(!S){let Z=Ke.x-We;P.shiftKey?(S="connect",$e({x:t+r,y:a+ye/2})):P.ctrlKey||P.metaKey?S="move":P.altKey?S=Z<r/2?"resize-start":"resize-end":ut?Z<r/2?S="move":S="resize-end":je?Z<=De/2?S="resize-start":Z>=r-De/2?S="resize-end":S="move":Z<=De?S="resize-start":Z>=r-De?S="resize-end":S="move";}k.current=false,$(S),rt(false),_e(null),S==="move"?_(Ke.x-We):S==="connect"?$e({x:t+r,y:a+ye/2}):_(0),ue(We),X(r);},[t,r,a,ye,w]),yt=react.useCallback(P=>{let K=C.current?.ownerSVGElement;if(!K)return;let q=K.closest(".gantt-timeline-scroll");if(!q)return;let de=q.getBoundingClientRect(),Se=60,Ke=15,We=0;if(P.clientX<de.left+Se){let S=de.left+Se-P.clientX;We=-Math.min(Ke,S/2);}else if(P.clientX>de.right-Se){let S=P.clientX-(de.right-Se);We=Math.min(Ke,S/2);}return We!==0&&(q.scrollLeft+=We),We!==0},[]),dt=react.useCallback(P=>{if(B==="none")return;k.current=true,T.current=P;let K=C.current?.ownerSVGElement;if(!K)return;if(B==="move"||B==="resize-start"||B==="resize-end"){let Se=yt(P);Se&&!D.current?D.current=window.setInterval(()=>{T.current&&(yt(T.current),dt(T.current));},16):!Se&&D.current&&(window.clearInterval(D.current),D.current=null);}let q=K.createSVGPoint();q.x=P.clientX,q.y=P.clientY;let de=q.matrixTransform(K.getScreenCTM()?.inverse());if(B==="connect"){$e({x:de.x,y:de.y});let Se=Tt(de.x,de.y);Y(Se);}else if(B==="move"){let Se=de.x-A,Ke=et(Se);ue(Ke),X(r);let We=Math.round((Ke-t)/s);if(b?.(e.id,We,true),e.segments&&e.segments.length>0&&z!==null){let S=Ke-J;He(S);}}else if(B==="resize-start"){let Se=de.x,Ke=et(Se),We=t+r-Ke;We>=s&&(ue(Ke),X(We));}else if(B==="resize-end"){let Se=de.x,We=et(Se)-t;We>=s&&X(We);}},[B,t,r,s,A,e,et,z,J,Tt,Y,$e,ue,X,He,b,yt]),Ft=react.useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,B!=="none"){if(B==="connect")R&&m&&m(e,R),$e(null),Y(null);else {let P=e.endDate.getTime()-e.startDate.getTime(),K,q,de=true;if(B==="move"){if(K=It(E),q=new Date(K.getTime()+P),e.segments&&e.segments.length>0&&z!==null){let Se=Math.round(xe/s),Ke=e.segments.map((me,Ee)=>{if(Ee===z){let Je=new Date(me.startDate),Ye=new Date(me.endDate);return Je.setDate(Je.getDate()+Se),Ye.setDate(Ye.getDate()+Se),{startDate:Je,endDate:Ye}}return me}),We=Ke.flatMap(me=>[me.startDate,me.endDate]),S=new Date(Math.min(...We.map(me=>me.getTime()))),Z=new Date(Math.max(...We.map(me=>me.getTime())));d?.({...e,segments:Ke},S,Z),Ct(t,r);return}}else B==="resize-start"?(K=It(E),q=e.endDate,K>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),de=false)):B==="resize-end"?(K=e.startDate,q=It(E+L),q.setDate(q.getDate()-1),q<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),de=false)):de=false;de&&K&&q&&(q.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,q));}b?.(e.id,0,false),Ct(t,r);}},[B,E,L,e,d,R,m,t,r,s,It,xe,z,Ct,b]);react.useEffect(()=>{if(B==="none")return;let P=q=>{dt(q);},K=()=>{Ft();};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",K),D.current&&(window.clearInterval(D.current),D.current=null);}},[B,dt,Ft]);let ze=pe&&!gt?E:t,Re=pe&&!gt?L:r,ct=l.taskClass(e),se=24,fe=y?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:C,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!k.current&&c?.(e),k.current=false;},onDoubleClick:P=>{!pe&&!k.current&&(P.stopPropagation(),i?.(e));},onContextMenu:P=>{P.preventDefault(),u?.(e,P);},onMouseEnter:()=>!pe&&rt(true),onMouseMove:P=>{h&&te&&!pe&&!e.segments&&h({task:e,x:t,y:a,width:r,height:ye,showBelow:false,mouseX:P.clientX,mouseY:P.clientY});},onMouseLeave:()=>{pe||(rt(false),_e(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+se,height:ye,fill:"transparent",style:{pointerEvents:"all"}}),te&&!pe&&!je&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:ye,fill:be==="resize-start"?o.accent:"transparent",opacity:be==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-start"),onMouseDown:P=>bt(P,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:ye,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>_e("move"),onMouseDown:P=>bt(P,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:ye,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-end"),onMouseDown:P=>bt(P,"resize-end")})]}),te&&!pe&&ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>_e("move"),onMouseDown:P=>bt(P,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-end"),onMouseDown:P=>bt(P,"resize-end")}),te&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ye-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!gt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:a,width:L,height:ye,rx:Qe,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!pe&&(()=>{let P=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),q=n.getTime(),de=864e5,Se=(P-q)/de,Ke=(K-P)/de,We=Se*s,S=Math.max(Ke*s,s),Z=ze+Re,me=We+S,Ee=e.endDate?.getTime()??0,Je=Math.ceil((Ee-K)/de),Ye=Je>0,I=Je<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:We,y:a,width:S,height:ye,rx:Qe,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ye&&Z>me&&jsxRuntime.jsx("rect",{x:me,y:a,width:Z-me,height:ye,rx:0,fill:"#EF4444",opacity:.2}),Ye&&jsxRuntime.jsxs("text",{x:Math.max(Z,me)+6,y:a+ye/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Je,"d"]}),I&&jsxRuntime.jsxs("text",{x:Z+6,y:a+ye/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Je,"d"]})]})})(),!e.segments&&ft&&H&&(()=>{let K=a+(ye-8)/2,q=4,de=e.progress||0,Se=new Date;Se.setHours(0,0,0,0);let Ke=e.startDate&&Se>=e.startDate,We=e.endDate&&(()=>{let Ye=new Date(e.endDate);return Ye.setHours(0,0,0,0),Se>Ye})(),S=e.startDate&&Se<e.startDate,Z=1;if(Ke&&e.startDate&&e.endDate&&!S){let Ye=new Date(e.startDate);Ye.setHours(0,0,0,0);let I=new Date(e.endDate);I.setHours(0,0,0,0);let G=Math.max(1,(I.getTime()-Ye.getTime())/(1e3*60*60*24)),F=Math.min((Se.getTime()-Ye.getTime())/(1e3*60*60*24),G)/G*100;Z=F>0?de/F:1;}let me;de>=100?me="#00E5CC":S?me="#4B5563":We&&de<100?me="#EF4444":Z>=.95?me="#22C55E":Z>=.8?me="#F59E0B":me="#EF4444";let Ee=Math.max(de/100*Re,de>0?q*2:0),Je=Re>100&&de>0;return jsxRuntime.jsxs("g",{"data-task-class":ct,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ze,y:K,width:Re,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),de>0&&jsxRuntime.jsx("rect",{x:ze,y:K,width:Ee,height:8,rx:q,fill:me}),Je&&jsxRuntime.jsxs("text",{x:ze+Ee+6,y:K+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(de),"%"]})]})})(),!e.segments&&ft&&!H&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:Re,height:ye,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!gt?.15:e.parentId?.6:1,scale:te&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:P=>bt(P),style:{cursor:Ue,pointerEvents:"all"}}),!e.segments&&!ft&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:Re,height:ye,rx:Qe,fill:ae,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!gt?.15:e.parentId?.6:te?.9:.8,scale:te&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:P=>bt(P),style:{cursor:H?"default":Ue,pointerEvents:"all"}}),ft&&(ie||N)&&!e.segments&&jsxRuntime.jsx("rect",{x:ze,y:a,width:Re,height:ye,rx:Qe,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsxRuntime.jsx("rect",{x:ze,y:a,width:Math.max(Re*(e.progress/100),Qe*2),height:ye,rx:Qe,fill:ae,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let P=e.progress>0?Re*(e.progress/100):0,K=ze+P,q=Re-P,de=e.progress===0?Qe:0,Se=e.progress===0?ze:K,Ke=e.progress===0?Re:q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Se,y:a,width:Ke,height:ye,rx:de,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Se,y:a,width:Ke,height:ye,rx:de,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ft&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!pe&&(()=>{let P=ze+Re*(e.progress/100),K=8,q=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:P,cy:a+ye/2,r:K,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:P,y:a+ye/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((P,K)=>{let q=(P.startDate.getTime()-n.getTime())/864e5*s,Se=(P.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Ke=pe&&B==="move"&&z===K,We=Ne===K,S=Ke?q+xe:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!pe&&at(K),onMouseLeave:()=>!pe&&at(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:S,y:a,width:Se,height:ye,rx:Qe,fill:ae,initial:{opacity:0,scale:.95},animate:{opacity:Ke||e.parentId?.6:We?.9:.8,scale:We&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>{Z.stopPropagation(),oe(K),Ae(q),bt(Z,void 0,q);},style:{cursor:Ue,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:S,y:a,width:Se*(e.progress/100),height:ye,rx:Qe,fill:ae,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),j&&(ie||N)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[N&&!ie&&jsxRuntime.jsx("rect",{x:ze,y:a,width:Re,height:ye,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ie&&jsxRuntime.jsx("rect",{x:ze,y:a,width:Re,height:ye,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Re>60&&!e.segments&&!(ft&&H)&&(()=>{let P=l.taskLabel(e),K=typeof P=="string"?P:e.name,q=K.length>Math.floor(Re/8)?`${K.substring(0,Math.floor(Re/8))}...`:K;return jsxRuntime.jsx("text",{x:ze+8,y:a+ye/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:q})})(),!pe&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(ft?jsxRuntime.jsxs("text",{x:ze+Re+6,y:a+ye/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Re>100?jsxRuntime.jsxs("text",{x:ze+Re-12,y:a+ye/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Re>80&&!pe&&!e.segments&&!(ft&&H)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ze+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ze+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(te||ot)&&!gt&&!e.segments&&!H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:ze-2,y:a,width:16,height:ye,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>_e("resize-start"),onMouseLeave:()=>_e(null),onMouseDown:P=>{P.stopPropagation(),bt(P,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ze+4,y:a+8,width:3,height:ye-16,rx:1.5,fill:be==="resize-start"||B==="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:ze+Re-14,y:a,width:16,height:ye,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>_e("resize-end"),onMouseLeave:()=>_e(null),onMouseDown:P=>{P.stopPropagation(),bt(P,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ze+Re-7,y:a+8,width:3,height:ye-16,rx:1.5,fill:be==="resize-end"||B==="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:te&&!pe&&!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+r+10,cy:a+ye/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>_e("connect"),onMouseLeave:()=>_e(null),onMouseDown:P=>{P.stopPropagation(),bt(P,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ye/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:be==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),gt&&ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ye/2,x2:ee.x,y2:ee.y,stroke:R?o.statusCompleted:o.accent,strokeWidth:R?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:R?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:ee.x,cy:ee.y,r:R?8:6,fill:R?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),R&&jsxRuntime.jsx(framerMotion.motion.text,{x:ee.x+15,y:ee.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ee.x+10},animate:{opacity:1,x:ee.x+15},transition:{duration:.2},children:"Connect"})]}),(te||pe)&&!gt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ze-1,y:a-1,width:Re+2,height:ye+2,rx:Qe+1,fill:"none",stroke:pe?o.accent:ft?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:ft?1:2,opacity:pe||ft?.6:.4,initial:{opacity:0},animate:{opacity:pe||ft?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ot&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:E+L,y1:0,x2:E+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&!pe&&!e.segments&&!h&&(()=>{let q=a<100,de=q?a+ye+13:a-82-13,Se=q?`M ${ze+Re/2-6} ${a+ye+3} L ${ze+Re/2} ${a+ye+13} L ${ze+Re/2+6} ${a+ye+3}`:`M ${ze+Re/2-6} ${a-13} L ${ze+Re/2} ${a-3} L ${ze+Re/2+6} ${a-13}`,Ke=de+22,We=de+40,S=de+55,Z=de+70,me=q?de+82-5:a-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:Se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ze+Re/2-120,y:de,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:ze+Re/2,y:Ke,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:ze+Re/2-110,y:We,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ze+Re/2-70,y:We,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsxRuntime.jsx("text",{x:ze+Re/2-110,y:S,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ze+Re/2-70,y:S,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsxRuntime.jsx("text",{x:ze+Re/2+10,y:We,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ze+Re/2+65,y:We,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ze()}),jsxRuntime.jsx("text",{x:ze+Re/2+10,y:S,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ze+Re/2+65,y:S,fill:o.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:ze+Re/2-110,y:Z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ze+Re/2-50,y:Z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ee=>Ee.name).join(", ").substring(0,30),e.assignees.map(Ee=>Ee.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:ze+Re/2,y:me,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ut?"Left: move \u2022 Right: resize":je?"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 hd=260,yn=8,tm=16,fv=-12;function am({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:y,mouseX:w,mouseY:x}=e,k=y.effortMinutes!=null||y.timeLoggedMinutes!=null||y.soldEffortMinutes!=null?155:105,D=w+tm,T=x+fv-k;D+hd>window.innerWidth-yn&&(D=w-hd-tm),D<yn&&(D=yn);let B=T<yn;B&&(T=x+20),T+k>window.innerHeight-yn&&(T=window.innerHeight-yn-k),o({left:D,top:T,showBelow:B});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=y=>y.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let y=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${y} d\xEDa${y!==1?"s":""}`:`${y} day${y!==1?"s":""}`},u=y=>{if(y==null||y===0)return "N/A";let w=Math.floor(y/60),x=y%60;return w===0?`${x}m`:x===0?`${w}h`:`${w}h ${x}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",h=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:hd,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 ${v}`,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:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(ui,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(ui,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsxRuntime.jsx(ui,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(ui,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(y=>y.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:b,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return reactDom.createPortal(f,document.body)}function di({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:u,hoverOverlayOnly:i=false,colorOverride:c,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[b,h]=react.useState(null),v=r-t,f=v>0,y=Math.abs(v)<5,w=20,x=!y&&a<=e,k,C,D=a-e,T=e+D/2;C=T;let R=8;if(n==="squared")if(y)k=`M ${e} ${t} L ${a} ${r}`;else if(x){let he=e+15,$e=a-w,Ne=f?t+20:t-20;C=$e;let at=f?1:-1;k=`M ${e} ${t} L ${he-R} ${t} Q ${he} ${t} ${he} ${t+at*R} L ${he} ${Ne-at*R} Q ${he} ${Ne} ${he-R} ${Ne} L ${$e+R} ${Ne} Q ${$e} ${Ne} ${$e} ${Ne+at*R} L ${$e} ${r-at*R} Q ${$e} ${r} ${$e+R} ${r} L ${a} ${r}`;}else {C=a-w;let Ae=f?1:-1;k=`M ${e} ${t} L ${C-R} ${t} Q ${C} ${t} ${C} ${t+Ae*R} L ${C} ${r-Ae*R} Q ${C} ${r} ${C+R} ${r} L ${a} ${r}`;}else k=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let $=6,L=5,j=`M ${a} ${r} L ${a-$} ${r-L/2} L ${a-$} ${r+L/2} Z`,E=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),ce=c||(E?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),I=d||1,X=o.dependencyHover||(E?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Ce="#f87171",Xe="rgba(248, 113, 113, 0.15)",P=C,G=(t+r)/2;if(b)if(n==="squared")if(y)P=Math.max(e+10,Math.min(a-10,b.x)),G=t;else if(x){let Ae=e+15,he=a-w,$e=f?t+20:t-20,Ne=[[e,t,Ae,t],[Ae,t,Ae,$e],[Ae,$e,he,$e],[he,$e,he,r],[he,r,a,r]],at=1/0,ee={x:P,y:G};for(let rt of Ne){let ue=fe(b.x,b.y,rt[0],rt[1],rt[2],rt[3]),ot=Math.hypot(b.x-ue.x,b.y-ue.y);ot<at&&(at=ot,ee=ue);}P=ee.x,G=ee.y;}else {let Ae=[[e,t,C,t],[C,t,C,r],[C,r,a,r]],he=1/0,$e={x:P,y:G};for(let Ne of Ae){let at=fe(b.x,b.y,Ne[0],Ne[1],Ne[2],Ne[3]),ee=Math.hypot(b.x-at.x,b.y-at.y);ee<he&&(he=ee,$e=at);}P=$e.x,G=$e.y;}else {let Ae=T,he=t,$e=T,Ne=r,at=1/0,ee=P,rt=G;for(let ue=0;ue<=1;ue+=.02){let ot=1-ue,gt=ot*ot*ot*e+3*ot*ot*ue*Ae+3*ot*ue*ue*$e+ue*ue*ue*a,Ct=ot*ot*ot*t+3*ot*ot*ue*he+3*ot*ue*ue*Ne+ue*ue*ue*r,be=Math.hypot(b.x-gt,b.y-Ct);be<at&&(at=be,ee=gt,rt=Ct);}P=ee,G=rt;}function fe(Ae,he,$e,Ne,at,ee){let rt=at-$e,ue=ee-Ne,ot=rt*rt+ue*ue;if(ot===0)return {x:$e,y:Ne};let gt=((Ae-$e)*rt+(he-Ne)*ue)/ot;return gt=Math.max(0,Math.min(1,gt)),{x:$e+gt*rt,y:Ne+gt*ue}}let Ve=Ae=>{let he=Ae.currentTarget.ownerSVGElement;if(!he)return;let $e=he.getScreenCTM();if(!$e)return;let Ne=$e.inverse();h({x:Ne.a*Ae.clientX+Ne.c*Ae.clientY+Ne.e,y:Ne.b*Ae.clientX+Ne.d*Ae.clientY+Ne.f});},z=()=>{g(false),h(null),u?.(false);},re=()=>{g(true),u?.(true);},J=Ae=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ae,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:he=>{he.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:P,cy:G,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:P,cy:G,r:9,fill:Xe,stroke:Ce,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:P-3,y1:G-3,x2:P+3,y2:G+3,stroke:Ce,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:P+3,y1:G-3,x2:P-3,y2:G+3,stroke:Ce,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:Ve,children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:X,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:X,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:j,fill:X,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:X,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:X,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:X,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:j,fill:X,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:X,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:ce,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:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:j,fill:ce,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:ce,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function mi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),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:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:u(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Pe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,u=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&u(d))return true;if(l.has(d))return true}}return l.delete(i),false};return u(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Pe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Pe.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Pe.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Pe.findTaskById(e,t);return !a||!a.dependencies?[]:Pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Pe.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Pe.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Pe.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Pe.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(
|
|
130
|
+
`})]});return reactDom.createPortal(f,document.body)}function ui({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function Jn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[b,h]=react.useState(null),v=r-t,f=v>0,y=Math.abs(v)<5,w=20,x=!y&&a<=e,C,k,D=a-e,T=e+D/2;k=T;let B=8;if(n==="squared")if(y)C=`M ${e} ${t} L ${a} ${r}`;else if(x){let xe=e+15,He=a-w,Ne=f?t+20:t-20;k=He;let at=f?1:-1;C=`M ${e} ${t} L ${xe-B} ${t} Q ${xe} ${t} ${xe} ${t+at*B} L ${xe} ${Ne-at*B} Q ${xe} ${Ne} ${xe-B} ${Ne} L ${He+B} ${Ne} Q ${He} ${Ne} ${He} ${Ne+at*B} L ${He} ${r-at*B} Q ${He} ${r} ${He+B} ${r} L ${a} ${r}`;}else {k=a-w;let Ae=f?1:-1;C=`M ${e} ${t} L ${k-B} ${t} Q ${k} ${t} ${k} ${t+Ae*B} L ${k} ${r-Ae*B} Q ${k} ${r} ${k+B} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let $=6,A=5,_=`M ${a} ${r} L ${a-$} ${r-A/2} L ${a-$} ${r+A/2} Z`,E=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),ue=u||(E?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=d||1,X=o.dependencyHover||(E?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),ee="#f87171",$e="rgba(248, 113, 113, 0.15)",R=k,Y=(t+r)/2;if(b)if(n==="squared")if(y)R=Math.max(e+10,Math.min(a-10,b.x)),Y=t;else if(x){let Ae=e+15,xe=a-w,He=f?t+20:t-20,Ne=[[e,t,Ae,t],[Ae,t,Ae,He],[Ae,He,xe,He],[xe,He,xe,r],[xe,r,a,r]],at=1/0,te={x:R,y:Y};for(let rt of Ne){let pe=be(b.x,b.y,rt[0],rt[1],rt[2],rt[3]),ot=Math.hypot(b.x-pe.x,b.y-pe.y);ot<at&&(at=ot,te=pe);}R=te.x,Y=te.y;}else {let Ae=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],xe=1/0,He={x:R,y:Y};for(let Ne of Ae){let at=be(b.x,b.y,Ne[0],Ne[1],Ne[2],Ne[3]),te=Math.hypot(b.x-at.x,b.y-at.y);te<xe&&(xe=te,He=at);}R=He.x,Y=He.y;}else {let Ae=T,xe=t,He=T,Ne=r,at=1/0,te=R,rt=Y;for(let pe=0;pe<=1;pe+=.02){let ot=1-pe,gt=ot*ot*ot*e+3*ot*ot*pe*Ae+3*ot*pe*pe*He+pe*pe*pe*a,Ct=ot*ot*ot*t+3*ot*ot*pe*xe+3*ot*pe*pe*Ne+pe*pe*pe*r,ye=Math.hypot(b.x-gt,b.y-Ct);ye<at&&(at=ye,te=gt,rt=Ct);}R=te,Y=rt;}function be(Ae,xe,He,Ne,at,te){let rt=at-He,pe=te-Ne,ot=rt*rt+pe*pe;if(ot===0)return {x:He,y:Ne};let gt=((Ae-He)*rt+(xe-Ne)*pe)/ot;return gt=Math.max(0,Math.min(1,gt)),{x:He+gt*rt,y:Ne+gt*pe}}let _e=Ae=>{let xe=Ae.currentTarget.ownerSVGElement;if(!xe)return;let He=xe.getScreenCTM();if(!He)return;let Ne=He.inverse();h({x:Ne.a*Ae.clientX+Ne.c*Ae.clientY+Ne.e,y:Ne.b*Ae.clientX+Ne.d*Ae.clientY+Ne.f});},z=()=>{g(false),h(null),c?.(false);},oe=()=>{g(true),c?.(true);},J=Ae=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ae,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:R,cy:Y,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:R,cy:Y,r:9,fill:$e,stroke:ee,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R-3,y1:Y-3,x2:R+3,y2:Y+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:R+3,y1:Y-3,x2:R-3,y2:Y+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,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:X,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:X,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:X,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:oe,onMouseLeave:z,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:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:X,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:_,fill:X,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:X,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:oe,onMouseLeave:z,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:ue,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:_,fill:ue,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:ue,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function fi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),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:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Pe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Pe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Pe.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Pe.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Pe.findTaskById(e,t);return !a||!a.dependencies?[]:Pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Pe.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Pe.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Pe.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Pe.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Pe.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Pe.formatDate(c.startDate):"N/A",c.endDate?Pe.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t)=>{let a=await import('xlsx'),r=Pe.flattenTasks(e),o=new Map,s=(u,d="")=>{[...u].sort((g,b)=>(g.position??0)-(b.position??0)).forEach((g,b)=>{let h=d?`${d}.${b+1}`:`${b+1}`;o.set(g.id,h),g.subtasks?.length&&s(g.subtasks,h);});};s(e);let n=r.map(u=>{let d=u.startDate&&u.endDate?Pe.calculateDuration(u.startDate,u.endDate):0,m=u.effortMinutes,g=u.timeLoggedMinutes,b=u.soldEffortMinutes;return {WBS:o.get(u.id)||"","Task Name":u.name,"Start Date":u.startDate?Pe.formatDate(u.startDate):"","End Date":u.endDate?Pe.formatDate(u.endDate):"","Duration (days)":d>0?d:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(h=>h.name).join(", ")||"","Estimated (h)":typeof m=="number"?+(m/60).toFixed(1):"","Logged (h)":typeof g=="number"?+(g/60).toFixed(1):"","Quoted (h)":typeof b=="number"?+(b/60).toFixed(1):"","Is Milestone":u.isMilestone?"Yes":"No"}}),l=a.utils.json_to_sheet(n),c=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},{wch:12}];l["!cols"]=c;let i=a.utils.book_new();if(a.utils.book_append_sheet(i,l,"Gantt Tasks"),!t){let u=new Date,d=g=>String(g).padStart(2,"0");t=`Project_${`${u.getFullYear()}-${d(u.getMonth()+1)}-${d(u.getDate())}_${d(u.getHours())}${d(u.getMinutes())}`}.xlsx`;}a.writeFile(i,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Pe.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Pe.getEarliestStartDate(e)||new Date,l=Pe.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let b=o.get(m.id),h=m.startDate&&m.endDate?Pe.calculateDuration(m.startDate,m.endDate):0,v=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -356,16 +356,16 @@
|
|
|
356
356
|
</WeekDays>
|
|
357
357
|
</Calendar>
|
|
358
358
|
</Calendars>
|
|
359
|
-
<Tasks>${
|
|
359
|
+
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Pe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let b=t.find(h=>h.id===g);if(b){o(b);let h=r.get(g)?.ef||0;d=Math.max(d,h);}}let m=d+c;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),m=s;if(d.length>0)for(let b of d){l(b);let h=n.get(b.id)?.ls||0;m=Math.min(m,h);}let g=m-c;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let u=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let m=d.ls-c.es;Math.abs(m)<.01&&u.push(i.id);}}return u},calculateCriticalPathFull:e=>{let t=new Map,r=Pe.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let b=s.get(g);b&&b.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,u=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();u.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let b=Pe.calculateDuration(g.startDate,g.endDate),h=0;if(g.dependencies)for(let f of g.dependencies){let y=l.get(f);y&&(h=Math.max(h,y.ef));}l.set(m,{es:h,ef:h+b});let v=s.get(m)||[];for(let f of v){let y=(n.get(f)||1)-1;n.set(f,y),y===0&&i.push(f);}}if(u.length<r.length)return t;let c=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=u.length-1;m>=0;m--){let g=u[m];if(!g)continue;let b=o.get(g);if(!b||!b.startDate||!b.endDate)continue;let h=Pe.calculateDuration(b.startDate,b.endDate),v=s.get(g)||[],f=c;if(v.length>0)for(let y of v){let w=d.get(y);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-h,lf:f});}for(let m of u){let g=l.get(m),b=d.get(m),h=b.ls-g.es,v=s.get(m)||[],f;v.length>0?f=Math.min(...v.map(y=>l.get(y).es))-g.ef:f=c-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:b.ls,lateFinish:b.lf,totalFloat:Math.round(h*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:h<=.01});}return t},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let l=Pe.getLatestEndDate(e);if(!l)return null;let u=Pe.calculateDuration(a.endDate,l);return Math.max(0,u)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,u)=>l-u)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Pe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Pe.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let u of n){if(o.has(u.id)||!u.startDate||!u.endDate)continue;let i=Pe.calculateDuration(u.startDate,u.endDate),c;if(a!==void 0?(c=new Date(u.startDate),c.setDate(c.getDate()+a)):(c=new Date(s.endDate),c.setDate(c.getDate()+1)),a!==void 0){let g=new Date(s.endDate),b=new Date(g);b.setDate(b.getDate()+1),c<b&&(c=b);}let d=Pe.calculateEndDate(c,i),m=g=>g.map(b=>b.id===u.id?{...b,startDate:c,endDate:d}:b.subtasks?{...b,subtasks:m(b.subtasks)}:b);l=m(l),l=Pe.autoScheduleDependents(l,u.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,d=Pe.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,b,h=new Set)=>{if(h.has(g))return;h.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let y=r.findIndex(L=>L.id===f.id);if(y===-1)continue;let w=f.startDate.getTime(),k=(f.endDate.getTime()-w)/c,D=(w-i)/c*s,T=D+b*s,R=Math.max(k*s,s),$=l+y*n+(n-18)/2;u.push({taskId:f.id,taskName:f.name,originalX:D,previewX:T,width:R,y:$,rowIndex:y,daysDelta:b,color:f.color}),m(f.id,b,h);}};return m(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function fi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:u,dependencyLineStyle:i="curved",showTaskBarLabels:c=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:b,onDependencyCreate:h,onDependencyDelete:v,showBaseline:f,showCriticalPath:y=true,showDependencies:w=true,highlightWeekends:x=true,canEditTask:k}){let D=Er(),T=react.useRef(null),[R,$]=react.useState([]),[L,j]=react.useState(null),[E,ce]=react.useState(null),[I,X]=react.useState(null),Ce=react.useRef(false),[Xe,P]=react.useState(new Set),[G,fe]=react.useState(null),Ve=react.useCallback(H=>{if(I&&!Ce.current){let se=H.target,N=false;for(;se&&se!==H.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}se=se.parentElement;}N||X(null);}},[I]),z=react.useCallback(H=>{ce(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Ae=re*J*n,he=H=>{let se=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-N);let K=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-K.getTime())/864e5+1)/7)},$e=H=>{let se=H.getDay();return se===0||se===6},Ne=react.useCallback(H=>{let se=Math.round(H/(J*n)),N=new Date(o);return N.setDate(N.getDate()+se),N},[o,J,n]),at=react.useCallback((H,se)=>{if(se.startDate&&se.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let K=N.createSVGPoint();K.x=H.clientX,K.y=H.clientY;let ie=K.matrixTransform(N.getScreenCTM()?.inverse()),we=Ne(ie.x),W=new Date(we);W.setDate(W.getDate()+1),fe(null),b?.(se,we,W);},[Ne,b]),ee=react.useCallback((H,se,N)=>{let K=H.currentTarget.ownerSVGElement;if(!K)return;let ie=K.createSVGPoint();ie.x=H.clientX,ie.y=H.clientY;let we=ie.matrixTransform(K.getScreenCTM()?.inverse()),W=Ne(we.x),ze=Math.round(we.x/(J*n))*J*n;fe({taskId:se.id,x:ze,y:N*a+a/2,date:W});},[Ne,J,n,a]),rt=react.useCallback(()=>{fe(null);},[]),ue=react.useMemo(()=>{let H=ie=>ie.map(we=>{if(we.subtasks&&we.subtasks.length>0){let W=H(we.subtasks),te=W.filter(ze=>ze.startDate&&ze.endDate);if(te.length>0){let ze=te.map(_e=>_e.startDate.getTime()),Te=te.map(_e=>_e.endDate.getTime()),Ie=new Date(Math.min(...ze)),De=new Date(Math.max(...Te));return {...we,subtasks:W,startDate:Ie,endDate:De}}return {...we,subtasks:W}}return we}),se=(ie,we=[])=>{let W=[...ie].sort((te,ze)=>(te.position??0)-(ze.position??0));for(let te of W)we.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&se(te.subtasks,we);return we},N=H(e);return se(N)},[e]),ot=react.useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let se=H.startDate.getTime(),N=H.endDate.getTime(),K=o.getTime(),ie=(se-K)/(1e3*60*60*24),we=(N-se)/(1e3*60*60*24)+1,W=ie*J*n,te=Math.max(J*n,40),ze=Math.max(we*J*n,te);return {x:W,width:ze}},[o,J,n]),gt=react.useMemo(()=>ue.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:se,width:N}=ot(H),ie=ue.findIndex(we=>we.id===H.id)*a+(a-18)/2;return {id:H.id,x:se,y:ie,width:N,height:18}}),[ue,ot]),Ct=react.useCallback((H,se,N)=>{if(!N){$([]),j(null);return}if(j({taskId:H,daysDelta:se}),se===0){$([]);return}let K=Pe.calculateCascadePreview(e,H,se,ue,o,J*n,a,48);$(K);},[e,ue,o,J,n,a,48]),be=react.useCallback((H,se)=>{if(!L)return se;let N=J*n,K=L.daysDelta*N;if(H===L.taskId)return {x:se.x+K,width:se.width};let ie=R.find(we=>we.taskId===H);return ie?{x:ie.previewX,width:ie.width}:se},[L,R,J,n]),ft=react.useMemo(()=>{let H=[],se=new Date(o);for(;se<=s;){let ie=(se.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(se),label:se.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ie}),se.setDate(se.getDate()+1);else if(r==="week"){let we=he(se);H.push({date:new Date(se),label:`${D.labels.week} ${we}`,x:ie}),se.setDate(se.getDate()+7);}else H.push({date:new Date(se),label:se.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ie}),se.setMonth(se.getMonth()+1);}return H},[o,s,r,J,n,l,D.labels.week]),tt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),Qe=Math.max(ue.length*a,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(Ae,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ae,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ft.map((H,se)=>jsxRuntime.jsxs("g",{children:[se>0&&jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${se}`)),tt>=0&&tt<=Ae&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${tt-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:T,width:Math.max(Ae,1e3),height:Qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ve,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:"#2E94FF",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(Ae,1e3),height:Qe,fill:t.bgPrimary}),ue.map((H,se)=>jsxRuntime.jsx("rect",{x:0,y:se*a,width:Math.max(Ae,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),ft.map((H,se)=>se>0?jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:ue.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),x&&ft.map((H,se)=>{let N=ft[se+1]?.x||Ae;return $e(H.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:H.x,y:0,width:N-H.x,height:ue.length*a,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:H.x,y:0,width:N-H.x,height:ue.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),ue.map((H,se)=>{let N=H.startDate&&H.endDate;return jsxRuntime.jsx("g",{children:!N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:se*a,width:Ae,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>at(K,H),onMouseMove:K=>ee(K,H,se),onMouseLeave:()=>{rt();}},`clickable-${H.id}`),G&&G.taskId===H.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:G.x,y1:se*a+4,x2:G.x,y2:se*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:G.x,cy:G.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:G.x,cy:G.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${G.x}, ${se*a-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:G.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!G||G.taskId!==H.id)&&jsxRuntime.jsx("text",{x:tt>0?tt:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),ue.map((H,se)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:K}=ot(H),ie=se*a+(a-18)/2,we=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsxRuntime.jsx(mi,{task:H,x:N+K/2,y:ie+12,theme:t,onClick:d},H.id);if(we){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,ze=ie+(a-18)/2+(18-te)/2,Te=4,Ie=H.progress||0,De=new Date;De.setHours(0,0,0,0);let _e=H.startDate&&De>=H.startDate,ut=H.endDate&&(()=>{let dt=new Date(H.endDate);return dt.setHours(0,0,0,0),De>dt})(),mt=H.startDate&&De<H.startDate,Ze=1;if(_e&&H.startDate&&H.endDate&&!mt){let dt=new Date(H.startDate);dt.setHours(0,0,0,0);let Ft=new Date(H.endDate);Ft.setHours(0,0,0,0);let He=Math.max(1,(Ft.getTime()-dt.getTime())/(1e3*60*60*24)),ct=Math.min((De.getTime()-dt.getTime())/(1e3*60*60*24),He)/He*100;Ze=ct>0?Ie/ct:1;}let et;Ie>=100?et="#00E5CC":mt?et="#4B5563":ut&&Ie<100?et="#EF4444":Ze>=.95?et="#22C55E":Ze>=.8?et="#F59E0B":et="#EF4444";let It=Math.max(Ie/100*K,Ie>0?Te*2:0),Tt=K>100&&Ie>0,bt=H.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(H),onContextMenu:dt=>{dt.preventDefault(),dt.stopPropagation(),g?.(H,dt);},onMouseMove:dt=>{z({task:H,x:N,y:ze,width:K,height:te,showBelow:ze<100,mouseX:dt.clientX,mouseY:dt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:y?bt?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:N,y:ie,width:K,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:N,y:ze,width:K,height:te,rx:Te,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ie>0&&jsxRuntime.jsx("rect",{x:N,y:ze,width:It,height:te,rx:Te,fill:et}),y&&bt&&jsxRuntime.jsx("rect",{x:N,y:ze,width:K,height:te,rx:Te,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Tt&&jsxRuntime.jsxs("text",{x:N+It+6,y:ze+te/2,dominantBaseline:"central",fill:W?"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(Ie),"%"]})]},H.id)}return jsxRuntime.jsx(li,{task:H,x:N,y:ie,width:K,theme:t,dayWidth:J*n,startDate:o,templates:u,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:b,onDependencyCreate:h,allTaskPositions:gt,onDragMove:Ct,onHoverChange:z,showBaseline:f,showTaskBarLabels:c,showCriticalPath:y,readOnly:k?!k(H):false},H.id)}),w&&ue.map((H,se)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let K=ue.find(et=>et.id===N);if(!K||!K.startDate||!K.endDate)return null;let ie=ue.findIndex(et=>et.id===N),we=be(K.id,ot(K)),W=be(H.id,ot(H)),te=we.x+we.width,ze=ie*a+26,Te=W.x,Ie=se*a+26,De=`dep-${N}-${H.id}`;if(Xe.has(De))return null;let _e=y&&H.isCriticalPath&&K.isCriticalPath;return jsxRuntime.jsx(qn,{x1:te,y1:ze,x2:Te,y2:Ie,theme:t,lineStyle:i,colorOverride:y?_e?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?_e?2:1:void 0,glowFilter:_e?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.(H.id,N),onHoverChange:et=>{Ce.current=et,et&&X({key:De,fromId:N,toId:H.id,exitX:te,exitY:ze,enterX:Te,enterY:Ie});}},De)})),R.map(H=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsxRuntime.jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),w&&I&&jsxRuntime.jsx(qn,{x1:I.exitX,y1:I.exitY,x2:I.enterX,y2:I.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=I.key;X(null),Ce.current=false,P(se=>new Set(se).add(H)),v?.(I.toId,I.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Ce.current=H,H||X(null);}},`${I.key}-hover-overlay`),tt>=0&&tt<=Ae&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsxRuntime.jsx(am,{tooltipData:E,theme:t,locale:l==="es"?"es":"en"})]})}var yv=['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"'],nm=({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"})}),xv=()=>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"})}),vv=()=>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"})}),wv=()=>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"})}),kv=()=>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 yi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:u}){let[i,c]=react.useState(false),[d,m]=react.useState(false),[g,b]=react.useState([]),[h,v]=react.useState(""),[f,y]=react.useState(false),[w,x]=react.useState(true),[k,C]=react.useState(""),[D,T]=react.useState(-1),[R,$]=react.useState(false),[L,j]=react.useState(0),E=react.useRef(null),ce=react.useRef(null),I=react.useRef(null),X=react.useRef(null),{enabled:Ce=true,placeholder:Xe='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:G,suggestions:fe=yv,maxHistory:Ve=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ae=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",he=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",$e=J?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ne=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",at=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ee=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",rt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",ue=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",ot=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",gt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ct=J?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",be=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ft=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Qe=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",se=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",K=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",we="rgba(46, 148, 255, 0.04)",W=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",ze=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Te=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ie=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",De=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",_e=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ut=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",mt="rgba(46, 148, 255, 0.06)",Ze=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",It=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Tt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",bt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",yt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",dt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ft=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",He=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Be=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ct=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ge=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",A=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Y=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=z?.storageKey||"gantt-ai-history",le=z?.maxMessages??5,Se=re.filter(B=>{if(!k)return true;let V=k.toLowerCase();return B.name.toLowerCase().includes(V)||B.email&&B.email.toLowerCase().includes(V)}).slice(0,5),je=react.useCallback(B=>{if(v(B),re.length===0)return;let V=E.current;if(!V)return;let ke=V.selectionStart||B.length,F=B.slice(0,ke),ae=F.lastIndexOf("@");if(ae>=0&&((ae>0?F[ae-1]:" ")===" "||ae===0)){let Je=F.slice(ae+1);if(Je.length<=40){C(Je),T(ae),$(true),j(0);return}}$(false),C(""),T(-1);},[re.length]),Ue=react.useCallback(B=>{let V=h.slice(0,D),ke=h.slice(D+1+k.length),F=`${V}@${B.name} ${ke}`;v(F),$(false),C(""),T(-1),setTimeout(()=>E.current?.focus(),0);},[h,D,k]),S=react.useCallback(B=>{if(!R||Se.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),j(V=>V<Se.length-1?V+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),j(V=>V>0?V-1:Se.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let V=Se[L];return V&&Ue(V),true}return B.key==="Escape"?($(false),true):false},[R,Se,L,Ue]);react.useEffect(()=>{if(z?.enabled)try{let B=localStorage.getItem(q);if(B){let ke=JSON.parse(B).map(F=>({...F,timestamp:new Date(F.timestamp)}));b(ke.slice(-le));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[z?.enabled,q,le]),react.useEffect(()=>{if(z?.enabled&&g.length>0)try{let B=g.filter(V=>!V.isLoading).slice(-le);localStorage.setItem(q,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[g,z?.enabled,q,le]),react.useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[i,d]);let Z=react.useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&l?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&u?.(B.taskId,B.dependencyFrom);break}},[o,s,n,l,u]),pe=react.useCallback(async B=>{if(!B.trim()||f)return;let V={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};b(F=>[...F.slice(-(Ve-1)),V]),v(""),x(false),y(true);let ke={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(F=>[...F,ke]);try{if(G){let F=await G(B,e);b(ae=>{let Re=ae.filter(qt=>!qt.isLoading),Je={id:`assistant-${Date.now()}`,role:"assistant",content:F.message,timestamp:new Date,command:F};return [...Re,Je]}),Z(F);}else b(F=>[...F.filter(Re=>!Re.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(F){b(ae=>[...ae.filter(Je=>!Je.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${F instanceof Error?F.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[f,Ve,G,e,Z]),Ee=B=>{B.preventDefault(),pe(h);},qe=B=>{v(B),E.current?.focus();};if(react.useEffect(()=>{let B=V=>{(V.metaKey||V.ctrlKey)&&V.key==="k"&&(V.preventDefault(),c(ke=>!ke),i||m(false)),V.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),react.useEffect(()=>{if(!i)return;let B=ke=>{let F=ke.target;I.current&&!I.current.contains(F)&&c(false);},V=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(V),document.removeEventListener("mousedown",B);}},[i]),!Ce)return null;let Ke={"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(Ot,{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 ${Ke[P]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ae,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${he}`,color:"#2E94FF",cursor:"pointer",boxShadow:$e,overflow:"visible"},onClick:()=>c(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ne}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(nm,{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:ue,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${rt}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Pe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let b=t.find(h=>h.id===g);if(b){o(b);let h=r.get(g)?.ef||0;d=Math.max(d,h);}}let m=d+u;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),m=s;if(d.length>0)for(let b of d){l(b);let h=n.get(b.id)?.ls||0;m=Math.min(m,h);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let m=d.ls-u.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Pe.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let b=s.get(g);b&&b.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,c=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let b=Pe.calculateDuration(g.startDate,g.endDate),h=0;if(g.dependencies)for(let f of g.dependencies){let y=l.get(f);y&&(h=Math.max(h,y.ef));}l.set(m,{es:h,ef:h+b});let v=s.get(m)||[];for(let f of v){let y=(n.get(f)||1)-1;n.set(f,y),y===0&&i.push(f);}}if(c.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let b=o.get(g);if(!b||!b.startDate||!b.endDate)continue;let h=Pe.calculateDuration(b.startDate,b.endDate),v=s.get(g)||[],f=u;if(v.length>0)for(let y of v){let w=d.get(y);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-h,lf:f});}for(let m of c){let g=l.get(m),b=d.get(m),h=b.ls-g.es,v=s.get(m)||[],f;v.length>0?f=Math.min(...v.map(y=>l.get(y).es))-g.ef:f=u-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:b.ls,lateFinish:b.lf,totalFloat:Math.round(h*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:h<=.01});}return t},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let l=Pe.getLatestEndDate(e);if(!l)return null;let c=Pe.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Pe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Pe.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=Pe.calculateDuration(c.startDate,c.endDate),u;if(a!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let g=new Date(s.endDate),b=new Date(g);b.setDate(b.getDate()+1),u<b&&(u=b);}let d=Pe.calculateEndDate(u,i),m=g=>g.map(b=>b.id===c.id?{...b,startDate:u,endDate:d}:b.subtasks?{...b,subtasks:m(b.subtasks)}:b);l=m(l),l=Pe.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,d=Pe.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,b,h=new Set)=>{if(h.has(g))return;h.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let y=r.findIndex(A=>A.id===f.id);if(y===-1)continue;let w=f.startDate.getTime(),C=(f.endDate.getTime()-w)/u,D=(w-i)/u*s,T=D+b*s,B=Math.max(C*s,s),$=l+y*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:T,width:B,y:$,rowIndex:y,daysDelta:b,color:f.color}),m(f.id,b,h);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function hi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:b,onDependencyCreate:h,onDependencyDelete:v,showBaseline:f,showCriticalPath:y=true,showDependencies:w=true,highlightWeekends:x=true,canEditTask:C}){let D=Er(),T=react.useRef(null),[B,$]=react.useState([]),[A,_]=react.useState(null),[E,ue]=react.useState(null),[L,X]=react.useState(null),ee=react.useRef(false),[$e,R]=react.useState(new Set),[Y,be]=react.useState(null),_e=react.useCallback(H=>{if(L&&!ee.current){let ie=H.target,N=false;for(;ie&&ie!==H.currentTarget;){if(ie.getAttribute?.("data-dependency-line")==="true"||ie.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}ie=ie.parentElement;}N||X(null);}},[L]),z=react.useCallback(H=>{ue(H);},[]),oe=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Ae=oe*J*n,xe=H=>{let ie=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=ie.getUTCDay()||7;ie.setUTCDate(ie.getUTCDate()+4-N);let j=new Date(Date.UTC(ie.getUTCFullYear(),0,1));return Math.ceil(((ie.getTime()-j.getTime())/864e5+1)/7)},He=H=>{let ie=H.getDay();return ie===0||ie===6},Ne=react.useCallback(H=>{let ie=Math.round(H/(J*n)),N=new Date(o);return N.setDate(N.getDate()+ie),N},[o,J,n]),at=react.useCallback((H,ie)=>{if(ie.startDate&&ie.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let j=N.createSVGPoint();j.x=H.clientX,j.y=H.clientY;let le=j.matrixTransform(N.getScreenCTM()?.inverse()),Ce=Ne(le.x),W=new Date(Ce);W.setDate(W.getDate()+1),be(null),b?.(ie,Ce,W);},[Ne,b]),te=react.useCallback((H,ie,N)=>{let j=H.currentTarget.ownerSVGElement;if(!j)return;let le=j.createSVGPoint();le.x=H.clientX,le.y=H.clientY;let Ce=le.matrixTransform(j.getScreenCTM()?.inverse()),W=Ne(Ce.x),Ue=Math.round(Ce.x/(J*n))*J*n;be({taskId:ie.id,x:Ue,y:N*a+a/2,date:W});},[Ne,J,n,a]),rt=react.useCallback(()=>{be(null);},[]),pe=react.useMemo(()=>{let H=le=>le.map(Ce=>{if(Ce.subtasks&&Ce.subtasks.length>0){let W=H(Ce.subtasks),ae=W.filter(Ue=>Ue.startDate&&Ue.endDate);if(ae.length>0){let Ue=ae.map(je=>je.startDate.getTime()),Te=ae.map(je=>je.endDate.getTime()),Be=new Date(Math.min(...Ue)),De=new Date(Math.max(...Te));return {...Ce,subtasks:W,startDate:Be,endDate:De}}return {...Ce,subtasks:W}}return Ce}),ie=(le,Ce=[])=>{let W=[...le].sort((ae,Ue)=>(ae.position??0)-(Ue.position??0));for(let ae of W)Ce.push(ae),ae.subtasks&&ae.subtasks.length>0&&(ae.isExpanded===void 0||ae.isExpanded)&&ie(ae.subtasks,Ce);return Ce},N=H(e);return ie(N)},[e]),ot=react.useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let ie=H.startDate.getTime(),N=H.endDate.getTime(),j=o.getTime(),le=(ie-j)/(1e3*60*60*24),Ce=(N-ie)/(1e3*60*60*24)+1,W=le*J*n,ae=Math.max(J*n,40),Ue=Math.max(Ce*J*n,ae);return {x:W,width:Ue}},[o,J,n]),gt=react.useMemo(()=>pe.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:ie,width:N}=ot(H),le=pe.findIndex(Ce=>Ce.id===H.id)*a+(a-18)/2;return {id:H.id,x:ie,y:le,width:N,height:18}}),[pe,ot]),Ct=react.useCallback((H,ie,N)=>{if(!N){$([]),_(null);return}if(_({taskId:H,daysDelta:ie}),ie===0){$([]);return}let j=Pe.calculateCascadePreview(e,H,ie,pe,o,J*n,a,48);$(j);},[e,pe,o,J,n,a,48]),ye=react.useCallback((H,ie)=>{if(!A)return ie;let N=J*n,j=A.daysDelta*N;if(H===A.taskId)return {x:ie.x+j,width:ie.width};let le=B.find(Ce=>Ce.taskId===H);return le?{x:le.previewX,width:le.width}:ie},[A,B,J,n]),ft=react.useMemo(()=>{let H=[],ie=new Date(o);for(;ie<=s;){let le=(ie.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(ie),label:ie.toLocaleDateString(l,{day:"numeric",month:"short"}),x:le}),ie.setDate(ie.getDate()+1);else if(r==="week"){let Ce=xe(ie);H.push({date:new Date(ie),label:`${D.labels.week} ${Ce}`,x:le}),ie.setDate(ie.getDate()+7);}else H.push({date:new Date(ie),label:ie.toLocaleDateString(l,{month:"short",year:"numeric"}),x:le}),ie.setMonth(ie.getMonth()+1);}return H},[o,s,r,J,n,l,D.labels.week]),tt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),Qe=Math.max(pe.length*a,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(Ae,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ae,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ft.map((H,ie)=>jsxRuntime.jsxs("g",{children:[ie>0&&jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${ie}`)),tt>=0&&tt<=Ae&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${tt-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:T,width:Math.max(Ae,1e3),height:Qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:_e,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:"#2E94FF",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(Ae,1e3),height:Qe,fill:t.bgPrimary}),pe.map((H,ie)=>jsxRuntime.jsx("rect",{x:0,y:ie*a,width:Math.max(Ae,1e3),height:a,fill:ie%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),ft.map((H,ie)=>ie>0?jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ie}`):null),x&&ft.map((H,ie)=>{let N=ft[ie+1]?.x||Ae;return He(H.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ie}`):null}),pe.map((H,ie)=>{let N=H.startDate&&H.endDate;return jsxRuntime.jsx("g",{children:!N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ie*a,width:Ae,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>at(j,H),onMouseMove:j=>te(j,H,ie),onMouseLeave:()=>{rt();}},`clickable-${H.id}`),Y&&Y.taskId===H.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:Y.x,y1:ie*a+4,x2:Y.x,y2:ie*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${Y.x}, ${ie*a-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:Y.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Y||Y.taskId!==H.id)&&jsxRuntime.jsx("text",{x:tt>0?tt:100,y:ie*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),pe.map((H,ie)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:j}=ot(H),le=ie*a+(a-18)/2,Ce=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsxRuntime.jsx(fi,{task:H,x:N+j/2,y:le+12,theme:t,onClick:d},H.id);if(Ce){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ae=8,Ue=le+(a-18)/2+(18-ae)/2,Te=4,Be=H.progress||0,De=new Date;De.setHours(0,0,0,0);let je=H.startDate&&De>=H.startDate,ut=H.endDate&&(()=>{let dt=new Date(H.endDate);return dt.setHours(0,0,0,0),De>dt})(),mt=H.startDate&&De<H.startDate,Ze=1;if(je&&H.startDate&&H.endDate&&!mt){let dt=new Date(H.startDate);dt.setHours(0,0,0,0);let Ft=new Date(H.endDate);Ft.setHours(0,0,0,0);let ze=Math.max(1,(Ft.getTime()-dt.getTime())/(1e3*60*60*24)),ct=Math.min((De.getTime()-dt.getTime())/(1e3*60*60*24),ze)/ze*100;Ze=ct>0?Be/ct:1;}let et;Be>=100?et="#00E5CC":mt?et="#4B5563":ut&&Be<100?et="#EF4444":Ze>=.95?et="#22C55E":Ze>=.8?et="#F59E0B":et="#EF4444";let It=Math.max(Be/100*j,Be>0?Te*2:0),Tt=j>100&&Be>0,bt=H.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(H),onContextMenu:dt=>{dt.preventDefault(),dt.stopPropagation(),g?.(H,dt);},onMouseMove:dt=>{z({task:H,x:N,y:Ue,width:j,height:ae,showBelow:Ue<100,mouseX:dt.clientX,mouseY:dt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:y?bt?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:N,y:le,width:j,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:N,y:Ue,width:j,height:ae,rx:Te,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Be>0&&jsxRuntime.jsx("rect",{x:N,y:Ue,width:It,height:ae,rx:Te,fill:et}),y&&bt&&jsxRuntime.jsx("rect",{x:N,y:Ue,width:j,height:ae,rx:Te,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Tt&&jsxRuntime.jsxs("text",{x:N+It+6,y:Ue+ae/2,dominantBaseline:"central",fill:W?"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(Be),"%"]})]},H.id)}return jsxRuntime.jsx(ci,{task:H,x:N,y:le,width:j,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:b,onDependencyCreate:h,allTaskPositions:gt,onDragMove:Ct,onHoverChange:z,showBaseline:f,showTaskBarLabels:u,showCriticalPath:y,readOnly:C?!C(H):false},H.id)}),w&&pe.map((H,ie)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let j=pe.find(et=>et.id===N);if(!j||!j.startDate||!j.endDate)return null;let le=pe.findIndex(et=>et.id===N),Ce=ye(j.id,ot(j)),W=ye(H.id,ot(H)),ae=Ce.x+Ce.width,Ue=le*a+26,Te=W.x,Be=ie*a+26,De=`dep-${N}-${H.id}`;if($e.has(De))return null;let je=y&&H.isCriticalPath&&j.isCriticalPath;return jsxRuntime.jsx(Jn,{x1:ae,y1:Ue,x2:Te,y2:Be,theme:t,lineStyle:i,colorOverride:y?je?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?je?2:1:void 0,glowFilter:je?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.(H.id,N),onHoverChange:et=>{ee.current=et,et&&X({key:De,fromId:N,toId:H.id,exitX:ae,exitY:Ue,enterX:Te,enterY:Be});}},De)})),B.map(H=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsxRuntime.jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),w&&L&&jsxRuntime.jsx(Jn,{x1:L.exitX,y1:L.exitY,x2:L.enterX,y2:L.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=L.key;X(null),ee.current=false,R(ie=>new Set(ie).add(H)),v?.(L.toId,L.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{ee.current=H,H||X(null);}},`${L.key}-hover-overlay`),tt>=0&&tt<=Ae&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsxRuntime.jsx(am,{tooltipData:E,theme:t,locale:l==="es"?"es":"en"})]})}var xv=['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"'],nm=({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"})}),vv=()=>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"})}),wv=()=>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"})}),kv=()=>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"})}),Cv=()=>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 vi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=react.useState(false),[d,m]=react.useState(false),[g,b]=react.useState([]),[h,v]=react.useState(""),[f,y]=react.useState(false),[w,x]=react.useState(true),[C,k]=react.useState(""),[D,T]=react.useState(-1),[B,$]=react.useState(false),[A,_]=react.useState(0),E=react.useRef(null),ue=react.useRef(null),L=react.useRef(null),X=react.useRef(null),{enabled:ee=true,placeholder:$e='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:Y,suggestions:be=xv,maxHistory:_e=50,persistHistory:z,mentionableUsers:oe=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ae=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",xe=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",He=J?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ne=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",at=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",te=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",rt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",ot=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",gt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ct=J?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",ye=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ft=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Qe=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ie=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",j=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",le=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ce="rgba(46, 148, 255, 0.04)",W=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ae=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Te=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Be=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",De=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",je=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ut=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",mt="rgba(46, 148, 255, 0.06)",Ze=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",It=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Tt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",bt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",yt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",dt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ft=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",ze=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Re=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ct=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",se=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",P=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=z?.storageKey||"gantt-ai-history",de=z?.maxMessages??5,Se=oe.filter(I=>{if(!C)return true;let G=C.toLowerCase();return I.name.toLowerCase().includes(G)||I.email&&I.email.toLowerCase().includes(G)}).slice(0,5),Ke=react.useCallback(I=>{if(v(I),oe.length===0)return;let G=E.current;if(!G)return;let he=G.selectionStart||I.length,F=I.slice(0,he),re=F.lastIndexOf("@");if(re>=0&&((re>0?F[re-1]:" ")===" "||re===0)){let qe=F.slice(re+1);if(qe.length<=40){k(qe),T(re),$(true),_(0);return}}$(false),k(""),T(-1);},[oe.length]),We=react.useCallback(I=>{let G=h.slice(0,D),he=h.slice(D+1+C.length),F=`${G}@${I.name} ${he}`;v(F),$(false),k(""),T(-1),setTimeout(()=>E.current?.focus(),0);},[h,D,C]),S=react.useCallback(I=>{if(!B||Se.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),_(G=>G<Se.length-1?G+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),_(G=>G>0?G-1:Se.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let G=Se[A];return G&&We(G),true}return I.key==="Escape"?($(false),true):false},[B,Se,A,We]);react.useEffect(()=>{if(z?.enabled)try{let I=localStorage.getItem(q);if(I){let he=JSON.parse(I).map(F=>({...F,timestamp:new Date(F.timestamp)}));b(he.slice(-de));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[z?.enabled,q,de]),react.useEffect(()=>{if(z?.enabled&&g.length>0)try{let I=g.filter(G=>!G.isLoading).slice(-de);localStorage.setItem(q,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,z?.enabled,q,de]),react.useEffect(()=>{ue.current&&ue.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[i,d]);let Z=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&l?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&c?.(I.taskId,I.dependencyFrom);break}},[o,s,n,l,c]),me=react.useCallback(async I=>{if(!I.trim()||f)return;let G={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};b(F=>[...F.slice(-(_e-1)),G]),v(""),x(false),y(true);let he={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(F=>[...F,he]);try{if(Y){let F=await Y(I,e);b(re=>{let Le=re.filter(qt=>!qt.isLoading),qe={id:`assistant-${Date.now()}`,role:"assistant",content:F.message,timestamp:new Date,command:F};return [...Le,qe]}),Z(F);}else b(F=>[...F.filter(Le=>!Le.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(F){b(re=>[...re.filter(qe=>!qe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${F instanceof Error?F.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[f,_e,Y,e,Z]),Ee=I=>{I.preventDefault(),me(h);},Je=I=>{v(I),E.current?.focus();};if(react.useEffect(()=>{let I=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),u(he=>!he),i||m(false)),G.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[i]),react.useEffect(()=>{if(!i)return;let I=he=>{let F=he.target;L.current&&!L.current.contains(F)&&u(false);},G=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(G),document.removeEventListener("mousedown",I);}},[i]),!ee)return null;let Ye={"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(Ot,{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 ${Ye[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ae,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${xe}`,color:"#2E94FF",cursor:"pointer",boxShadow:He,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ne}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(nm,{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:pe,background:te,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${rt}`},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:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ke[P]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ot,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${gt}`,boxShadow:Ct},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:be,borderBottom:`1px solid ${ft}`},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:tt,border:`1px solid ${Qe}`,color:"#2E94FF"},children:jsxRuntime.jsx(nm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:B=>{B.currentTarget.style.background=K,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=se;},children:jsxRuntime.jsx(wv,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:B=>{B.currentTarget.style.background=K,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=se;},children:jsxRuntime.jsx(vv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&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:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:fe.slice(0,4).map((B,V)=>jsxRuntime.jsx("button",{onClick:()=>qe(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:we,color:te,border:`1px solid ${W}`},onMouseEnter:ke=>{ke.currentTarget.style.borderColor=ze,ke.currentTarget.style.color="#2E94FF";},onMouseLeave:ke=>{ke.currentTarget.style.borderColor=W,ke.currentTarget.style.color=te;},children:B.length>30?B.slice(0,30)+"...":B},V))})]}),g.map(B=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?Te:De,color:B.role==="user"?"#2E94FF":ut,border:B.role==="user"?`1px solid ${Ie}`:`1px solid ${_e}`},children:[B.isLoading?jsxRuntime.jsx(kv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsxRuntime.jsx("div",{ref:ce})]}),jsxRuntime.jsxs("form",{onSubmit:B=>{if(R&&Se.length>0){B.preventDefault();return}Ee(B);},className:"p-3 relative",style:{borderTop:`1px solid ${mt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&Se.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:X,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ft,border:`1px solid ${He}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:Se.map((B,V)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ue(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:V===L?ct:"transparent",color:ne},onMouseEnter:()=>j(V),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:A,border:`1px solid ${Y}`,color:"#2E94FF"},children:B.name.split(" ").map(ke=>ke[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:B.name}),B.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:ge},children:B.email})]})]},B.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Ze,border:`1px solid ${et}`},children:[jsxRuntime.jsx("input",{ref:E,type:"text",value:h,onChange:B=>je(B.target.value),onKeyDown:B=>{S(B);},placeholder:Xe,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:It,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!h.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:h.trim()?Tt:"transparent",color:h.trim()?"#2E94FF":yt,border:h.trim()?`1px solid ${bt}`:"1px solid transparent"},children:jsxRuntime.jsx(xv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:dt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function sm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!c)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function im({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=l?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&u&&n.key==="y"){n.preventDefault(),t();return}if(l&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Dv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function lm(e){return {...Dv,...e}}var Iv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},um=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:u=true,showExportButton:i=true,projectName:c,availableUsers:d=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:b,persistFilter:h,clearFiltersKey:v,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:x=false,createTaskLabel:k,onCreateTask:C,taskFilter:D,onTaskFilterChange:T,toolbarRightContent:R,showBaseline:$,viewMode:L,onViewModeChange:j,projectForecast:E,onThemeChange:ce,onTaskClick:I,onTaskDblClick:X,onTaskContextMenu:Ce,onTaskUpdate:Xe,onDependentTasksScheduled:P,onProgressChange:G,onTaskEdit:fe,onTaskAddSubtask:Ve,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Ae,onBeforeTaskAdd:he,onAfterTaskAdd:$e,onBeforeTaskUpdate:Ne,onAfterTaskUpdate:at,onBeforeTaskDelete:ee,onAfterTaskDelete:rt,permissions:ue,onCopySnapshotLink:ot}=a,Ct=react.useContext(Xs)?.theme,[be,ft]=react.useState(Ct||s||"dark"),[tt,Qe]=react.useState(n),[H,se]=react.useState(l),[N,K]=react.useState(1),[ie,we]=react.useState("all"),[W,te]=react.useState(L||"execution"),ze=L??W,Te=react.useCallback(M=>{te(M),j?.(M);},[j]),Ie=$??ze==="oracle",[De,_e]=react.useState(a.showCriticalPath!==false),[ut,mt]=react.useState(a.showDependencies!==false),[Ze,et]=react.useState(a.highlightWeekends!==false),It=react.useCallback(M=>{_e(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),Tt=react.useCallback(M=>{mt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),bt=react.useCallback(M=>{et(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(tt);},[tt]),react.useEffect(()=>{a.onZoomChange?.(N);},[N]);let yt=react.useRef(a.onDateRangeChange);yt.current=a.onDateRangeChange;let dt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ft,He]=react.useState(()=>{if(!h)return "all";try{let M=typeof h=="string"?h:"gantt-filter-state",O=localStorage.getItem(M);if(O){let _=JSON.parse(O);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Be=D??Ft,ct=T??He,[ne,ge]=react.useState(()=>{if(!h)return false;try{let M=typeof h=="string"?h:"gantt-filter-state",O=localStorage.getItem(M);if(O){let _=JSON.parse(O);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=dt();if(M)try{let O={taskFilter:Be,hideCompleted:ne};localStorage.setItem(M,JSON.stringify(O));}catch(O){console.warn("[GanttBoard] Error saving filter state to localStorage:",O);}},[Be,ne,dt]);let A=react.useRef(v);react.useEffect(()=>{if(A.current!==v&&v!==void 0){He("all"),ge(false);let M=dt();if(M)try{localStorage.removeItem(M);}catch(O){console.warn("[GanttBoard] Error clearing filter state from localStorage:",O);}}A.current=v;},[v,dt]);let[Y,q]=react.useState(0),[le,Se]=react.useState(false),[je,Ue]=react.useState(null),[S,Z]=react.useState({isOpen:false,x:0,y:0,task:null}),[pe,Ee]=react.useState(null),[qe,Ke]=react.useState(null);react.useEffect(()=>{Ct&&Ct!==be&&ft(Ct);},[Ct]),react.useEffect(()=>{s&&s!==be&&ft(s);},[s]);let B=react.useCallback(M=>{ft(M),ce?.(M);},[ce]),{state:V,setState:ke,undo:F,redo:ae,canUndo:Re,canRedo:Je,clearHistory:qt}=sm(t,50),Bt=react.useMemo(()=>{let M=(O,_=0)=>{let Q=_;for(let xe of O)xe.subtasks?.length&&(Q=Math.max(Q,M(xe.subtasks,_+1)));return Q};return M(V)+1},[V]),Da=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),Ba=react.useRef(new Map),Ra=react.useRef(false);if(!Ra.current&&b){Ra.current=true;let M=typeof b=="string"?b:"gantt-expanded-tasks";try{let O=localStorage.getItem(M);if(O){let _=JSON.parse(O);Array.isArray(_)&&(Ba.current=new Map(_));}}catch(O){console.warn("[GanttBoard] Error loading expanded state from localStorage:",O);}}let fa=react.useCallback(()=>{let M=Da();if(M)try{let O=Array.from(Ba.current.entries());localStorage.setItem(M,JSON.stringify(O));}catch(O){console.warn("[GanttBoard] Error saving expanded state to localStorage:",O);}},[Da]),ir=react.useRef(0),Ec=react.useRef(V);react.useEffect(()=>{Ec.current=V;},[V]);let jo=react.useRef(false),Fc=react.useCallback(M=>{we(M),ir.current+=1,ke(O=>{let _=(xe,Me=0)=>xe.map(xt=>{let nt=M==="all"||Me<M-1;return xt.subtasks?.length&&Ba.current.set(xt.id,nt),{...xt,isExpanded:nt,subtasks:xt.subtasks?_(xt.subtasks,Me+1):void 0}}),Q=_(O);return fa(),Q});},[ke,fa]);react.useEffect(()=>{if(ir.current>0){ir.current-=1;return}let M=_=>{let Q=new Map;for(let xe of _){let Me=xe.id;Q.get(Me)||Q.set(Me,xe);}return Array.from(Q.values())},O=_=>_.map(Q=>{let xe=Ba.current.get(Q.id),Me=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Me.subtasks?.length){let xt=M(Me.subtasks);return {...Me,subtasks:O(xt)}}return Me});if(Ba.current.size>0)ke(yr(O(t)));else {let _=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:M(_(xe.subtasks))}:xe);ke(yr(_(t)));}},[t,ke]);let fs=react.useRef(t),Mc=react.useRef(true);react.useEffect(()=>{if(Mc.current){Mc.current=false,fs.current=V;return}if(jo.current){jo.current=false,fs.current=V;return}if(!r)return;let M=JSON.stringify(fs.current),O=JSON.stringify(V);M!==O&&(fs.current=V,r(V));},[V,r]);let _a=react.useMemo(()=>od(y,w),[y,w]),U0=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}],[]),[Ko,Ki]=react.useState(()=>U0(_a));react.useEffect(()=>{Ki(M=>M.map(O=>({...O,label:_a.columns[O.id==="name"?"taskName":O.id]||O.label})));},[_a]);let bs=react.useMemo(()=>Ko.filter(O=>O.visible).reduce((O,_)=>O+_.width,0),[Ko]),Pc=react.useRef(Ko.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=Ko.filter(Q=>Q.visible),O=M.map(Q=>Q.id).join(","),_=Pc.current;if(O!==_){let Q=M.some(Me=>Me.id!=="name"),xe=_.includes(",");Q?!xe&&Q&&Ue(null):Ue(null),Pc.current=O;}},[Ko]);let Ac=60,Lc=.6,W0=react.useMemo(()=>{let O=bs+Ac,_=typeof window<"u"?window.innerWidth*Lc:800,Q=Math.max(O,_);return je!==null?Math.max(200,Math.min(je,Q)):Math.max(200,O)},[je,bs]),ro=react.useRef(null),hs=react.useRef(null),Br=react.useRef(null),En=react.useRef(null),Zt=react.useMemo(()=>Fp(be),[be]),G0=react.useMemo(()=>({theme:Zt,themeName:be}),[Zt,be]),Ic=react.useMemo(()=>lm(m),[m]),Yi=react.useMemo(()=>{if(!g)return V;let M=Pe.calculateCriticalPathFull(V),O=_=>_.map(Q=>{let xe=M.get(Q.id),Me=Q.subtasks?O(Q.subtasks):void 0,xt=Me?.some(la=>la.isCriticalPath||la.subtasks&&la.subtasks.some(Rt=>Rt.isCriticalPath))||false,nt=xe?xe.isCritical:xt;return {...Q,isCriticalPath:nt,cpmData:xe||void 0,subtasks:Me}});return O(V)},[V,g]),V0=react.useMemo(()=>Pe.flattenTasks(V).some(O=>O.dependencies&&O.dependencies.length>0),[V]),Bc=react.useMemo(()=>{if(Be==="all"&&!ne)return Yi;let M=O=>{let _=[];for(let Q of O){let xe=Q.subtasks?.length?M(Q.subtasks):void 0,Me=false;if(ne)Me=Q.progress<100;else switch(Be){case "all":Me=true;break;case "incomplete":Me=Q.progress<100;break;case "in_progress":Me=Q.progress>0&&Q.progress<100;break;case "completed":Me=Q.progress===100;break}(Me||xe&&xe.length>0)&&_.push({...Q,subtasks:xe});}return _};return M(Yi)},[Yi,Be,ne]),ys=Iv(H);im({undo:F,redo:ae,canUndo:Re,canRedo:Je,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>Pe.findTaskById(V,M),addTask:(M,O)=>{ke(_=>{if(!O)return [..._,{...M,level:0}];let Q=xe=>xe.map(Me=>Me.id===O?{...Me,subtasks:[...Me.subtasks||[],{...M,parentId:O,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(_)});},updateTask:(M,O)=>{ke(_=>{let Q=xe=>xe.map(Me=>Me.id===M?{...Me,...O}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(_)});},deleteTask:M=>{ke(O=>{let _=Q=>Q.filter(xe=>xe.id===M?false:(xe.subtasks&&(xe.subtasks=_(xe.subtasks)),true));return _(O)});},deleteTasks:M=>{ke(O=>ud(O,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let O=Pe.findTaskById(V,M);O&&a.onTaskDuplicate(O);}else ke(O=>Kn(O,[M]).tasks);},splitTask:(M,O,_=3)=>{ke(Q=>Pe.splitTask(Q,M,O,_));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(M,O)=>!Pe.validateDependencies(V,M,O),getAllTasks:()=>Pe.flattenTasks(V),getTasksByStatus:M=>Pe.flattenTasks(V).filter(O=>O.status===M),getTasksByParent:M=>M?Pe.findTaskById(V,M)?.subtasks||[]:V.filter(_=>!_.parentId),getCriticalPath:()=>Pe.flattenTasks(V).filter(M=>M.isCriticalPath),indentTask:M=>{ke(O=>yr(ld(O,[M])));},outdentTask:M=>{ke(O=>yr(dd(O,[M])));},moveTask:(M,O)=>{ke(_=>cd(_,[M],O));},createSubtask:async M=>{let{tasks:O,newTask:_}=gd(V,M);if(he){let Q=he({..._,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}ke(yr(O)),$e&&$e({..._,parentId:M});},scrollToTask:M=>{let _=Pe.flattenTasks(V).findIndex(Q=>Q.id===M);if(_!==-1&&ro.current){let Q=_*ys;ro.current.scrollTo({top:Q,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,O=2e3)=>{},expandTask:M=>{ke(O=>{let _=Q=>Q.map(xe=>xe.id===M?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:_(xe.subtasks)}:xe);return _(O)});},collapseTask:M=>{ke(O=>{let _=Q=>Q.map(xe=>xe.id===M?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:_(xe.subtasks)}:xe);return _(O)});},expandAll:()=>{ke(M=>{let O=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?O(Q.subtasks):void 0}));return O(M)});},collapseAll:()=>{ke(M=>{let O=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?O(Q.subtasks):void 0}));return O(M)});},collapseToLevel:M=>{Fc(M);},undo:F,redo:ae,canUndo:()=>Re,canRedo:()=>Je,clearHistory:qt,exportToPNG:async()=>{if(!En.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let M=En.current,O=ro.current,_=hs.current||O.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=_?.scrollTop||0,Me=Q.scrollTop,xt=M.style.overflow,nt=M.style.height,la=O.style.overflow;try{let Rt=_?.querySelector(".gantt-taskgrid-content"),Xt=Q.querySelector("svg"),Ga=Rt?.scrollHeight||_?.scrollHeight||600,lr=Xt?.getBoundingClientRect().height||Q.scrollHeight,No=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Ga,lr)+20;_&&(_.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${No}px`,O.style.overflow="visible",await new Promise(Qo=>setTimeout(Qo,100));let Rr=await htmlToImage.toPng(M,{backgroundColor:Zt.bgPrimary,pixelRatio:2,filter:Qo=>{if(!(Qo instanceof Element))return !0;let xs=window.getComputedStyle(Qo),Mn=parseInt(xs.zIndex,10);return (isNaN(Mn)||Mn<50)&&xs.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{M.style.overflow=xt,M.style.height=nt,O.style.overflow=la,_&&(_.scrollTop=xe),Q.scrollTop=Me;}},exportToPDF:async M=>{await Pe.exportToPDF(V,M);},exportToExcel:async M=>{await Pe.exportToExcel(V,M);},exportToJSON:()=>Pe.exportToJSON(V),exportToCSV:()=>Pe.exportToCSV(V),importFromJSON:M=>{let O=Pe.importFromJSON(M);ke(O);},getTasks:()=>V,refresh:()=>{ke(M=>[...M]);},clearAll:()=>{ke([]);}}),[V,F,ae,Re,Je,qt,Zt,ys]);let _0=react.useCallback(M=>{Ki(O=>O.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),j0=react.useCallback((M,O)=>{Ki(_=>_.map(Q=>{if(Q.id!==M)return Q;let xe=Q.minWidth??100,Me=Q.maxWidth??800,xt=Math.max(xe,Math.min(Me,O));return {...Q,width:xt}}));},[]),K0=react.useCallback(M=>{ke(O=>{let _=md(O,M),Q=xe=>{for(let Me of xe){if(Me.id===M){Ba.current.set(M,Me.isExpanded??true);return}Me.subtasks?.length&&Q(Me.subtasks);}};return Q(_),fa(),_}),a.onTaskToggleExpand?.(M);},[a,fa]),Yo=react.useCallback((M,O)=>{if(Ne&&Ne(M,O)===false)return;let Q=Pe.findTaskById(V,M)?.progress,xe=xt=>xt.map(nt=>nt.id===M?{...nt,...O}:nt.subtasks?{...nt,subtasks:xe(nt.subtasks)}:nt);ke(xe(V));let Me=Pe.findTaskById(xe(V),M);Me&&(Xe?.(Me),at?.(Me),O.progress!==void 0&&Q!==void 0&&O.progress!==Q&&G?.(M,Q,O.progress));},[V,Xe,Ne,at,G]),Y0=react.useCallback(M=>{M.length!==0&&(ir.current+=1,jo.current=true,ke(O=>yr(ld(O,M))),a.onTaskIndent?.(M[0]));},[a]),q0=react.useCallback(M=>{M.length!==0&&(ir.current+=1,jo.current=true,ke(O=>yr(dd(O,M))),a.onTaskOutdent?.(M[0]));},[a]),X0=react.useCallback((M,O,_)=>{ir.current+=1,jo.current=true,ke(Q=>yr(Kp(Q,M,O,_))),a.onTaskReparent?.(M,O,_);},[a]),J0=react.useCallback((M,O)=>{M.length!==0&&(ir.current+=1,jo.current=true,ke(_=>cd(_,M,O)),a.onTaskMove?.(M[0],O));},[a]),qi=react.useCallback(async M=>{let O=[];for(let _ of M)ee&&await Promise.resolve(ee(_))===false||O.push(_);O.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(O):(ke(_=>yr(ud(_,O))),O.forEach(_=>a.onTaskDelete?.(_))),rt&&O.forEach(_=>rt(_)));},[a,ee,rt]),Q0=react.useCallback(M=>{a.onTaskDuplicate?M.forEach(O=>{let _=Pe.findTaskById(V,O);_&&a.onTaskDuplicate(_);}):ke(O=>Kn(O,M).tasks);},[a,V]),Z0=react.useCallback((M,O)=>{ke(_=>{let{tasks:Q,newTask:xe}=jp(_,M,O);return he&&he(xe)===false?_:(a.onTaskCreate?.(xe.parentId,xe.position||0),$e?.(xe),Q)});},[a,he,$e]),ef=react.useCallback((M,O)=>{ke(_=>pd(_,M,O)),a.onTaskRename?.(M,O);},[a]),Xi=react.useCallback(M=>{let{onTaskAddSubtask:O}=a;if(O){let _=ri(V,M);if(_){O(_);return}}ke(_=>{let{tasks:Q}=gd(_,M);return a.onTaskCreate?.(M,0),Q});},[a,V]),tf=react.useCallback((M,O,_)=>{let Q=!M.startDate&&!M.endDate,xe=M.startDate?Math.round((O.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Me=Rt=>Rt.map(Xt=>Xt.id===M.id?{...Xt,startDate:O,endDate:_,...M.segments&&{segments:M.segments}}:Xt.subtasks?{...Xt,subtasks:Me(Xt.subtasks)}:Xt),xt=Me(V),nt=xt;xt=Pe.autoScheduleDependents(xt,M.id,xe),xt=yr(xt),ke(xt);let la={...M,startDate:O,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,O,_):Xe?.(la),P&&xe!==0){let Rt=Pe.flattenTasks(nt),Xt=Pe.flattenTasks(xt),Ga=[];for(let lr of Xt){if(lr.id===M.id)continue;let oo=Rt.find(Rr=>Rr.id===lr.id);if(!oo)continue;let Jo=lr.startDate?.getTime()!==oo.startDate?.getTime(),No=lr.endDate?.getTime()!==oo.endDate?.getTime();(Jo||No)&&Ga.push(lr);}Ga.length>0&&P(Ga);}},[V,Xe,P,a]),af=react.useCallback((M,O)=>{Ce?.(M,O),Z({isOpen:true,x:O.clientX,y:O.clientY,task:M});},[Ce]),rf=react.useCallback((M,O)=>{let _=Pe.splitTask(V,M.id,O);ke(_),Z({isOpen:false,x:0,y:0,task:null});},[V]),Rc=react.useCallback(M=>{let O=Pe.findTaskById(V,M.id)||M;X?.(O),fe||Ee(O);},[V,X,fe]),Oc=react.useCallback((M,O,_)=>{let Q=new Map,xe=Rt=>{Rt.forEach(Xt=>{Xt.dependencies&&Q.set(Xt.id,Xt.dependencies),Xt.subtasks&&xe(Xt.subtasks);});};xe(_);let Me=Q.get(O)||[];Q.set(O,[...Me,M]);let xt=new Set,nt=new Set,la=Rt=>{if(!xt.has(Rt)){xt.add(Rt),nt.add(Rt);let Xt=Q.get(Rt)||[];for(let Ga of Xt){if(!xt.has(Ga)&&la(Ga))return true;if(nt.has(Ga))return true}}return nt.delete(Rt),false};return la(O)},[]),$c=react.useCallback((M,O)=>{if(Oc(M.id,O,Ec.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:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ye[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ot,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${gt}`,boxShadow:Ct},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ye,borderBottom:`1px solid ${ft}`},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:tt,border:`1px solid ${Qe}`,color:"#2E94FF"},children:jsxRuntime.jsx(nm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:ie},onMouseEnter:I=>{I.currentTarget.style.background=j,I.currentTarget.style.color=N;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=ie;},children:jsxRuntime.jsx(kv,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ie},onMouseEnter:I=>{I.currentTarget.style.background=j,I.currentTarget.style.color=N;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=ie;},children:jsxRuntime.jsx(wv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&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:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:le,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:be.slice(0,4).map((I,G)=>jsxRuntime.jsx("button",{onClick:()=>Je(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ce,color:ae,border:`1px solid ${W}`},onMouseEnter:he=>{he.currentTarget.style.borderColor=Ue,he.currentTarget.style.color="#2E94FF";},onMouseLeave:he=>{he.currentTarget.style.borderColor=W,he.currentTarget.style.color=ae;},children:I.length>30?I.slice(0,30)+"...":I},G))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?Te:De,color:I.role==="user"?"#2E94FF":ut,border:I.role==="user"?`1px solid ${Be}`:`1px solid ${je}`},children:[I.isLoading?jsxRuntime.jsx(Cv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:ue})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(B&&Se.length>0){I.preventDefault();return}Ee(I);},className:"p-3 relative",style:{borderTop:`1px solid ${mt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&Se.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:X,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ft,border:`1px solid ${ze}`,boxShadow:Re,backdropFilter:"blur(12px)"},children:Se.map((I,G)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>We(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:G===A?ct:"transparent",color:se},onMouseEnter:()=>_(G),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:P,border:`1px solid ${K}`,color:"#2E94FF"},children:I.name.split(" ").map(he=>he[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:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:fe},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Ze,border:`1px solid ${et}`},children:[jsxRuntime.jsx("input",{ref:E,type:"text",value:h,onChange:I=>Ke(I.target.value),onKeyDown:I=>{S(I);},placeholder:$e,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:It,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!h.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:h.trim()?Tt:"transparent",color:h.trim()?"#2E94FF":yt,border:h.trim()?`1px solid ${bt}`:"1px solid transparent"},children:jsxRuntime.jsx(vv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:dt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function sm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!u)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function im({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Sv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function lm(e){return {...Sv,...e}}var Bv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},um=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,projectName:u,availableUsers:d=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:b,persistFilter:h,clearFiltersKey:v,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:x=false,createTaskLabel:C,onCreateTask:k,taskFilter:D,onTaskFilterChange:T,toolbarRightContent:B,showBaseline:$,viewMode:A,onViewModeChange:_,projectForecast:E,onThemeChange:ue,onTaskClick:L,onTaskDblClick:X,onTaskContextMenu:ee,onTaskUpdate:$e,onDependentTasksScheduled:R,onProgressChange:Y,onTaskEdit:be,onTaskAddSubtask:_e,onTaskMarkIncomplete:z,onTaskSetInProgress:oe,onDependencyCreate:J,onDependencyDelete:Ae,onBeforeTaskAdd:xe,onAfterTaskAdd:He,onBeforeTaskUpdate:Ne,onAfterTaskUpdate:at,onBeforeTaskDelete:te,onAfterTaskDelete:rt,permissions:pe,onCopySnapshotLink:ot}=a,Ct=react.useContext(Qs)?.theme,[ye,ft]=react.useState(Ct||s||"dark"),[tt,Qe]=react.useState(n),[H,ie]=react.useState(l),[N,j]=react.useState(1),[le,Ce]=react.useState("all"),[W,ae]=react.useState(A||"execution"),Ue=A??W,Te=react.useCallback(M=>{ae(M),_?.(M);},[_]),Be=$??Ue==="oracle",[De,je]=react.useState(a.showCriticalPath!==false),[ut,mt]=react.useState(a.showDependencies!==false),[Ze,et]=react.useState(a.highlightWeekends!==false),It=react.useCallback(M=>{je(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),Tt=react.useCallback(M=>{mt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),bt=react.useCallback(M=>{et(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(tt);},[tt]),react.useEffect(()=>{a.onZoomChange?.(N);},[N]);let yt=react.useRef(a.onDateRangeChange);yt.current=a.onDateRangeChange;let dt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ft,ze]=react.useState(()=>{if(!h)return "all";try{let M=typeof h=="string"?h:"gantt-filter-state",O=localStorage.getItem(M);if(O){let V=JSON.parse(O);if(V.taskFilter)return V.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Re=D??Ft,ct=T??ze,[se,fe]=react.useState(()=>{if(!h)return false;try{let M=typeof h=="string"?h:"gantt-filter-state",O=localStorage.getItem(M);if(O){let V=JSON.parse(O);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=dt();if(M)try{let O={taskFilter:Re,hideCompleted:se};localStorage.setItem(M,JSON.stringify(O));}catch(O){console.warn("[GanttBoard] Error saving filter state to localStorage:",O);}},[Re,se,dt]);let P=react.useRef(v);react.useEffect(()=>{if(P.current!==v&&v!==void 0){ze("all"),fe(false);let M=dt();if(M)try{localStorage.removeItem(M);}catch(O){console.warn("[GanttBoard] Error clearing filter state from localStorage:",O);}}P.current=v;},[v,dt]);let[K,q]=react.useState(0),[de,Se]=react.useState(false),[Ke,We]=react.useState(null),[S,Z]=react.useState({isOpen:false,x:0,y:0,task:null}),[me,Ee]=react.useState(null),[Je,Ye]=react.useState(null);react.useEffect(()=>{Ct&&Ct!==ye&&ft(Ct);},[Ct]),react.useEffect(()=>{s&&s!==ye&&ft(s);},[s]);let I=react.useCallback(M=>{ft(M),ue?.(M);},[ue]),{state:G,setState:he,undo:F,redo:re,canUndo:Le,canRedo:qe,clearHistory:qt}=sm(t,50),Bt=react.useMemo(()=>{let M=(O,V=0)=>{let Q=V;for(let we of O)we.subtasks?.length&&(Q=Math.max(Q,M(we.subtasks,V+1)));return Q};return M(G)+1},[G]),Da=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),Ba=react.useRef(new Map),Ra=react.useRef(false);if(!Ra.current&&b){Ra.current=true;let M=typeof b=="string"?b:"gantt-expanded-tasks";try{let O=localStorage.getItem(M);if(O){let V=JSON.parse(O);Array.isArray(V)&&(Ba.current=new Map(V));}}catch(O){console.warn("[GanttBoard] Error loading expanded state from localStorage:",O);}}let ga=react.useCallback(()=>{let M=Da();if(M)try{let O=Array.from(Ba.current.entries());localStorage.setItem(M,JSON.stringify(O));}catch(O){console.warn("[GanttBoard] Error saving expanded state to localStorage:",O);}},[Da]),ir=react.useRef(0),Ec=react.useRef(G);react.useEffect(()=>{Ec.current=G;},[G]);let Ko=react.useRef(false),Fc=react.useCallback(M=>{Ce(M),ir.current+=1,he(O=>{let V=(we,Me=0)=>we.map(xt=>{let nt=M==="all"||Me<M-1;return xt.subtasks?.length&&Ba.current.set(xt.id,nt),{...xt,isExpanded:nt,subtasks:xt.subtasks?V(xt.subtasks,Me+1):void 0}}),Q=V(O);return ga(),Q});},[he,ga]);react.useEffect(()=>{if(ir.current>0){ir.current-=1;return}let M=V=>{let Q=new Map;for(let we of V){let Me=we.id;Q.get(Me)||Q.set(Me,we);}return Array.from(Q.values())},O=V=>V.map(Q=>{let we=Ba.current.get(Q.id),Me=we!==void 0?{...Q,isExpanded:we}:Q;if(Me.subtasks?.length){let xt=M(Me.subtasks);return {...Me,subtasks:O(xt)}}return Me});if(Ba.current.size>0)he(yr(O(t)));else {let V=Q=>Q.map(we=>we.subtasks?.length?{...we,subtasks:M(V(we.subtasks))}:we);he(yr(V(t)));}},[t,he]);let hs=react.useRef(t),Mc=react.useRef(true);react.useEffect(()=>{if(Mc.current){Mc.current=false,hs.current=G;return}if(Ko.current){Ko.current=false,hs.current=G;return}if(!r)return;let M=JSON.stringify(hs.current),O=JSON.stringify(G);M!==O&&(hs.current=G,r(G));},[G,r]);let _a=react.useMemo(()=>sd(y,w),[y,w]),W0=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}],[]),[Yo,qi]=react.useState(()=>W0(_a));react.useEffect(()=>{qi(M=>M.map(O=>({...O,label:_a.columns[O.id==="name"?"taskName":O.id]||O.label})));},[_a]);let ys=react.useMemo(()=>Yo.filter(O=>O.visible).reduce((O,V)=>O+V.width,0),[Yo]),Pc=react.useRef(Yo.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=Yo.filter(Q=>Q.visible),O=M.map(Q=>Q.id).join(","),V=Pc.current;if(O!==V){let Q=M.some(Me=>Me.id!=="name"),we=V.includes(",");Q?!we&&Q&&We(null):We(null),Pc.current=O;}},[Yo]);let Ac=60,Lc=.6,G0=react.useMemo(()=>{let O=ys+Ac,V=typeof window<"u"?window.innerWidth*Lc:800,Q=Math.max(O,V);return Ke!==null?Math.max(200,Math.min(Ke,Q)):Math.max(200,O)},[Ke,ys]),ro=react.useRef(null),xs=react.useRef(null),Br=react.useRef(null),Mn=react.useRef(null),Zt=react.useMemo(()=>Fp(ye),[ye]),V0=react.useMemo(()=>({theme:Zt,themeName:ye}),[Zt,ye]),Ic=react.useMemo(()=>lm(m),[m]),Xi=react.useMemo(()=>{if(!g)return G;let M=Pe.calculateCriticalPathFull(G),O=V=>V.map(Q=>{let we=M.get(Q.id),Me=Q.subtasks?O(Q.subtasks):void 0,xt=Me?.some(la=>la.isCriticalPath||la.subtasks&&la.subtasks.some(Rt=>Rt.isCriticalPath))||false,nt=we?we.isCritical:xt;return {...Q,isCriticalPath:nt,cpmData:we||void 0,subtasks:Me}});return O(G)},[G,g]),_0=react.useMemo(()=>Pe.flattenTasks(G).some(O=>O.dependencies&&O.dependencies.length>0),[G]),Bc=react.useMemo(()=>{if(Re==="all"&&!se)return Xi;let M=O=>{let V=[];for(let Q of O){let we=Q.subtasks?.length?M(Q.subtasks):void 0,Me=false;if(se)Me=Q.progress<100;else switch(Re){case "all":Me=true;break;case "incomplete":Me=Q.progress<100;break;case "in_progress":Me=Q.progress>0&&Q.progress<100;break;case "completed":Me=Q.progress===100;break}(Me||we&&we.length>0)&&V.push({...Q,subtasks:we});}return V};return M(Xi)},[Xi,Re,se]),vs=Bv(H);im({undo:F,redo:re,canUndo:Le,canRedo:qe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>Pe.findTaskById(G,M),addTask:(M,O)=>{he(V=>{if(!O)return [...V,{...M,level:0}];let Q=we=>we.map(Me=>Me.id===O?{...Me,subtasks:[...Me.subtasks||[],{...M,parentId:O,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(V)});},updateTask:(M,O)=>{he(V=>{let Q=we=>we.map(Me=>Me.id===M?{...Me,...O}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(V)});},deleteTask:M=>{he(O=>{let V=Q=>Q.filter(we=>we.id===M?false:(we.subtasks&&(we.subtasks=V(we.subtasks)),true));return V(O)});},deleteTasks:M=>{he(O=>md(O,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let O=Pe.findTaskById(G,M);O&&a.onTaskDuplicate(O);}else he(O=>qn(O,[M]).tasks);},splitTask:(M,O,V=3)=>{he(Q=>Pe.splitTask(Q,M,O,V));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(M,O)=>!Pe.validateDependencies(G,M,O),getAllTasks:()=>Pe.flattenTasks(G),getTasksByStatus:M=>Pe.flattenTasks(G).filter(O=>O.status===M),getTasksByParent:M=>M?Pe.findTaskById(G,M)?.subtasks||[]:G.filter(V=>!V.parentId),getCriticalPath:()=>Pe.flattenTasks(G).filter(M=>M.isCriticalPath),indentTask:M=>{he(O=>yr(cd(O,[M])));},outdentTask:M=>{he(O=>yr(ud(O,[M])));},moveTask:(M,O)=>{he(V=>pd(V,[M],O));},createSubtask:async M=>{let{tasks:O,newTask:V}=bd(G,M);if(xe){let Q=xe({...V,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}he(yr(O)),He&&He({...V,parentId:M});},scrollToTask:M=>{let V=Pe.flattenTasks(G).findIndex(Q=>Q.id===M);if(V!==-1&&ro.current){let Q=V*vs;ro.current.scrollTo({top:Q,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,O=2e3)=>{},expandTask:M=>{he(O=>{let V=Q=>Q.map(we=>we.id===M?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(O)});},collapseTask:M=>{he(O=>{let V=Q=>Q.map(we=>we.id===M?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(O)});},expandAll:()=>{he(M=>{let O=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?O(Q.subtasks):void 0}));return O(M)});},collapseAll:()=>{he(M=>{let O=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?O(Q.subtasks):void 0}));return O(M)});},collapseToLevel:M=>{Fc(M);},undo:F,redo:re,canUndo:()=>Le,canRedo:()=>qe,clearHistory:qt,exportToPNG:async()=>{if(!Mn.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let M=Mn.current,O=ro.current,V=xs.current||O.querySelector(".gantt-grid-scroll"),Q=Br.current,we=V?.scrollTop||0,Me=Q.scrollTop,xt=M.style.overflow,nt=M.style.height,la=O.style.overflow;try{let Rt=V?.querySelector(".gantt-taskgrid-content"),Xt=Q.querySelector("svg"),Ga=Rt?.scrollHeight||V?.scrollHeight||600,lr=Xt?.getBoundingClientRect().height||Q.scrollHeight,Do=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Ga,lr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${Do}px`,O.style.overflow="visible",await new Promise(Zo=>setTimeout(Zo,100));let Rr=await htmlToImage.toPng(M,{backgroundColor:Zt.bgPrimary,pixelRatio:2,filter:Zo=>{if(!(Zo instanceof Element))return !0;let ws=window.getComputedStyle(Zo),An=parseInt(ws.zIndex,10);return (isNaN(An)||An<50)&&ws.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{M.style.overflow=xt,M.style.height=nt,O.style.overflow=la,V&&(V.scrollTop=we),Q.scrollTop=Me;}},exportToPDF:async M=>{await Pe.exportToPDF(G,M);},exportToExcel:async M=>{await Pe.exportToExcel(G,M);},exportToJSON:()=>Pe.exportToJSON(G),exportToCSV:()=>Pe.exportToCSV(G),importFromJSON:M=>{let O=Pe.importFromJSON(M);he(O);},getTasks:()=>G,refresh:()=>{he(M=>[...M]);},clearAll:()=>{he([]);}}),[G,F,re,Le,qe,qt,Zt,vs]);let j0=react.useCallback(M=>{qi(O=>O.map(V=>V.id===M?{...V,visible:!V.visible}:V));},[]),K0=react.useCallback((M,O)=>{qi(V=>V.map(Q=>{if(Q.id!==M)return Q;let we=Q.minWidth??100,Me=Q.maxWidth??800,xt=Math.max(we,Math.min(Me,O));return {...Q,width:xt}}));},[]),Y0=react.useCallback(M=>{he(O=>{let V=fd(O,M),Q=we=>{for(let Me of we){if(Me.id===M){Ba.current.set(M,Me.isExpanded??true);return}Me.subtasks?.length&&Q(Me.subtasks);}};return Q(V),ga(),V}),a.onTaskToggleExpand?.(M);},[a,ga]),qo=react.useCallback((M,O)=>{if(Ne&&Ne(M,O)===false)return;let Q=Pe.findTaskById(G,M)?.progress,we=xt=>xt.map(nt=>nt.id===M?{...nt,...O}:nt.subtasks?{...nt,subtasks:we(nt.subtasks)}:nt);he(we(G));let Me=Pe.findTaskById(we(G),M);Me&&($e?.(Me),at?.(Me),O.progress!==void 0&&Q!==void 0&&O.progress!==Q&&Y?.(M,Q,O.progress));},[G,$e,Ne,at,Y]),q0=react.useCallback(M=>{M.length!==0&&(ir.current+=1,Ko.current=true,he(O=>yr(cd(O,M))),a.onTaskIndent?.(M[0]));},[a]),X0=react.useCallback(M=>{M.length!==0&&(ir.current+=1,Ko.current=true,he(O=>yr(ud(O,M))),a.onTaskOutdent?.(M[0]));},[a]),J0=react.useCallback((M,O,V)=>{ir.current+=1,Ko.current=true,he(Q=>yr(Kp(Q,M,O,V))),a.onTaskReparent?.(M,O,V);},[a]),Q0=react.useCallback((M,O)=>{M.length!==0&&(ir.current+=1,Ko.current=true,he(V=>pd(V,M,O)),a.onTaskMove?.(M[0],O));},[a]),Ji=react.useCallback(async M=>{let O=[];for(let V of M)te&&await Promise.resolve(te(V))===false||O.push(V);O.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(O):(he(V=>yr(md(V,O))),O.forEach(V=>a.onTaskDelete?.(V))),rt&&O.forEach(V=>rt(V)));},[a,te,rt]),Z0=react.useCallback(M=>{a.onTaskDuplicate?M.forEach(O=>{let V=Pe.findTaskById(G,O);V&&a.onTaskDuplicate(V);}):he(O=>qn(O,M).tasks);},[a,G]),ef=react.useCallback((M,O)=>{he(V=>{let{tasks:Q,newTask:we}=jp(V,M,O);return xe&&xe(we)===false?V:(a.onTaskCreate?.(we.parentId,we.position||0),He?.(we),Q)});},[a,xe,He]),tf=react.useCallback((M,O)=>{he(V=>gd(V,M,O)),a.onTaskRename?.(M,O);},[a]),Qi=react.useCallback(M=>{let{onTaskAddSubtask:O}=a;if(O){let V=ni(G,M);if(V){O(V);return}}he(V=>{let{tasks:Q}=bd(V,M);return a.onTaskCreate?.(M,0),Q});},[a,G]),af=react.useCallback((M,O,V)=>{let Q=!M.startDate&&!M.endDate,we=M.startDate?Math.round((O.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Me=Rt=>Rt.map(Xt=>Xt.id===M.id?{...Xt,startDate:O,endDate:V,...M.segments&&{segments:M.segments}}:Xt.subtasks?{...Xt,subtasks:Me(Xt.subtasks)}:Xt),xt=Me(G),nt=xt;xt=Pe.autoScheduleDependents(xt,M.id,we),xt=yr(xt),he(xt);let la={...M,startDate:O,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,O,V):$e?.(la),R&&we!==0){let Rt=Pe.flattenTasks(nt),Xt=Pe.flattenTasks(xt),Ga=[];for(let lr of Xt){if(lr.id===M.id)continue;let oo=Rt.find(Rr=>Rr.id===lr.id);if(!oo)continue;let Qo=lr.startDate?.getTime()!==oo.startDate?.getTime(),Do=lr.endDate?.getTime()!==oo.endDate?.getTime();(Qo||Do)&&Ga.push(lr);}Ga.length>0&&R(Ga);}},[G,$e,R,a]),rf=react.useCallback((M,O)=>{ee?.(M,O),Z({isOpen:true,x:O.clientX,y:O.clientY,task:M});},[ee]),of=react.useCallback((M,O)=>{let V=Pe.splitTask(G,M.id,O);he(V),Z({isOpen:false,x:0,y:0,task:null});},[G]),Rc=react.useCallback(M=>{let O=Pe.findTaskById(G,M.id)||M;X?.(O),be||Ee(O);},[G,X,be]),Oc=react.useCallback((M,O,V)=>{let Q=new Map,we=Rt=>{Rt.forEach(Xt=>{Xt.dependencies&&Q.set(Xt.id,Xt.dependencies),Xt.subtasks&&we(Xt.subtasks);});};we(V);let Me=Q.get(O)||[];Q.set(O,[...Me,M]);let xt=new Set,nt=new Set,la=Rt=>{if(!xt.has(Rt)){xt.add(Rt),nt.add(Rt);let Xt=Q.get(Rt)||[];for(let Ga of Xt){if(!xt.has(Ga)&&la(Ga))return true;if(nt.has(Ga))return true}}return nt.delete(Rt),false};return la(O)},[]),$c=react.useCallback((M,O)=>{if(Oc(M.id,O,Ec.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 _=Q=>Q.map(xe=>{if(xe.id===O){let Me=xe.dependencies||[];if(!Me.includes(M.id))return {...xe,dependencies:[...Me,M.id]}}return xe.subtasks?{...xe,subtasks:_(xe.subtasks)}:xe});ir.current+=1,ke(Q=>_(Q)),J?.(M.id,O);},[J,Oc]),Hc=react.useCallback((M,O)=>{let _=Q=>Q.map(xe=>{if(xe.id===M&&xe.dependencies){let Me=xe.dependencies.filter(xt=>xt!==O);return {...xe,dependencies:Me}}return xe.subtasks?{...xe,subtasks:_(xe.subtasks)}:xe});ir.current+=1,ke(Q=>_(Q)),Ae?.(M,O);},[Ae]),{startDate:qo,endDate:Ji}=react.useMemo(()=>{let M=V.filter(Me=>Me.startDate&&Me.endDate);if(M.length===0){let Me=new Date,xt=new Date(Me);xt.setDate(xt.getDate()-30);let nt=new Date(Me);return nt.setDate(nt.getDate()+60),{startDate:xt,endDate:nt}}let O=M.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),_=new Date(Math.min(...O.map(Me=>Me.getTime()))),Q=new Date(Math.max(...O.map(Me=>Me.getTime()))),xe=tt==="day"?7:tt==="week"?14:30;return _.setDate(_.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:_,endDate:Q}},[V,tt]);react.useEffect(()=>{yt.current?.(qo,Ji);},[qo,Ji]);let of=react.useCallback(async()=>{if(!En.current||!ro.current||!Br.current)return;await new Promise(No=>setTimeout(No,200));let M=En.current,O=ro.current,_=hs.current||O.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=_?.scrollTop||0,Me=_?.scrollLeft||0,xt=Q.scrollTop,nt=Q.scrollLeft,la=M.style.overflow,Rt=M.style.height,Xt=_?.style.overflow||"",Ga=Q.style.overflow,lr=O.style.overflow,oo=M.style.width,Jo=Q.style.width;try{let No=_?.querySelector(".gantt-taskgrid-content"),Rr=Q.querySelector("svg"),Zi=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Qo=No?.scrollHeight||_?.scrollHeight||600,xs=Math.max(Zi,Q.scrollHeight),Mn=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Q.scrollWidth,mf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,el=Math.max(Qo,xs,Zi),Wc=mf+el+50,Gc=(_?.offsetWidth||O.offsetWidth||300)+Mn+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Wc}px`,M.style.width=`${Gc}px`,O.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${el+50}px`),Q.style.overflow="visible",Q.style.height=`${el+50}px`,Q.style.width=`${Mn+10}px`,await new Promise(vs=>setTimeout(vs,150));let gf=await htmlToImage.toPng(M,{backgroundColor:Zt.bgPrimary,pixelRatio:2,width:Gc,height:Wc,skipFonts:!1,filter:vs=>{if(!(vs instanceof Element))return !0;let Vc=window.getComputedStyle(vs),_c=parseInt(Vc.zIndex,10);return !(!isNaN(_c)&&_c>=50||Vc.position==="fixed")}}),tl=document.createElement("a");tl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,tl.href=gf,tl.click();}finally{M.style.overflow=la,M.style.height=Rt,M.style.width=oo,O.style.overflow=lr,_&&(_.style.overflow=Xt,_.style.height="",_.scrollTop=xe,_.scrollLeft=Me),Q.style.overflow=Ga,Q.style.height="",Q.style.width=Jo,Q.scrollTop=xt,Q.scrollLeft=nt;}},[Zt]),nf=react.useCallback(async()=>{await Pe.exportToPDF(V);},[V]),sf=react.useCallback(async()=>{let M=new Date,O=xe=>String(xe).padStart(2,"0"),_=`${M.getFullYear()}-${O(M.getMonth()+1)}-${O(M.getDate())}_${O(M.getHours())}${O(M.getMinutes())}`,Q=c?c.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(V,`${Q}_${_}.xlsx`);},[V,c]),lf=react.useCallback(()=>{let M=Pe.exportToCSV(V),O=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(O),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[V]),df=react.useCallback(()=>{let M=Pe.exportToJSON(V),O=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(O),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[V]),cf=react.useCallback(()=>{Pe.exportToMSProject(V,"Gantt Project","project.xml");},[V]),uf=M=>{M.preventDefault(),Se(true);},Xo=react.useRef(false),[Qi,zc]=react.useState(false),Fn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=Br.current,O=ro.current?.querySelector(".gantt-grid-scroll");if(!M||!O)return;let _=()=>{if(Xo.current)return;Xo.current=true;let nt=M.scrollTop;q(nt),O.scrollTop=nt,requestAnimationFrame(()=>{Xo.current=false;});},Q=()=>{if(Xo.current)return;Xo.current=true;let nt=O.scrollTop;q(nt),M.scrollTop=nt,requestAnimationFrame(()=>{Xo.current=false;});},xe=nt=>{if(le&&O){let Rt=O.parentElement?.getBoundingClientRect()?.left||0,Xt=nt.clientX-Rt,Ga=200,lr=bs+Ac,oo=window.innerWidth*Lc,Jo=Math.max(lr,oo);Xt>=Ga&&Xt<=Jo&&Ue(Xt);}if(Qi&&M){let la=nt.clientX-Fn.current.x,Rt=nt.clientY-Fn.current.y;M.scrollLeft=Fn.current.scrollLeft-la,M.scrollTop=Fn.current.scrollTop-Rt;}},Me=()=>{Se(false),zc(false);},xt=nt=>{if(nt.button!==0)return;let la=nt.target;la.closest("[data-task-bar]")||la.closest("[data-dependency-line]")||la.closest("button")||la.closest('[role="button"]')||la.tagName==="rect"&&la.getAttribute("data-clickable")==="true"||(zc(true),Fn.current={x:nt.clientX,y:nt.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},nt.preventDefault());};return M.addEventListener("scroll",_),O.addEventListener("scroll",Q),M.addEventListener("mousedown",xt),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Me),()=>{M.removeEventListener("scroll",_),O.removeEventListener("scroll",Q),M.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Me);}},[le,Qi,bs]);let Uc=react.useRef(false),pf=react.useRef(null);return react.useLayoutEffect(()=>{if(Uc.current||V.length===0||!Br.current)return;Uc.current=true,pf.current=qo;let M=Br.current,O=new Date,_=tt==="day"?60:tt==="week"?20:8,Q=(O.getTime()-qo.getTime())/(1e3*60*60*24),xe=M.clientWidth,xt=Q*_*N-xe/2;Q>=0&&xe>0&&(M.scrollLeft=Math.max(0,xt));},[V.length,qo,tt,N]),jsxRuntime.jsx(pn.Provider,{value:_a,children:jsxRuntime.jsx(sl.Provider,{value:G0,children:jsxRuntime.jsxs("div",{ref:En,className:"flex flex-col h-full w-full",style:{backgroundColor:Zt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Zt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Zt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(ti,{theme:Zt,timeScale:tt,onTimeScaleChange:Qe,zoom:N,onZoomChange:K,currentTheme:be,onThemeChange:B,rowDensity:H,onRowDensityChange:se,showThemeSelector:u,showCreateTaskButton:x&&ue?.canCreateTask!==false&&!ue?.canCreateSubtaskOnly,createTaskLabel:k,onCreateTask:C,taskFilter:Be,onTaskFilterChange:ct,hideCompleted:ne,onHideCompletedChange:ge,toolbarRightContent:R,wbsLevel:ie,onWbsLevelChange:Fc,maxWbsDepth:Bt,viewMode:ze,onViewModeChange:Te,projectForecast:E,onExportPNG:i?of:void 0,onExportPDF:i?nf:void 0,onExportExcel:i?sf:void 0,onExportCSV:i?lf:void 0,onExportJSON:i?df:void 0,onExportMSProject:i?cf:void 0,showCriticalPath:De,onShowCriticalPathChange:It,showDependencies:ut,onShowDependenciesChange:Tt,highlightWeekends:Ze,onHighlightWeekendsChange:bt,showBaseline:Ie,onShowBaselineChange:M=>{M&&ze!=="oracle"&&Te("oracle"),!M&&ze==="oracle"&&Te("execution");},onCopySnapshotLink:ot,hasDependencies:V0})}),jsxRuntime.jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:hs,className:"gantt-grid-scroll flex-shrink-0",style:{width:W0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ni,{tasks:Bc,theme:Zt,rowHeight:ys,availableUsers:d,templates:Ic,showCriticalPath:De,onTaskClick:I,onTaskDblClick:Rc,onTaskContextMenu:Ce,onTaskToggle:K0,scrollTop:Y,columns:Ko,onToggleColumn:_0,onColumnResize:j0,onTaskUpdate:Yo,onTaskIndent:Y0,onTaskOutdent:q0,onTaskMove:J0,onMultiTaskDelete:qi,onTaskDuplicate:Q0,onTaskCreate:Z0,onTaskRename:ef,onCreateSubtask:Xi,onOpenTaskModal:I?M=>I(M):void 0,onDeleteRequest:(M,O)=>Ke({taskId:M,taskName:O}),onTaskReparent:X0,scrollContainerRef:hs})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Zt.border,zIndex:15},onMouseDown:uf}),jsxRuntime.jsx("div",{ref:Br,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Qi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(fi,{tasks:Bc,theme:Zt,rowHeight:ys,timeScale:tt,startDate:qo,endDate:Ji,zoom:N,locale:y,templates:Ic,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:I,onTaskDblClick:Rc,onTaskContextMenu:af,onTaskDateChange:tf,onDependencyCreate:$c,onDependencyDelete:Hc,showBaseline:Ie,showCriticalPath:De,showDependencies:ut,highlightWeekends:Ze,canEditTask:ue?.canEditTask})})]}),S.task&&jsxRuntime.jsx(fn,{isOpen:S.isOpen,x:S.x,y:S.y,theme:Zt,onClose:()=>Z({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=S.task;if(!M)return [];let O=Pe.findTaskById(V,M.id)||M,_=O.subtasks&&O.subtasks.length>0,Q=ue?.canCreateTask!==false,xe=ue?.canDeleteTask!==false;if(_){let Rt=[],Xt=ue?.canDuplicateTask!==false;return Q&&Rt.push({id:"addSubtask",label:_a.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{Ve?Ve(O):Xi(O.id);}}),Xt&&Rt.push({id:"duplicate",label:_a.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(O):ke(Ga=>Kn(Ga,[O.id]).tasks),Z({isOpen:false,x:0,y:0,task:null});}}),xe&&(Rt.length>0&&Rt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Rt.push({id:"delete",label:_a.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ke({taskId:O.id,taskName:O.name});}})),Rt}let Me=ue?.canUpdateTask!==false,xt=ue?.canDuplicateTask!==false,nt=[];return Me&&nt.push({id:"edit",label:_a.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{fe?fe(O):Ee(O);}}),Q&&nt.push({id:"addSubtask",label:_a.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{Ve?Ve(O):Xi(O.id);}}),nt.length>0&&Me&&nt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(nt.push({id:"markIncomplete",label:_a.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{z?z(O):Yo(O.id,{status:"todo",progress:0});},disabled:O.status==="todo"}),nt.push({id:"setInProgress",label:_a.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{re?re(O):Yo(O.id,{status:"in-progress"});},disabled:O.status==="in-progress"}),nt.push({id:"markComplete",label:_a.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{Yo(O.id,{status:"completed",progress:100});},disabled:O.status==="completed"})),(xt||Me&&O.startDate&&O.endDate)&&nt.length>0&&nt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),xt&&nt.push({id:"duplicate",label:_a.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(O):ke(Rt=>Kn(Rt,[O.id]).tasks),Z({isOpen:false,x:0,y:0,task:null});}}),Me&&O.startDate&&O.endDate&&nt.push({id:"split",label:_a.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{let Rt=O.startDate.getTime(),Xt=O.endDate.getTime(),Ga=Rt+(Xt-Rt)/2,lr=new Date(Ga);rf(O,lr);}}),xe&&(nt.length>0&&nt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),nt.push({id:"delete",label:_a.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ke({taskId:O.id,taskName:O.name});}})),nt})()}),jsxRuntime.jsx(Xr,{task:pe,isOpen:!!pe,onClose:()=>Ee(null),onTaskUpdate:M=>{pe&&(Yo(pe.id,M),Ee(null));},theme:be==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&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:()=>Ke(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:Zt.bgSecondary,border:`1px solid ${Zt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Zt.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:Zt.textPrimary,fontFamily:"Inter, sans-serif"},children:[_a.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Zt.textPrimary},children:['"',qe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Zt.bgPrimary,borderTop:`1px solid ${Zt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ke(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Zt.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{qi([qe.taskId]),Ke(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(yi,{tasks:V,theme:Zt,config:f,onTasksUpdate:ke,onTaskUpdate:Yo,onTaskCreate:M=>{ke(O=>[...O,M]);},onTaskDelete:M=>{qi([M]);},onDependencyCreate:(M,O)=>{let _=Pe.findTaskById(V,M);_&&$c(_,O);},onDependencyDelete:Hc})]})})})});function _v(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function jv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var hd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],yd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function fm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:b,defaultStatus:h}){let v=[...hd,...i.filter(N=>!hd.some(K=>K.id===N.id))],f=it[u]||it.dark,[y,w]=react.useState(false),[x,k]=react.useState(false),[C,D]=react.useState(false),[T,R]=react.useState(false),[$,L]=react.useState({top:0,left:0}),[j,E]=react.useState(null),[ce,I]=react.useState(new Date),[X,Ce]=react.useState({top:0,left:0}),[Xe,P]=react.useState(false),[G,fe]=react.useState([]),[Ve,z]=react.useState(false),[re,J]=react.useState(""),Ae=react.useRef(null),he=react.useRef(null),$e=react.useRef(null),Ne=react.useRef(null),at=react.useRef(null),[ee,rt]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[ue,ot]=react.useState({});react.useEffect(()=>{a?(rt({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&P(true)):(rt({name:"",description:"",progress:0,status:h||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),P(false),fe([]));},[a,e,h]),react.useEffect(()=>{let N=K=>{Ae.current&&!Ae.current.contains(K.target)&&w(false),he.current&&!he.current.contains(K.target)&&k(false),$e.current&&!$e.current.contains(K.target)&&D(false),Ne.current&&!Ne.current.contains(K.target)&&R(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let gt=()=>{let N={};return ee.name.trim()||(N.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),ot(N),Object.keys(N).length===0},Ct=async N=>{if(N.preventDefault(),!!gt())try{let K=l==="create"&&G.length>0?{...ee,pendingFiles:G}:ee;await s(K),fe([]),t();}catch(K){console.error("Error submitting task:",K);}},be=(N,K)=>{rt(ie=>{let we={...ie,[N]:K};if(N==="status"){let W=K;W==="todo"?we.progress=0:W==="in-progress"?(ie.progress===0||ie.progress===100)&&(we.progress=50):W==="completed"||W==="closed"?we.progress=100:(W==="in-review"||W==="review")&&(we.progress=75);}if(N==="progress"){let W=typeof K=="number"?K:parseInt(K,10);W===100&&ie.status!=="completed"?we.status="completed":W>0&&W<100&&ie.status==="todo"?we.status="in-progress":W===0&&ie.status!=="todo"&&(we.status="todo");}return we}),ue[N]&&ot(ie=>{let we={...ie};return delete we[N],we});},ft=v.find(N=>N.id===ee.status)??hd[0],tt=yd.find(N=>N.id===ee.priority)??yd[1],Qe=Po.find(N=>N.value===ee.color)??Po[0],H=u==="dark",se={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.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-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":u,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ft.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ct,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ee.name,onChange:N=>be("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ee.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),ue.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),ue.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ee.description||"",onChange:N=>be("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Ae,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:ft.color,backgroundColor:`${ft.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ft.color}}),jsxRuntime.jsx("span",{style:{color:ft.color},children:ft.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ft.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{be("status",N.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,ee.status===N.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxRuntime.jsxs("div",{ref:he,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsxRuntime.jsx("span",{children:tt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:yd.map(N=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{be("priority",N.id),k(false);},children:[jsxRuntime.jsx("span",{children:N.icon}),N.label,ee.priority===N.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:$e,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((N,K)=>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:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},K))}),ee.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(N=>{let K=ee.assignees?.some(ie=>ie.name===N.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:f.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=K?(ee.assignees||[]).filter(we=>we.name!==N.name):[...ee.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),color:f.accent}];be("assignees",ie);},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:f.accent},children:N.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxRuntime.jsxs("div",{ref:Ne,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)R(false);else {if(Ne.current){let N=Ne.current.getBoundingClientRect(),K=window.innerHeight,ie=120,W=K-N.bottom<ie?N.top-ie-8:N.bottom+8;L({top:W,left:N.left});}R(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsxRuntime.jsx("span",{children:Qe.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>R(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:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Po.slice(0,18).map(N=>{let K=ee.color===N.value;return jsxRuntime.jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),be("color",N.value),R(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:K?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),c.length>0||d?jsxRuntime.jsx(lo,{selectedTags:ee.tags||[],availableTags:c,onChange:N=>be("tags",N),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(j==="start")E(null);else {if(at.current){let N=at.current.getBoundingClientRect(),K=window.innerHeight,ie=320,W=K-N.bottom<ie?N.top-ie-8:N.bottom+8;Ce({top:W,left:N.left});}E("start"),I(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(j==="end")E(null);else {if(at.current){let N=at.current.getBoundingClientRect(),K=window.innerHeight,ie=320,W=K-N.bottom<ie?N.top-ie-8:N.bottom+8;Ce({top:W,left:N.left});}E("end"),I(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let N=new Date,K=new Date(N);K.setDate(N.getDate()+1);let ie=new Date(N);ie.setDate(N.getDate()+7);let we=new Date(N);return we.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:we}].map((te,ze)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{j==="start"?(be("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&be("endDate",te.date),E("end")):(be("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&be("startDate",te.date),E(null));},children:te.label},ze))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{be("startDate",void 0),be("endDate",void 0),E(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(ce.getFullYear(),ce.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ce.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>I(new Date(ce.getFullYear(),ce.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((N,K)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=ce.getFullYear(),K=ce.getMonth(),ie=new Date(N,K,1).getDay(),we=new Date(N,K+1,0).getDate(),W=new Date,te=[];for(let Te=ie-1;Te>=0;Te--)te.push({day:new Date(N,K,-Te).getDate(),date:new Date(N,K-1,new Date(N,K,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=we;Te++)te.push({day:Te,date:new Date(N,K,Te),isCurrentMonth:true});let ze=42-te.length;for(let Te=1;Te<=ze;Te++)te.push({day:Te,date:new Date(N,K+1,Te),isCurrentMonth:false});return te.map((Te,Ie)=>{let De=Te.date.toDateString()===W.toDateString(),_e=ee.startDate?.toDateString()===Te.date.toDateString(),ut=ee.endDate?.toDateString()===Te.date.toDateString(),mt=ee.startDate&&ee.endDate&&Te.date>=ee.startDate&&Te.date<=ee.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:Te.isCurrentMonth?_e||ut?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:_e?f.accent:ut?"#7C3AED":mt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:De&&!_e&&!ut?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{j==="start"?(be("startDate",Te.date),ee.endDate&&Te.date>ee.endDate&&be("endDate",Te.date),E("end")):(be("endDate",Te.date),ee.startDate&&Te.date<ee.startDate&&be("startDate",Te.date),E(null));},children:Te.day},Ie)})})()})]})]})]})})]}),ue.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ue.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ee.progress,onChange:N=>be("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ee.progress<30?"#EF4444":ee.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ee.progress<30?"#EF4444":ee.progress<70?"#F59E0B":"#10B981"}20`,color:ee.progress<30?"#EF4444":ee.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ee.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>P(!Xe),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Xe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&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:f.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:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ee.effortMinutes?_v(ee.effortMinutes):"",onChange:N=>{let K=jv(N.target.value);be("effortMinutes",K);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||l==="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:f.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:f.textTertiary},children:["Adjuntos ",l==="create"?G.length>0&&`(${G.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(Ur,{cardId:"pending",attachments:G.map((N,K)=>({id:`pending-${K}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>fe(K=>[...K,...N]),onDelete:N=>{let K=parseInt(N.replace("pending-",""),10);fe(ie=>ie.filter((we,W)=>W!==K));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Ur,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),l==="create"&&G.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[G.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:N=>be("isMilestone",N.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(N=>{let K=r.find(ie=>ie.id===N);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[K?.name||N.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ie=(ee.dependencies||[]).filter(we=>we!==N);be("dependencies",ie);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{z(!Ve),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),J("");}}),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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:re,onChange:N=>J(N.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(N=>N.id!==a?.id).filter(N=>re===""||N.name.toLowerCase().includes(re.toLowerCase())).map(N=>{let K=ee.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ie=ee.dependencies||[],we;K?we=ie.filter(W=>W!==N.id):we=[...ie,N.id],be("dependencies",we);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{K||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=K?`${f.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:K?f.accent:"transparent",borderColor:K?f.accent:f.borderLight},children:K&&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:f.textPrimary},children:N.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(N.currentTarget.style.opacity="1"),children:n?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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var bm=`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 V=Q=>Q.map(we=>{if(we.id===O){let Me=we.dependencies||[];if(!Me.includes(M.id))return {...we,dependencies:[...Me,M.id]}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});ir.current+=1,he(Q=>V(Q)),J?.(M.id,O);},[J,Oc]),Hc=react.useCallback((M,O)=>{let V=Q=>Q.map(we=>{if(we.id===M&&we.dependencies){let Me=we.dependencies.filter(xt=>xt!==O);return {...we,dependencies:Me}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});ir.current+=1,he(Q=>V(Q)),Ae?.(M,O);},[Ae]),{startDate:Xo,endDate:Zi}=react.useMemo(()=>{let M=G.filter(Me=>Me.startDate&&Me.endDate);if(M.length===0){let Me=new Date,xt=new Date(Me);xt.setDate(xt.getDate()-30);let nt=new Date(Me);return nt.setDate(nt.getDate()+60),{startDate:xt,endDate:nt}}let O=M.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),V=new Date(Math.min(...O.map(Me=>Me.getTime()))),Q=new Date(Math.max(...O.map(Me=>Me.getTime()))),we=tt==="day"?7:tt==="week"?14:30;return V.setDate(V.getDate()-we),Q.setDate(Q.getDate()+we),{startDate:V,endDate:Q}},[G,tt]);react.useEffect(()=>{yt.current?.(Xo,Zi);},[Xo,Zi]);let nf=react.useCallback(async()=>{if(!Mn.current||!ro.current||!Br.current)return;await new Promise(Do=>setTimeout(Do,200));let M=Mn.current,O=ro.current,V=xs.current||O.querySelector(".gantt-grid-scroll"),Q=Br.current,we=V?.scrollTop||0,Me=V?.scrollLeft||0,xt=Q.scrollTop,nt=Q.scrollLeft,la=M.style.overflow,Rt=M.style.height,Xt=V?.style.overflow||"",Ga=Q.style.overflow,lr=O.style.overflow,oo=M.style.width,Qo=Q.style.width;try{let Do=V?.querySelector(".gantt-taskgrid-content"),Rr=Q.querySelector("svg"),tl=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Zo=Do?.scrollHeight||V?.scrollHeight||600,ws=Math.max(tl,Q.scrollHeight),An=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Q.scrollWidth,gf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,al=Math.max(Zo,ws,tl),Wc=gf+al+50,Gc=(V?.offsetWidth||O.offsetWidth||300)+An+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Wc}px`,M.style.width=`${Gc}px`,O.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${al+50}px`),Q.style.overflow="visible",Q.style.height=`${al+50}px`,Q.style.width=`${An+10}px`,await new Promise(ks=>setTimeout(ks,150));let ff=await htmlToImage.toPng(M,{backgroundColor:Zt.bgPrimary,pixelRatio:2,width:Gc,height:Wc,skipFonts:!1,filter:ks=>{if(!(ks instanceof Element))return !0;let Vc=window.getComputedStyle(ks),_c=parseInt(Vc.zIndex,10);return !(!isNaN(_c)&&_c>=50||Vc.position==="fixed")}}),rl=document.createElement("a");rl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rl.href=ff,rl.click();}finally{M.style.overflow=la,M.style.height=Rt,M.style.width=oo,O.style.overflow=lr,V&&(V.style.overflow=Xt,V.style.height="",V.scrollTop=we,V.scrollLeft=Me),Q.style.overflow=Ga,Q.style.height="",Q.style.width=Qo,Q.scrollTop=xt,Q.scrollLeft=nt;}},[Zt]),sf=react.useCallback(async()=>{await Pe.exportToPDF(G);},[G]),lf=react.useCallback(async()=>{let M=new Date,O=we=>String(we).padStart(2,"0"),V=`${M.getFullYear()}-${O(M.getMonth()+1)}-${O(M.getDate())}_${O(M.getHours())}${O(M.getMinutes())}`,Q=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(G,`${Q}_${V}.xlsx`);},[G,u]),df=react.useCallback(()=>{let M=Pe.exportToCSV(G),O=new Blob([M],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(O),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[G]),cf=react.useCallback(()=>{let M=Pe.exportToJSON(G),O=new Blob([M],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(O),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[G]),uf=react.useCallback(()=>{Pe.exportToMSProject(G,"Gantt Project","project.xml");},[G]),pf=M=>{M.preventDefault(),Se(true);},Jo=react.useRef(false),[el,zc]=react.useState(false),Pn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=Br.current,O=ro.current?.querySelector(".gantt-grid-scroll");if(!M||!O)return;let V=()=>{if(Jo.current)return;Jo.current=true;let nt=M.scrollTop;q(nt),O.scrollTop=nt,requestAnimationFrame(()=>{Jo.current=false;});},Q=()=>{if(Jo.current)return;Jo.current=true;let nt=O.scrollTop;q(nt),M.scrollTop=nt,requestAnimationFrame(()=>{Jo.current=false;});},we=nt=>{if(de&&O){let Rt=O.parentElement?.getBoundingClientRect()?.left||0,Xt=nt.clientX-Rt,Ga=200,lr=ys+Ac,oo=window.innerWidth*Lc,Qo=Math.max(lr,oo);Xt>=Ga&&Xt<=Qo&&We(Xt);}if(el&&M){let la=nt.clientX-Pn.current.x,Rt=nt.clientY-Pn.current.y;M.scrollLeft=Pn.current.scrollLeft-la,M.scrollTop=Pn.current.scrollTop-Rt;}},Me=()=>{Se(false),zc(false);},xt=nt=>{if(nt.button!==0)return;let la=nt.target;la.closest("[data-task-bar]")||la.closest("[data-dependency-line]")||la.closest("button")||la.closest('[role="button"]')||la.tagName==="rect"&&la.getAttribute("data-clickable")==="true"||(zc(true),Pn.current={x:nt.clientX,y:nt.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},nt.preventDefault());};return M.addEventListener("scroll",V),O.addEventListener("scroll",Q),M.addEventListener("mousedown",xt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Me),()=>{M.removeEventListener("scroll",V),O.removeEventListener("scroll",Q),M.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Me);}},[de,el,ys]);let Uc=react.useRef(false),mf=react.useRef(null);return react.useLayoutEffect(()=>{if(Uc.current||G.length===0||!Br.current)return;Uc.current=true,mf.current=Xo;let M=Br.current,O=new Date,V=tt==="day"?60:tt==="week"?20:8,Q=(O.getTime()-Xo.getTime())/(1e3*60*60*24),we=M.clientWidth,xt=Q*V*N-we/2;Q>=0&&we>0&&(M.scrollLeft=Math.max(0,xt));},[G.length,Xo,tt,N]),jsxRuntime.jsx(mn.Provider,{value:_a,children:jsxRuntime.jsx(ll.Provider,{value:V0,children:jsxRuntime.jsxs("div",{ref:Mn,className:"flex flex-col h-full w-full",style:{backgroundColor:Zt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Zt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Zt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(ri,{theme:Zt,timeScale:tt,onTimeScaleChange:Qe,zoom:N,onZoomChange:j,currentTheme:ye,onThemeChange:I,rowDensity:H,onRowDensityChange:ie,showThemeSelector:c,showCreateTaskButton:x&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:C,onCreateTask:k,taskFilter:Re,onTaskFilterChange:ct,hideCompleted:se,onHideCompletedChange:fe,toolbarRightContent:B,wbsLevel:le,onWbsLevelChange:Fc,maxWbsDepth:Bt,viewMode:Ue,onViewModeChange:Te,projectForecast:E,onExportPNG:i?nf:void 0,onExportPDF:i?sf:void 0,onExportExcel:i?lf:void 0,onExportCSV:i?df:void 0,onExportJSON:i?cf:void 0,onExportMSProject:i?uf:void 0,showCriticalPath:De,onShowCriticalPathChange:It,showDependencies:ut,onShowDependenciesChange:Tt,highlightWeekends:Ze,onHighlightWeekendsChange:bt,showBaseline:Be,onShowBaselineChange:M=>{M&&Ue!=="oracle"&&Te("oracle"),!M&&Ue==="oracle"&&Te("execution");},onCopySnapshotLink:ot,hasDependencies:_0})}),jsxRuntime.jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:xs,className:"gantt-grid-scroll flex-shrink-0",style:{width:G0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ii,{tasks:Bc,theme:Zt,rowHeight:vs,availableUsers:d,templates:Ic,showCriticalPath:De,onTaskClick:L,onTaskDblClick:Rc,onTaskContextMenu:ee,onTaskToggle:Y0,scrollTop:K,columns:Yo,onToggleColumn:j0,onColumnResize:K0,onTaskUpdate:qo,onTaskIndent:q0,onTaskOutdent:X0,onTaskMove:Q0,onMultiTaskDelete:Ji,onTaskDuplicate:Z0,onTaskCreate:ef,onTaskRename:tf,onCreateSubtask:Qi,onOpenTaskModal:L?M=>L(M):void 0,onDeleteRequest:(M,O)=>Ye({taskId:M,taskName:O}),onTaskReparent:J0,scrollContainerRef:xs})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Zt.border,zIndex:15},onMouseDown:pf}),jsxRuntime.jsx("div",{ref:Br,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:el?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(hi,{tasks:Bc,theme:Zt,rowHeight:vs,timeScale:tt,startDate:Xo,endDate:Zi,zoom:N,locale:y,templates:Ic,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:L,onTaskDblClick:Rc,onTaskContextMenu:rf,onTaskDateChange:af,onDependencyCreate:$c,onDependencyDelete:Hc,showBaseline:Be,showCriticalPath:De,showDependencies:ut,highlightWeekends:Ze,canEditTask:pe?.canEditTask})})]}),S.task&&jsxRuntime.jsx(bn,{isOpen:S.isOpen,x:S.x,y:S.y,theme:Zt,onClose:()=>Z({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=S.task;if(!M)return [];let O=Pe.findTaskById(G,M.id)||M,V=O.subtasks&&O.subtasks.length>0,Q=pe?.canCreateTask!==false,we=pe?.canDeleteTask!==false;if(V){let Rt=[],Xt=pe?.canDuplicateTask!==false;return Q&&Rt.push({id:"addSubtask",label:_a.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{_e?_e(O):Qi(O.id);}}),Xt&&Rt.push({id:"duplicate",label:_a.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(O):he(Ga=>qn(Ga,[O.id]).tasks),Z({isOpen:false,x:0,y:0,task:null});}}),we&&(Rt.length>0&&Rt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Rt.push({id:"delete",label:_a.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ye({taskId:O.id,taskName:O.name});}})),Rt}let Me=pe?.canUpdateTask!==false,xt=pe?.canDuplicateTask!==false,nt=[];return Me&&nt.push({id:"edit",label:_a.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{be?be(O):Ee(O);}}),Q&&nt.push({id:"addSubtask",label:_a.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{_e?_e(O):Qi(O.id);}}),nt.length>0&&Me&&nt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(nt.push({id:"markIncomplete",label:_a.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{z?z(O):qo(O.id,{status:"todo",progress:0});},disabled:O.status==="todo"}),nt.push({id:"setInProgress",label:_a.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{oe?oe(O):qo(O.id,{status:"in-progress"});},disabled:O.status==="in-progress"}),nt.push({id:"markComplete",label:_a.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{qo(O.id,{status:"completed",progress:100});},disabled:O.status==="completed"})),(xt||Me&&O.startDate&&O.endDate)&&nt.length>0&&nt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),xt&&nt.push({id:"duplicate",label:_a.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(O):he(Rt=>qn(Rt,[O.id]).tasks),Z({isOpen:false,x:0,y:0,task:null});}}),Me&&O.startDate&&O.endDate&&nt.push({id:"split",label:_a.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{let Rt=O.startDate.getTime(),Xt=O.endDate.getTime(),Ga=Rt+(Xt-Rt)/2,lr=new Date(Ga);of(O,lr);}}),we&&(nt.length>0&&nt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),nt.push({id:"delete",label:_a.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ye({taskId:O.id,taskName:O.name});}})),nt})()}),jsxRuntime.jsx(qr,{task:me,isOpen:!!me,onClose:()=>Ee(null),onTaskUpdate:M=>{me&&(qo(me.id,M),Ee(null));},theme:ye==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Je&&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:()=>Ye(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:Zt.bgSecondary,border:`1px solid ${Zt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Zt.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:Zt.textPrimary,fontFamily:"Inter, sans-serif"},children:[_a.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Zt.textPrimary},children:['"',Je.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Zt.bgPrimary,borderTop:`1px solid ${Zt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ye(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Zt.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ji([Je.taskId]),Ye(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(vi,{tasks:G,theme:Zt,config:f,onTasksUpdate:he,onTaskUpdate:qo,onTaskCreate:M=>{he(O=>[...O,M]);},onTaskDelete:M=>{Ji([M]);},onDependencyCreate:(M,O)=>{let V=Pe.findTaskById(G,M);V&&$c(V,O);},onDependencyDelete:Hc})]})})})});function jv(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Kv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var xd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],vd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function fm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:b,defaultStatus:h}){let v=[...xd,...i.filter(N=>!xd.some(j=>j.id===N.id))],f=it[c]||it.dark,[y,w]=react.useState(false),[x,C]=react.useState(false),[k,D]=react.useState(false),[T,B]=react.useState(false),[$,A]=react.useState({top:0,left:0}),[_,E]=react.useState(null),[ue,L]=react.useState(new Date),[X,ee]=react.useState({top:0,left:0}),[$e,R]=react.useState(false),[Y,be]=react.useState([]),[_e,z]=react.useState(false),[oe,J]=react.useState(""),Ae=react.useRef(null),xe=react.useRef(null),He=react.useRef(null),Ne=react.useRef(null),at=react.useRef(null),[te,rt]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,ot]=react.useState({});react.useEffect(()=>{a?(rt({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(rt({name:"",description:"",progress:0,status:h||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),R(false),be([]));},[a,e,h]),react.useEffect(()=>{let N=j=>{Ae.current&&!Ae.current.contains(j.target)&&w(false),xe.current&&!xe.current.contains(j.target)&&C(false),He.current&&!He.current.contains(j.target)&&D(false),Ne.current&&!Ne.current.contains(j.target)&&B(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let gt=()=>{let N={};return te.name.trim()||(N.name="El nombre es requerido"),te.startDate&&te.endDate&&te.startDate>te.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),ot(N),Object.keys(N).length===0},Ct=async N=>{if(N.preventDefault(),!!gt())try{let j=l==="create"&&Y.length>0?{...te,pendingFiles:Y}:te;await s(j),be([]),t();}catch(j){console.error("Error submitting task:",j);}},ye=(N,j)=>{rt(le=>{let Ce={...le,[N]:j};if(N==="status"){let W=j;W==="todo"?Ce.progress=0:W==="in-progress"?(le.progress===0||le.progress===100)&&(Ce.progress=50):W==="completed"||W==="closed"?Ce.progress=100:(W==="in-review"||W==="review")&&(Ce.progress=75);}if(N==="progress"){let W=typeof j=="number"?j:parseInt(j,10);W===100&&le.status!=="completed"?Ce.status="completed":W>0&&W<100&&le.status==="todo"?Ce.status="in-progress":W===0&&le.status!=="todo"&&(Ce.status="todo");}return Ce}),pe[N]&&ot(le=>{let Ce={...le};return delete Ce[N],Ce});},ft=v.find(N=>N.id===te.status)??xd[0],tt=vd.find(N=>N.id===te.priority)??vd[1],Qe=Ao.find(N=>N.value===te.color)??Ao[0],H=c==="dark",ie={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.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-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ft.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ct,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:te.name,onChange:N=>ye("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:te.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:te.description||"",onChange:N=>ye("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Ae,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ie,borderColor:ft.color,backgroundColor:`${ft.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ft.color}}),jsxRuntime.jsx("span",{style:{color:ft.color},children:ft.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ft.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("status",N.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,te.status===N.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxRuntime.jsxs("div",{ref:xe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&C(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsxRuntime.jsx("span",{children:tt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:vd.map(N=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("priority",N.id),C(false);},children:[jsxRuntime.jsx("span",{children:N.icon}),N.label,te.priority===N.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[te.assignees&&te.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:te.assignees.slice(0,3).map((N,j)=>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:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},j))}),te.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",te.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(N=>{let j=te.assignees?.some(le=>le.name===N.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:f.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=j?(te.assignees||[]).filter(Ce=>Ce.name!==N.name):[...te.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ye("assignees",le);},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:f.accent},children:N.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxRuntime.jsxs("div",{ref:Ne,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)B(false);else {if(Ne.current){let N=Ne.current.getBoundingClientRect(),j=window.innerHeight,le=120,W=j-N.bottom<le?N.top-le-8:N.bottom+8;A({top:W,left:N.left});}B(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:te.color}}),jsxRuntime.jsx("span",{children:Qe.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>B(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:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Ao.slice(0,18).map(N=>{let j=te.color===N.value;return jsxRuntime.jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),ye("color",N.value),B(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:j?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(lo,{selectedTags:te.tags||[],availableTags:u,onChange:N=>ye("tags",N),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(_==="start")E(null);else {if(at.current){let N=at.current.getBoundingClientRect(),j=window.innerHeight,le=320,W=j-N.bottom<le?N.top-le-8:N.bottom+8;ee({top:W,left:N.left});}E("start"),L(te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ie,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.startDate?te.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(_==="end")E(null);else {if(at.current){let N=at.current.getBoundingClientRect(),j=window.innerHeight,le=320,W=j-N.bottom<le?N.top-le-8:N.bottom+8;ee({top:W,left:N.left});}E("end"),L(te.endDate||te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ie,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.endDate?te.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let N=new Date,j=new Date(N);j.setDate(N.getDate()+1);let le=new Date(N);le.setDate(N.getDate()+7);let Ce=new Date(N);return Ce.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:j},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:Ce}].map((ae,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{_==="start"?(ye("startDate",ae.date),(!te.endDate||ae.date>te.endDate)&&ye("endDate",ae.date),E("end")):(ye("endDate",ae.date),(!te.startDate||ae.date<te.startDate)&&ye("startDate",ae.date),E(null));},children:ae.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("startDate",void 0),ye("endDate",void 0),E(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:()=>L(new Date(ue.getFullYear(),ue.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ue.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ue.getFullYear(),ue.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((N,j)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},j))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=ue.getFullYear(),j=ue.getMonth(),le=new Date(N,j,1).getDay(),Ce=new Date(N,j+1,0).getDate(),W=new Date,ae=[];for(let Te=le-1;Te>=0;Te--)ae.push({day:new Date(N,j,-Te).getDate(),date:new Date(N,j-1,new Date(N,j,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=Ce;Te++)ae.push({day:Te,date:new Date(N,j,Te),isCurrentMonth:true});let Ue=42-ae.length;for(let Te=1;Te<=Ue;Te++)ae.push({day:Te,date:new Date(N,j+1,Te),isCurrentMonth:false});return ae.map((Te,Be)=>{let De=Te.date.toDateString()===W.toDateString(),je=te.startDate?.toDateString()===Te.date.toDateString(),ut=te.endDate?.toDateString()===Te.date.toDateString(),mt=te.startDate&&te.endDate&&Te.date>=te.startDate&&Te.date<=te.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:Te.isCurrentMonth?je||ut?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:je?f.accent:ut?"#7C3AED":mt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:De&&!je&&!ut?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{_==="start"?(ye("startDate",Te.date),te.endDate&&Te.date>te.endDate&&ye("endDate",Te.date),E("end")):(ye("endDate",Te.date),te.startDate&&Te.date<te.startDate&&ye("startDate",Te.date),E(null));},children:Te.day},Be)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:te.progress,onChange:N=>ye("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"}20`,color:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[te.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(!$e),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${$e?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$e&&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:f.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:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:te.effortMinutes?jv(te.effortMinutes):"",onChange:N=>{let j=Kv(N.target.value);ye("effortMinutes",j);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||l==="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:f.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:f.textTertiary},children:["Adjuntos ",l==="create"?Y.length>0&&`(${Y.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(Ur,{cardId:"pending",attachments:Y.map((N,j)=>({id:`pending-${j}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>be(j=>[...j,...N]),onDelete:N=>{let j=parseInt(N.replace("pending-",""),10);be(le=>le.filter((Ce,W)=>W!==j));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Ur,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),l==="create"&&Y.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[Y.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:te.isMilestone,onChange:N=>ye("isMilestone",N.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),te.dependencies&&te.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:te.dependencies.map(N=>{let j=r.find(le=>le.id===N);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[j?.name||N.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let le=(te.dependencies||[]).filter(Ce=>Ce!==N);ye("dependencies",le);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{z(!_e),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[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:()=>{z(false),J("");}}),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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:N=>J(N.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(N=>N.id!==a?.id).filter(N=>oe===""||N.name.toLowerCase().includes(oe.toLowerCase())).map(N=>{let j=te.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let le=te.dependencies||[],Ce;j?Ce=le.filter(W=>W!==N.id):Ce=[...le,N.id],ye("dependencies",Ce);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:j?`${f.accent}10`:"transparent"},onMouseEnter:le=>{j||(le.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:le=>{le.currentTarget.style.backgroundColor=j?`${f.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:j?f.accent:"transparent",borderColor:j?f.accent:f.borderLight},children:j&&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:f.textPrimary},children:N.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(N.currentTarget.style.opacity="1"),children:n?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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var bm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -410,35 +410,35 @@ If ambiguous, ask for clarification in the message field.`;function hm(e){return
|
|
|
410
410
|
${ym(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function ym(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ao(e,t){let a=ym(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let u=l.name.toLowerCase();return n.every(i=>u.includes(i))})}function xd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let b=new Date(r),h=b.getDay(),v=g-h;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+m):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+m),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,b=parseInt(l[3],10);return new Date(b,g,m)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=u[i[2].toLowerCase()],b=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,m)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=c[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(b,m,g)}return null}function vd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function wd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function xm(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 vm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),d=ao(t,i),m=xd(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(m);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:b},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=ao(t,i),m=vd(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=ao(t,i),m=wd(c);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=ao(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=ao(t,i),m=ao(t,c);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),c=ao(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function wm(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 Kv(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 Yv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function wi(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(m=>m.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>wi(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||l&&u&&Math.abs(u.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:u,progress:e.progress||0,status:Kv(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function km(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:Yv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>wi(r,e,t))}var kd={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"},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"}},Cd={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:"Carga Equipo",blockers:"Bloqueantes"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},ki={en:kd,es:Cd};function Td(e){return ki[e]||ki.en}function Ci(e,t){let a=Td(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Nd=[{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 Tm(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 Nm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=Tm(e),i=Nd[0],c=Nd.find(g=>g.value===u)??i,d=c.icon,m=g=>{switch(Tm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:p("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:p("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Nd.map(g=>{let b=g.icon;return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",u===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:p("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Dd=[{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 Sm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=Dd.find(c=>c.value===e)??Dd[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Dd.map(c=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===c.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function Zn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Sd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Pm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[u,i]=react.useState(""),c=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let h=v=>{c.current&&!c.current.contains(v.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(h=>h.name.toLowerCase().includes(u.toLowerCase())),g=h=>e.some(v=>v.name===h),b=h=>{if(a){if(g(h.name))a(e.filter(v=>v.name!==h.name));else {let v={name:h.name,initials:Zn(h.name),color:h.color||Sd(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,v]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,v)=>jsxRuntime.jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Sd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||Zn(h.name)},`${h.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),l(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,v)=>jsxRuntime.jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Sd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||Zn(h.name)},`${h.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:p("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:u,onChange:h=>i(h.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((h,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:8,fontWeight:700,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||Zn(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==h.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}})})]},`${h.name}-${v}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let v=g(h.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),b(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):Zn(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),v&&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"}})})]},h.id)})})]})]})}function Im({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:u}){let[i,c]=react.useState(false),[d,m]=react.useState(o),[g,b]=react.useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),h=react.useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=T=>{h.current&&!h.current.contains(T.target)&&c(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let y=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",w=react.useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),R=new Date(D,T,1),L=new Date(D,T+1,0).getDate(),j=R.getDay(),E=[],I=new Date(D,T,0).getDate();for(let Ce=j-1;Ce>=0;Ce--)E.push({date:new Date(D,T-1,I-Ce),isCurrentMonth:false});for(let Ce=1;Ce<=L;Ce++)E.push({date:new Date(D,T,Ce),isCurrentMonth:true});let X=42-E.length;for(let Ce=1;Ce<=X;Ce++)E.push({date:new Date(D,T+1,Ce),isCurrentMonth:false});return E},[g]),x=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),c(false);else if(d==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),c(false);}},k=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let R=new Date(D);R.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let L=new Date(D);L.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let j=new Date(D);j.setDate(D.getDate()+14);let E=new Date(D);return E.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:j,display:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let D=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:y(D)})]})}let C=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:D=>{D.stopPropagation(),c(!i);let T=o==="start"?v:f;T&&b(new Date(T.getFullYear(),T.getMonth(),1));},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:y(C)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxRuntime.jsxs("div",{className:p("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((D,T)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),c(false);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>b(new Date),className:p("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let R=D.date.toDateString()===new Date().toDateString(),$=v?.toDateString()===D.date.toDateString(),L=f?.toDateString()===D.date.toDateString(),j=$||L,E=!r&&v&&f&&D.date>=v&&D.date<=f;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(D.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",L&&!$&&"bg-[#7C3AED] text-white",E&&!j&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!j&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function Di({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let u=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Im,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function kn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Si(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,u]=react.useState(false),i=react.useRef(e),c=react.useRef([]);return react.useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,b=r/o;u(true);for(let h=1;h<=o;h++){let v=setTimeout(()=>{let f=h/o,y=1-Math.pow(1-f,3),w=Math.round(d+g*y);n(w),h===o&&(u(false),n(m));},b*h);c.current.push(v);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Bm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),u=react.useRef(null),i=react.useRef(null),c=react.useCallback(g=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(g),l(0);let b=Date.now();i.current=setInterval(()=>{let h=Date.now()-b,v=Math.min(h/a*100,100);l(v);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Om({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[u,i]=react.useState(""),c=react.useRef(null),{isFlashing:d,triggerFlash:m}=kn(),{displayValue:g,isAnimating:b}=Si(e,{enabled:o,duration:300,steps:6}),h=x=>{if(r||!t)return;x.stopPropagation();let k=x.currentTarget.getBoundingClientRect(),C=x.clientX-k.left,D=Math.round(C/k.width*100),T=Math.max(0,Math.min(100,D));T!==e&&(t(T),s&&m());},v=react.useCallback(x=>{r||!t||(x.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&c.current&&(c.current.focus(),c.current.select());},[n]);let f=react.useCallback(()=>{l(false);let x=parseInt(u,10);if(!isNaN(x)&&t){let k=Math.max(0,Math.min(100,x));k!==e&&(t(k),s&&m());}},[u,t,e,s,m]),y=react.useCallback(x=>{x.key==="Enter"&&f(),x.key==="Escape"&&l(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:h,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",b&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:c,value:u,onChange:x=>i(x.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:y,maxLength:3,className:p("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:v,className:p("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",b&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,u]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{u(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?c():m.key==="Escape"&&(u(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:m=>u(m.target.value),onBlur:c,onKeyDown:d,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:p("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Gm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:u=true}){let[i,c]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:b,triggerFlash:h}=kn(),{displayValue:v,isAnimating:f}=Si(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let y=()=>{let x=parseFloat(d);if(!isNaN(x)){let k=x;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),u&&h());}c(false);},w=x=>{x.key==="Enter"?y():x.key==="Escape"&&(m(e?.toString()||""),c(false));};return n||!t?jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:x=>m(x.target.value),onBlur:y,onKeyDown:w,onClick:x=>x.stopPropagation(),min:o,max:s,className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),c(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),b&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Vm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),u=react.useRef(null);return react.useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:p("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function jm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:u,startChange:i,cancelChange:c}=Bm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},m=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&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:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),c();},className:p("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function qm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:p("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.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)),o>0&&jsxRuntime.jsxs("span",{className:p("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function A2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function L2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+u}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function mr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:u="hours",hourlyRate:i=0}){let[c,d]=react.useState(false),[m,g]=react.useState(""),b=react.useRef(null),{isFlashing:h,triggerFlash:v}=kn(),f=u==="financial"&&i>0,y=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:A2(e,r);react.useEffect(()=>{c&&b.current&&(b.current.focus(),b.current.select());},[c]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?g(`${C}h ${D}m`):C>0?g(`${C}h`):g(`${D}m`);}else g("");},[e,c]);let w=()=>{let C=L2(m);C!==e&&(t?.(C),n&&v()),d(false);},x=C=>{C.key==="Enter"?w():C.key==="Escape"&&d(false);};if(l)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:y})]}):c?jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:x,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),d(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:y})]})}function Zm({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=l=>l.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let l=o==="es";return a===0?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:l?"En Tiempo":"On Track"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",l?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",l?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function tg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:l,lens:u="hours",hourlyRate:i=0}){let c=a==="es",d=u==="financial"&&i>0,m=P=>d?`$${Math.round(P*i).toLocaleString("en-US")}`:`${P}h`,[g,b]=react.useState(false),[h,v]=react.useState(false),[f,y]=react.useState(null),w=react.useRef(null),x=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,D=Math.round(x/60*10)/10,T=Math.round(k/60*10)/10,R=Math.round(C/60*10)/10,$=k>0?x/k*100:0,L=$>100?Math.round((x-k)/60*10)/10:0,j=$>100?"#FF2D20":$>=80?"#FFD60A":"#3BF06E";react.useEffect(()=>{if(!h&&!f)return;let P=G=>{w.current&&!w.current.contains(G.target)&&(v(false),y(null));};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[h,f]);let E=P=>{if(P.stopPropagation(),r&&!o&&!s){y("log");return}if(r||o||s){v(G=>!G),y(null);return}l&&l(e);},ce=P=>{v(false),y(P);},I=async(P,G)=>{f==="log"&&r&&P?r(e,P,G):f==="estimate"&&o?o(e,P):f==="quoted"&&s&&s(e,P),y(null);},X=r||o||s||l,Ce=[{mode:"log",icon:lucideReact.Clock,label:c?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:c?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:c?"T. Ofertado":"Quoted time",show:!!s}].filter(P=>P.show),Xe=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&x===0&&C===0?jsxRuntime.jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:P=>P.stopPropagation(),onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),children:[jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&X&&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:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",P.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",P.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:Ce.map(P=>jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),ce(P.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:G=>{G.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.target.style.background="transparent";},children:[jsxRuntime.jsx(P.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),P.label]},P.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&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($r,{mode:f,locale:a,isDark:t,currentValue:Xe||void 0,onSave:I,onClose:()=>y(null)})})})})]}):jsxRuntime.jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:P=>P.stopPropagation(),onMouseEnter:()=>b(true),onMouseLeave:()=>b(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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(D)}),k>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),L>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",m(L)," ",c?"Exceso":"Over"]})]}),k>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($,100)}%`,backgroundColor:j,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[c?"Ofertado":"Quoted",":"]}),jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(R)})]})]}),X&&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:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",P.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",P.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:Ce.map(P=>jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),ce(P.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:G=>{G.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.target.style.background="transparent";},children:[jsxRuntime.jsx(P.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),P.label]},P.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&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($r,{mode:f,locale:a,isDark:t,currentValue:Xe||void 0,onSave:I,onClose:()=>y(null)})})})})]})}function ag({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF2D20]/15 text-[#FF2D20]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#3BF06E]/15 text-[#3BF06E]";return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsxRuntime.jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsxRuntime.jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var H2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function og({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:p("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",H2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function r1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function o1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function lg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:u,onColumnSort:i,availableUsers:c=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let b=react.useRef(null),h=r==="es"?sg.es:sg.en;if(react.useEffect(()=>{let x=C=>{b.current&&!b.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",x),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let x=[];return o&&x.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),x.push({id:"sep1",label:"",icon:null,separator:true}),l&&(x.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:()=>{l({...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-blue-500"}),onClick:()=>{l({...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:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),x.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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&x.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(R=>R.name===k.name)?C.filter(R=>R.name!==k.name):[...C,{name:k.name,initials:r1(k.name),color:k.color||o1(k.name),avatar:k.avatarUrl}];l({...e.task,assignees:T}),t();}}))})),d&&x.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&x.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&x.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),x.push({id:"sep2",label:"",icon:null,separator:true}),s&&x.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&x.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),x},f=()=>{if(!e.columnId)return [];let x=[];return i&&(x.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),x.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(x.push({id:"sep-hide",label:"",icon:null,separator:true}),x.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),x},y=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:y.map(x=>x.separator?jsxRuntime.jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},x.id):x.submenu?jsxRuntime.jsx(n1,{item:x,isDark:a},x.id):jsxRuntime.jsxs("button",{onClick:x.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",x.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:p(x.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:x.icon}),x.label]},x.id))})}function n1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[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:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var sg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var bg={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"}),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"})},k1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function yg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[u,i]=react.useState(""),[c,d]=react.useState(null),m=react.useRef(null),g=l==="es"?hg.es:hg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let x=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),D=window.innerHeight-k.top-20;d(Math.max(300,D));};return requestAnimationFrame(x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[e]),react.useEffect(()=>{if(!e)return;let x=setTimeout(()=>{let k=D=>{m.current&&!m.current.contains(D.target)&&t();},C=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(x),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let b=x=>g.columns[x]||x,h=x=>{if(x==="name")return;let k=a.map(C=>C.id===x?{...C,visible:!C.visible}:C);o(k);},v=(x,k)=>{let C=a.find(T=>T.type===x&&(!k||T.customFieldId===k));if(C){h(C.id);return}let D={id:k||x,type:x,label:k?r.find(T=>T.id===k)?.name||x:b(x),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,D]);},f=k1.filter(x=>b(x).toLowerCase().includes(u.toLowerCase())),y=r.filter(x=>x.name.toLowerCase().includes(u.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...c?{maxHeight:`${c}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",x.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:u,onChange:x=>i(x.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:x=>{x&&x.style.setProperty("--focus-border",w);},onFocus:x=>{x.currentTarget.style.borderColor=w,x.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:x=>{x.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",x.currentTarget.style.background=n?"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:x=>x.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(x=>{let k=a.find(T=>T.type===x&&!T.customFieldId),C=k?.visible??false,D=x==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(k?h(k.id):v(x));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&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:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:bg[x]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:b(x)})]},x)})})]}),y.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:y.map(x=>{let C=a.find(D=>D.customFieldId===x.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(x.type,x.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&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:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:bg[x.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x.name})]},x.id)})})]})]})]})}var hg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var P1=[{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 wg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,u]=react.useState("text"),[i,c]=react.useState([""]),d=o==="es"?vg.es:vg.en;react.useEffect(()=>{e&&(n(""),u("text"),c([""]));},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:l};l==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{c([...i,""]);},b=(v,f)=>{let y=[...i];y[v]=f,c(y);},h=v=>{i.length>1&&c(i.filter((f,y)=>y!==v));};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:p("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:p("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:P1.map(v=>jsxRuntime.jsxs("button",{onClick:()=>u(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:p("text-xs",l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:v,onChange:y=>b(f,y.target.value),placeholder:`${d.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>h(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:p("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:p("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var vg={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 Tg={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 Ng({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),u=react.useRef(null),i=react.useRef(0),c=s==="es"?Tg.es:Tg.en;react.useEffect(()=>{if(!n)return;let g=h=>{Date.now()-i.current<100||u.current&&!u.current.contains(h.target)&&l(false);},b=h=>{h.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(b=>!b);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,m&&jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:p("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,h=()=>g.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p(b?g.color:"text-gray-400","flex-shrink-0"),children:h()}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Dg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Sg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxRuntime.jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children: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"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,l=n>0?Math.min(Math.round(s/n*100),100):0,u=s>n&&n>0,i=u?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono font-bold",u?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Dg(s)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Dg(n)})]}),n>0&&jsxRuntime.jsx("div",{className:p("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:`${l}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),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:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"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:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,l=s<0,u=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let l=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:p("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(s.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${s.name}-${n}`)})})]})]})}var K1=[{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 Lg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Lg(r.subtasks,t+1));return a}function Y1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),u=s.endDate.getTime()-n;if(u<=0)continue;let c=Math.max(0,Math.min(a.getTime()-n,u))/u*100;if(c<=0)continue;let d=(s.progress||0)/c;r+=d,o++;}return o>0?r/o:null}function q1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Nn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Nn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Tn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Ig({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:u=[],toolbarRightContent:i}){let{theme:c="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:w=false,onCreateTask:x,persistFilter:k=false,financialBlur:C,healthSidebar:D,lens:T="hours",hourlyRate:R=0,aggregateParentHours:$=false,showProjectTotals:L=false}=t,j=Ci(d,m),E=c==="dark",ce=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]),I=react.useMemo(()=>{function S(Z){let pe=0,Ee=0,qe=0;for(let Ke of Z)if(Ke.subtasks&&Ke.subtasks.length>0){let B=S(Ke.subtasks);pe+=B.spent,Ee+=B.allocated,qe+=B.quoted;}else pe+=Ke.timeLoggedMinutes??0,Ee+=Ke.effortMinutes??0,qe+=Ke.soldEffortMinutes??0;return {spent:pe,allocated:Ee,quoted:qe}}return S(e)},[e]),X=react.useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:I.spent,totalHoursAllocatedMinutes:I.allocated}},[D,I]),[Ce,Xe]=react.useState(true),[P,G]=react.useState("position"),[fe,Ve]=react.useState("asc"),[z,re]=react.useState(""),[J,Ae]=react.useState(()=>ce().statusFilter),[he,$e]=react.useState(()=>ce().hideCompleted),[Ne,at]=react.useState(h||K1),[ee,rt]=react.useState(false),[ue,ot]=react.useState(false),[gt,Ct]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[be,ft]=react.useState("all"),[tt,Qe]=react.useState(false),H=react.useRef(null),se=react.useRef(null),N=react.useMemo(()=>{let S=0;function Z(pe,Ee){for(let qe of pe)Ee>S&&(S=Ee),qe.subtasks?.length&&Z(qe.subtasks,Ee+1);}return Z(e,1),S},[e]);react.useEffect(()=>{if(!tt)return;let S=Z=>{H.current?.contains(Z.target)||se.current?.contains(Z.target)||Qe(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[tt]),react.useEffect(()=>{if(be==="all"){let pe=function(Ee){for(let qe of Ee)qe.subtasks?.length&&(qe.isExpanded===false&&a.onTaskToggleExpand?.(qe.id),pe(qe.subtasks));};pe(e);}else {let pe=function(Ee,qe){for(let Ke of Ee)if(Ke.subtasks?.length){let B=qe<be,V=Ke.isExpanded!==false;B!==V&&a.onTaskToggleExpand?.(Ke.id),pe(Ke.subtasks,qe+1);}};pe(e,1);}},[be]);let[K,ie]=react.useState(null),[we,W]=react.useState(0),[te,ze]=react.useState(0),Te=react.useRef(null),[Ie,De]=react.useState(null),[_e,ut]=react.useState(null);react.useEffect(()=>{h&&at(h);},[h]),react.useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:J,hideCompleted:he}));}catch(S){console.error("Error persisting filter state:",S);}},[k,J,he]);let mt=react.useMemo(()=>{let S=new Set;function Z(pe){for(let Ee of pe)Ee.subtasks?.length&&(Ee.isExpanded!==false&&S.add(Ee.id),Z(Ee.subtasks));}return Z(e),S},[e]),Ze=react.useMemo(()=>Ne.filter(S=>S.visible),[Ne]),et=react.useCallback(S=>{a.onTaskToggleExpand?.(S);},[a]),It=react.useCallback(S=>{P===S?Ve(Z=>Z==="asc"?"desc":"asc"):(G(S),Ve("asc")),a.onSortChange?.({column:S,direction:fe==="asc"?"desc":"asc"});},[P,fe,a]),Tt=react.useCallback(S=>{at(S),a.onColumnsChange?.(S);},[a]),bt=react.useCallback(S=>{let Z=Ne.map(pe=>pe.id===S?{...pe,visible:false}:pe);Tt(Z);},[Ne,Tt]),yt=react.useCallback((S,Z)=>{G(S),Ve(Z);},[]),dt=react.useCallback((S,Z,pe)=>{y&&(S.preventDefault(),Ct({isOpen:true,x:S.clientX,y:S.clientY,type:Z?"task":"header",task:Z,columnId:pe}));},[y]),Ft=react.useCallback(()=>{Ct(S=>({...S,isOpen:false}));},[]),He=react.useCallback((S,Z)=>{if(!f)return;S.preventDefault(),S.stopPropagation();let pe=Ne.find(Ee=>Ee.id===Z);pe&&(ie(Z),W(S.clientX),ze(pe.width));},[Ne,f]);react.useEffect(()=>{if(!K)return;let S=pe=>{let Ee=pe.clientX-we,qe=Math.max(50,te+Ee),Ke=Ne.map(B=>B.id===K?{...B,width:qe}:B);at(Ke);},Z=()=>{K&&a.onColumnsChange?.(Ne),ie(null);};return document.addEventListener("mousemove",S),document.addEventListener("mouseup",Z),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",Z);}},[K,we,te,Ne,a]);let Be=react.useCallback((S,Z)=>{if(Z==="name"){S.preventDefault();return}De(Z),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Z),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),ct=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),De(null),ut(null);},[]),ne=react.useCallback((S,Z)=>{S.preventDefault(),Z!=="name"&&(S.dataTransfer.dropEffect="move",ut(Z));},[]),ge=react.useCallback(()=>{ut(null);},[]),A=react.useCallback((S,Z)=>{if(S.preventDefault(),!Ie||Ie===Z||Z==="name")return;let pe=[...Ne],Ee=pe.findIndex(B=>B.id===Ie),qe=pe.findIndex(B=>B.id===Z);if(Ee===-1||qe===-1)return;let Ke=pe.splice(Ee,1);Ke[0]&&(pe.splice(qe,0,Ke[0]),Tt(pe),De(null),ut(null));},[Ie,Ne,Tt]),Y=react.useCallback(async S=>{if(a.onCreateCustomField){let Z={...S,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Z);}ot(false);},[a]),q=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),le=react.useMemo(()=>{let S=Lg(e);if(z.trim()){let Z=z.toLowerCase();S=S.filter(pe=>pe.name.toLowerCase().includes(Z));}return J!=="all"&&(S=S.filter(Z=>q(Z)===J)),he&&(S=S.filter(Z=>q(Z)!=="completed")),S.sort((Z,pe)=>{let Ee,qe;switch(P){case "name":Ee=Z.name.toLowerCase(),qe=pe.name.toLowerCase();break;case "startDate":Ee=Z.startDate?.getTime()||0,qe=pe.startDate?.getTime()||0;break;case "endDate":Ee=Z.endDate?.getTime()||0,qe=pe.endDate?.getTime()||0;break;case "progress":Ee=Z.progress||0,qe=pe.progress||0;break;case "status":Ee=Z.status||"todo",qe=pe.status||"todo";break;case "priority":let Ke={urgent:0,high:1,medium:2,low:3,none:4};Ee=Ke[Z.priority]??4,qe=Ke[pe.priority]??4;break;case "position":return 0;default:return 0}return Ee<qe?fe==="asc"?-1:1:Ee>qe?fe==="asc"?1:-1:0}),S},[e,z,J,he,P,fe,q]),Se=react.useCallback((S,Z)=>{let pe=Ke=>{a.onTaskUpdate?.({...S,...Ke});},Ee=Ke=>Ke?S.customFields?.find(V=>V.fieldId===Ke)?.value:void 0,qe=(Ke,B)=>{if(!Ke)return;let ke=[...S.customFields||[]],F=ke.findIndex(ae=>ae.fieldId===Ke);F>=0?ke[F]={fieldId:Ke,value:B}:ke.push({fieldId:Ke,value:B}),pe({customFields:ke});};switch(Z.type){case "name":return null;case "status":return jsxRuntime.jsx(Nm,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:B=>{pe({status:B,progress:B==="completed"?100:B==="in-progress"?50:0});},isDark:E,locale:d,translations:j.status});case "priority":return jsxRuntime.jsx(Sm,{value:S.priority,onChange:B=>pe({priority:B}),isDark:E,locale:d});case "assignees":return jsxRuntime.jsx(Pm,{value:S.assignees||[],availableUsers:l,onChange:B=>pe({assignees:B}),isDark:E,locale:d});case "startDate":return jsxRuntime.jsx(Di,{value:S.startDate,onChange:B=>pe({startDate:B}),isDark:E,locale:d,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(Di,{value:S.endDate,onChange:B=>pe({endDate:B}),isDark:E,locale:d,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":return jsxRuntime.jsx(Om,{value:S.progress||0,onChange:B=>{let V=B===100?"completed":B>0?"in-progress":"todo";pe({progress:B,status:V});},isDark:E});case "tags":return jsxRuntime.jsx(qm,{value:S.tags||[],isDark:E});case "text":return jsxRuntime.jsx(zm,{value:Ee(Z.customFieldId)||"",onChange:B=>qe(Z.customFieldId,B),isDark:E});case "number":return jsxRuntime.jsx(Gm,{value:Ee(Z.customFieldId)||0,onChange:B=>qe(Z.customFieldId,B),isDark:E});case "date":let Ke=Ee(Z.customFieldId);return jsxRuntime.jsx(Di,{value:Ke?new Date(Ke):void 0,onChange:B=>qe(Z.customFieldId,B),isDark:E,locale:d});case "dropdown":return jsxRuntime.jsx(Vm,{value:Ee(Z.customFieldId)||"",options:Z.options||[],onChange:B=>qe(Z.customFieldId,B),isDark:E});case "checkbox":return jsxRuntime.jsx(jm,{value:Ee(Z.customFieldId)||false,onChange:B=>qe(Z.customFieldId,B),isDark:E});case "estimatedTime":{let B=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.estimatedTime,onChange:V=>pe({estimatedTime:V}),isDark:E,locale:d,disabled:B,lens:T,hourlyRate:R})}case "quotedTime":{let B=S.status==="completed"||S.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsxRuntime.jsx(mr,{value:S.quotedTime,onChange:ke=>pe({quotedTime:ke}),isDark:E,locale:d,disabled:B,isBlurred:V,lens:T,hourlyRate:R})}case "elapsedTime":{let B=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.elapsedTime,onChange:V=>pe({elapsedTime:V}),isDark:E,locale:d,disabled:B,lens:T,hourlyRate:R})}case "effortMinutes":{if($&&S.subtasks&&S.subtasks.length>0){let{allocated:V}=Nn(S);return jsxRuntime.jsx(mr,{value:V>0?V:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:R})}let B=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.effortMinutes,onChange:V=>pe({effortMinutes:V}),isDark:E,locale:d,disabled:B,lens:T,hourlyRate:R})}case "timeLoggedMinutes":{if($&&S.subtasks&&S.subtasks.length>0){let{spent:V}=Nn(S);return jsxRuntime.jsx(mr,{value:V>0?V:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:R})}let B=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.timeLoggedMinutes,onChange:a.onLogTime?V=>{a.onLogTime?.(S,V);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:B,lens:T,hourlyRate:R})}case "soldEffortMinutes":{if($&&S.subtasks&&S.subtasks.length>0){let{quoted:ke}=Nn(S),F=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(mr,{value:ke>0?ke:void 0,isDark:E,locale:d,disabled:true,isBlurred:F,lens:T,hourlyRate:R})}let B=S.status==="completed"||S.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(mr,{value:S.soldEffortMinutes,onChange:ke=>pe({soldEffortMinutes:ke}),isDark:E,locale:d,disabled:B,isBlurred:V,lens:T,hourlyRate:R})}case "scheduleVariance":return jsxRuntime.jsx(Zm,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:E,locale:d});case "hoursBar":{if($&&S.hasChildren){let{spent:B,allocated:V,quoted:ke}=Nn(S),F=B>V&&V>0;return jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:p("font-bold",F?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Tn(B)}),V>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:E?"text-white/60":"text-gray-600",children:Tn(V)})]}),ke>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Tn(ke)})]})]})}return jsxRuntime.jsx(tg,{task:S,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:R})}case "teamLoad":return jsxRuntime.jsx(ag,{task:S,isDark:E});case "blockers":return jsxRuntime.jsx(og,{blockers:S.blockers,isDark:E,locale:d});default:return jsxRuntime.jsx("span",{className:p("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,l,j,$]),je=react.useCallback(S=>{let pe={name:j.columns.name,status:j.columns.status,priority:j.columns.priority,assignees:j.columns.assignees,startDate:j.columns.startDate,endDate:j.columns.endDate,progress:j.columns.progress,tags:j.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:j.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:j.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:j.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:j.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:j.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:j.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:j.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:j.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:j.columns.teamLoad||(d==="es"?"Carga Equipo":"Team Load"),blockers:j.columns.blockers||(d==="es"?"Bloqueantes":"Blockers")}[S.type]||S.label;return typeof pe=="string"?pe:String(pe||S.type)},[j,d]),Ue=react.useMemo(()=>{let pe=Ze.reduce((qe,Ke)=>qe+Ke.width,0)+(v?48:0),Ee={};for(let qe of Ze)Ee[qe.id]=`${qe.width/pe*100}%`;return Ee},[Ze,v]);return r?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:[j.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,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:p("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:j.empty.noTasks}),jsxRuntime.jsx("p",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:j.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Te,className:p(E?"bg-[#0D0D0D]":"bg-white",K&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:[le.length," ",j.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:z,onChange:S=>re(S.target.value),placeholder:j.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"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&&N>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:H,onClick:()=>Qe(!tt),className:p("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",E?tt?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":tt?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),be==="all"?d==="es"?"Todos":"All":`L${be}`]}),tt&&jsxRuntime.jsx("div",{ref:se,className:p("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",E?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(N,5)},(S,Z)=>({value:Z+1,label:`L${Z+1}`}))].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{ft(S.value),Qe(false);},className:p("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",E?be===S.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":be===S.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:S.label}),be===S.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(Ng,{value:J,hideCompleted:he,onChange:Ae,onHideCompletedChange:$e,isDark:E,locale:d}),X?.enabled&&X.data&&!Ce&&jsxRuntime.jsx("button",{onClick:()=>Xe(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),w&&x&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:j.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:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ze.map(S=>{let Z=S.id!=="name",pe=_e===S.id&&Ie!==S.id;return jsxRuntime.jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",Z&&"cursor-grab",Ie===S.id&&"opacity-50",pe&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Ue[S.id],minWidth:S.minWidth},draggable:Z,onDragStart:Z?Ee=>Be(Ee,S.id):void 0,onDragEnd:Z?ct:void 0,onDragOver:Z?Ee=>ne(Ee,S.id):void 0,onDragLeave:Z?ge:void 0,onDrop:Z?Ee=>A(Ee,S.id):void 0,onContextMenu:Ee=>dt(Ee,void 0,S.id),children:[Z&&jsxRuntime.jsx(lucideReact.GripVertical,{className:p("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>It(S.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[je(S),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:p("w-3 h-3",P===S.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:je(S)}),f&&S.resizable&&jsxRuntime.jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",K===S.id&&"bg-[#007BFF]"),onMouseDown:Ee=>He(Ee,S.id)})]},S.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),rt(Z=>!Z);},className:p("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ee&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(yg,{isOpen:ee,onClose:()=>rt(false),columns:Ne,customFields:u,onColumnsChange:Tt,onCreateCustomField:()=>{rt(false),ot(true);},isDark:E,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:le.map((S,Z)=>{let pe=mt.has(S.id),Ee=Math.min(Z*.01,.2),qe=S.hasChildren&&S.level===0,Ke=S.subtasks?.length||0;if(qe){let{spent:B,allocated:V,quoted:ke}=Nn(S),F=Y1(S),ae=q1(S);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ee},className:p("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(S),children:Ze.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:Ue[Re.id],minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Je=>{Je.stopPropagation(),et(S.id);},className:p("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",E?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Je=>{Je.stopPropagation(),et(S.id);},className:"flex-shrink-0 cursor-pointer",children:pe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsx("span",{title:S.name,className:p("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:S.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",Ke," ",d==="es"?Ke===1?"Tarea":"Tareas":Ke===1?"Item":"Items",")"]}),F!==null&&jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono flex-shrink-0",F>=1?"text-[#32D74B]":F>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",F.toFixed(2)]}),ae>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",ae]})]}):Re.type==="timeLoggedMinutes"?jsxRuntime.jsx(mr,{value:B>0?B:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:R}):Re.type==="soldEffortMinutes"?jsxRuntime.jsx(mr,{value:ke>0?ke:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:R}):Re.type==="effortMinutes"?jsxRuntime.jsx(mr,{value:V>0?V:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:R}):Se(S,Re)},Re.id))},S.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ee},className:p("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(S),onDoubleClick:()=>a.onTaskDoubleClick?.(S),onContextMenu:B=>dt(B,S),children:[Ze.map(B=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:Ue[B.id],minWidth:B.minWidth},children:B.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:V=>{V.stopPropagation(),et(S.id);},className:p("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",E?"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:p("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.jsx("span",{className:p("truncate font-bold text-[13px]",E?"text-white":"text-gray-900",S.progress===100&&(E?"line-through text-white/30":"line-through text-gray-400")),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})]})]}):Se(S,B)},B.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),L&&le.length>0&&(()=>{let{spent:S,allocated:Z,quoted:pe}=I,Ee=Z-S,qe=Ee<0,Ke=qe?`+${Tn(Math.abs(Ee))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Tn(Ee)} ${d==="es"?"AHORRADO":"SAVED"}`,B=T==="financial"&&R>0,V=ae=>B?`$${(ae/60*R).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Tn(ae),ke=B?Math.abs(Ee/60*R):0,F=B?`${qe?"+":"-"}$${ke.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${qe?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Ke;return jsxRuntime.jsxs("div",{className:p("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ze.map(ae=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:Ue[ae.id],minWidth:ae.minWidth},children:ae.type==="name"?jsxRuntime.jsx("span",{className:p("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):ae.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:V(S)}),jsxRuntime.jsx("span",{className:p("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:p("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:V(Z)}),Z>0&&jsxRuntime.jsx("span",{className:p("text-[10px] font-semibold ml-1",qe?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:B?F:Ke})]}):ae.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?V(pe):"\u2013"}):ae.type==="effortMinutes"?jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Z>0?V(Z):"\u2013"}):ae.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?V(S):"\u2013"}):jsxRuntime.jsx("span",{className:p("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},ae.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),le.length===0&&z&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:p("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:p(E?"text-white/60":"text-gray-600"),children:j.empty.noResults})]})})]})}),X?.enabled&&X.data&&Ce&&jsxRuntime.jsx(Sg,{data:X.data,isDark:E,locale:d,onClose:()=>Xe(false)})]}),jsxRuntime.jsx(lg,{state:gt,onClose:Ft,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:bt,onColumnSort:yt,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(wg,{isOpen:ue,onClose:()=>ot(false),onSave:Y,isDark:E,locale:d})]})}var Bg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"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}],Rg=[{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"}],Og=[{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 Vd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},_d={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},jd={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"},Ii={dark:Vd,light:_d,neutral:jd};function $g(e){return Ii[e]||Ii.dark}var Kd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Yd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Bi={en:Kd,es:Yd};function os(e){return Bi[e]||Bi.en}function Ri(e,t){let a=os(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Hg(e){let t=os(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function zg(e,t=0,a=true){let r=os(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function ss(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function Xd(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Gg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var jg=26,rw=22,ow=10;function Vg(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Kg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function _g(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function nw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:u,spanCols:i,lane:c,isStart:d,isEnd:m}=e,g=u.progress===100||u.status==="completed",b=u.isCriticalPath,h=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",v=m?Jd(u.effortMinutes,n,l):null,f=m?Kg(u,n,l):null,y=m?u.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",h,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":b?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${c*jg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${rw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:b?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?b?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[b&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:u.name}),m&&(v||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),y&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",y.type]}),u.progress>0&&u.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${u.progress}%`}})]})}function Yg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,timerState:x,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:R,onDiscardTimer:$,blurFinancials:L=false,suppressDetailModal:j=false,lens:E="hours",hourlyRate:ce=0}){let{theme:I="dark",locale:X="en",customTranslations:Ce,showBacklog:Xe=true}=t,P=Ri(X,Ce),G=I==="dark"||I==="neutral",[fe,Ve]=react.useState(r||new Date),[z,re]=react.useState(null),[J,Ae]=react.useState(null),[he,$e]=react.useState(null),[Ne,at]=react.useState({}),ee=3,rt=3,ue=react.useCallback(W=>{Ae(W.id),j||re(W),v?.(W.id);},[j,v]),[ot,gt]=react.useState(null),Ct=react.useCallback(()=>{Ve(new Date(fe.getFullYear(),fe.getMonth()-1,1));},[fe]),be=react.useCallback(()=>{Ve(new Date(fe.getFullYear(),fe.getMonth()+1,1));},[fe]),ft=react.useCallback(()=>{Ve(new Date);},[]),tt=react.useMemo(()=>{let W=fe.getFullYear(),te=fe.getMonth(),ze=new Date(W,te,1),Te=new Date(W,te+1,0),Ie=ze.getDay(),De=Te.getDate(),_e=ss(e),ut=new Date;ut.setHours(0,0,0,0);let mt=[],Ze=Ie,et=new Date(W,te,0).getDate();for(let Tt=Ze-1;Tt>=0;Tt--){let bt=new Date(W,te-1,et-Tt);mt.push({date:bt,isCurrentMonth:false,isToday:false,isWeekend:bt.getDay()===0||bt.getDay()===6,events:_e.filter(yt=>Xd(bt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}for(let Tt=1;Tt<=De;Tt++){let bt=new Date(W,te,Tt),yt=bt.getTime()===ut.getTime();mt.push({date:bt,isCurrentMonth:true,isToday:yt,isWeekend:bt.getDay()===0||bt.getDay()===6,events:_e.filter(dt=>Xd(bt,dt)).map(dt=>({id:dt.id,title:dt.name,start:dt.startDate,end:dt.endDate,task:dt}))});}let It=42-mt.length;for(let Tt=1;Tt<=It;Tt++){let bt=new Date(W,te+1,Tt);mt.push({date:bt,isCurrentMonth:false,isToday:false,isWeekend:bt.getDay()===0||bt.getDay()===6,events:_e.filter(yt=>Xd(bt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}return mt},[fe,e]),Qe=react.useMemo(()=>ss(e).filter(W=>!W.startDate||!W.endDate),[e]),H=react.useMemo(()=>{let W=ss(e),te=0,ze=0,Te=0,Ie=0,De=0;W.forEach(et=>{et.effortMinutes&&(te+=et.effortMinutes),et.soldEffortMinutes&&(ze+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Te+=et.scheduleVariance,Ie++),et.soldEffortMinutes&&et.effortMinutes&&(De+=et.soldEffortMinutes-et.effortMinutes);});let _e=ze>0?Math.min(100,Math.round(te/ze*100)):0,ut=Ie>0?Math.round(Te/Ie):0,Ze=`${De<0?"-":"+"}${_g(De,E,ce)}`;return {budgetUtil:_e,avgVariance:ut,costDisplay:Ze,hasCostData:ze>0}},[e,E,ce]),se=react.useMemo(()=>{let W=[0,0,0,0,0,0];return tt.forEach((te,ze)=>{let Te=Math.floor(ze/7);te.events.forEach(Ie=>{if(Ie.task.startDate&&Ie.task.soldEffortMinutes){let De=new Date(Ie.task.startDate),_e=te.date;De.getFullYear()===_e.getFullYear()&&De.getMonth()===_e.getMonth()&&De.getDate()===_e.getDate()&&Te<W.length&&(W[Te]-=Ie.task.soldEffortMinutes);}});}),W},[tt]),N=react.useMemo(()=>{let W=ss(e),te=new Map,ze=new Set,Te=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:te,multiDayTaskIds:ze,maxLanesPerRow:Te};let Ie=Ze=>new Date(Ze.getFullYear(),Ze.getMonth(),Ze.getDate()),De=Ie(tt[0].date),_e=Ie(tt[tt.length-1].date),ut=[];for(let Ze of W){if(!Ze.startDate||!Ze.endDate)continue;let et=Ie(Ze.startDate),It=Ie(Ze.endDate);if(et.getTime()===It.getTime()||It<De||et>_e)continue;let Tt=et<De?De:et,bt=It>_e?_e:It,yt=Vg(Tt,De),dt=Vg(bt,De);yt<0||yt>41||dt<0||dt>41||yt!==dt&&(ze.add(Ze.id),ut.push({task:Ze,startIdx:yt,endIdx:dt}));}ut.sort((Ze,et)=>Ze.startIdx!==et.startIdx?Ze.startIdx-et.startIdx:et.endIdx-et.startIdx-(Ze.endIdx-Ze.startIdx));let mt=[[],[],[],[],[],[]];for(let{task:Ze,startIdx:et,endIdx:It}of ut){let Tt=Math.floor(et/7),bt=Math.floor(It/7),yt=Ie(Ze.startDate),dt=Ie(Ze.endDate),Ft=false;for(let He=Tt;He<=bt;He++){let Be=He===Tt?et%7:0,ct=He===bt?It%7:6,ne=ct-Be+1,ge=0,A=mt[He]??[];for(mt[He]||(mt[He]=A);ge<A.length&&(A[ge]??-1)>=Be;)ge++;if(ge>=ow){Ft=true;break}ge>=A.length?A.push(ct):A[ge]=ct,Te[He]=Math.max(Te[He]??0,ge+1);let Y=He===Tt&&yt>=De,q=He===bt&&dt<=_e,le=He*7+Be,Se={taskId:Ze.id,task:Ze,rowIndex:He,startCol:Be,endCol:ct,spanCols:ne,lane:ge,isStart:Y,isEnd:q};te.has(le)||te.set(le,[]),te.get(le).push(Se);}Ft&&(ze.delete(Ze.id),te.forEach((He,Be)=>{let ct=He.filter(ne=>ne.taskId!==Ze.id);ct.length===0?te.delete(Be):te.set(Be,ct);}));}return {segmentsByCell:te,multiDayTaskIds:ze,maxLanesPerRow:Te}},[tt,e]),K=X==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=fe.toLocaleDateString(X==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),we=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:l,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-[#007FFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm font-mono",G?"text-white/30":"text-gray-600"),children:[P.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",G?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",G?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",G?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",G?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-8 h-8",G?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",G?"text-white/90":"text-gray-900"),children:P.labels.noEvents}),jsxRuntime.jsx("p",{className:p("text-sm",G?"text-white/30":"text-gray-600"),children:P.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",G?"bg-[#050505]":"bg-white",n),style:l,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",G?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",G?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-3.5 h-3.5",G?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:p("font-medium",G?"text-white":"text-gray-900"),children:X==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:p("h-4 w-px",G?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Ct,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",G?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",G?"text-white":"text-gray-900"),children:we}),jsxRuntime.jsx("button",{onClick:be,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",G?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:p("h-4 w-px",G?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:ft,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",G?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:P.navigation.today})]})]}),jsxRuntime.jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",G?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:K.map(W=>jsxRuntime.jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",G?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",G?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ae(null),children:tt.map((W,te)=>{let ze=te%7===6,Te=te>=35;return jsxRuntime.jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!ze&&(G?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(G?"border-b border-[#222]":"border-b border-gray-200"),G?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&G&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!G&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:p("text-xs font-mono select-none relative z-20",W.isToday?G?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?G?"text-white/60":"text-gray-900":G?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let Ie=Math.floor(te/7),De=(N.maxLanesPerRow[Ie]??0)*jg,_e=N.segmentsByCell.get(te);return De===0&&!_e?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${De}px`,zIndex:5},children:_e?.map(ut=>jsxRuntime.jsx(nw,{segment:ut,isDark:G,blurFinancials:L,isSelected:J===ut.taskId,t:P,lens:E,hourlyRate:ce,onClick:()=>{ue(ut.task),a.onEventClick?.({id:ut.task.id,title:ut.task.name,start:ut.task.startDate,end:ut.task.endDate,task:ut.task});}},ut.taskId))})})(),(()=>{let Ie=W.events.filter(De=>De.task.isMilestone&&!N.multiDayTaskIds.has(De.id));return Ie.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ie.slice(0,4).map(De=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:De.title,onClick:_e=>{_e.stopPropagation(),ue(De.task);}},De.id)),Ie.length>4&&jsxRuntime.jsxs("span",{className:p("text-[8px] font-mono",G?"text-white/30":"text-gray-400"),children:["+",Ie.length-4]})]})})(),(()=>{let Ie=[];W.events.forEach(_e=>{_e.task.blockers?.forEach(ut=>{(ut.severity==="warning"||ut.severity==="critical")&&Ie.push({taskId:_e.id,type:ut.type,severity:ut.severity,variance:_e.task.scheduleVariance});});});let De=Ie[0];return De?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",De.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[P.labels.risk,": ",De.type,De.variance?` (+${Math.abs(De.variance)}d ${P.labels.delay})`:""]})]})}):null})(),(()=>{let Ie=W.events.filter(mt=>!N.multiDayTaskIds.has(mt.id)),De=Ne[te]||ee,_e=Ie.slice(0,De),ut=Ie.length-De;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[_e.map(mt=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{ue(mt.task),a.onEventClick?.(mt);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",mt.task.progress===100||mt.task.status==="completed"?G?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":G?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:G?mt.task.progress===100||mt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:mt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:p("flex-shrink-0 text-[9px]",mt.task.isMilestone?G?"text-amber-400":"text-amber-600":mt.task.isCriticalPath?"text-red-400":G?"text-[#1264FF]":"text-gray-400"),children:mt.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:mt.title})]},mt.id)),ut>0&&jsxRuntime.jsxs("button",{onClick:mt=>{mt.stopPropagation(),at(Ze=>({...Ze,[te]:De+rt}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",G?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ut," ",X==="es"?"m\xE1s":"more"]}),De>ee&&Ie.length>ee&&jsxRuntime.jsx("button",{onClick:mt=>{mt.stopPropagation(),at(Ze=>({...Ze,[te]:ee}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",G?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ie=te>=28,De=te%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:_e=>{_e.stopPropagation(),gt(ot===te?null:te);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",ot===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",G?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3.5 h-3.5 transition-transform",ot===te&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot===te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>gt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ie?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ie?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Ie?"bottom-full mb-1":"top-full mt-1",De?"right-0":"left-0",G?"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(Ao,{onSubmit:_e=>{a.onTaskCreate?.({name:_e.name,startDate:_e.startDate||W.date,endDate:_e.endDate||W.date,priority:_e.priority,assignees:_e.assignee?[_e.assignee]:void 0}),gt(null);},onCancel:()=>gt(null),availableUsers:t.availableUsers,isDark:G,locale:X==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Ie?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let Ie=Math.floor(te/7),De=se[Ie];if(!De||De===0)return null;let _e=_g(De,E,ce);return jsxRuntime.jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",De<0?"text-red-400":"text-emerald-400",L&&"blur-sm select-none"),children:[P.labels.cashOut,": ",De<0?"-":"+",_e]})})()]},te)})})})]}),Xe&&jsxRuntime.jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",G?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",G?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",G?"text-white/40":"text-gray-500"),children:P.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:p("text-[10px] font-mono tabular-nums",G?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",G?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-5 h-5",G?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:p("text-xs font-mono",G?"text-white/20":"text-gray-400"),children:X==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{ue(W);},className:p("w-full text-left rounded-md p-3 transition-all group/card",G?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",G?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",G?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",G?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",G?"text-white/25":"text-gray-400",L&&"blur-sm select-none"),children:[Jd(W.effortMinutes,E,ce)&&jsxRuntime.jsxs("span",{children:[P.labels.estimate,": ",Jd(W.effortMinutes,E,ce)]}),(()=>{let te=Kg(W,E,ce);return te?jsxRuntime.jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:p("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(Gg,{task:W,isDark:G})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,ze)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},ze))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",G?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:P.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",G?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),H.hasCostData&&jsxRuntime.jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",G?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",G?"text-white/40":"text-gray-500"),children:["\u25C8 ",P.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",G?"text-white/40":"text-gray-500"),children:P.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",G?"text-white/60":"text-gray-700",L&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",G?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",G?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",G?"text-white/25":"text-gray-400"),children:P.labels.variance}),jsxRuntime.jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":G?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",P.labels.days]})]}),jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",G?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",G?"text-white/25":"text-gray-400"),children:P.labels.cost}),jsxRuntime.jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",L&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!j&&jsxRuntime.jsx(Xr,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:I==="dark"?"dark":"light",locale:X,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:u,onCreateTag:i,attachments:z?c?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ss(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:R,onTimerDiscard:$,blurFinancials:L}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>$e(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:p("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",G?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",G?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("font-medium text-sm",G?"text-white/90":"text-gray-900"),children:he.date.toLocaleDateString(X==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>$e(null),className:p("p-1 rounded",G?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:he.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{$e(null),ue(W.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",G?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(Gg,{task:W.task,isDark:G}),jsxRuntime.jsx("span",{className:p("text-sm truncate flex-1",G?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var Qd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Zd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},ec={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Hi={dark:Qd,light:Zd,neutral:ec};function qg(e){return Hi[e]||Hi.dark}function iw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[u,i]=react.useState(false),c=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=c.length,b=new Set(c.flatMap(f=>f.assignedUserIds||[])).size,h=c.map(f=>f.priority).filter(Boolean),v=new Set(c.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:h,labels:v}},[c]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,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:p("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:d.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"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(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:[d.uniqueAssignees," assignees"]})]}),d.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:[d.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:c.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:c.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.stopPropagation(),s?.(e.id,g.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"})]})})]},g.id))})})]})}var Jg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ls(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 ds(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 Qg(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Zg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let u=react.useMemo(()=>({...Jg,...n}),[n]),[i,c]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(w=>{let x=w.timestamp.toISOString().split("T")[0],k=y.get(x);k?k.push(w):y.set(x,[w]);}),Array.from(y.entries()).sort((w,x)=>x[0].localeCompare(w[0])).map(([w,x])=>({date:new Date(w),events:x.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=react.useMemo(()=>{let y=new Set,w=new Set;return e.forEach(x=>{y.add(x.userId),w.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(w)}},[e]),h=y=>{c(w=>{let x=new Set(w);return x.has(y)?x.delete(y):x.add(y),x});},v=y=>{let x=new Date().getTime()-y.getTime(),k=Math.floor(x/6e4),C=Math.floor(x/36e5),D=Math.floor(x/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:D<7?`${D}d ago`:y.toLocaleDateString()},f=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&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:p("history-timeline-empty",l),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:p("history-timeline",u.compact&&"compact",l),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 w=y.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(y=>jsxRuntime.jsxs("option",{value:y,children:[ds(y)," ",y.replace("_"," ")]},y))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.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=>a({...t,searchTerm:y.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.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((w,x)=>{let k=i.has(w.id),C=s===w.id,D=Qg(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ds(w.type)})}),x<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),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:[u.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ls(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),h(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},T)),w.metadata&&Object.keys(w.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(w.metadata).map(([T,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},T))]})]})]})]},w.id)})})]},y.date?.toISOString()||"all"))})]})}function t0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:p("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:p("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&ds(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&ls(d)}),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:d&&d.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:g=>l(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,b)=>jsxRuntime.jsx("div",{className:p("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>l(b),title:ls(g)},g.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:o,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:n,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:c.map(g=>jsxRuntime.jsxs("button",{className:p("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>u(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,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:d&&d.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(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:p("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,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 tc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function ac(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 a0(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 r0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function mw(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let d=a/2,m=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(m-c.y)*o.centerForce*i,n.forEach(g=>{if(c.id===g.id)return;let b=c.x-g.x,h=c.y-g.y,v=Math.sqrt(b*b+h*h)||1,f=o.chargeStrength*i/(v*v);c.vx+=b/v*f,c.vy+=h/v*f;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),m=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!m)return;let g=m.x-d.x,b=m.y-d.y,h=Math.sqrt(g*g+b*b)||1,v=(h-o.linkDistance)/h*o.forceStrength*i;d.vx+=g*v,d.vy+=b*v,m.vx-=g*v,m.vy-=b*v;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function o0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:u}){let i=react.useRef(null),[c,d]=react.useState([]),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(1),[x,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let E=mw(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let C=react.useCallback((E,ce)=>{a.enableDragging&&(ce.stopPropagation(),g(E));},[a.enableDragging]),D=react.useCallback(E=>{if(!m||!i.current)return;let I=i.current.getBoundingClientRect(),X=(E.clientX-I.left-x.x)/y,Ce=(E.clientY-I.top-x.y)/y;d(Xe=>Xe.map(P=>P.id===m?{...P,x:X,y:Ce,fx:X,fy:Ce}:P));},[m,y,x]),T=react.useCallback(()=>{g(null);},[]),R=react.useCallback((E,ce)=>{ce.stopPropagation(),l?.({type:"node-click",node:E,position:{x:ce.clientX,y:ce.clientY}});},[l]),$=react.useCallback((E,ce)=>{ce.stopPropagation(),l?.({type:"edge-click",edge:E,position:{x:ce.clientX,y:ce.clientY}});},[l]),L=react.useCallback(E=>{let ce=c.find(I=>I.id===E);return ce?{x:ce.x,y:ce.y}:{x:0,y:0}},[c]),j=react.useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ce=E.card.priority;return ce==="URGENT"?"#ef4444":ce==="HIGH"?"#f59e0b":ce==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:p("relationships-graph-empty",u),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:p("relationships-graph",u),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:n.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:n.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"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.min(E+.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:()=>w(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:tc(E)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[a0(E)," ",ac(E)]})]},E))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let ce=L(typeof E.source=="string"?E.source:E.source.id),I=L(typeof E.target=="string"?E.target:E.target.id),X=r0(E.type),Ce=v===E.id,Xe=E.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-edge",Ce&&"hovered",Xe&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:P=>$(E,P),children:[jsxRuntime.jsx("line",{x1:ce.x,y1:ce.y,x2:I.x,y2:I.y,stroke:tc(E.type),strokeWidth:Xe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Ce?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Ce&&jsxRuntime.jsx("text",{x:(ce.x+I.x)/2,y:(ce.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ac(E.type)})]},E.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(E=>{let ce=b===E.id,I=E.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-node",ce&&"hovered",I&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:X=>C(E.id,X),onMouseEnter:()=>h(E.id),onMouseLeave:()=>h(null),onClick:X=>R(E,X),children:[jsxRuntime.jsx("circle",{r:I?a.nodeSize*1.2:a.nodeSize,fill:j(E),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:ce?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.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 i0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,u]=react.useState(false),[i,c]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),b=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&!b&&h();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,b]);let h=()=>{b||(n(""),c(null),m(null),t());},v=async()=>{if(!(!s.trim()||b)){u(true),c(null),m(null);try{let y=await r(s.trim());m(y);}catch(y){c(y instanceof Error?y.message:"Failed to generate plan");}finally{u(false);}}},f=()=>{d&&(a(d),h());};return e?jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),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-blue-400",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:h,disabled:b,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:d?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!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,w)=>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},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,w)=>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-blue-500/20 text-blue-400"}`,children:y.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.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:g,value:s,onChange:y=>n(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-blue-500/50 transition-all resize-none",disabled:b}),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,w)=>jsxRuntime.jsx("button",{onClick:()=>n(y),disabled:b,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},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 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:h,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!s.trim()||b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var rc={"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 fw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},bw={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 hw(e,t,a){let r=rc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function cs(e){return `$${e.toFixed(4)}`}var oc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=hw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),u=a.reduce((d,m)=>d+m.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:u,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Wo=new oc;function c0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Wo.getStats()),[s,n]=react.useState(Wo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(Wo.getStats()),n(Wo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),react.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let l=Wo.getRecentOperations(5);return jsxRuntime.jsxs(Ot,{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:u=>u.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-blue-500/10 to-purple-500/10 border border-blue-500/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 (",a.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:cs(r.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-blue-400 mt-1",children:r.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:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.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:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.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(r.operationsByFeature).map(([u,i])=>{let c=r.costsByFeature[u]||0,d=r.totalOperations>0?i/r.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:u.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:cs(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:cs(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 m0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[u,i]=react.useState(""),[c,d]=react.useState(""),[m,g]=react.useState(false),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(null),x=react.useRef(null),k=m||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let $=L=>{L.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,k]);let C=()=>{k||(l(""),i(""),d(""),h(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||k)){g(true),h(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:c||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){h($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let R=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:$=>$.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-blue-400",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:C,disabled:k,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:v?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-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% 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:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(($,L)=>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:["#",L+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:$.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"})]}),$.start," \u2192 ",$.end]}),jsxRuntime.jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.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:x,value:n,onChange:$=>l($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),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:u,onChange:$=>i($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]}),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:c,onChange:$=>d($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),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(($,L)=>jsxRuntime.jsx("button",{onClick:()=>l($),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},L))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 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:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:D,disabled:!n.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wi({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&Ts(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,y,w)=>{console.warn(`Retry attempt ${y} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(v,f,y)=>{r(w=>{let x=w.cards.find($=>$.id===v);if(!x)return w;let k=x.columnId,C={...x,columnId:f,position:y},D=w.cards.map($=>$.id===v?C:$),T=w.columns.map($=>{if($.id===k)return {...$,cardIds:$.cardIds.filter(L=>L!==v)};if($.id===f){let L=D.filter(j=>j.columnId===f).sort((j,E)=>j.position-E.position);return {...$,cardIds:L.map(j=>j.id)}}return $}),R={...w,cards:D,columns:T};return o(R),R});},[o]),n=react.useCallback(async(v,f)=>{r(y=>{let w=y.cards.map(k=>k.id===v?{...k,...f}:k),x={...y,cards:w};return o(x),x});},[o]),l=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f},x=y.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...y,cards:[...y.cards,w],columns:x};return o(k),k});},[o]),u=react.useCallback(async v=>{r(f=>{let y=f.cards.find(C=>C.id===v);if(!y)return f;let w=f.cards.filter(C=>C.id!==v),x=f.columns.map(C=>C.id===y.columnId?{...C,cardIds:C.cardIds.filter(D=>D!==v)}:C),k={...f,cards:w,columns:x};return o(k),k});},[o]),i=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f,cardIds:[]},x={...y,columns:[...y.columns,w]};return o(x),x});},[o]),c=react.useCallback(async(v,f)=>{r(y=>{let w=y.columns.map(k=>k.id===v?{...k,...f}:k),x={...y,columns:w};return o(x),x});},[o]),d=react.useCallback(async v=>{r(f=>{let y=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),x={...f,cards:y,columns:w};return o(x),x});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),b=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:u,deleteColumn:d,clearBoard:b}}}function f0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Wi({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var us={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},h0={by:"none",order:"asc"};function y0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...us,...e}),[s,n]=react.useState({...h0,...t}),l=react.useCallback(h=>{o(v=>({...v,...h}));},[]),u=react.useCallback(h=>{n(v=>({...v,...h}));},[]),i=react.useCallback(()=>{o(us),n(h0);},[]),c=react.useCallback(()=>{a&&o({...us,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...us,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...us,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),b=react.useCallback(h=>{let v=[...h];if(r.search){let f=r.search.toLowerCase();v=v.filter(y=>y.title.toLowerCase().includes(f)||y.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,y=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),x=String(f.getDate()).padStart(2,"0"),k=`${y}-${w}-${x}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let D=C.endDate||C.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let R=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),L=String(D.getUTCDate()).padStart(2,"0");T=`${R}-${$}-${L}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let R=new Date(k+"T00:00:00"),$=new Date(T+"T00:00:00"),L=new Date(R);return L.setDate(L.getDate()+7),$>=R&&$<=L;case "custom":if(r.dateRange){let j=typeof D=="string"?new Date(D):D;return j>=r.dateRange.start&&j<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,y)=>{let w=0;switch(s.by){case "created":let x=f.createdAt?new Date(f.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;w=x-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=C[f.priority||"LOW"],T=C[y.priority||"LOW"];w=D-T;break;case "dueDate":let R=f.endDate||f.dueDate,$=y.endDate||y.dueDate;if(!R)return 1;if(!$)return -1;let L=typeof R=="string"?new Date(R).getTime():R.getTime(),j=typeof $=="string"?new Date($).getTime():$.getTime();w=L-j;break;case "title":w=f.title.localeCompare(y.title);break;case "estimate":let E=f.estimatedTime||0,ce=y.estimatedTime||0;w=E-ce;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:m,applyFilters:b,hasActiveFilters:g}}var v0,w0;if(typeof window<"u")try{let e=ws("ai");v0=e.generateObject,w0=e.generateText;}catch{}function k0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(v0&&w0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function sc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function C0(e){let{cards:t}=e,[a,r]=sc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,b=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let h=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(h&&v&&h.columnId===v.columnId){let f=t.filter(T=>T.columnId===h.columnId).sort((T,R)=>T.position-R.position),y=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===d),[x,k]=y<w?[y,w]:[w,y],C=f.slice(x,k+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:u,toggleCard:i,getSelectedCards:c}}var T0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function N0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...T0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((h,v,f,y,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:v,columnId:f,strategy:y,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,x]);},[o.minCardsPerStack,s]),u=react.useCallback(h=>{n(v=>v.filter(f=>f.id!==h));},[]),i=react.useCallback(h=>{n(v=>v.map(f=>f.id===h?{...f,isExpanded:!f.isExpanded}:f));},[]),c=react.useCallback((h,v)=>{n(f=>f.map(y=>y.id===h&&!y.cardIds.includes(v)?{...y,cardIds:[...y.cardIds,v]}:y));},[]),d=react.useCallback((h,v)=>{n(f=>f.map(y=>{if(y.id===h){let w=y.cardIds.filter(x=>x!==v);return w.length<o.minCardsPerStack?null:{...y,cardIds:w}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),m=react.useCallback(h=>s.filter(v=>v.columnId===h).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async h=>{let v=t.filter(k=>k.columnId===h);if(v.length<o.minCardsPerStack*2)return [];let f=[],y=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{y.has(C)||y.set(C,[]),y.get(C).push(k);});}),y.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(D=>D.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(D=>D.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(k=>{k.priority&&(x.has(k.priority)||x.set(k.priority,[]),x.get(k.priority).push(k));}),x.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:h,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let D=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[k.id,...D.map($=>$.card.id)],R=D.reduce(($,L)=>$+L.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:R});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),b=react.useCallback(h=>{l(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),y=f[0];f.length>0&&y&&y.confidence>=.9&&b(y);});},[]),{stacks:s,createStack:l,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:b,config:o}}var D0=react.createContext(null);function S0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=ws("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=ws("@libxai/core");n.set(u.id,new i(u));});let l=null;if(t?.board){let{Board:u}=ws("@libxai/core");l=new u(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(D0.Provider,{value:{store:o},children:e})}function Gi(){let e=react.useContext(D0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ms(){let e=Gi(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(y=>{e.updateBoard(y);},[e]),u=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,w)=>{e.updateColumn(y,w);},[e]),c=react.useCallback(y=>{e.deleteColumn(y);},[e]),d=react.useCallback(y=>e.getColumn(y),[e]),m=react.useCallback(y=>{e.addCard(y);},[e]),g=react.useCallback((y,w)=>{e.updateCard(y,w);},[e]),b=react.useCallback(y=>{e.deleteCard(y);},[e]),h=react.useCallback((y,w,x)=>{e.moveCard(y,w,x);},[e]),v=react.useCallback(y=>e.getCard(y),[e]),f=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:d,addCard:m,updateCard:g,deleteCard:b,moveCard:h,getCard:v,getCardsByColumn:f}}function F0(e){let{cards:t}=ms();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function M0(e="position",t="asc"){let{cards:a}=ms();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Vi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Yc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Iw=new Vi;function A0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:u}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(b=>{let h=e[b.index];if(!h)return null;let v=u?u(h,b.index):b.index,f={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsxRuntime.jsx("div",{style:f,"data-index":b.index,children:r(h,b.index)},v)})})})}function L0(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 B0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:u,horizontal:i=true}){let c=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:g,className:s,children:jsxRuntime.jsx("div",{style:b,children:m.map(h=>{let v=e[h.index];if(!v)return null;let f=u?u(v,h.index):h.index,y={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":h.index,children:o(v,h.index)},f)})})})}function R0(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 O0(e,t=10){return e>t}var cc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},uc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},pc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},mc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},gc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},fc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},bc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},hc={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)"},yc={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)"},xc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},vc={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}},wc={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}},_i={spacing:cc,borderRadius:uc,fontSize:pc,fontWeight:mc,lineHeight:gc,zIndex:fc,duration:bc,easing:hc,shadows:yc,opacity:xc,kanban:vc,gantt:wc};function $0(e,t,a){return e[t]??a}function kc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?kc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Ow(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Cc(e="asakaa"){let t=kc(_i),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Ow(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function ym(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function to(e,t){let a=ym(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function wd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let b=new Date(r),h=b.getDay(),v=g-h;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+m):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+m),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,b=parseInt(l[3],10);return new Date(b,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=c[i[2].toLowerCase()],b=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=u[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(b,m,g)}return null}function kd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Cd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function xm(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 vm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),d=to(t,i),m=wd(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(m);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:b},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=to(t,i),m=kd(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),d=to(t,i),m=Cd(u);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=to(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),d=to(t,i),m=to(t,u);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=to(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function wm(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 Yv(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 qv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ci(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(m=>m.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Ci(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:Yv(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function km(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:qv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ci(r,e,t))}var Td={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"},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"}},Nd={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:"Carga Equipo",blockers:"Bloqueantes"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Ti={en:Td,es:Nd};function Dd(e){return Ti[e]||Ti.en}function Ni(e,t){let a=Dd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Sd=[{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 Tm(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 Nm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Tm(e),i=Sd[0],u=Sd.find(g=>g.value===c)??i,d=u.icon,m=g=>{switch(Tm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Sd.map(g=>{let b=g.icon;return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:p("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Ed=[{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 Sm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=Ed.find(u=>u.value===e)??Ed[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ed.map(u=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(u.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function ts(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Fd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Pm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[c,i]=react.useState(""),u=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let h=v=>{u.current&&!u.current.contains(v.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=h=>e.some(v=>v.name===h),b=h=>{if(a){if(g(h.name))a(e.filter(v=>v.name!==h.name));else {let v={name:h.name,initials:ts(h.name),color:h.color||Fd(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,v]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,v)=>jsxRuntime.jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Fd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ts(h.name)},`${h.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),l(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,v)=>jsxRuntime.jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Fd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ts(h.name)},`${h.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:p("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((h,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:8,fontWeight:700,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||ts(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==h.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}})})]},`${h.name}-${v}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let v=g(h.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),b(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ts(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),v&&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"}})})]},h.id)})})]})]})}function Im({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,u]=react.useState(false),[d,m]=react.useState(o),[g,b]=react.useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),h=react.useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=T=>{h.current&&!h.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let y=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),B=new Date(D,T,1),A=new Date(D,T+1,0).getDate(),_=B.getDay(),E=[],L=new Date(D,T,0).getDate();for(let ee=_-1;ee>=0;ee--)E.push({date:new Date(D,T-1,L-ee),isCurrentMonth:false});for(let ee=1;ee<=A;ee++)E.push({date:new Date(D,T,ee),isCurrentMonth:true});let X=42-E.length;for(let ee=1;ee<=X;ee++)E.push({date:new Date(D,T+1,ee),isCurrentMonth:false});return E},[g]),x=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),u(false);else if(d==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),u(false);}},C=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let B=new Date(D);B.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.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 _=new Date(D);_.setDate(D.getDate()+14);let E=new Date(D);return E.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:B,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let D=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:y(D)})]})}let k=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:D=>{D.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&b(new Date(T.getFullYear(),T.getMonth(),1));},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:y(k)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxRuntime.jsxs("div",{className:p("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,T)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>b(new Date),className:p("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let B=D.date.toDateString()===new Date().toDateString(),$=v?.toDateString()===D.date.toDateString(),A=f?.toDateString()===D.date.toDateString(),_=$||A,E=!r&&v&&f&&D.date>=v&&D.date<=f;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(D.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),B&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",A&&!$&&"bg-[#7C3AED] text-white",E&&!_&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!_&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function Ei({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Im,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Cn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Fi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,b=r/o;c(true);for(let h=1;h<=o;h++){let v=setTimeout(()=>{let f=h/o,y=1-Math.pow(1-f,3),w=Math.round(d+g*y);n(w),h===o&&(c(false),n(m));},b*h);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Bm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),u=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let b=Date.now();i.current=setInterval(()=>{let h=Date.now()-b,v=Math.min(h/a*100,100);l(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:d}}function Om({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[c,i]=react.useState(""),u=react.useRef(null),{isFlashing:d,triggerFlash:m}=Cn(),{displayValue:g,isAnimating:b}=Fi(e,{enabled:o,duration:300,steps:6}),h=x=>{if(r||!t)return;x.stopPropagation();let C=x.currentTarget.getBoundingClientRect(),k=x.clientX-C.left,D=Math.round(k/C.width*100),T=Math.max(0,Math.min(100,D));T!==e&&(t(T),s&&m());},v=react.useCallback(x=>{r||!t||(x.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&u.current&&(u.current.focus(),u.current.select());},[n]);let f=react.useCallback(()=>{l(false);let x=parseInt(c,10);if(!isNaN(x)&&t){let C=Math.max(0,Math.min(100,x));C!==e&&(t(C),s&&m());}},[c,t,e,s,m]),y=react.useCallback(x=>{x.key==="Enter"&&f(),x.key==="Escape"&&l(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:h,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",b&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:u,value:c,onChange:x=>i(x.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:y,maxLength:3,className:p("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:v,className:p("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",b&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let u=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:d,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:p("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Gm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:b,triggerFlash:h}=Cn(),{displayValue:v,isAnimating:f}=Fi(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let y=()=>{let x=parseFloat(d);if(!isNaN(x)){let C=x;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&h());}u(false);},w=x=>{x.key==="Enter"?y():x.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:x=>m(x.target.value),onBlur:y,onKeyDown:w,onClick:x=>x.stopPropagation(),min:o,max:s,className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),b&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Vm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:p("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function jm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:u}=Bm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?u():i(!e):t(!e));},m=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&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:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function qm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:p("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.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)),o>0&&jsxRuntime.jsxs("span",{className:p("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function L2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function I2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function mr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0}){let[u,d]=react.useState(false),[m,g]=react.useState(""),b=react.useRef(null),{isFlashing:h,triggerFlash:v}=Cn(),f=c==="financial"&&i>0,y=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:L2(e,r);react.useEffect(()=>{u&&b.current&&(b.current.focus(),b.current.select());},[u]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?g(`${k}h ${D}m`):k>0?g(`${k}h`):g(`${D}m`);}else g("");},[e,u]);let w=()=>{let k=I2(m);k!==e&&(t?.(k),n&&v()),d(false);},x=k=>{k.key==="Enter"?w():k.key==="Escape"&&d(false);};if(l)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let C=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(C,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:y})]}):u?jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:k=>g(k.target.value),onBlur:w,onKeyDown:x,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),d(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(C,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:y})]})}function Zm({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),l()]})}function tg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",u=l==="financial"&&c>0,d=ee=>u?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[m,g]=react.useState(false),[b,h]=react.useState(false),[v,f]=react.useState(null),y=react.useRef(null),w=e.timeLoggedMinutes||0,x=e.effortMinutes||0,C=e.soldEffortMinutes||0,k=Math.round(w/60*10)/10,D=Math.round(x/60*10)/10,T=x>0?w/x*100:0,B=T>100?Math.round((w-x)/60*10)/10:0,$=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!b&&!v)return;let ee=$e=>{y.current&&!y.current.contains($e.target)&&(h(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[b,v]);let A=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){h($e=>!$e),f(null);return}n&&n(e);},_=ee=>{h(false),f(ee);},E=async(ee,$e)=>{v==="log"&&r&&ee?r(e,ee,$e):v==="estimate"&&o?o(e,ee):v==="quoted"&&s&&s(e,ee),f(null);},ue=r||o||s||n,L=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),X=v==="estimate"?x:v==="quoted"?C:void 0;return x===0&&w===0&&C===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&ue&&jsxRuntime.jsx("button",{onClick:A,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.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:b&&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:L.map(ee=>jsxRuntime.jsxs("button",{onClick:$e=>{$e.stopPropagation(),_(ee.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:$e=>{$e.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:$e=>{$e.target.style.background="transparent";},children:[jsxRuntime.jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(k)}),x>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),B>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(B)," Over"]})]}),x>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(T,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),ue&&jsxRuntime.jsx("button",{onClick:A,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.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:b&&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:L.map(ee=>jsxRuntime.jsxs("button",{onClick:$e=>{$e.stopPropagation(),_(ee.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:$e=>{$e.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:$e=>{$e.target.style.background="transparent";},children:[jsxRuntime.jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]})}function U2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function W2(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 ag({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:p(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:p(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function rg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let u=U2(e);if(u.length===0)return null;let d=u.slice(0,3),m=u.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,b)=>jsxRuntime.jsx(ag,{assignee:g,size:24,isDark:t},g.name+b))}),m>0&&jsxRuntime.jsxs("span",{className:p("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:p("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:p("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,c=!!n&&l>0,i=c?W2(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ag,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:p("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&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:[l,"% LOAD"]})]})}var G2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function ng({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:p("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",G2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function i1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function l1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function dg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let b=react.useRef(null),h=r==="es"?ig.es:ig.en;if(react.useEffect(()=>{let x=k=>{b.current&&!b.current.contains(k.target)&&t();},C=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",x),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let x=[];return o&&x.push({id:"edit",label:h.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),x.push({id:"sep1",label:"",icon:null,separator:true}),l&&(x.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:()=>{l({...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-blue-500"}),onClick:()=>{l({...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:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),x.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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&x.push({id:"assign",label:h.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],T=k.some(B=>B.name===C.name)?k.filter(B=>B.name!==C.name):[...k,{name:C.name,initials:i1(C.name),color:C.color||l1(C.name),avatar:C.avatarUrl}];l({...e.task,assignees:T}),t();}}))})),d&&x.push({id:"log-time",label:h.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&x.push({id:"report-blocker",label:h.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&x.push({id:"copy-link",label:h.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),x.push({id:"sep2",label:"",icon:null,separator:true}),s&&x.push({id:"duplicate",label:h.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&x.push({id:"delete",label:h.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),x},f=()=>{if(!e.columnId)return [];let x=[];return i&&(x.push({id:"sort-asc",label:h.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),x.push({id:"sort-desc",label:h.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(x.push({id:"sep-hide",label:"",icon:null,separator:true}),x.push({id:"hide",label:h.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),x},y=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:y.map(x=>x.separator?jsxRuntime.jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},x.id):x.submenu?jsxRuntime.jsx(d1,{item:x,isDark:a},x.id):jsxRuntime.jsxs("button",{onClick:x.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",x.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:p(x.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:x.icon}),x.label]},x.id))})}function d1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[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:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var ig={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var hg={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"}),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"})},D1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function xg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[u,d]=react.useState(null),m=react.useRef(null),g=l==="es"?yg.es:yg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let x=()=>{if(!m.current)return;let C=m.current.getBoundingClientRect(),D=window.innerHeight-C.top-20;d(Math.max(300,D));};return requestAnimationFrame(x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[e]),react.useEffect(()=>{if(!e)return;let x=setTimeout(()=>{let C=D=>{m.current&&!m.current.contains(D.target)&&t();},k=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",k),m._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(x),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let b=x=>g.columns[x]||x,h=x=>{if(x==="name")return;let C=a.map(k=>k.id===x?{...k,visible:!k.visible}:k);o(C);},v=(x,C)=>{let k=a.find(T=>T.type===x&&(!C||T.customFieldId===C));if(k){h(k.id);return}let D={id:C||x,type:x,label:C?r.find(T=>T.id===C)?.name||x:b(x),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,D]);},f=D1.filter(x=>b(x).toLowerCase().includes(c.toLowerCase())),y=r.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",x.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:x=>i(x.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:x=>{x&&x.style.setProperty("--focus-border",w);},onFocus:x=>{x.currentTarget.style.borderColor=w,x.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:x=>{x.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",x.currentTarget.style.background=n?"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:x=>x.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(x=>{let C=a.find(T=>T.type===x&&!T.customFieldId),k=C?.visible??false,D=x==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(C?h(C.id):v(x));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&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:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:hg[x]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:b(x)})]},x)})})]}),y.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:y.map(x=>{let k=a.find(D=>D.customFieldId===x.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(x.type,x.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&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:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:hg[x.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x.name})]},x.id)})})]})]})]})}var yg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var B1=[{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 kg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,u]=react.useState([""]),d=o==="es"?wg.es:wg.en;react.useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:l};l==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},b=(v,f)=>{let y=[...i];y[v]=f,u(y);},h=v=>{i.length>1&&u(i.filter((f,y)=>y!==v));};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:p("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:p("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:B1.map(v=>jsxRuntime.jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:p("text-xs",l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:v,onChange:y=>b(f,y.target.value),placeholder:`${d.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>h(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:p("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:p("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var wg={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 Ng={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 Dg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),u=s==="es"?Ng.es:Ng.en;react.useEffect(()=>{if(!n)return;let g=h=>{Date.now()-i.current<100||c.current&&!c.current.contains(h.target)&&l(false);},b=h=>{h.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(b=>!b);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),u.filters,m&&jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:p("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,h=()=>g.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p(b?g.color:"text-gray-400","flex-shrink-0"),children:h()}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Sg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Eg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxRuntime.jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children: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"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,l=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Sg(s)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Sg(n)})]}),n>0&&jsxRuntime.jsx("div",{className:p("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:`${l}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),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:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"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:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,l=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let l=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:p("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(s.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${s.name}-${n}`)})})]})]})}var J1=[{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 Ig(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Ig(r.subtasks,t+1));return a}function Q1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let d=(s.progress||0)/u;r+=d,o++;}return o>0?r/o:null}function Z1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Sn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Sn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Dn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Bg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:w=false,onCreateTask:x,persistFilter:C=false,financialBlur:k,healthSidebar:D,lens:T="hours",hourlyRate:B=0,aggregateParentHours:$=false,showProjectTotals:A=false}=t,_=Ni(d,m),E=u==="dark",ue=react.useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(C);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}},[C]),L=react.useMemo(()=>{function S(Z){let me=0,Ee=0,Je=0;for(let Ye of Z)if(Ye.subtasks&&Ye.subtasks.length>0){let I=S(Ye.subtasks);me+=I.spent,Ee+=I.allocated,Je+=I.quoted;}else me+=Ye.timeLoggedMinutes??0,Ee+=Ye.effortMinutes??0,Je+=Ye.soldEffortMinutes??0;return {spent:me,allocated:Ee,quoted:Je}}return S(e)},[e]),X=react.useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:L.spent,totalHoursAllocatedMinutes:L.allocated}},[D,L]),[ee,$e]=react.useState(true),[R,Y]=react.useState("position"),[be,_e]=react.useState("asc"),[z,oe]=react.useState(""),[J,Ae]=react.useState(()=>ue().statusFilter),[xe,He]=react.useState(()=>ue().hideCompleted),[Ne,at]=react.useState(h||J1),[te,rt]=react.useState(false),[pe,ot]=react.useState(false),[gt,Ct]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ye,ft]=react.useState("all"),[tt,Qe]=react.useState(false),H=react.useRef(null),ie=react.useRef(null),N=react.useMemo(()=>{let S=0;function Z(me,Ee){for(let Je of me)Ee>S&&(S=Ee),Je.subtasks?.length&&Z(Je.subtasks,Ee+1);}return Z(e,1),S},[e]);react.useEffect(()=>{if(!tt)return;let S=Z=>{H.current?.contains(Z.target)||ie.current?.contains(Z.target)||Qe(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[tt]),react.useEffect(()=>{if(ye==="all"){let me=function(Ee){for(let Je of Ee)Je.subtasks?.length&&(Je.isExpanded===false&&a.onTaskToggleExpand?.(Je.id),me(Je.subtasks));};me(e);}else {let me=function(Ee,Je){for(let Ye of Ee)if(Ye.subtasks?.length){let I=Je<ye,G=Ye.isExpanded!==false;I!==G&&a.onTaskToggleExpand?.(Ye.id),me(Ye.subtasks,Je+1);}};me(e,1);}},[ye]);let[j,le]=react.useState(null),[Ce,W]=react.useState(0),[ae,Ue]=react.useState(0),Te=react.useRef(null),[Be,De]=react.useState(null),[je,ut]=react.useState(null);react.useEffect(()=>{h&&at(h);},[h]),react.useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:J,hideCompleted:xe}));}catch(S){console.error("Error persisting filter state:",S);}},[C,J,xe]);let mt=react.useMemo(()=>{let S=new Set;function Z(me){for(let Ee of me)Ee.subtasks?.length&&(Ee.isExpanded!==false&&S.add(Ee.id),Z(Ee.subtasks));}return Z(e),S},[e]),Ze=react.useMemo(()=>Ne.filter(S=>S.visible),[Ne]),et=react.useCallback(S=>{a.onTaskToggleExpand?.(S);},[a]),It=react.useCallback(S=>{R===S?_e(Z=>Z==="asc"?"desc":"asc"):(Y(S),_e("asc")),a.onSortChange?.({column:S,direction:be==="asc"?"desc":"asc"});},[R,be,a]),Tt=react.useCallback(S=>{at(S),a.onColumnsChange?.(S);},[a]),bt=react.useCallback(S=>{let Z=Ne.map(me=>me.id===S?{...me,visible:false}:me);Tt(Z);},[Ne,Tt]),yt=react.useCallback((S,Z)=>{Y(S),_e(Z);},[]),dt=react.useCallback((S,Z,me)=>{y&&(S.preventDefault(),Ct({isOpen:true,x:S.clientX,y:S.clientY,type:Z?"task":"header",task:Z,columnId:me}));},[y]),Ft=react.useCallback(()=>{Ct(S=>({...S,isOpen:false}));},[]),ze=react.useCallback((S,Z)=>{if(!f)return;S.preventDefault(),S.stopPropagation();let me=Ne.find(Ee=>Ee.id===Z);me&&(le(Z),W(S.clientX),Ue(me.width));},[Ne,f]);react.useEffect(()=>{if(!j)return;let S=me=>{let Ee=me.clientX-Ce,Je=Math.max(50,ae+Ee),Ye=Ne.map(I=>I.id===j?{...I,width:Je}:I);at(Ye);},Z=()=>{j&&a.onColumnsChange?.(Ne),le(null);};return document.addEventListener("mousemove",S),document.addEventListener("mouseup",Z),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",Z);}},[j,Ce,ae,Ne,a]);let Re=react.useCallback((S,Z)=>{if(Z==="name"){S.preventDefault();return}De(Z),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Z),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),ct=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),De(null),ut(null);},[]),se=react.useCallback((S,Z)=>{S.preventDefault(),Z!=="name"&&(S.dataTransfer.dropEffect="move",ut(Z));},[]),fe=react.useCallback(()=>{ut(null);},[]),P=react.useCallback((S,Z)=>{if(S.preventDefault(),!Be||Be===Z||Z==="name")return;let me=[...Ne],Ee=me.findIndex(I=>I.id===Be),Je=me.findIndex(I=>I.id===Z);if(Ee===-1||Je===-1)return;let Ye=me.splice(Ee,1);Ye[0]&&(me.splice(Je,0,Ye[0]),Tt(me),De(null),ut(null));},[Be,Ne,Tt]),K=react.useCallback(async S=>{if(a.onCreateCustomField){let Z={...S,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Z);}ot(false);},[a]),q=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),de=react.useMemo(()=>{let S=Ig(e);if(z.trim()){let Z=z.toLowerCase();S=S.filter(me=>me.name.toLowerCase().includes(Z));}return J!=="all"&&(S=S.filter(Z=>q(Z)===J)),xe&&(S=S.filter(Z=>q(Z)!=="completed")),S.sort((Z,me)=>{let Ee,Je;switch(R){case "name":Ee=Z.name.toLowerCase(),Je=me.name.toLowerCase();break;case "startDate":Ee=Z.startDate?.getTime()||0,Je=me.startDate?.getTime()||0;break;case "endDate":Ee=Z.endDate?.getTime()||0,Je=me.endDate?.getTime()||0;break;case "progress":Ee=Z.progress||0,Je=me.progress||0;break;case "status":Ee=Z.status||"todo",Je=me.status||"todo";break;case "priority":let Ye={urgent:0,high:1,medium:2,low:3,none:4};Ee=Ye[Z.priority]??4,Je=Ye[me.priority]??4;break;case "position":return 0;default:return 0}return Ee<Je?be==="asc"?-1:1:Ee>Je?be==="asc"?1:-1:0}),S},[e,z,J,xe,R,be,q]),Se=react.useCallback((S,Z)=>{let me=Ye=>{a.onTaskUpdate?.({...S,...Ye});},Ee=Ye=>Ye?S.customFields?.find(G=>G.fieldId===Ye)?.value:void 0,Je=(Ye,I)=>{if(!Ye)return;let he=[...S.customFields||[]],F=he.findIndex(re=>re.fieldId===Ye);F>=0?he[F]={fieldId:Ye,value:I}:he.push({fieldId:Ye,value:I}),me({customFields:he});};switch(Z.type){case "name":return null;case "status":return jsxRuntime.jsx(Nm,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:I=>{me({status:I,progress:I==="completed"?100:I==="in-progress"?50:0});},isDark:E,locale:d,translations:_.status});case "priority":return jsxRuntime.jsx(Sm,{value:S.priority,onChange:I=>me({priority:I}),isDark:E,locale:d});case "assignees":{let I=S.hasChildren,G=S.assignees||[];if(I&&S.subtasks?.length){let he=new Map;(S.assignees||[]).forEach(re=>he.set(re.name,re));let F=re=>{(re||[]).forEach(Le=>{(Le.assignees||[]).forEach(qe=>{he.has(qe.name)||he.set(qe.name,qe);}),Le.subtasks?.length&&F(Le.subtasks);});};F(S.subtasks),G=Array.from(he.values());}return jsxRuntime.jsx(Pm,{value:G,availableUsers:l,onChange:he=>me({assignees:he}),isDark:E,locale:d,disabled:I})}case "startDate":return jsxRuntime.jsx(Ei,{value:S.startDate,onChange:I=>me({startDate:I}),isDark:E,locale:d,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(Ei,{value:S.endDate,onChange:I=>me({endDate:I}),isDark:E,locale:d,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":return jsxRuntime.jsx(Om,{value:S.progress||0,onChange:I=>{let G=I===100?"completed":I>0?"in-progress":"todo";me({progress:I,status:G});},isDark:E});case "tags":return jsxRuntime.jsx(qm,{value:S.tags||[],isDark:E});case "text":return jsxRuntime.jsx(zm,{value:Ee(Z.customFieldId)||"",onChange:I=>Je(Z.customFieldId,I),isDark:E});case "number":return jsxRuntime.jsx(Gm,{value:Ee(Z.customFieldId)||0,onChange:I=>Je(Z.customFieldId,I),isDark:E});case "date":let Ye=Ee(Z.customFieldId);return jsxRuntime.jsx(Ei,{value:Ye?new Date(Ye):void 0,onChange:I=>Je(Z.customFieldId,I),isDark:E,locale:d});case "dropdown":return jsxRuntime.jsx(Vm,{value:Ee(Z.customFieldId)||"",options:Z.options||[],onChange:I=>Je(Z.customFieldId,I),isDark:E});case "checkbox":return jsxRuntime.jsx(jm,{value:Ee(Z.customFieldId)||false,onChange:I=>Je(Z.customFieldId,I),isDark:E});case "estimatedTime":{let I=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.estimatedTime,onChange:G=>me({estimatedTime:G}),isDark:E,locale:d,disabled:I,lens:T,hourlyRate:B})}case "quotedTime":{let I=S.status==="completed"||S.progress===100,G=k?.enabled&&(!k.columns||k.columns.includes("quotedTime"));return jsxRuntime.jsx(mr,{value:S.quotedTime,onChange:he=>me({quotedTime:he}),isDark:E,locale:d,disabled:I,isBlurred:G,lens:T,hourlyRate:B})}case "elapsedTime":{let I=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.elapsedTime,onChange:G=>me({elapsedTime:G}),isDark:E,locale:d,disabled:I,lens:T,hourlyRate:B})}case "effortMinutes":{if($&&S.subtasks&&S.subtasks.length>0){let{allocated:G}=Sn(S);return jsxRuntime.jsx(mr,{value:G>0?G:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:B})}let I=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.effortMinutes,onChange:G=>me({effortMinutes:G}),isDark:E,locale:d,disabled:I,lens:T,hourlyRate:B})}case "timeLoggedMinutes":{if($&&S.subtasks&&S.subtasks.length>0){let{spent:G}=Sn(S);return jsxRuntime.jsx(mr,{value:G>0?G:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:B})}let I=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(mr,{value:S.timeLoggedMinutes,onChange:a.onLogTime?G=>{a.onLogTime?.(S,G);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:I,lens:T,hourlyRate:B})}case "soldEffortMinutes":{if($&&S.subtasks&&S.subtasks.length>0){let{quoted:he}=Sn(S),F=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(mr,{value:he>0?he:void 0,isDark:E,locale:d,disabled:true,isBlurred:F,lens:T,hourlyRate:B})}let I=S.status==="completed"||S.progress===100,G=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(mr,{value:S.soldEffortMinutes,onChange:he=>me({soldEffortMinutes:he}),isDark:E,locale:d,disabled:I,isBlurred:G,lens:T,hourlyRate:B})}case "scheduleVariance":{let I=S.effortMinutes||0,G=S.soldEffortMinutes||0,he=S.timeLoggedMinutes||0,F=I>0||G>0||he>0;return jsxRuntime.jsx(Zm,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:E,locale:d,hasTimeAllocated:F})}case "hoursBar":{if($&&S.hasChildren){let{spent:I,allocated:G,quoted:he}=Sn(S),F=I>G&&G>0;return jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:p("font-bold",F?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Dn(I)}),G>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:E?"text-white/60":"text-gray-600",children:Dn(G)})]}),he>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Dn(he)})]})]})}return jsxRuntime.jsx(tg,{task:S,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:B})}case "teamLoad":return jsxRuntime.jsx(rg,{task:S,isDark:E,locale:d});case "blockers":return jsxRuntime.jsx(ng,{blockers:S.blockers,isDark:E,locale:d});default:return jsxRuntime.jsx("span",{className:p("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,l,_,$]),Ke=react.useCallback(S=>{let me={name:_.columns.name,status:_.columns.status,priority:_.columns.priority,assignees:_.columns.assignees,startDate:_.columns.startDate,endDate:_.columns.endDate,progress:_.columns.progress,tags:_.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:_.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:_.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:_.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:_.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:_.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:_.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:_.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:_.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:_.columns.teamLoad||(d==="es"?"Carga Equipo":"Team Load"),blockers:_.columns.blockers||(d==="es"?"Bloqueantes":"Blockers")}[S.type]||S.label;return typeof me=="string"?me:String(me||S.type)},[_,d]),We=react.useMemo(()=>{let me=Ze.reduce((Je,Ye)=>Je+Ye.width,0)+(v?48:0),Ee={};for(let Je of Ze)Ee[Je.id]=`${Je.width/me*100}%`;return Ee},[Ze,v]);return r?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:[_.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,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:p("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,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-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:_.empty.noTasks}),jsxRuntime.jsx("p",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:_.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Te,className:p(E?"bg-[#0D0D0D]":"bg-white",j&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:p("text-sm",E?"text-white/60":"text-gray-600"),children:[de.length," ",_.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:z,onChange:S=>oe(S.target.value),placeholder:_.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"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&&N>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:H,onClick:()=>Qe(!tt),className:p("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",E?tt?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":tt?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),ye==="all"?d==="es"?"Todos":"All":`L${ye}`]}),tt&&jsxRuntime.jsx("div",{ref:ie,className:p("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",E?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(N,5)},(S,Z)=>({value:Z+1,label:`L${Z+1}`}))].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{ft(S.value),Qe(false);},className:p("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",E?ye===S.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":ye===S.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:S.label}),ye===S.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(Dg,{value:J,hideCompleted:xe,onChange:Ae,onHideCompletedChange:He,isDark:E,locale:d}),X?.enabled&&X.data&&!ee&&jsxRuntime.jsx("button",{onClick:()=>$e(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),w&&x&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:x,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:_.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:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ze.map(S=>{let Z=S.id!=="name",me=je===S.id&&Be!==S.id;return jsxRuntime.jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",Z&&"cursor-grab",Be===S.id&&"opacity-50",me&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:We[S.id],minWidth:S.minWidth},draggable:Z,onDragStart:Z?Ee=>Re(Ee,S.id):void 0,onDragEnd:Z?ct:void 0,onDragOver:Z?Ee=>se(Ee,S.id):void 0,onDragLeave:Z?fe:void 0,onDrop:Z?Ee=>P(Ee,S.id):void 0,onContextMenu:Ee=>dt(Ee,void 0,S.id),children:[Z&&jsxRuntime.jsx(lucideReact.GripVertical,{className:p("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>It(S.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Ke(S),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:p("w-3 h-3",R===S.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Ke(S)}),f&&S.resizable&&jsxRuntime.jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",j===S.id&&"bg-[#007BFF]"),onMouseDown:Ee=>ze(Ee,S.id)})]},S.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),rt(Z=>!Z);},className:p("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",te&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(xg,{isOpen:te,onClose:()=>rt(false),columns:Ne,customFields:c,onColumnsChange:Tt,onCreateCustomField:()=>{rt(false),ot(true);},isDark:E,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:de.map((S,Z)=>{let me=mt.has(S.id),Ee=Math.min(Z*.01,.2),Je=S.hasChildren&&S.level===0,Ye=S.subtasks?.length||0;if(Je){let{spent:I,allocated:G,quoted:he}=Sn(S),F=Q1(S),re=Z1(S);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ee},className:p("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(S),children:Ze.map(Le=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:We[Le.id],minWidth:Le.minWidth},children:Le.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:qe=>{qe.stopPropagation(),et(S.id);},className:p("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",E?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:qe=>{qe.stopPropagation(),et(S.id);},className:"flex-shrink-0 cursor-pointer",children:me?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsx("span",{title:S.name,className:p("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:S.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",Ye," ",d==="es"?Ye===1?"Tarea":"Tareas":Ye===1?"Item":"Items",")"]}),F!==null&&jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono flex-shrink-0",F>=1?"text-[#32D74B]":F>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",F.toFixed(2)]}),re>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",re]})]}):Le.type==="timeLoggedMinutes"?jsxRuntime.jsx(mr,{value:I>0?I:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:B}):Le.type==="soldEffortMinutes"?jsxRuntime.jsx(mr,{value:he>0?he:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:B}):Le.type==="effortMinutes"?jsxRuntime.jsx(mr,{value:G>0?G:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:B}):Se(S,Le)},Le.id))},S.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ee},className:p("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(S),onDoubleClick:()=>a.onTaskDoubleClick?.(S),onContextMenu:I=>dt(I,S),children:[Ze.map(I=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:We[I.id],minWidth:I.minWidth},children:I.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:G=>{G.stopPropagation(),et(S.id);},className:p("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",E?"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:p("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.jsx("span",{className:p("truncate font-bold text-[13px]",S.progress===100?E?"line-through text-white/50":"line-through text-gray-400":E?"text-white":"text-gray-900"),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})]})]}):Se(S,I)},I.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),A&&de.length>0&&(()=>{let{spent:S,allocated:Z,quoted:me}=L,Ee=Z-S,Je=Ee<0,Ye=Je?`+${Dn(Math.abs(Ee))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Dn(Ee)} ${d==="es"?"AHORRADO":"SAVED"}`,I=T==="financial"&&B>0,G=re=>I?`$${(re/60*B).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Dn(re),he=I?Math.abs(Ee/60*B):0,F=I?`${Je?"+":"-"}$${he.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Je?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Ye;return jsxRuntime.jsxs("div",{className:p("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ze.map(re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:We[re.id],minWidth:re.minWidth},children:re.type==="name"?jsxRuntime.jsx("span",{className:p("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):re.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:G(S)}),jsxRuntime.jsx("span",{className:p("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:p("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:G(Z)}),Z>0&&jsxRuntime.jsx("span",{className:p("text-[10px] font-semibold ml-1",Je?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:I?F:Ye})]}):re.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?G(me):"\u2013"}):re.type==="effortMinutes"?jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Z>0?G(Z):"\u2013"}):re.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:p("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?G(S):"\u2013"}):jsxRuntime.jsx("span",{className:p("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},re.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),de.length===0&&z&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:p("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:p(E?"text-white/60":"text-gray-600"),children:_.empty.noResults})]})})]})}),X?.enabled&&X.data&&ee&&jsxRuntime.jsx(Eg,{data:X.data,isDark:E,locale:d,onClose:()=>$e(false)})]}),jsxRuntime.jsx(dg,{state:gt,onClose:Ft,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:bt,onColumnSort:yt,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(kg,{isOpen:pe,onClose:()=>ot(false),onSave:K,isDark:E,locale:d})]})}var Rg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"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}],Og=[{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"}],$g=[{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 Vd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},_d={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},jd={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"},Ri={dark:Vd,light:_d,neutral:jd};function Hg(e){return Ri[e]||Ri.dark}var Kd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Yd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Oi={en:Kd,es:Yd};function ss(e){return Oi[e]||Oi.en}function $i(e,t){let a=ss(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function zg(e){let t=ss(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Ug(e,t=0,a=true){let r=ss(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function ls(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function Xd(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Vg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Kg=26,iw=22,lw=10;function _g(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Yg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function jg(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function dw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:u,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",b=c.isCriticalPath,h=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",v=m?Jd(c.effortMinutes,n,l):null,f=m?Yg(c,n,l):null,y=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",h,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":b?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${u*Kg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${iw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:b?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?b?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[b&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),y&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",y.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function qg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,timerState:x,onLogTime:C,onUpdateEstimate:k,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:B,onDiscardTimer:$,blurFinancials:A=false,suppressDetailModal:_=false,lens:E="hours",hourlyRate:ue=0}){let{theme:L="dark",locale:X="en",customTranslations:ee,showBacklog:$e=true}=t,R=$i(X,ee),Y=L==="dark"||L==="neutral",[be,_e]=react.useState(r||new Date),[z,oe]=react.useState(null),[J,Ae]=react.useState(null),[xe,He]=react.useState(null),[Ne,at]=react.useState({}),te=3,rt=3,pe=react.useCallback(W=>{Ae(W.id),_||oe(W),v?.(W.id);},[_,v]),[ot,gt]=react.useState(null),Ct=react.useCallback(()=>{_e(new Date(be.getFullYear(),be.getMonth()-1,1));},[be]),ye=react.useCallback(()=>{_e(new Date(be.getFullYear(),be.getMonth()+1,1));},[be]),ft=react.useCallback(()=>{_e(new Date);},[]),tt=react.useMemo(()=>{let W=be.getFullYear(),ae=be.getMonth(),Ue=new Date(W,ae,1),Te=new Date(W,ae+1,0),Be=Ue.getDay(),De=Te.getDate(),je=ls(e),ut=new Date;ut.setHours(0,0,0,0);let mt=[],Ze=Be,et=new Date(W,ae,0).getDate();for(let Tt=Ze-1;Tt>=0;Tt--){let bt=new Date(W,ae-1,et-Tt);mt.push({date:bt,isCurrentMonth:false,isToday:false,isWeekend:bt.getDay()===0||bt.getDay()===6,events:je.filter(yt=>Xd(bt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}for(let Tt=1;Tt<=De;Tt++){let bt=new Date(W,ae,Tt),yt=bt.getTime()===ut.getTime();mt.push({date:bt,isCurrentMonth:true,isToday:yt,isWeekend:bt.getDay()===0||bt.getDay()===6,events:je.filter(dt=>Xd(bt,dt)).map(dt=>({id:dt.id,title:dt.name,start:dt.startDate,end:dt.endDate,task:dt}))});}let It=42-mt.length;for(let Tt=1;Tt<=It;Tt++){let bt=new Date(W,ae+1,Tt);mt.push({date:bt,isCurrentMonth:false,isToday:false,isWeekend:bt.getDay()===0||bt.getDay()===6,events:je.filter(yt=>Xd(bt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}return mt},[be,e]),Qe=react.useMemo(()=>ls(e).filter(W=>!W.startDate||!W.endDate),[e]),H=react.useMemo(()=>{let W=ls(e),ae=0,Ue=0,Te=0,Be=0,De=0;W.forEach(et=>{et.effortMinutes&&(ae+=et.effortMinutes),et.soldEffortMinutes&&(Ue+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Te+=et.scheduleVariance,Be++),et.soldEffortMinutes&&et.effortMinutes&&(De+=et.soldEffortMinutes-et.effortMinutes);});let je=Ue>0?Math.min(100,Math.round(ae/Ue*100)):0,ut=Be>0?Math.round(Te/Be):0,Ze=`${De<0?"-":"+"}${jg(De,E,ue)}`;return {budgetUtil:je,avgVariance:ut,costDisplay:Ze,hasCostData:Ue>0}},[e,E,ue]),ie=react.useMemo(()=>{let W=[0,0,0,0,0,0];return tt.forEach((ae,Ue)=>{let Te=Math.floor(Ue/7);ae.events.forEach(Be=>{if(Be.task.startDate&&Be.task.soldEffortMinutes){let De=new Date(Be.task.startDate),je=ae.date;De.getFullYear()===je.getFullYear()&&De.getMonth()===je.getMonth()&&De.getDate()===je.getDate()&&Te<W.length&&(W[Te]-=Be.task.soldEffortMinutes);}});}),W},[tt]),N=react.useMemo(()=>{let W=ls(e),ae=new Map,Ue=new Set,Te=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:ae,multiDayTaskIds:Ue,maxLanesPerRow:Te};let Be=Ze=>new Date(Ze.getFullYear(),Ze.getMonth(),Ze.getDate()),De=Be(tt[0].date),je=Be(tt[tt.length-1].date),ut=[];for(let Ze of W){if(!Ze.startDate||!Ze.endDate)continue;let et=Be(Ze.startDate),It=Be(Ze.endDate);if(et.getTime()===It.getTime()||It<De||et>je)continue;let Tt=et<De?De:et,bt=It>je?je:It,yt=_g(Tt,De),dt=_g(bt,De);yt<0||yt>41||dt<0||dt>41||yt!==dt&&(Ue.add(Ze.id),ut.push({task:Ze,startIdx:yt,endIdx:dt}));}ut.sort((Ze,et)=>Ze.startIdx!==et.startIdx?Ze.startIdx-et.startIdx:et.endIdx-et.startIdx-(Ze.endIdx-Ze.startIdx));let mt=[[],[],[],[],[],[]];for(let{task:Ze,startIdx:et,endIdx:It}of ut){let Tt=Math.floor(et/7),bt=Math.floor(It/7),yt=Be(Ze.startDate),dt=Be(Ze.endDate),Ft=false;for(let ze=Tt;ze<=bt;ze++){let Re=ze===Tt?et%7:0,ct=ze===bt?It%7:6,se=ct-Re+1,fe=0,P=mt[ze]??[];for(mt[ze]||(mt[ze]=P);fe<P.length&&(P[fe]??-1)>=Re;)fe++;if(fe>=lw){Ft=true;break}fe>=P.length?P.push(ct):P[fe]=ct,Te[ze]=Math.max(Te[ze]??0,fe+1);let K=ze===Tt&&yt>=De,q=ze===bt&&dt<=je,de=ze*7+Re,Se={taskId:Ze.id,task:Ze,rowIndex:ze,startCol:Re,endCol:ct,spanCols:se,lane:fe,isStart:K,isEnd:q};ae.has(de)||ae.set(de,[]),ae.get(de).push(Se);}Ft&&(Ue.delete(Ze.id),ae.forEach((ze,Re)=>{let ct=ze.filter(se=>se.taskId!==Ze.id);ct.length===0?ae.delete(Re):ae.set(Re,ct);}));}return {segmentsByCell:ae,multiDayTaskIds:Ue,maxLanesPerRow:Te}},[tt,e]),j=X==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],le=be.toLocaleDateString(X==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ce=le.charAt(0).toUpperCase()+le.slice(1);return o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:l,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-[#007FFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm font-mono",Y?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",Y?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",Y?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",Y?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-8 h-8",Y?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsxRuntime.jsx("p",{className:p("text-sm",Y?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",Y?"bg-[#050505]":"bg-white",n),style:l,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",Y?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-3.5 h-3.5",Y?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:p("font-medium",Y?"text-white":"text-gray-900"),children:X==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:p("h-4 w-px",Y?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Ct,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",Y?"text-white":"text-gray-900"),children:Ce}),jsxRuntime.jsx("button",{onClick:ye,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:p("h-4 w-px",Y?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:ft,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",Y?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsxRuntime.jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:j.map(W=>jsxRuntime.jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",Y?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",Y?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ae(null),children:tt.map((W,ae)=>{let Ue=ae%7===6,Te=ae>=35;return jsxRuntime.jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(Y?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(Y?"border-b border-[#222]":"border-b border-gray-200"),Y?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&Y&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!Y&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:p("text-xs font-mono select-none relative z-20",W.isToday?Y?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?Y?"text-white/60":"text-gray-900":Y?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let Be=Math.floor(ae/7),De=(N.maxLanesPerRow[Be]??0)*Kg,je=N.segmentsByCell.get(ae);return De===0&&!je?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${De}px`,zIndex:5},children:je?.map(ut=>jsxRuntime.jsx(dw,{segment:ut,isDark:Y,blurFinancials:A,isSelected:J===ut.taskId,t:R,lens:E,hourlyRate:ue,onClick:()=>{pe(ut.task),a.onEventClick?.({id:ut.task.id,title:ut.task.name,start:ut.task.startDate,end:ut.task.endDate,task:ut.task});}},ut.taskId))})})(),(()=>{let Be=W.events.filter(De=>De.task.isMilestone&&!N.multiDayTaskIds.has(De.id));return Be.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Be.slice(0,4).map(De=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:De.title,onClick:je=>{je.stopPropagation(),pe(De.task);}},De.id)),Be.length>4&&jsxRuntime.jsxs("span",{className:p("text-[8px] font-mono",Y?"text-white/30":"text-gray-400"),children:["+",Be.length-4]})]})})(),(()=>{let Be=[];W.events.forEach(je=>{je.task.blockers?.forEach(ut=>{(ut.severity==="warning"||ut.severity==="critical")&&Be.push({taskId:je.id,type:ut.type,severity:ut.severity,variance:je.task.scheduleVariance});});});let De=Be[0];return De?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",De.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[R.labels.risk,": ",De.type,De.variance?` (+${Math.abs(De.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Be=W.events.filter(mt=>!N.multiDayTaskIds.has(mt.id)),De=Ne[ae]||te,je=Be.slice(0,De),ut=Be.length-De;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[je.map(mt=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{pe(mt.task),a.onEventClick?.(mt);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",mt.task.progress===100||mt.task.status==="completed"?Y?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":Y?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:Y?mt.task.progress===100||mt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:mt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:p("flex-shrink-0 text-[9px]",mt.task.isMilestone?Y?"text-amber-400":"text-amber-600":mt.task.isCriticalPath?"text-red-400":Y?"text-[#1264FF]":"text-gray-400"),children:mt.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:mt.title})]},mt.id)),ut>0&&jsxRuntime.jsxs("button",{onClick:mt=>{mt.stopPropagation(),at(Ze=>({...Ze,[ae]:De+rt}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ut," ",X==="es"?"m\xE1s":"more"]}),De>te&&Be.length>te&&jsxRuntime.jsx("button",{onClick:mt=>{mt.stopPropagation(),at(Ze=>({...Ze,[ae]:te}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Be=ae>=28,De=ae%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),gt(ot===ae?null:ae);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",ot===ae?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3.5 h-3.5 transition-transform",ot===ae&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot===ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>gt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"bottom-full mb-1":"top-full mt-1",De?"right-0":"left-0",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(Lo,{onSubmit:je=>{a.onTaskCreate?.({name:je.name,startDate:je.startDate||W.date,endDate:je.endDate||W.date,priority:je.priority,assignees:je.assignee?[je.assignee]:void 0}),gt(null);},onCancel:()=>gt(null),availableUsers:t.availableUsers,isDark:Y,locale:X==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Be?"up":"down"})})]})})]})})()}),ae%7===6&&(()=>{let Be=Math.floor(ae/7),De=ie[Be];if(!De||De===0)return null;let je=jg(De,E,ue);return jsxRuntime.jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",De<0?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:[R.labels.cashOut,": ",De<0?"-":"+",je]})})()]},ae)})})})]}),$e&&jsxRuntime.jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",Y?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",Y?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:p("text-[10px] font-mono tabular-nums",Y?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",Y?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-5 h-5",Y?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:p("text-xs font-mono",Y?"text-white/20":"text-gray-400"),children:X==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{pe(W);},className:p("w-full text-left rounded-md p-3 transition-all group/card",Y?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",Y?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",Y?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(ae=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ae.color}15`,color:ae.color,border:`1px solid ${ae.color}30`},children:ae.name},ae.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",Y?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",Y?"text-white/25":"text-gray-400",A&&"blur-sm select-none"),children:[Jd(W.effortMinutes,E,ue)&&jsxRuntime.jsxs("span",{children:[R.labels.estimate,": ",Jd(W.effortMinutes,E,ue)]}),(()=>{let ae=Yg(W,E,ue);return ae?jsxRuntime.jsx("span",{className:ae.isNegative?"text-red-400":"text-emerald-400",children:ae.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:p("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(Vg,{task:W,isDark:Y})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((ae,Ue)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ae.color||"#007FFF"},title:ae.name,children:ae.initials||ae.name?.slice(0,2).toUpperCase()},Ue))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",Y?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),H.hasCostData&&jsxRuntime.jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",Y?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",Y?"text-white/60":"text-gray-700",A&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",Y?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxRuntime.jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":Y?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",R.labels.days]})]}),jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsxRuntime.jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!_&&jsxRuntime.jsx(qr,{task:z,isOpen:!!z,onClose:()=>oe(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),oe(W);},theme:L==="dark"?"dark":"light",locale:X,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:z?u?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ls(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:k,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:B,onTimerDiscard:$,blurFinancials:A}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>He(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:p("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("font-medium text-sm",Y?"text-white/90":"text-gray-900"),children:xe.date.toLocaleDateString(X==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>He(null),className:p("p-1 rounded",Y?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:xe.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{He(null),pe(W.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(Vg,{task:W.task,isDark:Y}),jsxRuntime.jsx("span",{className:p("text-sm truncate flex-1",Y?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var Qd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Zd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},ec={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Ui={dark:Qd,light:Zd,neutral:ec};function Xg(e){return Ui[e]||Ui.dark}function uw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=u.length,b=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,h=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:h,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,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:p("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:d.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"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(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:[d.uniqueAssignees," assignees"]})]}),d.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:[d.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:u.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:u.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.stopPropagation(),s?.(e.id,g.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"})]})})]},g.id))})})]})}var Qg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function cs(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 us(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 Zg(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function e0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...Qg,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(w=>{let x=w.timestamp.toISOString().split("T")[0],C=y.get(x);C?C.push(w):y.set(x,[w]);}),Array.from(y.entries()).sort((w,x)=>x[0].localeCompare(w[0])).map(([w,x])=>({date:new Date(w),events:x.sort((C,k)=>k.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=react.useMemo(()=>{let y=new Set,w=new Set;return e.forEach(x=>{y.add(x.userId),w.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(w)}},[e]),h=y=>{u(w=>{let x=new Set(w);return x.has(y)?x.delete(y):x.add(y),x});},v=y=>{let x=new Date().getTime()-y.getTime(),C=Math.floor(x/6e4),k=Math.floor(x/36e5),D=Math.floor(x/864e5);return C<1?"just now":C<60?`${C}m ago`:k<24?`${k}h ago`:D<7?`${D}d ago`:y.toLocaleDateString()},f=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&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:p("history-timeline-empty",l),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:p("history-timeline",c.compact&&"compact",l),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 w=y.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(y=>jsxRuntime.jsxs("option",{value:y,children:[us(y)," ",y.replace("_"," ")]},y))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.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=>a({...t,searchTerm:y.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.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((w,x)=>{let C=i.has(w.id),k=s===w.id,D=Zg(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",C&&"expanded",k&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:us(w.type)})}),x<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),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:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:cs(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),h(w.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},T)),w.metadata&&Object.keys(w.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(w.metadata).map(([T,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},T))]})]})]})]},w.id)})})]},y.date?.toISOString()||"all"))})]})}function a0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:p("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:p("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&us(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&cs(d)}),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:d&&d.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:g=>l(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,b)=>jsxRuntime.jsx("div",{className:p("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>l(b),title:cs(g)},g.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:o,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:n,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:u.map(g=>jsxRuntime.jsxs("button",{className:p("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,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:d&&d.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(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:p("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,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 tc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function ac(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 r0(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 o0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function hw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let d=a/2,m=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let b=u.x-g.x,h=u.y-g.y,v=Math.sqrt(b*b+h*h)||1,f=o.chargeStrength*i/(v*v);u.vx+=b/v*f,u.vy+=h/v*f;});}),t.forEach(u=>{let d=l.get(typeof u.source=="string"?u.source:u.source.id),m=l.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!m)return;let g=m.x-d.x,b=m.y-d.y,h=Math.sqrt(g*g+b*b)||1,v=(h-o.linkDistance)/h*o.forceStrength*i;d.vx+=g*v,d.vy+=b*v,m.vx-=g*v,m.vy-=b*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function n0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[u,d]=react.useState([]),[m,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(1),[x,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let E=hw(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let k=react.useCallback((E,ue)=>{a.enableDragging&&(ue.stopPropagation(),g(E));},[a.enableDragging]),D=react.useCallback(E=>{if(!m||!i.current)return;let L=i.current.getBoundingClientRect(),X=(E.clientX-L.left-x.x)/y,ee=(E.clientY-L.top-x.y)/y;d($e=>$e.map(R=>R.id===m?{...R,x:X,y:ee,fx:X,fy:ee}:R));},[m,y,x]),T=react.useCallback(()=>{g(null);},[]),B=react.useCallback((E,ue)=>{ue.stopPropagation(),l?.({type:"node-click",node:E,position:{x:ue.clientX,y:ue.clientY}});},[l]),$=react.useCallback((E,ue)=>{ue.stopPropagation(),l?.({type:"edge-click",edge:E,position:{x:ue.clientX,y:ue.clientY}});},[l]),A=react.useCallback(E=>{let ue=u.find(L=>L.id===E);return ue?{x:ue.x,y:ue.y}:{x:0,y:0}},[u]),_=react.useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ue=E.card.priority;return ue==="URGENT"?"#ef4444":ue==="HIGH"?"#f59e0b":ue==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:p("relationships-graph-empty",c),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:p("relationships-graph",c),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:n.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:n.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"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.min(E+.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:()=>w(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:tc(E)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[r0(E)," ",ac(E)]})]},E))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let ue=A(typeof E.source=="string"?E.source:E.source.id),L=A(typeof E.target=="string"?E.target:E.target.id),X=o0(E.type),ee=v===E.id,$e=E.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-edge",ee&&"hovered",$e&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:R=>$(E,R),children:[jsxRuntime.jsx("line",{x1:ue.x,y1:ue.y,x2:L.x,y2:L.y,stroke:tc(E.type),strokeWidth:$e?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsxRuntime.jsx("text",{x:(ue.x+L.x)/2,y:(ue.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ac(E.type)})]},E.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(E=>{let ue=b===E.id,L=E.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-node",ue&&"hovered",L&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:X=>k(E.id,X),onMouseEnter:()=>h(E.id),onMouseLeave:()=>h(null),onClick:X=>B(E,X),children:[jsxRuntime.jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:_(E),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ue?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.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 l0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,u]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),b=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&!b&&h();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,b]);let h=()=>{b||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||b)){c(true),u(null),m(null);try{let y=await r(s.trim());m(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),h());};return e?jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),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-blue-400",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:h,disabled:b,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:d?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!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,w)=>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},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,w)=>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-blue-500/20 text-blue-400"}`,children:y.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.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:g,value:s,onChange:y=>n(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-blue-500/50 transition-all resize-none",disabled:b}),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,w)=>jsxRuntime.jsx("button",{onClick:()=>n(y),disabled:b,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},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 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:h,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!s.trim()||b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var rc={"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 xw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},vw={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 ww(e,t,a){let r=rc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ps(e){return `$${e.toFixed(4)}`}var oc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=ww(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Go=new oc;function u0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Go.getStats()),[s,n]=react.useState(Go.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Go.getStats()),n(Go.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=Go.getRecentOperations(5);return jsxRuntime.jsxs(Ot,{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:c=>c.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-blue-500/10 to-purple-500/10 border border-blue-500/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 (",a.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:ps(r.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-blue-400 mt-1",children:r.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:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.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:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.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(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,d=r.totalOperations>0?i/r.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:c.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:ps(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.map(c=>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:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ps(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.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 g0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[u,d]=react.useState(""),[m,g]=react.useState(false),[b,h]=react.useState(null),[v,f]=react.useState(null),[y,w]=react.useState(null),x=react.useRef(null),C=m||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let $=A=>{A.key==="Escape"&&!C&&k();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,C]);let k=()=>{C||(l(""),i(""),d(""),h(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||C)){g(true),h(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){h($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),k());};if(!e)return null;let B=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ot,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:$=>$.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-blue-400",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:k,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:v?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-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",B,"% 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:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(($,A)=>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:["#",A+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:$.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"})]}),$.start," \u2192 ",$.end]}),jsxRuntime.jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.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:x,value:n,onChange:$=>l($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled: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:c,onChange:$=>i($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled: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:u,onChange:$=>d($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),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(($,A)=>jsxRuntime.jsx("button",{onClick:()=>l($),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:$},A))})]})]})}),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-blue-400 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:k,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"}),v?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:D,disabled:!n.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Vi({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&Ds(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,y,w)=>{console.warn(`Retry attempt ${y} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(v,f,y)=>{r(w=>{let x=w.cards.find($=>$.id===v);if(!x)return w;let C=x.columnId,k={...x,columnId:f,position:y},D=w.cards.map($=>$.id===v?k:$),T=w.columns.map($=>{if($.id===C)return {...$,cardIds:$.cardIds.filter(A=>A!==v)};if($.id===f){let A=D.filter(_=>_.columnId===f).sort((_,E)=>_.position-E.position);return {...$,cardIds:A.map(_=>_.id)}}return $}),B={...w,cards:D,columns:T};return o(B),B});},[o]),n=react.useCallback(async(v,f)=>{r(y=>{let w=y.cards.map(C=>C.id===v?{...C,...f}:C),x={...y,cards:w};return o(x),x});},[o]),l=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f},x=y.columns.map(k=>k.id===v.columnId?{...k,cardIds:[...k.cardIds,f]}:k),C={...y,cards:[...y.cards,w],columns:x};return o(C),C});},[o]),c=react.useCallback(async v=>{r(f=>{let y=f.cards.find(k=>k.id===v);if(!y)return f;let w=f.cards.filter(k=>k.id!==v),x=f.columns.map(k=>k.id===y.columnId?{...k,cardIds:k.cardIds.filter(D=>D!==v)}:k),C={...f,cards:w,columns:x};return o(C),C});},[o]),i=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f,cardIds:[]},x={...y,columns:[...y.columns,w]};return o(x),x});},[o]),u=react.useCallback(async(v,f)=>{r(y=>{let w=y.columns.map(C=>C.id===v?{...C,...f}:C),x={...y,columns:w};return o(x),x});},[o]),d=react.useCallback(async v=>{r(f=>{let y=f.cards.filter(C=>C.columnId!==v),w=f.columns.filter(C=>C.id!==v),x={...f,cards:y,columns:w};return o(x),x});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),b=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:b}}}function b0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Vi({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var ms={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},y0={by:"none",order:"asc"};function x0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...ms,...e}),[s,n]=react.useState({...y0,...t}),l=react.useCallback(h=>{o(v=>({...v,...h}));},[]),c=react.useCallback(h=>{n(v=>({...v,...h}));},[]),i=react.useCallback(()=>{o(ms),n(y0);},[]),u=react.useCallback(()=>{a&&o({...ms,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...ms,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...ms,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),b=react.useCallback(h=>{let v=[...h];if(r.search){let f=r.search.toLowerCase();v=v.filter(y=>y.title.toLowerCase().includes(f)||y.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,y=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),x=String(f.getDate()).padStart(2,"0"),C=`${y}-${w}-${x}`;v=v.filter(k=>{if(!k.endDate&&!k.dueDate)return false;let D=k.endDate||k.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let B=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),A=String(D.getUTCDate()).padStart(2,"0");T=`${B}-${$}-${A}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let B=new Date(C+"T00:00:00"),$=new Date(T+"T00:00:00"),A=new Date(B);return A.setDate(A.getDate()+7),$>=B&&$<=A;case "custom":if(r.dateRange){let _=typeof D=="string"?new Date(D):D;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,y)=>{let w=0;switch(s.by){case "created":let x=f.createdAt?new Date(f.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;w=x-C;break;case "priority":let k={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=k[f.priority||"LOW"],T=k[y.priority||"LOW"];w=D-T;break;case "dueDate":let B=f.endDate||f.dueDate,$=y.endDate||y.dueDate;if(!B)return 1;if(!$)return -1;let A=typeof B=="string"?new Date(B).getTime():B.getTime(),_=typeof $=="string"?new Date($).getTime():$.getTime();w=A-_;break;case "title":w=f.title.localeCompare(y.title);break;case "estimate":let E=f.estimatedTime||0,ue=y.estimatedTime||0;w=E-ue;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:m,applyFilters:b,hasActiveFilters:g}}var w0,k0;if(typeof window<"u")try{let e=Cs("ai");w0=e.generateObject,k0=e.generateText;}catch{}function C0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(w0&&k0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function sc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function T0(e){let{cards:t}=e,[a,r]=sc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,b=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let h=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(h&&v&&h.columnId===v.columnId){let f=t.filter(T=>T.columnId===h.columnId).sort((T,B)=>T.position-B.position),y=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===d),[x,C]=y<w?[y,w]:[w,y],k=f.slice(x,C+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...k]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var N0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function D0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...N0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((h,v,f,y,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:v,columnId:f,strategy:y,color:w,isExpanded:true,position:s.filter(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,x]);},[o.minCardsPerStack,s]),c=react.useCallback(h=>{n(v=>v.filter(f=>f.id!==h));},[]),i=react.useCallback(h=>{n(v=>v.map(f=>f.id===h?{...f,isExpanded:!f.isExpanded}:f));},[]),u=react.useCallback((h,v)=>{n(f=>f.map(y=>y.id===h&&!y.cardIds.includes(v)?{...y,cardIds:[...y.cardIds,v]}:y));},[]),d=react.useCallback((h,v)=>{n(f=>f.map(y=>{if(y.id===h){let w=y.cardIds.filter(x=>x!==v);return w.length<o.minCardsPerStack?null:{...y,cardIds:w}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),m=react.useCallback(h=>s.filter(v=>v.columnId===h).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async h=>{let v=t.filter(C=>C.columnId===h);if(v.length<o.minCardsPerStack*2)return [];let f=[],y=new Map;v.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(k=>{y.has(k)||y.set(k,[]),y.get(k).push(C);});}),y.forEach((C,k)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${k}`,cardIds:C.map(D=>D.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${k}"`,confidence:.85});});let w=new Map;v.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(k=>{w.has(k)||w.set(k,[]),w.get(k).push(C);});}),w.forEach((C,k)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${k.slice(-4)}`,cardIds:C.map(D=>D.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(C=>{C.priority&&(x.has(C.priority)||x.set(C.priority,[]),x.get(C.priority).push(C));}),x.forEach((C,k)=>{if(C.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[k.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${k} Priority`,cardIds:C.map(T=>T.id),columnId:h,strategy:"priority",color:k==="high"||k==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${k} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of v){let D=(await r.findSimilar(C,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[C.id,...D.map($=>$.card.id)],B=D.reduce(($,A)=>$+A.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:B});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,k)=>k.confidence-C.confidence).slice(0,5)},[t,o,r]),b=react.useCallback(h=>{l(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),y=f[0];f.length>0&&y&&y.confidence>=.9&&b(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:b,config:o}}var S0=react.createContext(null);function E0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=Cs("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Cs("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Cs("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(S0.Provider,{value:{store:o},children:e})}function _i(){let e=react.useContext(S0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function fs(){let e=_i(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,w)=>{e.updateColumn(y,w);},[e]),u=react.useCallback(y=>{e.deleteColumn(y);},[e]),d=react.useCallback(y=>e.getColumn(y),[e]),m=react.useCallback(y=>{e.addCard(y);},[e]),g=react.useCallback((y,w)=>{e.updateCard(y,w);},[e]),b=react.useCallback(y=>{e.deleteCard(y);},[e]),h=react.useCallback((y,w,x)=>{e.moveCard(y,w,x);},[e]),v=react.useCallback(y=>e.getCard(y),[e]),f=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:d,addCard:m,updateCard:g,deleteCard:b,moveCard:h,getCard:v,getCardsByColumn:f}}function M0(e){let{cards:t}=fs();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function P0(e="position",t="asc"){let{cards:a}=fs();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ji=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Yc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},$w=new ji;function L0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(b=>{let h=e[b.index];if(!h)return null;let v=c?c(h,b.index):b.index,f={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsxRuntime.jsx("div",{style:f,"data-index":b.index,children:r(h,b.index)},v)})})})}function I0(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 R0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:l}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:g,className:s,children:jsxRuntime.jsx("div",{style:b,children:m.map(h=>{let v=e[h.index];if(!v)return null;let f=c?c(v,h.index):h.index,y={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":h.index,children:o(v,h.index)},f)})})})}function O0(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 $0(e,t=10){return e>t}var cc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},uc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},pc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},mc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},gc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},fc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},bc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},hc={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)"},yc={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)"},xc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},vc={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}},wc={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}},Ki={spacing:cc,borderRadius:uc,fontSize:pc,fontWeight:mc,lineHeight:gc,zIndex:fc,duration:bc,easing:hc,shadows:yc,opacity:xc,kanban:vc,gantt:wc};function H0(e,t,a){return e[t]??a}function kc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?kc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Uw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Cc(e="asakaa"){let t=kc(Ki),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Uw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function
|
|
416
|
+
}`}function bs(e,t="asakaa"){let a=[],r=kc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
417
417
|
${a.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var
|
|
419
|
+
}`}var Yi={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Tc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Nc={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Dc(e=Yi,t="asakaa"){let a=Cc(t),r=bs(e,t);return `${a}
|
|
420
420
|
|
|
421
|
-
${r}`}function
|
|
421
|
+
${r}`}function z0(){return `/**
|
|
422
422
|
* ASAKAA Design Tokens
|
|
423
423
|
* Auto-generated from design-tokens.ts
|
|
424
424
|
* Do not edit this file directly
|
|
425
425
|
*/
|
|
426
426
|
|
|
427
|
-
${Dc(
|
|
427
|
+
${Dc(Yi)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${
|
|
431
|
+
${bs(Tc,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${
|
|
438
|
+
${bs(Nc,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
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=
|
|
442
|
+
`}var Ww=({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 U0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=un();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let c=n,i=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Ww,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
|
|
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=u0;exports.AI_FEATURES=vw;exports.AI_MODELS=rc;exports.AddCardButton=Pl;exports.AddColumnButton=Dl;exports.AttachmentUploader=Ur;exports.BoardProvider=E0;exports.BulkOperationsToolbar=qs;exports.BurnDownChart=Gl;exports.CUSTOM_FIELD_TYPES=$g;exports.CalendarBoard=qg;exports.Card=Kr;exports.CardDetailModal=Ol;exports.CardDetailModalV2=zl;exports.CardHistoryReplay=a0;exports.CardHistoryTimeline=e0;exports.CardRelationshipsGraph=n0;exports.CardStack=uw;exports.CardTemplateSelector=Xl;exports.CircuitBreaker=nl;exports.Column=rn;exports.ColumnManager=oi;exports.CommandPalette=Il;exports.ConfigMenu=ed;exports.ContextMenu=bn;exports.DEFAULT_SHORTCUTS=Kn;exports.DEFAULT_TABLE_COLUMNS=Rg;exports.DEFAULT_TEMPLATES=ql;exports.DateRangePicker=Ln;exports.DependenciesSelector=Bn;exports.DependencyLine=Jn;exports.DistributionCharts=Vl;exports.EditableColumnTitle=ml;exports.ErrorBoundary=sn;exports.ExportImportModal=Ql;exports.FilterBar=Zl;exports.GANTT_AI_SYSTEM_PROMPT=bm;exports.GanttAIAssistant=vi;exports.GanttBoard=um;exports.GanttI18nContext=mn;exports.GanttMilestone=fi;exports.GanttToolbar=ri;exports.GenerateGanttTasksDialog=g0;exports.GeneratePlanModal=l0;exports.GroupBySelector=Kl;exports.HealthBar=xl;exports.KanbanBoard=po;exports.KanbanToolbar=Tl;exports.KanbanViewAdapter=Vn;exports.KeyboardShortcutsHelp=Yl;exports.ListView=Bg;exports.MenuIcons=Kt;exports.PluginManager=ji;exports.PrioritySelector=Eo;exports.ProfitabilityReport=vl;exports.QuickTaskCreate=Lo;exports.RATE_LIMITS=xw;exports.STANDARD_FIELDS=Og;exports.SwimlaneBoardView=_l;exports.TagBadge=fl;exports.TagList=Pu;exports.TagPicker=lo;exports.TaskBar=ci;exports.TaskDetailModal=qr;exports.TaskFormModal=fm;exports.TaskGrid=ii;exports.ThemeModal=od;exports.ThemeProvider=Ep;exports.ThemeSwitcher=U0;exports.TimeInputPopover=$r;exports.TimePill=bl;exports.TimePopover=hl;exports.Timeline=hi;exports.UserAssignmentSelector=Mo;exports.VelocityChart=Wl;exports.VirtualGrid=R0;exports.VirtualList=L0;exports.aiUsageTracker=Go;exports.borderRadius=uc;exports.calculatePosition=Ns;exports.calendarDarkTheme=Qd;exports.calendarEnTranslations=Kd;exports.calendarEsTranslations=Yd;exports.calendarLightTheme=Zd;exports.calendarNeutralTheme=ec;exports.calendarThemes=Ui;exports.calendarTranslations=Oi;exports.cardToGanttTask=Ci;exports.cardsToGanttTasks=Cm;exports.cn=p;exports.createKanbanView=ip;exports.createRetryWrapper=kf;exports.darkTheme=td;exports.darkTokenTheme=Yi;exports.defaultTheme=Js;exports.designTokens=Ki;exports.duration=bc;exports.easing=hc;exports.exportTokensToCSS=z0;exports.findTaskByName=to;exports.fontSize=pc;exports.fontWeight=mc;exports.formatCost=ps;exports.ganttEnTranslations=Zs;exports.ganttEsTranslations=Mp;exports.ganttTaskToCardUpdate=km;exports.ganttThemes=it;exports.ganttTokens=wc;exports.ganttTranslations=nd;exports.ganttUtils=Pe;exports.generateCSSVariables=Cc;exports.generateCompleteCSS=Dc;exports.generateInitialPositions=yf;exports.generateTasksContext=hm;exports.generateThemeVariables=bs;exports.getCalendarTheme=Xg;exports.getCalendarTranslations=ss;exports.getListViewTheme=Hg;exports.getListViewTranslations=Dd;exports.getMonthNames=zg;exports.getToken=H0;exports.getTranslations=Pp;exports.getWeekdayNames=Ug;exports.kanbanTokens=vc;exports.lightTheme=ad;exports.lightTokenTheme=Tc;exports.lineHeight=gc;exports.listViewDarkTheme=Vd;exports.listViewEnTranslations=Td;exports.listViewEsTranslations=Nd;exports.listViewLightTheme=_d;exports.listViewNeutralTheme=jd;exports.listViewThemes=Ri;exports.listViewTranslations=Ti;exports.mergeCalendarTranslations=$i;exports.mergeListViewTranslations=Ni;exports.mergeTranslations=sd;exports.neutralTheme=rd;exports.neutralTokenTheme=Nc;exports.opacity=xc;exports.parseLocalCommand=vm;exports.parseNaturalDate=wd;exports.parseNaturalDuration=kd;exports.parseProgress=Cd;exports.parseStatus=xm;exports.pluginManager=$w;exports.retrySyncOperation=wf;exports.retryWithBackoff=Ds;exports.shadows=yc;exports.shouldVirtualizeGrid=$0;exports.spacing=cc;exports.themes=Ro;exports.useAI=C0;exports.useBoard=b0;exports.useBoardCore=fs;exports.useBoardStore=_i;exports.useCardStacking=D0;exports.useDragState=kl;exports.useFilteredCards=M0;exports.useFilters=x0;exports.useGanttI18n=Er;exports.useKanbanState=Vi;exports.useKeyboardShortcuts=Np;exports.useMultiSelect=T0;exports.useSelectionState=sc;exports.useSortedCards=P0;exports.useTheme=un;exports.useVirtualGrid=O0;exports.useVirtualList=I0;exports.validateAIResponse=wm;exports.withErrorBoundary=Al;exports.wouldCreateCircularDependency=Es;exports.zIndex=fc;//# sourceMappingURL=index.cjs.map
|
|
444
444
|
//# sourceMappingURL=index.cjs.map
|