@libxai/board 1.4.27 → 1.5.0
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 +39 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -4
- package/dist/index.d.ts +63 -4
- package/dist/index.js +39 -34
- package/dist/index.js.map +1 -1
- package/dist/styles.css +34 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Mc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Mc(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,v)=>{i[g]=l[v]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),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 Mc(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 Ac(e,t){switch(t){case "json":return Z0(e);case "csv":return ef(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Lc(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 Yi=react.createContext(null);function Ic(){return react.useContext(Yi)}var Bc=react.createContext(null);function Rc({children:e,themeName:t}){return jsxRuntime.jsx(Bc.Provider,{value:{themeName:t},children:e})}function _o(){return react.useContext(Bc)}function Pt({children:e,container:t}){let[a,r]=react.useState(false),o=Ic(),s=_o();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 Uc={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},df="#BDC3C7",cf=({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 ko({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(),v=window.innerHeight,b=window.innerWidth,y=160,f=220,x=4,k=g.right-y;k<10&&(k=g.left),k+y>b-10&&(k=b-y-10);let h=v-g.bottom,N=g.top,T;h>=f+x?T=g.bottom+x:N>=f+x?T=g.top-f-x:T=h>=N?g.bottom+x:Math.max(10,g.top-f-x),n({top:T,left:k}),o(true);};react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&!c.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?Uc[e]:null,m=d?.color||df;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(Pt,{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(Uc).map(([g,v])=>jsxRuntime.jsxs("button",{onClick:()=>p(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:v.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(cf,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.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:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 uf=[{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 vn({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=(_o()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let k=i.current.getBoundingClientRect(),h=window.innerHeight,N=window.innerWidth,T=320,D=380,C=4,B=k.left;B+T>N-10&&(B=N-T-10),B<10&&(B=10);let E=h-k.bottom,w=k.top,U;E>=D+C?U=k.bottom+C:w>=D+C?U=k.top-D-C:U=E>=w?k.bottom+C:Math.max(10,k.top-D-C),l({top:U,left:B}),s(true);};react.useEffect(()=>{let k=h=>{c.current&&!c.current.contains(h.target)&&!i.current?.contains(h.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),react.useEffect(()=>{let k=h=>{h.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let v=k=>{let h=new Date,N=B=>{let E=B.getFullYear(),w=String(B.getMonth()+1).padStart(2,"0"),U=String(B.getDate()).padStart(2,"0");return `${E}-${w}-${U}`},T=N(h),D=new Date(h);D.setDate(D.getDate()+k);let C=N(D);a(T,C),s(false);},b=()=>{if(!e||!t)return "Set date";let k=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=D.split("-").map(Number);if(C.length!==3||C.some(U=>isNaN(U)))return null;let B=C[0],E=C[1],w=C[2];return B===void 0||E===void 0||w===void 0?null:new Date(B,E-1,w)},h=k(e),N=k(t);if(!h||!N||isNaN(h.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[h.getMonth()]} ${h.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},y=e&&t,x=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,h=new Date;return h.setHours(0,0,0,0),k<h})();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 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${b()}`:"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:b()})]}),o&&jsxRuntime.jsx(Pt,{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:uf.map(k=>jsxRuntime.jsx("button",{onClick:()=>v(k.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:h=>{h.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",h.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:h=>{h.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",h.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:k.label},k.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:k=>a(k.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:k=>a(e,k.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:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Co({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let x=m.current.getBoundingClientRect(),k=window.innerHeight,h=window.innerWidth,N=300,T=380,D=4,C=x.right-N;C<10&&(C=x.left),C+N>h-10&&(C=h-N-10);let B=k-x.bottom,E=x.top,w;B>=T+D?w=x.bottom+D:E>=T+D?w=x.top-T-D:w=B>=E?x.bottom+D:Math.max(10,x.top-T-D),p({top:w,left:C}),n(true);};react.useEffect(()=>{let x=k=>{d.current&&!d.current.contains(k.target)&&!m.current?.contains(k.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),react.useEffect(()=>{let x=k=>{k.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let v=x=>{let k=e.some(h=>h.id===x.id);a(k?e.filter(h=>h.id!==x.id):[...e,x]);},b=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),y=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:[y.map(x=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"asakaa-avatar-img"}):x.initials},x.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(Pt,{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:x=>c(x.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:b.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"}):b.map(x=>{let k=e.some(h=>h.id===x.id);return jsxRuntime.jsxs("button",{onClick:()=>v(x),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:h=>{h.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:x.color,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials}),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:x.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:k?"#3b82f6":"transparent"},children:k?"\u2713":""})]},x.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 xs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;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 p of i){if(!s.has(p)&&l(p))return true;if(n.has(p))return true}}return n.delete(c),false};return l(a)}function wn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,v]=react.useState({top:0,left:0}),[b,y]=react.useState(null),f=react.useRef(null),x=react.useRef(null),k=()=>{if(!x.current)return;let C=x.current.getBoundingClientRect(),B=window.innerHeight,E=window.innerWidth,w=300,U=d?380:120,$=4,Z=C.right-w;Z<10&&(Z=C.left),Z+w>E-10&&(Z=E-w-10);let F=B-C.bottom,K=C.top,le;F>=U+$?le=C.bottom+$:K>=U+$?le=C.top-U-$:le=F>=K?C.bottom+$:Math.max(10,C.top-U-$),v({top:le,left:Z}),c(true);};react.useEffect(()=>{if(!l||!x.current)return;let C=x.current.getBoundingClientRect(),B=window.innerHeight,E=window.innerWidth,w=300,U=d?380:120,$=4,Z=C.right-w;Z<10&&(Z=C.left),Z+w>E-10&&(Z=E-w-10);let F=B-C.bottom,K=C.top,le;F>=U+$?le=C.bottom+$:K>=U+$?le=C.top-U-$:le=F>=K?C.bottom+$:Math.max(10,C.top-U-$),v({top:le,left:Z});},[d,l]),react.useEffect(()=>{let C=B=>{f.current&&!f.current.contains(B.target)&&!x.current?.contains(B.target)&&(c(false),p(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),react.useEffect(()=>{let C=B=>{B.key==="Escape"&&(c(false),p(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let h=C=>{let B=t.includes(C),E=a.find(w=>w.id===C);if(y(null),B){let w=t.filter(U=>U!==C);r(w),w.length===0&&m(false);}else {if(s&&xs(a,C,e)){let U=`Cannot add "${E?.title||C}" as dependency - would create circular reference`;y(U),n?.(C,E?.title||C),setTimeout(()=>y(null),3e3);return}r([...t,C]),m(true);}},N=()=>{let C=!d;m(C),C||r([]);},T=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:x,onClick:()=>l?c(false):k(),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(Pt,{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:[b&&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:b})]}),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:N,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:C=>p(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:T.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"}):T.map(C=>{let B=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>h(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:E=>{E.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:E=>{E.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:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&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 Ur=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:fs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:b,...i,...p,onClick:()=>a?.(e),children:t(e)});let y=l.filter(h=>e.assignedUserIds?.includes(h.id)),f=e.progress===100,x=(e.attachments||[]).filter(h=>h.type.startsWith("image/")),k={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:k,className:u("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:h=>{h.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:h=>{h.currentTarget.style.display="none";}})}),x.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:x.length===1&&x[0]?jsxRuntime.jsx("img",{src:x[0].url,alt:x[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:h=>{h.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((h,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:h.url,alt:h.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),N===3&&x.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:["+",x.length-4]})})]},h.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:h=>h.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ko,{priority:e.priority,onChange:h=>n?.(e.id,{priority:h})})}),jsxRuntime.jsx("div",{onClick:h=>h.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(vn,{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:(h,N)=>n?.(e.id,{startDate:h,endDate:N})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:h=>h.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Co,{assignedUsers:y,availableUsers:l,onChange:h=>n?.(e.id,{assignedUserIds:h.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:h=>h.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(wn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(h=>typeof h=="string"?h:h.taskId):[],availableTasks:c,onChange:h=>n?.(e.id,{dependencies:h})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(h=>jsxRuntime.jsx("span",{className:"asakaa-label",children:h},h))}),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)));Ur.displayName="Card";var vs={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"}},Jc=({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 Qc({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),p=[...Object.entries(vs).map(([y,f])=>({id:y,label:f.label,color:f.color,icon:f.icon})),...r.filter(y=>!Object.keys(vs).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let y=vs[e];if(y)return {...y,id:e};let f=r.find(x=>x.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...vs.todo,id:"todo"}},m=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,k=180,h=280,N=4,T=y.right-k;T<10&&(T=y.left),T+k>x-10&&(T=x-k-10);let D=f-y.bottom,C=y.top,B;D>=h+N?B=y.bottom+N:C>=h+N?B=y.top-h-N:B=D>=C?y.bottom+N:Math.max(10,y.top-h-N),l({top:B,left:T}),s(true);};react.useEffect(()=>{let y=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let g=y=>{t(y),s(false);},v=d(),b=v.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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:v.label,children:jsxRuntime.jsx(Jc,{icon:v.icon,color:b})}),o&&jsxRuntime.jsx(Pt,{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:p.map(y=>jsxRuntime.jsxs("button",{onClick:()=>g(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter: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(Jc,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function Zc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[l,c]=react.useState(false),[i,p]=react.useState(e),[d,m]=react.useState({top:0,left:0}),g=react.useRef(null),v=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let k=v.current.getBoundingClientRect();m({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[s]),react.useEffect(()=>{let k=h=>{g.current&&!g.current.contains(h.target)&&!v.current?.contains(h.target)&&(n(false),c(false));};if(s)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[s]),react.useEffect(()=>{let k=h=>{h.key==="Escape"&&(n(false),c(false),p(e));};if(s)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[s,e]),react.useEffect(()=>{l&&b.current&&(b.current.focus(),b.current.select());},[l]);let y=()=>{c(true),p(e);},f=()=>{let k=i.trim();k&&k!==e&&t(k),c(false),n(false),p(e);},x=k=>{k.key==="Enter"?f():k.key==="Escape"&&(c(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children: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"})]})}),s&&jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{ref:g,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?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:"Rename Column"}),jsxRuntime.jsx("input",{ref:b,type:"text",value:i,onChange:k=>p(k.target.value),onKeyDown:x,onBlur:f,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):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:"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(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[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:"Delete"})]})]})]})})})]})}var Yo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:v,onColumnDelete:b,isDeletable:y=false,className:f,renderMetrics:x})=>{let{setNodeRef:k,isOver:h}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),N=react.useRef(null),T=p??Nc(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>N.current,estimateSize:()=>d,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:k,className:f,children:a(e,t)});let B=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),E=B.state==="exceeded",w=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:k,className:u("asakaa-column",h&&"ring-2 ring-asakaa-accent-blue",E&&"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:u(w()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&B.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${B.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[B.state==="exceeded"&&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"})]}),B.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"})]}),B.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"})}),B.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"})]})]}),(v||b)&&jsxRuntime.jsx(Zc,{columnTitle:e.title,onRename:U=>v?.(e.id,U),onDelete:b?()=>b(e.id):void 0,isDeletable:y}),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"})]})]}),x&&x(e,t),!m&&jsxRuntime.jsx("div",{ref:N,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(U=>U.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"})}):T?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(U=>{let $=t[U.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsxRuntime.jsx(Ur,{card:$,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},$.id):null})}):t.map(U=>jsxRuntime.jsx(Ur,{card:U,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},U.id))})})]})});Yo.displayName="Column";function Zi({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 p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Mf(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 nu(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,""),p=c.split(/\s+/);return !!(i===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Af(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Lf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var If=["\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 su({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:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:v,maxFileSizeMB:b=10}){let y=l==="dark",[f,x]=react.useState(false),[k,h]=react.useState([]),[N,T]=react.useState(0),[D,C]=react.useState(null),[B,E]=react.useState(false),w=react.useRef(null),U=react.useRef(null),$=react.useRef(null),Z=react.useRef(null),F=react.useCallback((O,Q)=>{let te=Mf(O,Q);if(C(te),te){let Ue=r.filter(rt=>rt.name.toLowerCase().includes(te.query)||rt.email&&rt.email.toLowerCase().includes(te.query)).slice(0,5);h(Ue),x(Ue.length>0),T(0);}else x(false),h([]);},[r]),K=O=>{let Q=O.target.value;if(t(Q),F(Q,O.target.selectionStart||0),w.current){w.current.style.height="24px";let te=w.current.scrollHeight,Ue=280,rt=Math.min(te,Ue);w.current.style.height=`${rt}px`,w.current.style.overflowY=te>Ue?"auto":"hidden";}},le=()=>{w.current&&F(e,w.current.selectionStart||0);},Ie=react.useCallback(O=>{if(!D||!w.current)return;let Q=e.slice(0,D.start),te=e.slice(D.end),Ue=`@${O.name.replace(/\s+/g,"")} `,rt=Q+Ue+te;t(rt),x(false),C(null),setTimeout(()=>{if(w.current){let Ze=D.start+Ue.length;w.current.selectionStart=Ze,w.current.selectionEnd=Ze,w.current.focus();}},0);},[D,e,t]),A=O=>{if(f&&k.length>0)switch(O.key){case "ArrowDown":O.preventDefault(),T(Q=>Q<k.length-1?Q+1:0);break;case "ArrowUp":O.preventDefault(),T(Q=>Q>0?Q-1:k.length-1);break;case "Enter":{O.preventDefault();let Q=k[N];Q&&Ie(Q);break}case "Tab":{O.preventDefault();let Q=k[N];Q&&Ie(Q);break}case "Escape":O.preventDefault(),x(false);break}else O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),a());};react.useEffect(()=>{let O=Q=>{U.current&&!U.current.contains(Q.target)&&w.current&&!w.current.contains(Q.target)&&x(false),Z.current&&!Z.current.contains(Q.target)&&E(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let _=react.useCallback(O=>{if(!w.current)return;let Q=w.current.selectionStart||e.length,te=e.slice(0,Q)+O+e.slice(Q);t(te),E(false),setTimeout(()=>{if(w.current){let Ue=Q+O.length;w.current.selectionStart=Ue,w.current.selectionEnd=Ue,w.current.focus();}},0);},[e,t]),ve=react.useCallback(O=>{if(!g||!O.target.files)return;let Q=Array.from(O.target.files),te=b*1024*1024,Ue=Q.filter(rt=>rt.size>te?(console.warn(`File ${rt.name} exceeds max size of ${b}MB`),false):true);Ue.length>0&&g(Ue),O.target.value="";},[g,b]),Qe=react.useCallback(O=>O.type.startsWith("image/")?lucideReact.Image:O.type.includes("pdf")||O.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&U.current){let O=U.current.children[N];O&&O.scrollIntoView({block:"nearest"});}},[N,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(O=>{let Q=Qe(O.file),te=O.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[te&&O.preview?jsxRuntime.jsx("img",{src:O.preview,alt:O.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(Q,{className:u("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",y?"text-white":"text-gray-900"),children:O.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:Lf(O.file.size)})]}),v&&jsxRuntime.jsx("button",{onClick:()=>v(O.id),className:u("p-0.5 rounded-full transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},O.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:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>E(!B),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||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:Z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:If.map(O=>jsxRuntime.jsx("button",{type:"button",onClick:()=>_(O),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:O},O))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:$,type:"file",multiple:true,onChange:ve,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:w,value:e,onChange:K,onSelect:le,onKeyDown:A,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||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:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":y?"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&&k.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:U,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:k.map((O,Q)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ie(O),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Q===N?y?"bg-white/10":"bg-gray-100":y?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:O.color||"#8B5CF6"},children:Af(O.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:O.name}),O.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:O.email})]})]},O.id))})})]})]})]})}function iu({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:u("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 Ns=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function to({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(false),[g,v]=react.useState(Ns[10]||"#2E94FF"),[b,y]=react.useState({top:0,left:0}),f=react.useRef(null),x=react.useRef(null),k=react.useRef(null),h=react.useRef(null),N=t.filter(w=>w.name.toLowerCase().includes(i.toLowerCase())),T=t.some(w=>w.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&x.current){let w=x.current.getBoundingClientRect();y({top:w.bottom+6,left:w.left});}},[l]),react.useEffect(()=>{let w=U=>{let $=U.target,Z=f.current?.contains($),F=k.current?.contains($);!Z&&!F&&(c(false),p(""),m(false));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{l&&h.current&&h.current.focus();},[l]);let D=w=>{let U=e.some($=>$.id===w.id);a(U?e.filter($=>$.id!==w.id):[...e,w]);},C=async()=>{if(!(!r||!i.trim())){m(true);try{let w=await r(i.trim(),g);w&&(a([...e,w]),p(""),v(Ns[Math.floor(Math.random()*Ns.length)]||"#2E94FF"));}finally{m(false);}}},B=(w,U)=>{U.stopPropagation(),a(e.filter($=>$.id!==w));},E={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:x,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:E,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(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.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:k,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:h,type:"text",value:i,onChange:w=>p(w.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:w=>{w.key==="Enter"&&i.trim()&&!T&&r&&C();}})}),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(w=>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:`${w.color}20`,color:w.color},onClick:U=>B(w.id,U),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(w=>{let U=e.some($=>$.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:U?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{U||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{U||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.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()&&!T&&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:Ns.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:g===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor: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 tl({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 du({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(tl,{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 No=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function cu(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 Gf(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 Vf({className:e}){return jsxRuntime.jsxs("svg",{className:u("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 al({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Gf(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=cu(e.loggedMinutes),i=e.estimateMinutes?cu(e.estimateMinutes):null,p=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("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(Vf,{className:l[t]}),jsxRuntime.jsx("span",{children:p})]})}function pu(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Ss(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 Kf(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 Yf({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function qf({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 mu({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 Xf({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 rl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:p,className:d}){let[m,g]=react.useState(""),[v,b]=react.useState(t.estimateMinutes?Ss(t.estimateMinutes):""),[y,f]=react.useState(""),[x,k]=react.useState(false),[h,N]=react.useState(false),T=react.useRef(null);react.useEffect(()=>{T.current?.focus();},[]);let D=async()=>{let E=pu(m);if(!(E<=0||!s)){k(true);try{await s({durationMinutes:E,note:y.trim()||void 0,source:"manual"}),g(""),f("");}finally{k(false);}}},C=async()=>{if(!n)return;let E=v.trim()?pu(v):null;await n(E),N(false);},B=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),D()),E.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("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:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(mu,{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:Kf(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(qf,{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(mu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:u("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(Yf,{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(Xf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:T,type:"text",value:m,onChange:E=>g(E.target.value),onKeyDown:B,placeholder:"8 (=8h), 2h 30m",className:u("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:x||!m.trim(),className:u("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:y,onChange:E=>f(E.target.value),onKeyDown:B,placeholder:"Note (optional)",className:u("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:Ss(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"}),h?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:v,onChange:E=>b(E.target.value),onKeyDown:E=>{E.key==="Enter"&&C(),E.key==="Escape"&&N(false);},onBlur:C,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:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Ss(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:u("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:u("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(E=>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:E.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Ss(E.durationMinutes)})]},E.id))})]})]})}function tb(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function ab(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 Ar({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(ab(r)),[i,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let v=async()=>{m(true);let k=tb(l);await o(k&&k>0?k:null,i||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},y=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),v()),k.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},x=t==="es";return jsxRuntime.jsxs("div",{className:u("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:k=>k.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:k=>c(k.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border: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 2:30"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:k=>p(k.target.value),onKeyDown:y,placeholder:x?"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:v,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?x?"Guardando...":"Saving...":x?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:b,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:x?"Quitar":"Clear"})]})]})}function rb(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 ob(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 nl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=rb(e.health),s=ob(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:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("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:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function qo(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 sb(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 lb(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 db({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:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",qo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("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:u("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:u("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:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("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:u("font-medium",c),children:qo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:qo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function cb({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:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?qo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:qo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("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,qo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("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:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",ib(e.status,a),sb(e.status,a)),children:lb(e.status,t)})})]})}function sl({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",p=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((v,b)=>v.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("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:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("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(db,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("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:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",i),children:g.map(v=>jsxRuntime.jsx(cb,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("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 Xo(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 Tb(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 Cu(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 Nb(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 Gr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:v=[],onAddComment:b,currentUser:y,mentionableUsers:f=[],onUploadCommentAttachments:x,enableTimeTracking:k=false,timeTrackingSummary:h,timeEntries:N=[],isTimerRunning:T=false,timerElapsedSeconds:D=0,onTimeLog:C,onEstimateUpdate:B,onSoldEffortUpdate:E,onTimerStart:w,onTimerStop:U,onTimerDiscard:$,blurFinancials:Z=false}){let F=s==="dark",K={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},le=e&&"title"in e&&!("name"in e),Ie=e,[A,_]=react.useState(e?Cu(e,l):null),[ve,Qe]=react.useState(false),[O,Q]=react.useState(false),[te,Ue]=react.useState(false),[rt,Ze]=react.useState(null),[mt,Ce]=react.useState(new Date),[se,j]=react.useState(false),[ue,ae]=react.useState(false),[Fe,$e]=react.useState(""),[Re,ct]=react.useState(false),[je,et]=react.useState(false),[Le,pt]=react.useState(false),[P,ee]=react.useState(false),[ke,Be]=react.useState(""),W=react.useRef(null),pe=react.useRef(null),[dt,Ee]=react.useState(""),qe=react.useRef(null),[Ke,Xe]=react.useState(""),[ot,R]=react.useState(false),[de,Ne]=react.useState([]),[ye,he]=react.useState(""),[tt,fe]=react.useState(false),Y=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 S=Cu(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),_(S),Be(S.description||""),Ee(S.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!ke)return;let S=setTimeout(()=>{let ie=pe.current;ie&&(ie.style.height="auto",ie.style.height=`${Math.max(100,ie.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,ke]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),qe.current&&clearTimeout(qe.current);},[]),react.useEffect(()=>{t&&Y.current&&v.length>0&&setTimeout(()=>{Y.current&&(Y.current.scrollTop=Y.current.scrollHeight);},100);},[t,v.length]);let De=react.useCallback(S=>{_(S),le&&o&&Ie?o(Nb(S,Ie)):r&&r(S);},[le,Ie,o,r]),be=react.useCallback(()=>{Qe(false),Q(false),Ue(false),Ze(null),ae(false),$e(""),ct(false);},[]),We=react.useCallback((S,ie)=>{if(!A)return;let ze={...A,[S]:ie};De(ze);},[A,De]),H=react.useCallback(()=>{let S=pe.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),ne=react.useCallback(S=>{Be(S),setTimeout(H,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(A){let ie={...A,description:S};De(ie);}},800);},[A,De,H]),He=react.useCallback(S=>{Ee(S),qe.current&&clearTimeout(qe.current),qe.current=setTimeout(()=>{if(A&&S.trim()){let ie={...A,name:S.trim()};De(ie);}},800);},[A,De]),I=react.useCallback(S=>{let ie=S.map(ze=>{let Ge={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ze};return ze.type.startsWith("image/")&&(Ge.preview=URL.createObjectURL(ze)),Ge});Ne(ze=>[...ze,...ie]);},[]),J=react.useCallback(S=>{Ne(ie=>{let ze=ie.find(Ge=>Ge.id===S);return ze?.preview&&URL.revokeObjectURL(ze.preview),ie.filter(Ge=>Ge.id!==S)});},[]),G=react.useCallback(async()=>{if(!(!A||!Ke.trim()&&de.length===0||!b)){R(true);try{let S=nu(Ke,f),ie=[];if(de.length>0&&x){let ze=de.map(Ge=>Ge.file);ie=await x(ze);}await b(A.id,Ke.trim(),S.length>0?S:void 0,ie.length>0?ie:void 0),Xe(""),de.forEach(ze=>{ze.preview&&URL.revokeObjectURL(ze.preview);}),Ne([]);}finally{R(false);}}},[A,Ke,de,b,f,x]),ge=react.useCallback(()=>{if(!A||!ye.trim())return;let S=A.subtasks||[],ie={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:ye.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},ze=[...S,ie],Ge={...A,subtasks:ze};De(Ge),he(""),fe(false);},[A,ye,De]),Je=react.useCallback(S=>{if(!A?.subtasks)return;let ie=A.subtasks.map(Ge=>Ge.id===S?{...Ge,progress:Ge.progress===100?0:100}:Ge),ze={...A,subtasks:ie};De(ze);},[A,De]),ft=react.useCallback(S=>{if(!A?.subtasks)return;let ie=A.subtasks.filter(Ge=>Ge.id!==S),ze={...A,subtasks:ie};De(ze);},[A,De]),bt=react.useCallback(S=>{let ie=typeof S=="string"?new Date(S):S,Ge=new Date().getTime()-ie.getTime(),xt=Math.floor(Ge/6e4),pa=Math.floor(Ge/36e5),ma=Math.floor(Ge/864e5);return xt<1?n==="es"?"Ahora":"Just now":xt<60?n==="es"?`Hace ${xt} min`:`${xt}m ago`:pa<24?n==="es"?`Hace ${pa}h`:`${pa}h ago`:ma<7?n==="es"?`Hace ${ma}d`:`${ma}d ago`:ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Fa=react.useCallback(S=>{if(!A)return;let ie=A.progress||0;S==="completed"?ie=100:S==="in-progress"&&ie===0?ie=10:S==="todo"&&(ie=0);let ze={...A,status:S,progress:ie};De(ze),Qe(false);},[A,De]),Yt=react.useCallback((S,ie)=>{if(!A)return;let ze={...A,startDate:S,endDate:ie};De(ze);},[A,De]),Pa=react.useCallback(()=>{let S=mt.getFullYear(),ie=mt.getMonth(),ze=new Date(S,ie,1),xt=new Date(S,ie+1,0).getDate(),pa=ze.getDay(),ma=[],Wa=new Date(S,ie,0).getDate();for(let Oa=pa-1;Oa>=0;Oa--)ma.push({date:new Date(S,ie-1,Wa-Oa),isCurrentMonth:false});for(let Oa=1;Oa<=xt;Oa++)ma.push({date:new Date(S,ie,Oa),isCurrentMonth:true});let ga=42-ma.length;for(let Oa=1;Oa<=ga;Oa++)ma.push({date:new Date(S,ie+1,Oa),isCurrentMonth:false});return ma},[mt]),Fr=react.useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),pt(false),!A||!d)return;let ie=Array.from(S.dataTransfer.files);if(ie.length!==0){ee(true);try{await d(A.id,ie);}finally{ee(false);}}},[A,d]),Ya=react.useCallback(async S=>{if(!A||!d||!S.target.files)return;let ie=Array.from(S.target.files);if(ie.length!==0){ee(true);try{await d(A.id,ie);}finally{ee(false);}S.target.value="";}},[A,d]),Ae=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),pt(true);},[]),q=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),pt(false);},[]),at=react.useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),At=react.useCallback(S=>S.startsWith("image/")?lucideReact.Image:S.includes("pdf")||S.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!A?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&A&&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:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",F?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:A.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 S=A.progress===100?0:100,ze={...A,progress:S,status:S===100?"completed":"todo"};De(ze);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",A.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:dt,onChange:S=>He(S.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",A.progress===100?"line-through text-[#6B7280]":F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{be(),Qe(!ve);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",A.progress===100||A.status==="completed"?"bg-green-500/20 text-green-400":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.progress===100||A.status==="completed"?n==="es"?"COMPLETADO":"DONE":A.progress&&A.progress>0||A.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Qe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>Fa(S.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",A.status===S.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:F?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{be(),Ue(!te);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[A.assignees&&A.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[A.assignees.slice(0,3).map((S,ie)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},ie)),A.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",A.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(S=>{let ie=A.assignees?.some(ze=>ze.name===S.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ze=A.assignees||[],Ge;ie?Ge=ze.filter(xt=>xt.name!==S.name):Ge=[...ze,S],We("assignees",Ge);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",ie&&(F?"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:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",F?"text-white":"text-gray-900"),children:S.name}),ie&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ze(rt?null:"start"),Ce(A.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[A.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),A.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:rt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ze(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,ie=new Date(S);ie.setDate(S.getDate()+1);let ze=new Date(S);ze.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Ge=new Date(S);Ge.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let xt=new Date(S);xt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let pa=new Date(S);pa.setDate(S.getDate()+14);let ma=new Date(S);return ma.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ie,display:ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ze,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ge,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:xt,display:xt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:pa,display:pa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ma,display:ma.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ga,Oa)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(rt==="start"){let zo=A.endDate&&ga.date>A.endDate?ga.date:A.endDate;Yt(ga.date,zo),Ze("end");}else {let zo=A.startDate&&ga.date<A.startDate?ga.date:A.startDate;Yt(zo,ga.date),Ze(null);}},children:[jsxRuntime.jsx("span",{children:ga.label}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ga.display})]},Oa))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Yt(void 0,void 0),Ze(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:rt==="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:u("font-medium",F?"text-white":"text-gray-900"),children:mt.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:()=>Ce(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ce(new Date(mt.getFullYear(),mt.getMonth()-1)),className:u("p-1 rounded",F?"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:()=>Ce(new Date(mt.getFullYear(),mt.getMonth()+1)),className:u("p-1 rounded",F?"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(S=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Pa().map((S,ie)=>{let ze=S.date.toDateString()===new Date().toDateString(),Ge=A.startDate?.toDateString()===S.date.toDateString(),xt=A.endDate?.toDateString()===S.date.toDateString(),pa=Ge||xt,ma=A.startDate&&A.endDate&&S.date>=A.startDate&&S.date<=A.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Wa=new Date(S.date);if(rt==="start"){let ga=A.endDate&&Wa>A.endDate?Wa:A.endDate;Yt(Wa,ga),Ze("end");}else {let ga=A.startDate&&Wa<A.startDate?Wa:A.startDate;Yt(ga,Wa),Ze(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(F?"text-white":"text-gray-900"),ze&&"ring-2 ring-[#2E94FF]",Ge&&"bg-[#2E94FF] text-white",xt&&!Ge&&"bg-[#7C3AED] text-white",ma&&!pa&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!pa&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},ie)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{be(),Q(!O);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",A.priority==="high"||A.priority==="urgent"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":A.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.priority?A.priority==="high"||A.priority==="urgent"?n==="es"?"Alta":"High":A.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{We("priority",S.id),Q(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",A.priority===S.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:F?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:A.startDate&&A.endDate?`${Math.ceil((A.endDate.getTime()-A.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:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[se?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A.progress||0,onChange:S=>{let ie=parseInt(S.target.value),ze=A.status;ie===100?ze="completed":ie>0?ze="in-progress":ze="todo";let Ge={...A,progress:ie,status:ze};De(Ge);},onBlur:()=>j(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>j(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${A.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[A.progress||0,"%"]})]})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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:A.status==="completed"||A.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:h?.estimateMinutes?Xo(h.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):h?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>et("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Xo(h.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>et("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je==="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(Ar,{mode:"estimate",locale:n,isDark:F,currentValue:h?.estimateMinutes||null,onSave:async S=>{await B?.(A.id,S),et(false);},onClose:()=>et(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:Z?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):A.status==="completed"||A.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:A.quotedMinutes?Xo(A.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):A.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>et("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Xo(A.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>et("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je==="quoted"&&!Z&&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(Ar,{mode:"quoted",locale:n,isDark:F,currentValue:A.quotedMinutes||null,onSave:async S=>{E?(await E(A.id,S),_(ie=>ie?{...ie,quotedMinutes:S}:null)):We("quotedMinutes",S),et(false);},onClose:()=>et(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[A.status==="completed"||A.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",F?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):T?jsxRuntime.jsxs("button",{type:"button",onClick:()=>U?.(A.id),className:u("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"}),Tb(D||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>w?.(A.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),A.status==="completed"||A.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>et("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),h&&h.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",h.health==="over-budget"?"text-red-500":h.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[Xo(h.loggedMinutes),h.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",Xo(h.estimateMinutes)]})]}),h.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:u("h-full rounded-full transition-all",h.health==="over-budget"?"bg-red-500":h.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,h.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je==="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(Ar,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(S,ie)=>{S&&await C?.(A.id,{durationMinutes:S,note:ie,source:"manual"}),et(false);},onClose:()=>et(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(to,{selectedTags:A.tags||[],availableTags:c,onChange:S=>{We("tags",S);},onCreateTag:i,theme:K})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[A.dependencies&&A.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:A.dependencies.map(S=>{let ie=g.find(ze=>ze.id===S);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ie?.name||S.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ze=(A.dependencies||[]).filter(Ge=>Ge!==S);We("dependencies",ze);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{onClick:()=>{be(),ae(!ue);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:u("text-sm",F?"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:()=>{ae(false),$e("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Fe,onChange:S=>$e(S.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(S=>S.id!==A.id).filter(S=>Fe===""||S.name.toLowerCase().includes(Fe.toLowerCase())).map(S=>{let ie=A.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ze=A.dependencies||[],Ge;ie?Ge=ze.filter(xt=>xt!==S.id):Ge=[...ze,S.id],We("dependencies",Ge);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",ie&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ie?"bg-blue-500 border-blue-500":F?"border-white/30":"border-gray-300"),children:ie&&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:u("block truncate",F?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{be(),ct(!Re);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:A.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:No.find(S=>S.value===A.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ct(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:No.map(S=>{let ie=A.color===S.value;return jsxRuntime.jsx("button",{onClick:()=>{We("color",S.value),ct(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ie&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:ie?S.value:void 0},title:S.name,children:ie&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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:A.isMilestone||false,onChange:S=>We("isMilestone",S.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",A.isMilestone?"bg-purple-500 border-purple-500":F?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:pe,value:ke,onChange:S=>ne(S.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",A.subtasks&&A.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",A.subtasks.filter(S=>S.progress===100).length,"/",A.subtasks.length,")"]})]})}),A.subtasks&&A.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...A.subtasks].sort((S,ie)=>(S.position??0)-(ie.position??0)).map(S=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Je(S.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:S.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("button",{onClick:()=>ft(S.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},S.id))}),tt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:ye,onChange:S=>he(S.target.value),onKeyDown:S=>{S.key==="Enter"&&ye.trim()?ge():S.key==="Escape"&&(fe(false),he(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",F?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:ge,disabled:!ye.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",ye.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{fe(false),he("");},className:u("p-2 rounded-lg transition-colors",F?"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:()=>fe(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(S=>{let ie=At(S.type),ze=S.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ze&&S.thumbnailUrl?jsxRuntime.jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ie,{className:u("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:at(S.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(S.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ae,onDragLeave:q,onDrop:Fr,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Le?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",P&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ya,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||P}),P?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:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",Le?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:Le?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:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",F?"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'),uf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Fh=require('react-markdown'),Mh=require('remark-gfm'),Ah=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var uf__default=/*#__PURE__*/_interopDefault(uf);var Fh__default=/*#__PURE__*/_interopDefault(Fh);var Mh__default=/*#__PURE__*/_interopDefault(Mh);var Ah__default=/*#__PURE__*/_interopDefault(Ah);var hs=(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 ys=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 [ys.Translate.toString(e),ys.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 xs(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 nf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zi(e,t){return e.length===0?1e3:t===0?xs(null,e[0].position):t>=e.length?xs(e[e.length-1].position,null):xs(e[t-1].position,e[t].position)}function Hc(e,t=100){return e>t}var sf=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 lf(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 vs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=sf,onRetry:d}=t,u,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(u=l,c===a||!n(u,c))return {error:u,attempts:i,success:false};let g=lf(c,r,o,s);if(d)try{d(u,c,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function df(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 cf(e,t={}){return async(...a)=>vs(()=>e(...a),t)}var el=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 zc=(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))(zc||{}),wo=class wo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,u?n:"");break;case "INFO":console.info(d,o,u?n:"");break;case "WARN":console.warn(d,o,u?n:"");break;case "ERROR":console.error(d,o,u?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",...wo.globalOptions};}static configure(t){wo.globalOptions={...wo.globalOptions,...t};}child(t){return new wo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new ks((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new ks(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:zc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};wo.globalOptions={};var tl=wo,ks=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Uc=new tl;function pf(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 mf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(d=>d.id===s.columnId);return [s.id,al(s.title),al(s.description||""),al(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 gf(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 uf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),u=297,i=210,c=n.width/n.height,l=u-20,m=l/c;m>i-20&&(m=i-20,l=m*c);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,u,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(u-l)/2;return g.addImage(d,"PNG",y,20,l,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 d=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,d.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):d.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(u.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let c=[];u.startDate&&c.push(`Start: ${u.startDate}`),u.endDate&&c.push(`End: ${u.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function al(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Gc(e,t,a,r){switch(t){case "json":return pf(e,r);case "csv":return mf(e);case "pdf":return await gf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Vc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},d=new Blob([e],{type:n[t]}),u=URL.createObjectURL(d),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function ff(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 bf(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=_c(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=_c(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((g,y)=>{i[g]=d[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let l=o.get(c),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),l.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function _c(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 jc(e,t){switch(t){case "json":return ff(e);case "csv":return bf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Kc(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 rl=react.createContext(null);function Yc(){return react.useContext(rl)}var qc=react.createContext(null);function Xc({children:e,themeName:t}){return jsxRuntime.jsx(qc.Provider,{value:{themeName:t},children:e})}function qo(){return react.useContext(qc)}function Lt({children:e,container:t}){let[a,r]=react.useState(false),o=Yc(),s=qo();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:d,themeName:u}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return 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 tu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Tf="#BDC3C7",Nf=({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 Co({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let g=u.current.getBoundingClientRect(),y=window.innerHeight,b=window.innerWidth,v=160,f=220,x=4,k=g.right-v;k<10&&(k=g.left),k+v>b-10&&(k=b-v-10);let h=y-g.bottom,w=g.top,C;h>=f+x?C=g.bottom+x:w>=f+x?C=g.top-f-x:C=h>=w?g.bottom+x:Math.max(10,g.top-f-x),n({top:C,left:k}),o(true);};react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&!u.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let c=g=>{t(g),o(false);},l=e?tu[e]:null,m=l?.color||Tf;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:l?.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(Lt,{children:jsxRuntime.jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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(tu).map(([g,y])=>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:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Nf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.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 Df=[{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 Dn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),m=(qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let k=i.current.getBoundingClientRect(),h=window.innerHeight,w=window.innerWidth,C=320,S=380,T=4,L=k.left;L+C>w-10&&(L=w-C-10),L<10&&(L=10);let A=h-k.bottom,N=k.top,Y;A>=S+T?Y=k.bottom+T:N>=S+T?Y=k.top-S-T:Y=A>=N?k.bottom+T:Math.max(10,k.top-S-T),d({top:Y,left:L}),s(true);};react.useEffect(()=>{let k=h=>{u.current&&!u.current.contains(h.target)&&!i.current?.contains(h.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),react.useEffect(()=>{let k=h=>{h.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let y=k=>{let h=new Date,w=L=>{let A=L.getFullYear(),N=String(L.getMonth()+1).padStart(2,"0"),Y=String(L.getDate()).padStart(2,"0");return `${A}-${N}-${Y}`},C=w(h),S=new Date(h);S.setDate(S.getDate()+k);let T=w(S);a(C,T),s(false);},b=()=>{if(!e||!t)return "Set date";let k=S=>{if(S instanceof Date)return S;if(typeof S!="string"||!S.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=S.split("-").map(Number);if(T.length!==3||T.some(Y=>isNaN(Y)))return null;let L=T[0],A=T[1],N=T[2];return L===void 0||A===void 0||N===void 0?null:new Date(L,A-1,N)},h=k(e),w=k(t);if(!h||!w||isNaN(h.getTime())||isNaN(w.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[h.getMonth()]} ${h.getDate()} \u2013 ${C[w.getMonth()]} ${w.getDate()}`},v=e&&t,x=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,h=new Date;return h.setHours(0,0,0,0),k<h})();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 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${b()}`:"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:b()})]}),o&&jsxRuntime.jsx(Lt,{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:Df.map(k=>jsxRuntime.jsx("button",{onClick:()=>y(k.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:h=>{h.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",h.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:h=>{h.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",h.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:k.label},k.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:k=>a(k.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:k=>a(e,k.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:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function No({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,u]=react.useState(""),[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let x=m.current.getBoundingClientRect(),k=window.innerHeight,h=window.innerWidth,w=300,C=380,S=4,T=x.right-w;T<10&&(T=x.left),T+w>h-10&&(T=h-w-10);let L=k-x.bottom,A=x.top,N;L>=C+S?N=x.bottom+S:A>=C+S?N=x.top-C-S:N=L>=A?x.bottom+S:Math.max(10,x.top-C-S),c({top:N,left:T}),n(true);};react.useEffect(()=>{let x=k=>{l.current&&!l.current.contains(k.target)&&!m.current?.contains(k.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),react.useEffect(()=>{let x=k=>{k.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let y=x=>{let k=e.some(h=>h.id===x.id);a(k?e.filter(h=>h.id!==x.id):[...e,x]);},b=t.filter(x=>x.name.toLowerCase().includes(d.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(x=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"asakaa-avatar-img"}):x.initials},x.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(Lt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:d,onChange:x=>u(x.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:b.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"}):b.map(x=>{let k=e.some(h=>h.id===x.id);return jsxRuntime.jsxs("button",{onClick:()=>y(x),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:h=>{h.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:x.color,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials}),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:x.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:k?"#3b82f6":"transparent"},children:k?"\u2713":""})]},x.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 ws(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 l=c;return l.taskId||l.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,d=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)&&d(c))return true;if(n.has(c))return true}}return n.delete(u),false};return d(a)}function En({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,u]=react.useState(false),[i,c]=react.useState(""),[l,m]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[b,v]=react.useState(null),f=react.useRef(null),x=react.useRef(null),k=()=>{if(!x.current)return;let T=x.current.getBoundingClientRect(),L=window.innerHeight,A=window.innerWidth,N=300,Y=l?380:120,O=4,le=T.right-N;le<10&&(le=T.left),le+N>A-10&&(le=A-N-10);let P=L-T.bottom,q=T.top,fe;P>=Y+O?fe=T.bottom+O:q>=Y+O?fe=T.top-Y-O:fe=P>=q?T.bottom+O:Math.max(10,T.top-Y-O),y({top:fe,left:le}),u(true);};react.useEffect(()=>{if(!d||!x.current)return;let T=x.current.getBoundingClientRect(),L=window.innerHeight,A=window.innerWidth,N=300,Y=l?380:120,O=4,le=T.right-N;le<10&&(le=T.left),le+N>A-10&&(le=A-N-10);let P=L-T.bottom,q=T.top,fe;P>=Y+O?fe=T.bottom+O:q>=Y+O?fe=T.top-Y-O:fe=P>=q?T.bottom+O:Math.max(10,T.top-Y-O),y({top:fe,left:le});},[l,d]),react.useEffect(()=>{let T=L=>{f.current&&!f.current.contains(L.target)&&!x.current?.contains(L.target)&&(u(false),c(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),react.useEffect(()=>{let T=L=>{L.key==="Escape"&&(u(false),c(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let h=T=>{let L=t.includes(T),A=a.find(N=>N.id===T);if(v(null),L){let N=t.filter(Y=>Y!==T);r(N),N.length===0&&m(false);}else {if(s&&ws(a,T,e)){let Y=`Cannot add "${A?.title||T}" as dependency - would create circular reference`;v(Y),n?.(T,A?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},w=()=>{let T=!l;m(T),T||r([]);},C=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),S=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:x,onClick:()=>d?u(false):k(),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:S,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:S},children:t.length})]}),d&&jsxRuntime.jsx(Lt,{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:[b&&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:b})]}),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:w,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&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"})]})}),l&&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 L=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>h(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&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 Vr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:l,transform:m,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:ys.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:l,style:b,...i,...c,onClick:()=>a?.(e),children:t(e)});let v=d.filter(h=>e.assignedUserIds?.includes(h.id)),f=e.progress===100,x=(e.attachments||[]).filter(h=>h.type.startsWith("image/")),k={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:k,className:p("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:h=>{h.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:h=>{h.currentTarget.style.display="none";}})}),x.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:x.length===1&&x[0]?jsxRuntime.jsx("img",{src:x[0].url,alt:x[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:h=>{h.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((h,w)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:h.url,alt:h.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";}}),w===3&&x.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:["+",x.length-4]})})]},h.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:h=>h.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Co,{priority:e.priority,onChange:h=>n?.(e.id,{priority:h})})}),jsxRuntime.jsx("div",{onClick:h=>h.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Dn,{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:(h,w)=>n?.(e.id,{startDate:h,endDate:w})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:h=>h.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(No,{assignedUsers:v,availableUsers:d,onChange:h=>n?.(e.id,{assignedUserIds:h.map(w=>w.id)})})}),jsxRuntime.jsx("div",{onClick:h=>h.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(En,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(h=>typeof h=="string"?h:h.taskId):[],availableTasks:u,onChange:h=>n?.(e.id,{dependencies:h})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(h=>jsxRuntime.jsx("span",{className:"asakaa-label",children:h},h))}),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)));Vr.displayName="Card";var Cs={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"}},uu=({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 pu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),c=[...Object.entries(Cs).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Cs).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let v=Cs[e];if(v)return {...v,id:e};let f=r.find(x=>x.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Cs.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,k=180,h=280,w=4,C=v.right-k;C<10&&(C=v.left),C+k>x-10&&(C=x-k-10);let S=f-v.bottom,T=v.top,L;S>=h+w?L=v.bottom+w:T>=h+w?L=v.top-h-w:L=S>=T?v.bottom+w:Math.max(10,v.top-h-w),d({top:L,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);},y=l(),b=y.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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:y.label,children:jsxRuntime.jsx(uu,{icon:y.icon,color:b})}),o&&jsxRuntime.jsx(Lt,{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(uu,{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 mu={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 gu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=mu[s]||mu.en,[d,u]=react.useState(false),[i,c]=react.useState(false),[l,m]=react.useState(e),[g,y]=react.useState({top:0,left:0}),b=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(d&&v.current){let w=v.current.getBoundingClientRect();y({top:w.bottom+window.scrollY+8,left:w.left+window.scrollX});}},[d]),react.useEffect(()=>{let w=C=>{b.current&&!b.current.contains(C.target)&&!v.current?.contains(C.target)&&(u(false),c(false));};if(d)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]),react.useEffect(()=>{let w=C=>{C.key==="Escape"&&(u(false),c(false),m(e));};if(d)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[d,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let x=()=>{c(true),m(e);},k=()=>{let w=l.trim();w&&w!==e&&t(w),c(false),u(false),m(e);},h=w=>{w.key==="Enter"?k():w.key==="Escape"&&(c(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>u(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children: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"})]})}),d&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?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:l,onChange:w=>m(w.target.value),onKeyDown:h,onBlur:k,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:x,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 Qo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:l=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:y,onColumnDelete:b,isDeletable:v=false,className:f,renderMetrics:x,locale:k})=>{let{setNodeRef:h,isOver:w}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),S=c??Hc(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:S});if(a)return jsxRuntime.jsx("div",{ref:h,className:f,children:a(e,t)});let A=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),N=A.state==="exceeded",Y=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:p("asakaa-column",w&&"ring-2 ring-asakaa-accent-blue",N&&"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(Y()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&A.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${A.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[A.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"})]}),A.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"})]}),A.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"})}),A.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"})]})]}),(y||b)&&jsxRuntime.jsx(gu,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:b?()=>b(e.id):void 0,isDeletable:v,locale:k}),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"})]})]}),x&&x(e,t),!m&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(O=>O.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):S?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(O=>{let le=t[O.index];return le?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsxRuntime.jsx(Vr,{card:le,render:r,onClick:n,onUpdate:d,availableUsers:u,allCards:i})},le.id):null})}):t.map(O=>jsxRuntime.jsx(Vr,{card:O,render:r,onClick:n,onUpdate:d,availableUsers:u,allCards:i},O.id))})})]})});Qo.displayName="Column";function ll({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.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:d,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 jf(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 vu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let u=d.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Kf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Yf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var qf=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:l=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:b=10}){let v=d==="dark",[f,x]=react.useState(false),[k,h]=react.useState([]),[w,C]=react.useState(0),[S,T]=react.useState(null),[L,A]=react.useState(false),N=react.useRef(null),Y=react.useRef(null),O=react.useRef(null),le=react.useRef(null),P=react.useCallback((R,J)=>{let X=jf(R,J);if(T(X),X){let ue=r.filter(Ie=>Ie.name.toLowerCase().includes(X.query)||Ie.email&&Ie.email.toLowerCase().includes(X.query)).slice(0,5);h(ue),x(ue.length>0),C(0);}else x(false),h([]);},[r]),q=R=>{let J=R.target.value;if(t(J),P(J,R.target.selectionStart||0),N.current){N.current.style.height="24px";let X=N.current.scrollHeight,ue=280,Ie=Math.min(X,ue);N.current.style.height=`${Ie}px`,N.current.style.overflowY=X>ue?"auto":"hidden";}},fe=()=>{N.current&&P(e,N.current.selectionStart||0);},Ke=react.useCallback(R=>{if(!S||!N.current)return;let J=e.slice(0,S.start),X=e.slice(S.end),ue=`@${R.name.replace(/\s+/g,"")} `,Ie=J+ue+X;t(Ie),x(false),T(null),setTimeout(()=>{if(N.current){let Xe=S.start+ue.length;N.current.selectionStart=Xe,N.current.selectionEnd=Xe,N.current.focus();}},0);},[S,e,t]),F=R=>{if(f&&k.length>0)switch(R.key){case "ArrowDown":R.preventDefault(),C(J=>J<k.length-1?J+1:0);break;case "ArrowUp":R.preventDefault(),C(J=>J>0?J-1:k.length-1);break;case "Enter":{R.preventDefault();let J=k[w];J&&Ke(J);break}case "Tab":{R.preventDefault();let J=k[w];J&&Ke(J);break}case "Escape":R.preventDefault(),x(false);break}else R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),a());};react.useEffect(()=>{let R=J=>{Y.current&&!Y.current.contains(J.target)&&N.current&&!N.current.contains(J.target)&&x(false),le.current&&!le.current.contains(J.target)&&A(false);};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);let U=react.useCallback(R=>{if(!N.current)return;let J=N.current.selectionStart||e.length,X=e.slice(0,J)+R+e.slice(J);t(X),A(false),setTimeout(()=>{if(N.current){let ue=J+R.length;N.current.selectionStart=ue,N.current.selectionEnd=ue,N.current.focus();}},0);},[e,t]),ae=react.useCallback(R=>{if(!g||!R.target.files)return;let J=Array.from(R.target.files),X=b*1024*1024,ue=J.filter(Ie=>Ie.size>X?(console.warn(`File ${Ie.name} exceeds max size of ${b}MB`),false):true);ue.length>0&&g(ue),R.target.value="";},[g,b]),Ne=react.useCallback(R=>R.type.startsWith("image/")?lucideReact.Image:R.type.includes("pdf")||R.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&Y.current){let R=Y.current.children[w];R&&R.scrollIntoView({block:"nearest"});}},[w,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(R=>{let J=Ne(R.file),X=R.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:[X&&R.preview?jsxRuntime.jsx("img",{src:R.preview,alt:R.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(J,{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:R.file.name}),jsxRuntime.jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Yf(R.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(R.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"})})]},R.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:()=>A(!L),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsx(framerMotion.motion.div,{ref:le,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:qf.map(R=>jsxRuntime.jsx("button",{type:"button",onClick:()=>U(R),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:R},R))})})})]}),l&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.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:O,type:"file",multiple:true,onChange:ae,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:N,value:e,onChange:q,onSelect:fe,onKeyDown:F,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&&k.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,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:k.map((R,J)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ke(R),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",J===w?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:R.color||"#8B5CF6"},children:Kf(R.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:R.name}),R.email&&jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:R.email})]})]},R.id))})})]})]})]})}function wu({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((d,u)=>d.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:d.value},u):jsxRuntime.jsx("span",{children:d.value},u))})}var Es=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function oo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,u]=react.useState(false),[i,c]=react.useState(""),[l,m]=react.useState(false),[g,y]=react.useState(Es[10]||"#2E94FF"),[b,v]=react.useState({top:0,left:0}),f=react.useRef(null),x=react.useRef(null),k=react.useRef(null),h=react.useRef(null),w=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),C=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&x.current){let N=x.current.getBoundingClientRect();v({top:N.bottom+6,left:N.left});}},[d]),react.useEffect(()=>{let N=Y=>{let O=Y.target,le=f.current?.contains(O),P=k.current?.contains(O);!le&&!P&&(u(false),c(""),m(false));};if(d)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]),react.useEffect(()=>{d&&h.current&&h.current.focus();},[d]);let S=N=>{let Y=e.some(O=>O.id===N.id);a(Y?e.filter(O=>O.id!==N.id):[...e,N]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let N=await r(i.trim(),g);N&&(a([...e,N]),c(""),y(Es[Math.floor(Math.random()*Es.length)]||"#2E94FF"));}finally{m(false);}}},L=(N,Y)=>{Y.stopPropagation(),a(e.filter(O=>O.id!==N));},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:x,type:"button",onClick:()=>!s&&u(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,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(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:k,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:h,type:"text",value:i,onChange:N=>c(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!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(N=>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:`${N.color}20`,color:N.color},onClick:Y=>L(N.id,Y),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:w.length>0?w.map(N=>{let Y=e.some(O=>O.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>S(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:Y?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{Y||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{Y||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),Y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.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:Es.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:g===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:l?.7:1},children:[l?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 cl({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 Tu({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(cl,{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 So=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Nu(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 ob(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 nb({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 ul({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=ob(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Nu(e.loggedMinutes),i=e.estimateMinutes?Nu(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(nb,{className:d[t]}),jsxRuntime.jsx("span",{children:c})]})}function Su(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Fs(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 lb(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 db({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 Eu({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 ub({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 pl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:u,onDiscardTimer:i,onClose:c,className:l}){let[m,g]=react.useState(""),[y,b]=react.useState(t.estimateMinutes?Fs(t.estimateMinutes):""),[v,f]=react.useState(""),[x,k]=react.useState(false),[h,w]=react.useState(false),C=react.useRef(null);react.useEffect(()=>{C.current?.focus();},[]);let S=async()=>{let A=Su(m);if(!(A<=0||!s)){k(true);try{await s({durationMinutes:A,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{k(false);}}},T=async()=>{if(!n)return;let A=y.trim()?Su(y):null;await n(A),w(false);},L=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),S()),A.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",l),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(Eu,{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:lb(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(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(Eu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:d,className:p("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(db,{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(ub,{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:A=>g(A.target.value),onKeyDown:L,placeholder:"8 (=8h), 2h 30m",className:p("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:S,disabled:x||!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:A=>f(A.target.value),onKeyDown:L,placeholder:"Note (optional)",className:p("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),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:Fs(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"}),h?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="Enter"&&T(),A.key==="Escape"&&w(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:()=>w(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Fs(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(A=>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:A.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Fs(A.durationMinutes)})]},A.id))})]})]})}function bb(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function hb(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Ir({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,u]=react.useState(hb(r)),[i,c]=react.useState(""),[l,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{m(true);let k=bb(d);await o(k&&k>0?k:null,i||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},v=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y()),k.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},x=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:k=>k.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:d,onChange:k=>u(k.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 2:30"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:k=>c(k.target.value),onKeyDown:v,placeholder:x?"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:y,disabled:l||!d.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:l?x?"Guardando...":"Saving...":x?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:l,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:x?"Quitar":"Clear"})]})]})}function yb(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 xb(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 gl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=yb(e.health),s=xb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,u=Math.min(100,d),i=d>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:[d,"%"]})]})}function Zo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function kb(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 wb(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 Cb(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 Tb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",d=a?"text-[#9CA3AF]":"text-gray-500",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",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",Zo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:p("text-xs mt-1",d),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",d),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",d),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:d,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:Zo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:Zo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:p("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function Nb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return 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",d),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Zo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Zo(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":d),children:[o,Zo(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":d),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",wb(e.status,a),kb(e.status,a)),children:Cb(e.status,t)})})]})}function fl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",u=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",c=n?"text-white/[0.92]":"text-gray-900",l=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,b)=>y.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:p("space-y-6 p-6",d,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",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Tb,{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",l),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:p("divide-y",i),children:g.map(y=>jsxRuntime.jsx(Nb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:p("text-xs text-center",l),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 en(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Hb(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 jr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:l,onDeleteAttachment:m,availableTasks:g=[],comments:y=[],onAddComment:b,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:x,enableTimeTracking:k=false,timeTrackingSummary:h,timeEntries:w=[],isTimerRunning:C=false,timerElapsedSeconds:S=0,onTimeLog:T,onEstimateUpdate:L,onSoldEffortUpdate:A,onTimerStart:N,onTimerStop:Y,onTimerDiscard:O,blurFinancials:le=false}){let P=s==="dark",q={textTertiary:P?"#6B7280":"#9CA3AF",textSecondary:P?"#9CA3AF":"#6B7280",textPrimary:P?"#FFFFFF":"#111827",borderLight:P?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:P?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:P?"#1A1D25":"#FFFFFF",bgSecondary:P?"#0A0A0A":"#F9FAFB",hoverBg:P?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},fe=e&&"title"in e&&!("name"in e),Ke=e,[F,U]=react.useState(e?$u(e,d):null),[ae,Ne]=react.useState(false),[R,J]=react.useState(false),[X,ue]=react.useState(false),[Ie,Xe]=react.useState(null),[dt,lt]=react.useState(new Date),[re,ct]=react.useState(false),[Be,ht]=react.useState(false),[mt,Ct]=react.useState(""),[we,Je]=react.useState(false),[tt,Qe]=react.useState(false),[H,ne]=react.useState(false),[D,K]=react.useState(false),[se,be]=react.useState(""),G=react.useRef(null),Z=react.useRef(null),[ze,ye]=react.useState(""),Ue=react.useRef(null),[Se,He]=react.useState(""),[$,pe]=react.useState(false),[ke,Ve]=react.useState([]),[st,Ze]=react.useState(""),[me,qe]=react.useState(false),gt=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 M=$u(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:M?.id,taskName:M?.name,soldEffortMinutes:M?.soldEffortMinutes,quotedMinutes:M?.quotedMinutes,effortMinutes:M?.effortMinutes,timeLoggedMinutes:M?.timeLoggedMinutes}),U(M),be(M.description||""),ye(M.name||"");}},[e?.id,e?.quotedMinutes,d,t]),react.useEffect(()=>{if(!t||!se)return;let M=setTimeout(()=>{let de=Z.current;de&&(de.style.height="auto",de.style.height=`${Math.max(100,de.scrollHeight)}px`);},50);return ()=>clearTimeout(M)},[t,se]),react.useEffect(()=>()=>{G.current&&clearTimeout(G.current),Ue.current&&clearTimeout(Ue.current);},[]),react.useEffect(()=>{t&>.current&&y.length>0&&setTimeout(()=>{gt.current&&(gt.current.scrollTop=gt.current.scrollHeight);},100);},[t,y.length]);let Pt=react.useCallback(M=>{U(M),fe&&o&&Ke?o(zb(M,Ke)):r&&r(M);},[fe,Ke,o,r]),Fe=react.useCallback(()=>{Ne(false),J(false),ue(false),Xe(null),ht(false),Ct(""),Je(false);},[]),_e=react.useCallback((M,de)=>{if(!F)return;let $e={...F,[M]:de};Pt($e);},[F,Pt]),j=react.useCallback(()=>{let M=Z.current;M&&(M.style.height="auto",M.style.height=`${Math.max(100,M.scrollHeight)}px`);},[]),xe=react.useCallback(M=>{be(M),setTimeout(j,0),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{if(F){let de={...F,description:M};Pt(de);}},800);},[F,Pt,j]),ee=react.useCallback(M=>{ye(M),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(F&&M.trim()){let de={...F,name:M.trim()};Pt(de);}},800);},[F,Pt]),I=react.useCallback(M=>{let de=M.map($e=>{let et={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:$e};return $e.type.startsWith("image/")&&(et.preview=URL.createObjectURL($e)),et});Ve($e=>[...$e,...de]);},[]),V=react.useCallback(M=>{Ve(de=>{let $e=de.find(et=>et.id===M);return $e?.preview&&URL.revokeObjectURL($e.preview),de.filter(et=>et.id!==M)});},[]),te=react.useCallback(async()=>{if(!(!F||!Se.trim()&&ke.length===0||!b)){pe(true);try{let M=vu(Se,f),de=[];if(ke.length>0&&x){let $e=ke.map(et=>et.file);de=await x($e);}await b(F.id,Se.trim(),M.length>0?M:void 0,de.length>0?de:void 0),He(""),ke.forEach($e=>{$e.preview&&URL.revokeObjectURL($e.preview);}),Ve([]);}finally{pe(false);}}},[F,Se,ke,b,f,x]),Ce=react.useCallback(()=>{if(!F||!st.trim())return;let M=F.subtasks||[],de={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:st.trim(),progress:0,startDate:new Date,endDate:new Date,position:M.length},$e=[...M,de],et={...F,subtasks:$e};Pt(et),Ze(""),qe(false);},[F,st,Pt]),Pe=react.useCallback(M=>{if(!F?.subtasks)return;let de=F.subtasks.map(et=>et.id===M?{...et,progress:et.progress===100?0:100}:et),$e={...F,subtasks:de};Pt($e);},[F,Pt]),Ye=react.useCallback(M=>{if(!F?.subtasks)return;let de=F.subtasks.filter(et=>et.id!==M),$e={...F,subtasks:de};Pt($e);},[F,Pt]),Re=react.useCallback(M=>{let de=typeof M=="string"?new Date(M):M,et=new Date().getTime()-de.getTime(),yt=Math.floor(et/6e4),Ha=Math.floor(et/36e5),ta=Math.floor(et/864e5);return yt<1?n==="es"?"Ahora":"Just now":yt<60?n==="es"?`Hace ${yt} min`:`${yt}m ago`:Ha<24?n==="es"?`Hace ${Ha}h`:`${Ha}h ago`:ta<7?n==="es"?`Hace ${ta}d`:`${ta}d ago`:de.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Dt=react.useCallback(M=>{if(!F)return;let de=F.progress||0;M==="completed"?de=100:M==="in-progress"&&de===0?de=10:M==="todo"&&(de=0);let $e={...F,status:M,progress:de};Pt($e),Ne(false);},[F,Pt]),pt=react.useCallback((M,de)=>{if(!F)return;let $e={...F,startDate:M,endDate:de};Pt($e);},[F,Pt]),Ut=react.useCallback(()=>{let M=dt.getFullYear(),de=dt.getMonth(),$e=new Date(M,de,1),yt=new Date(M,de+1,0).getDate(),Ha=$e.getDay(),ta=[],tr=new Date(M,de,0).getDate();for(let sa=Ha-1;sa>=0;sa--)ta.push({date:new Date(M,de-1,tr-sa),isCurrentMonth:false});for(let sa=1;sa<=yt;sa++)ta.push({date:new Date(M,de,sa),isCurrentMonth:true});let na=42-ta.length;for(let sa=1;sa<=na;sa++)ta.push({date:new Date(M,de+1,sa),isCurrentMonth:false});return ta},[dt]),Ca=react.useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),ne(false),!F||!l)return;let de=Array.from(M.dataTransfer.files);if(de.length!==0){K(true);try{await l(F.id,de);}finally{K(false);}}},[F,l]),ha=react.useCallback(async M=>{if(!F||!l||!M.target.files)return;let de=Array.from(M.target.files);if(de.length!==0){K(true);try{await l(F.id,de);}finally{K(false);}M.target.value="";}},[F,l]),Ae=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),ne(true);},[]),z=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),ne(false);},[]),ve=react.useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),Ot=react.useCallback(M=>M.startsWith("image/")?lucideReact.Image:M.includes("pdf")||M.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!F?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&F&&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",P?"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]",P?"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",P?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:p("text-xs px-2 py-0.5 rounded",P?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",P?"text-[#6B7280]":"text-gray-400"),children:F.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 M=F.progress===100?0:100,$e={...F,progress:M,status:M===100?"completed":"todo"};Pt($e);},className:p("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",F.progress===100?"bg-green-500 border-green-500":P?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:ze,onChange:M=>ee(M.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",F.progress===100?"line-through text-[#6B7280]":P?"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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),Ne(!ae);},className:p("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",F.progress===100||F.status==="completed"?"bg-green-500/20 text-green-400":F.progress&&F.progress>0||F.status==="in-progress"?"bg-blue-500/20 text-blue-400":P?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:F.progress===100||F.status==="completed"?n==="es"?"COMPLETADO":"DONE":F.progress&&F.progress>0||F.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ne(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]",P?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(M=>jsxRuntime.jsxs("button",{onClick:()=>Dt(M.id),className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",P?"hover:bg-white/5":"hover:bg-gray-50",F.status===M.id&&(P?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:P?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),ue(!X);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",P?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[F.assignees&&F.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[F.assignees.slice(0,3).map((M,de)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},de)),F.assignees.length>3&&jsxRuntime.jsxs("span",{className:p("text-xs",P?"text-[#6B7280]":"text-gray-400"),children:["+",F.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:p("text-sm",P?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",P?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className: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",P?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(M=>{let de=F.assignees?.some($e=>$e.name===M.name);return jsxRuntime.jsxs("button",{onClick:()=>{let $e=F.assignees||[],et;de?et=$e.filter(yt=>yt.name!==M.name):et=[...$e,M],_e("assignees",et);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",P?"hover:bg-white/5":"hover:bg-gray-50",de&&(P?"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:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p("flex-1",P?"text-white":"text-gray-900"),children:M.name}),de&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},M.name)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",P?"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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Xe(Ie?null:"start"),lt(F.startDate||new Date);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",P?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[F.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:p("mx-1",P?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),F.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Xe(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",P?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",P?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,de=new Date(M);de.setDate(M.getDate()+1);let $e=new Date(M);$e.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let et=new Date(M);et.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let yt=new Date(M);yt.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let Ha=new Date(M);Ha.setDate(M.getDate()+14);let ta=new Date(M);return ta.setDate(M.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:de,display:de.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:$e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:et,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:yt,display:yt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ha,display:Ha.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ta,display:ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((na,sa)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",P?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ie==="start"){let Wo=F.endDate&&na.date>F.endDate?na.date:F.endDate;pt(na.date,Wo),Xe("end");}else {let Wo=F.startDate&&na.date<F.startDate?na.date:F.startDate;pt(Wo,na.date),Xe(null);}},children:[jsxRuntime.jsx("span",{children:na.label}),jsxRuntime.jsx("span",{className:p("text-xs",P?"text-[#6B7280]":"text-gray-400"),children:na.display})]},sa))})(),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",P?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{pt(void 0,void 0),Xe(null);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",P?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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",P?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ie==="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",P?"text-white":"text-gray-900"),children:dt.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:()=>lt(new Date),className:p("p-1 rounded text-sm transition-colors",P?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>lt(new Date(dt.getFullYear(),dt.getMonth()-1)),className:p("p-1 rounded",P?"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:()=>lt(new Date(dt.getFullYear(),dt.getMonth()+1)),className:p("p-1 rounded",P?"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(M=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",P?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Ut().map((M,de)=>{let $e=M.date.toDateString()===new Date().toDateString(),et=F.startDate?.toDateString()===M.date.toDateString(),yt=F.endDate?.toDateString()===M.date.toDateString(),Ha=et||yt,ta=F.startDate&&F.endDate&&M.date>=F.startDate&&M.date<=F.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let tr=new Date(M.date);if(Ie==="start"){let na=F.endDate&&tr>F.endDate?tr:F.endDate;pt(tr,na),Xe("end");}else {let na=F.startDate&&tr<F.startDate?tr:F.startDate;pt(na,tr),Xe(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!M.isCurrentMonth&&(P?"text-[#4B5563]":"text-gray-300"),M.isCurrentMonth&&(P?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#2E94FF]",et&&"bg-[#2E94FF] text-white",yt&&!et&&"bg-[#7C3AED] text-white",ta&&!Ha&&(P?"bg-[#7C3AED]/20":"bg-purple-100"),!Ha&&(P?"hover:bg-white/10":"hover:bg-gray-100")),children:M.date.getDate()},de)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),J(!R);},className:p("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",F.priority==="high"||F.priority==="urgent"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":F.priority==="low"?"bg-green-500/20 text-green-400":P?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:F.priority?F.priority==="high"||F.priority==="urgent"?n==="es"?"Alta":"High":F.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(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]",P?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{_e("priority",M.id),J(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",P?"hover:bg-white/5":"hover:bg-gray-50",F.priority===M.id&&(P?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:P?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:p("text-sm",P?"text-white":"text-gray-900"),children:F.startDate&&F.endDate?`${Math.ceil((F.endDate.getTime()-F.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",P?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[re?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:F.progress||0,onChange:M=>{let de=parseInt(M.target.value),$e=F.status;de===100?$e="completed":de>0?$e="in-progress":$e="todo";let et={...F,progress:de,status:$e};Pt(et);},onBlur:()=>ct(false),className:p("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",P?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ct(true),className:p("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",P?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",F.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${F.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:p("text-sm font-medium min-w-[40px]",P?"text-white":"text-gray-900"),children:[F.progress||0,"%"]})]})]}),k&&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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"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:F.status==="completed"||F.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",P?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:h?.estimateMinutes?en(h.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):h?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm px-2 py-0.5 rounded",P?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(h.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm",P?"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(Ir,{mode:"estimate",locale:n,isDark:P,currentValue:h?.estimateMinutes||null,onSave:async M=>{await L?.(F.id,M),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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:le?jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",P?"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"}):F.status==="completed"||F.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",P?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:F.quotedMinutes?en(F.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):F.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm px-2 py-0.5 rounded",P?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(F.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm",P?"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"&&!le&&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(Ir,{mode:"quoted",locale:n,isDark:P,currentValue:F.quotedMinutes||null,onSave:async M=>{A?(await A(F.id,M),U(de=>de?{...de,quotedMinutes:M}:null)):_e("quotedMinutes",M),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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[F.status==="completed"||F.progress===100?jsxRuntime.jsx("div",{className:p("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",P?"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:()=>Y?.(F.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"}),Hb(S||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>N?.(F.id),className:p("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",P?"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"})}),F.status==="completed"||F.progress===100?jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",P?"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",P?"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"]}),h&&h.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p("text-sm font-medium",h.health==="over-budget"?"text-red-500":h.health==="at-risk"?"text-yellow-500":P?"text-white":"text-gray-900"),children:[en(h.loggedMinutes),h.estimateMinutes&&jsxRuntime.jsxs("span",{className:p("font-normal",P?"text-[#6B7280]":"text-gray-400"),children:[" / ",en(h.estimateMinutes)]})]}),h.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",h.health==="over-budget"?"bg-red-500":h.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,h.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(Ir,{mode:"log",locale:n,isDark:P,currentValue:null,onSave:async(M,de)=>{M&&await T?.(F.id,{durationMinutes:M,note:de,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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(oo,{selectedTags:F.tags||[],availableTags:u,onChange:M=>{_e("tags",M);},onCreateTag:i,theme:q})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:p("w-4 h-4 mt-1.5",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0 mt-1",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[F.dependencies&&F.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:F.dependencies.map(M=>{let de=g.find($e=>$e.id===M);return jsxRuntime.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",P?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[de?.name||M.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let $e=(F.dependencies||[]).filter(et=>et!==M);_e("dependencies",$e);},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"})})]},M)})}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),ht(!Be);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",P?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:p("text-sm",P?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ht(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]",P?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("p-2 border-b",P?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:mt,onChange:M=>Ct(M.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("w-full px-3 py-2 rounded-md text-sm outline-none",P?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(M=>M.id!==F.id).filter(M=>mt===""||M.name.toLowerCase().includes(mt.toLowerCase())).map(M=>{let de=F.dependencies?.includes(M.id);return jsxRuntime.jsxs("button",{onClick:()=>{let $e=F.dependencies||[],et;de?et=$e.filter(yt=>yt!==M.id):et=[...$e,M.id],_e("dependencies",et);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",P?"hover:bg-white/5":"hover:bg-gray-50",de&&(P?"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",de?"bg-blue-500 border-blue-500":P?"border-white/30":"border-gray-300"),children:de&&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",P?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("span",{className:p("text-xs",P?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",P?"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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),Je(!we);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",P?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:F.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:p("text-sm",P?"text-white":"text-gray-900"),children:So.find(M=>M.value===F.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",P?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Je(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",P?"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:So.map(M=>{let de=F.color===M.value;return jsxRuntime.jsx("button",{onClick:()=>{_e("color",M.value),Je(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",de&&"ring-2 ring-offset-2",P?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:de?M.value:void 0},title:M.name,children:de&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:p("w-4 h-4",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",P?"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:F.isMilestone||false,onChange:M=>_e("isMilestone",M.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",F.isMilestone?"bg-purple-500 border-purple-500":P?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:p("text-sm",P?"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",P?"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",P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:p("text-sm font-semibold",P?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:Z,value:se,onChange:M=>xe(M.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",P?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",P?"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",P?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",F.subtasks&&F.subtasks.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",P?"text-[#6B7280]":"text-gray-400"),children:["(",F.subtasks.filter(M=>M.progress===100).length,"/",F.subtasks.length,")"]})]})}),F.subtasks&&F.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...F.subtasks].sort((M,de)=>(M.position??0)-(de.position??0)).map(M=>jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",P?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Pe(M.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",M.progress===100?"bg-green-500 border-green-500":P?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:p("text-sm flex-1",M.progress===100?"line-through text-[#6B7280]":P?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("button",{onClick:()=>Ye(M.id),className:p("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",P?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},M.id))}),me?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:st,onChange:M=>Ze(M.target.value),onKeyDown:M=>{M.key==="Enter"&&st.trim()?Ce():M.key==="Escape"&&(qe(false),Ze(""));},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",P?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:Ce,disabled:!st.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",st.trim()?"bg-blue-500 hover:bg-blue-600 text-white":P?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{qe(false),Ze("");},className:p("p-2 rounded-lg transition-colors",P?"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:()=>qe(true),className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",P?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[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",P?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold mb-3",P?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",P?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(M=>{let de=Ot(M.type),$e=M.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("flex items-center gap-3 p-2 rounded-lg group transition-colors",P?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[$e&&M.thumbnailUrl?jsxRuntime.jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",P?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(de,{className:p("w-5 h-5",P?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",P?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("p",{className:p("text-xs",P?"text-[#6B7280]":"text-gray-400"),children:ve(M.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(M.id),className:p("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",P?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},M.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ae,onDragLeave:z,onDrop:Ca,className:p("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?P?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":P?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ha,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||D}),D?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",P?"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":P?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:p("text-sm",P?"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"})]})}),!l&&jsxRuntime.jsx("p",{className:p("text-xs mt-1",P?"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",P?"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]",P?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",P?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",P?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:p("p-1.5 rounded transition-colors",P?"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: ${P?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{ref:Y,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...v].sort((S,ie)=>{let ze=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,Ge=typeof ie.createdAt=="string"?new Date(ie.createdAt):ie.createdAt;return ze.getTime()-Ge.getTime()}).map(S=>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:S.user?.color||"#8B5CF6"},children:S.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:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:bt(S.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(iu,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(ie=>{let ze=ie.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:ie.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ze?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ie.name})]},ie.id)})})]})]},S.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(su,{value:Ke,onChange:Xe,onSubmit:G,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!b,isSubmitting:ot,theme:s,locale:n,currentUser:y,enableEmoji:true,enableAttachments:!!x,pendingFiles:de,onFilesSelect:I,onRemoveFile:J})})]})]})]})})}function ll(){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 oo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:v,onDeleteAttachment:b,comments:y,onAddComment:f,currentUser:x,mentionableUsers:k,onTaskOpen:h,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:C,timerState:B,onLogTime:E,onUpdateEstimate:w,onUpdateSoldEffort:U,onStartTimer:$,onStopTimer:Z,onDiscardTimer:F,blurFinancials:K=false,sidePanel:le,renderColumnMetrics:Ie,suppressDetailModal:A=false}){let[_,ve]=ll(),[Qe,O]=react.useState(null),[Q,te]=react.useState(false),Ue=react.useRef(null),rt=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ze=o?.theme||"dark",mt=Ze==="dark"||Ze==="neutral",Ce=mt?"dark":"",se=react.useCallback((P,ee)=>{t.onCardUpdate?.(P,ee);},[t]),j=react.useCallback((P,ee)=>{t.onColumnUpdate?.(P,{title:ee});},[t]),ue=react.useCallback(P=>{t.onColumnDelete?.(P);},[t]),ae=["todo","in-progress","completed"],Fe=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),$e=react.useMemo(()=>{let P=new Map;return e.columns.forEach(ee=>{let ke=ee.cardIds.map(Be=>e.cards.find(W=>W.id===Be)).filter(Be=>Be!==void 0).sort((Be,W)=>Be.position-W.position);P.set(ee.id,ke);}),P},[e.cards,e.columns]);react.useEffect(()=>{let P=Ue.current;if(!P)return;let ee=pe=>{let dt=pe.target,Ee=pe.button===1,qe=dt===P||dt.classList.contains("asakaa-column")&&!dt.closest(".asakaa-card");(Ee||pe.button===0&&qe&&!_.isDragging)&&(pe.preventDefault(),te(true),rt.current={x:pe.clientX,y:pe.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},P.style.cursor="grabbing",P.style.userSelect="none");},ke=pe=>{if(!Q)return;let dt=pe.clientX-rt.current.x,Ee=pe.clientY-rt.current.y;P.scrollLeft=rt.current.scrollLeft-dt,P.scrollTop=rt.current.scrollTop-Ee;},Be=()=>{Q&&(te(false),P.style.cursor="",P.style.userSelect="");},W=()=>{Q&&(te(false),P.style.cursor="",P.style.userSelect="");};return P.addEventListener("mousedown",ee),document.addEventListener("mousemove",ke),document.addEventListener("mouseup",Be),P.addEventListener("mouseleave",W),()=>{P.removeEventListener("mousedown",ee),document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",Be),P.removeEventListener("mouseleave",W);}},[Q,_.isDragging]);let Re=react.useMemo(()=>e.cards.map(P=>({id:P.id,name:P.title,startDate:P.startDate?new Date(P.startDate):void 0,endDate:P.endDate?new Date(P.endDate):void 0,progress:P.progress||0,status:P.columnId,priority:P.priority?.toLowerCase(),dependencies:Array.isArray(P.dependencies)?P.dependencies.map(ee=>typeof ee=="string"?ee:ee.taskId):[]})),[e.cards]),ct=react.useCallback(P=>{let{active:ee}=P,ke=e.cards.find(Be=>Be.id===ee.id);ke&&ve({isDragging:true,draggedCardId:ke.id,sourceColumnId:ke.columnId,targetColumnId:ke.columnId});},[e.cards,ve]),je=react.useCallback(P=>{let{active:ee,over:ke}=P;if(!ke||!e.cards.find(pe=>pe.id===ee.id))return;let W=null;ke.data.current?.type==="column"?W=ke.id:ke.data.current?.type==="card"&&(W=e.cards.find(dt=>dt.id===ke.id)?.columnId||null),W&&W!==_.targetColumnId&&ve({..._,targetColumnId:W});},[e.cards,_,ve]),et=react.useCallback(async P=>{let{active:ee,over:ke}=P;if(ve({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ke)return;let Be=e.cards.find(Ee=>Ee.id===ee.id);if(!Be)return;let W,pe;if(ke.data.current?.type==="column"){W=ke.id;let Ee=$e.get(W)||[];pe=Vi(Ee,0);}else {let Ee=e.cards.find(Xe=>Xe.id===ke.id);if(!Ee)return;W=Ee.columnId;let qe=$e.get(W)||[],Ke=qe.findIndex(Xe=>Xe.id===ke.id);pe=Vi(qe,Ke);}let dt=e.columns.find(Ee=>Ee.id===W);if(dt&&dt.wipLimit&&dt.wipLimitType==="hard"){let Ee=$e.get(W)||[];if(Be.columnId!==W&&Ee.length>=dt.wipLimit){t.onWipLimitExceeded?.(dt,Be);return}}(Be.columnId!==W||Be.position!==pe)&&await t.onCardMove?.(Be.id,W,pe);},[e.cards,e.columns,$e,t,ve]),Le=react.useCallback(P=>{A||O(P),a?.(P),h?.(P.id);},[a,h,A]),pt=react.useCallback(P=>{t.onCardUpdate?.(P.id,P),O(P);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",Ce,n),style:l,children:jsxRuntime.jsx(Ob,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:u("asakaa-board",Ce,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(Rc,{themeName:Ze,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",le?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Fe,collisionDetection:core$1.closestCorners,onDragStart:ct,onDragOver:je,onDragEnd:et,children:[jsxRuntime.jsxs("div",{ref:Ue,className:u("asakaa-board",le?"flex-1":"",Ce,n),style:{...l,cursor:Q?"grabbing":void 0},"data-theme":Ze,children:[e.columns.sort((P,ee)=>P.position-ee.position).map(P=>{let ee=$e.get(P.id)||[],ke=!ae.includes(P.id),Be=r?.renderColumnFooter?.(P);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Yo,{column:P,cards:ee,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ie?(W,pe)=>Ie(W,pe):void 0,onCardClick:Le,onCardUpdate:se,onColumnRename:j,onColumnDelete:ue,isDeletable:ke,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Be]},P.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:_.draggedCardId?jsxRuntime.jsx(Ur,{card:e.cards.find(P=>P.id===_.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),le]}),!A&&jsxRuntime.jsx(Gr,{task:Qe,isOpen:!!Qe,onClose:()=>O(null),onCardUpdate:pt,theme:mt?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:Qe?g?.get(Qe.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:b,availableTasks:Re,comments:y,onAddComment:f,currentUser:x,mentionableUsers:k,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:C,isTimerRunning:B?.isRunning,timerElapsedSeconds:B?.elapsedSeconds,onTimeLog:E,onEstimateUpdate:w,onSoldEffortUpdate:U,onTimerStart:$,onTimerStop:Z,onTimerDiscard:F,blurFinancials:K})]})}function Ob({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 Wb={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)"},Gb={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)"},Vb={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},_b={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function jb({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=p=>{l.current&&!l.current.contains(p.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,p)=>i.position-p.position).map((i,p)=>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:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[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 Kb({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=v=>{i.current&&!i.current.contains(v.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,v)=>{if(v){c(g);try{await v();}catch(b){console.error(`Export ${g} failed:`,b);}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,v)=>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:v<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[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 Yb({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 cl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:p}){let d=r==="dark"?Wb:Gb,m={...o==="es"?Vb:_b,...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:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kb,{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(jb,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsxRuntime.jsx(Yb,{onClick:()=>t(),label:a||m.newTask}))]})})}function pl({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]),p=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:u("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:p,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:u("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 Do({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[v,b]=react.useState(null),[y,f]=react.useState(false),[x,k]=react.useState(false),[h,N]=react.useState(false),[T,D]=react.useState(s||new Date),C=react.useRef(null),B=o==="es",E=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{C.current?.focus();},[]);let w=react.useCallback(()=>{f(false),k(false),N(false);},[]),U=react.useCallback(()=>{i(""),d(void 0),g(null),b(null),w(),t();},[t,w]),$=react.useCallback(()=>{let K=c.trim();if(!K)return;let le=a.find(A=>A.id===m),Ie=v||s;e({name:K,priority:p,assignee:le||void 0,assigneeId:m,startDate:Ie,endDate:Ie}),i(""),d(void 0),g(null),b(null),w(),C.current?.focus();},[c,p,m,v,s,a,e,w]),Z=react.useCallback(K=>{K.key==="Enter"&&c.trim()&&(K.preventDefault(),$()),K.key==="Escape"&&U();},[$,U,c]),F=v||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>w(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:C,type:"text",value:c,onChange:K=>i(K.target.value),placeholder:B?"Nombre de la tarea...":"Task name...",className:u("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:Z})}),jsxRuntime.jsxs("div",{className:u("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:K=>{K.stopPropagation(),f(!y),k(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",E,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.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(K=>jsxRuntime.jsxs("button",{onClick:()=>{d(K.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===K.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",K.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:K.label})]},K.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:K=>{K.stopPropagation(),N(!h),f(false),k(false),D(v||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",v?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"}),F.toLocaleDateString(B?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",E,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let K=new Date,le=new Date(K);le.setDate(K.getDate()+1);let Ie=new Date(K);Ie.setDate(K.getDate()+((6-K.getDay()+7)%7||7));let A=new Date(K);A.setDate(K.getDate()+((1-K.getDay()+7)%7||7));let _=new Date(K);_.setDate(K.getDate()+14);let ve=new Date(K);ve.setDate(K.getDate()+28);let Qe=B?"es-ES":"en-US";return [{label:B?"Hoy":"Today",date:K,display:K.toLocaleDateString(Qe,{weekday:"short"}).slice(0,3)+"."},{label:B?"Ma\xF1ana":"Tomorrow",date:le,display:le.toLocaleDateString(Qe,{weekday:"short"}).slice(0,3)+"."},{label:B?"Este fin de semana":"This weekend",date:Ie,display:B?"s\xE1b.":"sat."},{label:B?"Pr\xF3xima semana":"Next week",date:A,display:B?"lun.":"mon."},{label:B?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(Qe,{day:"numeric",month:"short"})},{label:B?"4 semanas":"4 weeks",date:ve,display:ve.toLocaleDateString(Qe,{day:"numeric",month:"short"})}].map((Q,te)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{b(Q.date),N(false);},children:[jsxRuntime.jsx("span",{children:Q.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Q.display})]},te))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.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:u("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(T.getFullYear(),T.getMonth()-1)),className:u("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(T.getFullYear(),T.getMonth()+1)),className:u("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(K=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:K},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let K=T.getFullYear(),le=T.getMonth(),Ie=new Date(K,le,1).getDay(),A=new Date(K,le+1,0).getDate(),_=new Date(K,le,0).getDate(),ve=new Date().toDateString(),Qe=[];for(let Q=Ie-1;Q>=0;Q--)Qe.push({dayNum:_-Q,isCurrent:false,date:new Date(K,le-1,_-Q)});for(let Q=1;Q<=A;Q++)Qe.push({dayNum:Q,isCurrent:true,date:new Date(K,le,Q)});let O=42-Qe.length;for(let Q=1;Q<=O;Q++)Qe.push({dayNum:Q,isCurrent:false,date:new Date(K,le+1,Q)});return Qe.map((Q,te)=>{let Ue=Q.date.toDateString()===ve,rt=(v||s)?.toDateString()===Q.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!Q.isCurrent&&(r?"text-white/20":"text-gray-300"),Q.isCurrent&&(r?"text-white":"text-gray-900"),Ue&&"ring-1 ring-[#007FFF]",rt&&"bg-[#007FFF] text-white",!rt&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{b(Q.date),N(false);},children:Q.dayNum},te)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:K=>{K.stopPropagation(),k(!x),f(false),N(false);},type:"button",className:u("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(K=>K.id===m)?.color||"#007FFF"},children:a.find(K=>K.id===m)?.initials||a.find(K=>K.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),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:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",E,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),k(false);},className:u("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:u("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(K=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(K.id),k(false);},className:u("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===K.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:K.color||"#007FFF"},children:K.initials||K.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:K.name})]},K.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("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:$,disabled:!c.trim(),type:"button",className:u("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 hl({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),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[v,b]=react.useState(false),y=n==="dark",x={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let h=90,N=()=>{let T=p.current.getBoundingClientRect(),C=window.innerHeight-T.bottom<h+8;b(C),g({position:"fixed",...C?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),react.useEffect(()=>{if(!c)return;let h=N=>{let T=N.target;d.current&&!d.current.contains(T)&&p.current&&!p.current.contains(T)&&i(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let k=react.useCallback(h=>{t({name:h.name,columnId:e,assigneeIds:h.assigneeId?[h.assigneeId]:void 0,startDate:h.startDate,endDate:h.endDate,priority:h.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("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"})]}),x.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:v?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:v?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Do,{onSubmit:k,onCancel:()=>i(false),availableUsers:a,isDark:y,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Mn=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(oo,{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 Hu(e={}){return new Mn(e)}var Jo=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 yl(e,t){let a=r=>jsxRuntime.jsx(Jo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function vl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:p=""}){let[d,m]=react.useState(false),[g,v]=react.useState(""),[b,y]=react.useState("home"),[f,x]=react.useState(""),[k,h]=react.useState("");react.useEffect(()=>{let C=B=>{(B.metaKey||B.ctrlKey)&&B.key===i&&(B.preventDefault(),m(E=>!E)),B.key==="Escape"&&(m(false),y("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),react.useEffect(()=>{d||(y("home"),v(""),x(""),h(""));},[d]);let N=react.useCallback(()=>{m(false);},[]),T=react.useCallback(C=>{let[B,E]=C.split(":");switch(B){case "create-card":y("create-card");break;case "create-card-in":x(E||"");break;case "navigate":E?(a?.(E),N()):y("navigate");break;case "search":r?.(g),N();break;case "priority":y("priority");break;case "set-priority":k&&E&&(o?.(k,E),N());break;case "assign":y("assign");break;case "assign-user":k&&E&&(s?.(k,E),N());break;case "ai":y("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":c?.(),N();break;case "back":y("home");break;}},[g,k,t,a,r,o,s,n,l,c,N]),D=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:v,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:b==="create-card"&&f?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&b==="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."}),b==="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:T,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:T,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:T,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:T,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},C.id))})]}),b==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:T,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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),b==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,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(C=>{let B=e.columns.find(E=>E.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:T,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(E=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:E},E))})]},C.id)})})]}),b==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,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:T,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:T,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:T,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 Wu(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:gt,className:p("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",P?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((M,de)=>{let $e=typeof M.createdAt=="string"?new Date(M.createdAt):M.createdAt,et=typeof de.createdAt=="string"?new Date(de.createdAt):de.createdAt;return $e.getTime()-et.getTime()}).map(M=>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:M.user?.color||"#8B5CF6"},children:M.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",P?"text-white":"text-gray-900"),children:M.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:p("text-xs",P?"text-[#6B7280]":"text-gray-400"),children:Re(M.createdAt)})]}),jsxRuntime.jsx("div",{className:p("text-sm",P?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(wu,{content:M.content,theme:s})}),M.attachments&&M.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:M.attachments.map(de=>{let $e=de.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:de.url,target:"_blank",rel:"noopener noreferrer",className:p("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",P?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[$e?jsxRuntime.jsx(lucideReact.Image,{className:p("w-4 h-4",P?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:p("w-4 h-4",P?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:p("text-xs truncate max-w-[100px]",P?"text-white":"text-gray-900"),children:de.name})]},de.id)})})]})]},M.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",P?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:p("text-sm",P?"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",P?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(ku,{value:Se,onChange:He,onSubmit:te,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!b,isSubmitting:$,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!x,pendingFiles:ke,onFilesSelect:I,onRemoveFile:V})})]})]})]})})}function hl(){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 io({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:u,error:i,children:c,availableTags:l=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:b,comments:v,onAddComment:f,currentUser:x,mentionableUsers:k,onTaskOpen:h,onUploadCommentAttachments:w,enableTimeTracking:C,timeTrackingSummary:S,timeEntries:T,timerState:L,onLogTime:A,onUpdateEstimate:N,onUpdateSoldEffort:Y,onStartTimer:O,onStopTimer:le,onDiscardTimer:P,blurFinancials:q=false,sidePanel:fe,renderColumnMetrics:Ke,suppressDetailModal:F=false}){let[U,ae]=hl(),[Ne,R]=react.useState(null),[J,X]=react.useState(false),ue=react.useRef(null),Ie=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Xe=o?.theme||"dark",dt=Xe==="dark"||Xe==="neutral",lt=dt?"dark":"",re=react.useCallback((D,K)=>{t.onCardUpdate?.(D,K);},[t]),ct=react.useCallback((D,K)=>{t.onColumnUpdate?.(D,{title:K});},[t]),Be=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),ht=["todo","in-progress","completed"],mt=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 D=new Map;return e.columns.forEach(K=>{let se=K.cardIds.map(be=>e.cards.find(G=>G.id===be)).filter(be=>be!==void 0).sort((be,G)=>be.position-G.position);D.set(K.id,se);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=ue.current;if(!D)return;let K=Z=>{let ze=Z.target,ye=Z.button===1,Ue=ze===D||ze.classList.contains("asakaa-column")&&!ze.closest(".asakaa-card");(ye||Z.button===0&&Ue&&!U.isDragging)&&(Z.preventDefault(),X(true),Ie.current={x:Z.clientX,y:Z.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},se=Z=>{if(!J)return;let ze=Z.clientX-Ie.current.x,ye=Z.clientY-Ie.current.y;D.scrollLeft=Ie.current.scrollLeft-ze,D.scrollTop=Ie.current.scrollTop-ye;},be=()=>{J&&(X(false),D.style.cursor="",D.style.userSelect="");},G=()=>{J&&(X(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",K),document.addEventListener("mousemove",se),document.addEventListener("mouseup",be),D.addEventListener("mouseleave",G),()=>{D.removeEventListener("mousedown",K),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",be),D.removeEventListener("mouseleave",G);}},[J,U.isDragging]);let we=react.useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),Je=react.useCallback(D=>{let{active:K}=D,se=e.cards.find(be=>be.id===K.id);se&&ae({isDragging:true,draggedCardId:se.id,sourceColumnId:se.columnId,targetColumnId:se.columnId});},[e.cards,ae]),tt=react.useCallback(D=>{let{active:K,over:se}=D;if(!se||!e.cards.find(Z=>Z.id===K.id))return;let G=null;se.data.current?.type==="column"?G=se.id:se.data.current?.type==="card"&&(G=e.cards.find(ze=>ze.id===se.id)?.columnId||null),G&&G!==U.targetColumnId&&ae({...U,targetColumnId:G});},[e.cards,U,ae]),Qe=react.useCallback(async D=>{let{active:K,over:se}=D;if(ae({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!se)return;let be=e.cards.find(ye=>ye.id===K.id);if(!be)return;let G,Z;if(se.data.current?.type==="column"){G=se.id;let ye=Ct.get(G)||[];Z=Zi(ye,0);}else {let ye=e.cards.find(He=>He.id===se.id);if(!ye)return;G=ye.columnId;let Ue=Ct.get(G)||[],Se=Ue.findIndex(He=>He.id===se.id);Z=Zi(Ue,Se);}let ze=e.columns.find(ye=>ye.id===G);if(ze&&ze.wipLimit&&ze.wipLimitType==="hard"){let ye=Ct.get(G)||[];if(be.columnId!==G&&ye.length>=ze.wipLimit){t.onWipLimitExceeded?.(ze,be);return}}(be.columnId!==G||be.position!==Z)&&await t.onCardMove?.(be.id,G,Z);},[e.cards,e.columns,Ct,t,ae]),H=react.useCallback(D=>{F||R(D),a?.(D),h?.(D.id);},[a,h,F]),ne=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),R(D);},[t]);return u?jsxRuntime.jsx("div",{className:p("asakaa-board",lt,n),style:d,children:jsxRuntime.jsx(Qb,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:p("asakaa-board",lt,n),style:d,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(Xc,{themeName:Xe,children:[jsxRuntime.jsxs("div",{className:p("flex h-full overflow-hidden",fe?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:mt,collisionDetection:core$1.closestCorners,onDragStart:Je,onDragOver:tt,onDragEnd:Qe,children:[jsxRuntime.jsxs("div",{ref:ue,className:p("asakaa-board",fe?"flex-1":"",lt,n),style:{...d,cursor:J?"grabbing":void 0},"data-theme":Xe,children:[e.columns.sort((D,K)=>D.position-K.position).map(D=>{let K=Ct.get(D.id)||[],se=!ht.includes(D.id),be=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Qo,{column:D,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ke?(G,Z)=>Ke(G,Z):void 0,onCardClick:H,onCardUpdate:re,onColumnRename:t.onColumnUpdate?ct:void 0,onColumnDelete:t.onColumnDelete?Be:void 0,isDeletable:se,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),be]},D.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:U.draggedCardId?jsxRuntime.jsx(Vr,{card:e.cards.find(D=>D.id===U.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),fe]}),!F&&jsxRuntime.jsx(jr,{task:Ne,isOpen:!!Ne,onClose:()=>R(null),onCardUpdate:ne,theme:dt?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:m,attachments:Ne?g?.get(Ne.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:b,availableTasks:we,comments:v,onAddComment:f,currentUser:x,mentionableUsers:k,onUploadCommentAttachments:w,enableTimeTracking:C,timeTrackingSummary:S,timeEntries:T,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:A,onEstimateUpdate:N,onSoldEffortUpdate:Y,onTimerStart:O,onTimerStop:le,onTimerDiscard:P,blurFinancials:q})]})}function Qb({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 rh={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)"},oh={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)"},nh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},sh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function ih({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let i=c=>{d.current&&!d.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:d,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 lh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[d,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon: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,y)=>{if(y){u(g);try{await y();}catch(b){console.error(`Export ${g} failed:`,b);}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:l.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===g.id?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 dh({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 xl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:u,translations:i,toolbarRightContent:c}){let l=r==="dark"?rh:oh,m={...o==="es"?nh:sh,...i},g=n||d||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:l.bgGrid,borderColor:l.border},children: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:l.borderLight}})]}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lh,{theme:l,t:m,onExportCSV:n,onExportJSON:d,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:l.borderLight}})]}),t&&(s?jsxRuntime.jsx(ih,{columns:e,onSelect:t,theme:l,t:m,createTaskLabel:a}):jsxRuntime.jsx(dh,{onClick:()=>t(),label:a||m.newTask}))]})})}function kl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[d,u]=react.useState(""),i=react.useCallback(()=>{let m=d.trim();m&&(e(m),u(""),n(false));},[d,e]),c=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(u(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);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:d,onChange:m=>u(m.target.value),onKeyDown:c,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!d.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 Eo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:d="up"}){let[u,i]=react.useState(""),[c,l]=react.useState(void 0),[m,g]=react.useState(null),[y,b]=react.useState(null),[v,f]=react.useState(false),[x,k]=react.useState(false),[h,w]=react.useState(false),[C,S]=react.useState(s||new Date),T=react.useRef(null),L=o==="es",A=d==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let N=react.useCallback(()=>{f(false),k(false),w(false);},[]),Y=react.useCallback(()=>{i(""),l(void 0),g(null),b(null),N(),t();},[t,N]),O=react.useCallback(()=>{let q=u.trim();if(!q)return;let fe=a.find(F=>F.id===m),Ke=y||s;e({name:q,priority:c,assignee:fe||void 0,assigneeId:m,startDate:Ke,endDate:Ke}),i(""),l(void 0),g(null),b(null),N(),T.current?.focus();},[u,c,m,y,s,a,e,N]),le=react.useCallback(q=>{q.key==="Enter"&&u.trim()&&(q.preventDefault(),O()),q.key==="Escape"&&Y();},[O,Y,u]),P=y||s||new Date;return jsxRuntime.jsxs("div",{className:p("quick-task-create",n),onClick:()=>N(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:u,onChange:q=>i(q.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:p("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:le})}),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:q=>{q.stopPropagation(),f(!v),k(false),w(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:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxRuntime.jsxs("button",{onClick:()=>{l(q.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===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",q.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:q=>{q.stopPropagation(),w(!h),f(false),k(false),S(y||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",y?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"}),P.toLocaleDateString(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{className:p("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,fe=new Date(q);fe.setDate(q.getDate()+1);let Ke=new Date(q);Ke.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let F=new Date(q);F.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let U=new Date(q);U.setDate(q.getDate()+14);let ae=new Date(q);ae.setDate(q.getDate()+28);let Ne=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:q,display:q.toLocaleDateString(Ne,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:fe,display:fe.toLocaleDateString(Ne,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:Ke,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:F,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:U,display:U.toLocaleDateString(Ne,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:ae,display:ae.toLocaleDateString(Ne,{day:"numeric",month:"short"})}].map((J,X)=>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:()=>{b(J.date),w(false);},children:[jsxRuntime.jsx("span",{children:J.label}),jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:J.display})]},X))})()}),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(L?"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:()=>S(new Date),className:p("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:L?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>S(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:()=>S(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:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>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:q},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=C.getFullYear(),fe=C.getMonth(),Ke=new Date(q,fe,1).getDay(),F=new Date(q,fe+1,0).getDate(),U=new Date(q,fe,0).getDate(),ae=new Date().toDateString(),Ne=[];for(let J=Ke-1;J>=0;J--)Ne.push({dayNum:U-J,isCurrent:false,date:new Date(q,fe-1,U-J)});for(let J=1;J<=F;J++)Ne.push({dayNum:J,isCurrent:true,date:new Date(q,fe,J)});let R=42-Ne.length;for(let J=1;J<=R;J++)Ne.push({dayNum:J,isCurrent:false,date:new Date(q,fe+1,J)});return Ne.map((J,X)=>{let ue=J.date.toDateString()===ae,Ie=(y||s)?.toDateString()===J.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",!J.isCurrent&&(r?"text-white/20":"text-gray-300"),J.isCurrent&&(r?"text-white":"text-gray-900"),ue&&"ring-1 ring-[#007FFF]",Ie&&"bg-[#007FFF] text-white",!Ie&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{b(J.date),w(false);},children:J.dayNum},X)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),k(!x),f(false),w(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(q=>q.id===m)?.color||"#007FFF"},children:a.find(q=>q.id===m)?.initials||a.find(q=>q.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",A,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),k(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:L?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(q.id),k(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===q.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:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.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:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:O,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:L?"Guardar":"Save"})]})]})}function Dl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:d="es"}){let[u,i]=react.useState(false),c=react.useRef(null),l=react.useRef(null),[m,g]=react.useState({}),[y,b]=react.useState(false),v=n==="dark",x={buttonLabel:o||(d==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!u||!c.current)return;let h=90,w=()=>{let C=c.current.getBoundingClientRect(),T=window.innerHeight-C.bottom<h+8;b(T),g({position:"fixed",...T?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return w(),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[u]),react.useEffect(()=>{if(!u)return;let h=w=>{let C=w.target;l.current&&!l.current.contains(C)&&c.current&&!c.current.contains(C)&&i(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[u]);let k=react.useCallback(h=>{t({name:h.name,columnId:e,assigneeIds:h.assigneeId?[h.assigneeId]:void 0,startDate:h.startDate,endDate:h.endDate,priority:h.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"})]}),x.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?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(Eo,{onSubmit:k,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:d,dropdownDirection:"up"})})}),document.body)]})}var On=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(io,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}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 ep(e={}){return new On(e)}var tn=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 Sl(e,t){let a=r=>jsxRuntime.jsx(tn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Pl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:u,shortcut:i="k",className:c=""}){let[l,m]=react.useState(false),[g,y]=react.useState(""),[b,v]=react.useState("home"),[f,x]=react.useState(""),[k,h]=react.useState("");react.useEffect(()=>{let T=L=>{(L.metaKey||L.ctrlKey)&&L.key===i&&(L.preventDefault(),m(A=>!A)),L.key==="Escape"&&(m(false),v("home"),y(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),react.useEffect(()=>{l||(v("home"),y(""),x(""),h(""));},[l]);let w=react.useCallback(()=>{m(false);},[]),C=react.useCallback(T=>{let[L,A]=T.split(":");switch(L){case "create-card":v("create-card");break;case "create-card-in":x(A||"");break;case "navigate":A?(a?.(A),w()):v("navigate");break;case "search":r?.(g),w();break;case "priority":v("priority");break;case "set-priority":k&&A&&(o?.(k,A),w());break;case "assign":v("assign");break;case "assign-user":k&&A&&(s?.(k,A),w());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),w();break;case "ai-predict-risks":d?.(),w();break;case "ai-usage":u?.(),w();break;case "back":v("home");break;}},[g,k,t,a,r,o,s,n,d,u,w]),S=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),w());},[f,g,t,w]);return l?jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:w,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,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:b==="create-card"&&f?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&b==="create-card"&&f&&S();}}),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."}),b==="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(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},T.id))})]}),b==="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))})]}),b==="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 L=e.columns.find(A=>A.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:L?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},T.id)})})]}),b==="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 rp(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;
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
justify-content: center !important;
|
|
26
26
|
background: rgba(0, 0, 0, 0.95) !important;
|
|
27
27
|
cursor: pointer !important;
|
|
28
|
-
`;let
|
|
28
|
+
`;let d=document.createElement("img");d.src=e,d.alt=t,d.className="attachment-lightbox-image",d.style.cssText=`
|
|
29
29
|
max-width: 92vw !important;
|
|
30
30
|
max-height: 92vh !important;
|
|
31
31
|
object-fit: contain !important;
|
|
32
32
|
cursor: default !important;
|
|
33
|
-
`,
|
|
33
|
+
`,d.onclick=l=>l.stopPropagation();let u=document.createElement("div");u.className="attachment-lightbox-hint",u.textContent="Click anywhere or press ESC to close",u.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",c);},c=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let m=r>0?r-1:a.length-1;i(),o(m);}else if(l.key==="ArrowRight"&&a.length>1){let m=r<a.length-1?r+1:0;i(),o(m);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,
|
|
51
|
+
`,l.onclick=y=>y.stopPropagation(),a.forEach((y,b)=>{let v=document.createElement("button");v.className=`attachment-lightbox-dot ${b===r?"active":""}`,v.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,
|
|
59
|
+
`,v.onclick=f=>{f.stopPropagation(),i(),o(b);},l.appendChild(v);});let m=document.createElement("button");m.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",m.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',m.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
border: none !important;
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
opacity: 0.5 !important;
|
|
72
|
-
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=
|
|
72
|
+
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=y=>{y.stopPropagation();let b=r>0?r-1:a.length-1;i(),o(b);};let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
|
|
73
73
|
position: absolute !important;
|
|
74
74
|
right: 0 !important;
|
|
75
75
|
top: 0 !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=v=>{v.stopPropagation();let b=r<a.length-1?r+1:0;i(),o(b);},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 dh(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 ch(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 wl(e){return e.startsWith("image/")}function Br({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),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let v=react.useCallback((C,B)=>{B.preventDefault(),B.stopPropagation();let E=g.current.filter($=>wl($.type)),w=E.findIndex($=>$.id===C.id),U=$=>{let Z=g.current.filter(K=>wl(K.type)),F=Z[$];F&&Wu(F.url,F.name,Z,$,U);};Wu(C.url,C.name,E,w,U);},[]),b=react.useCallback(C=>{let B=[],E=[];return e.length+C.length>s?(E.push(`Maximum ${s} files allowed`),{valid:B,errors:E}):(C.forEach(w=>{if(w.size/1048576>r){E.push(`${w.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>w.type.match($))){E.push(`${w.name} has invalid file type`);return}B.push(w);}),{valid:B,errors:E})},[e.length,s,r,o]),y=react.useCallback(async C=>{let{valid:B,errors:E}=b(C);if(E.length>0){d(E.join(", ")),setTimeout(()=>d(null),5e3);return}if(B.length!==0){i(true),d(null);try{await t?.(B);}catch(w){d(w instanceof Error?w.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[b,t]),f=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),x=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),k=react.useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),h=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let B=Array.from(C.dataTransfer.files);y(B);},[y]),N=react.useCallback(C=>{let B=C.target.files?Array.from(C.target.files):[];y(B),m.current&&(m.current.value="");},[y]),T=react.useCallback(()=>{m.current?.click();},[]),D=react.useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:x,onDragOver:k,onDrop:h,onClick:T,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:N,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"]})]})})]}),p&&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:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(C=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:wl(C.type)&&C.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>v(C,B),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:ch(C.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:dh(C.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(C.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"})})})]},C.id))})]})}function Cl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:v,onGenerateSubtasks:b,onEstimateEffort:y,currentUserId:f="user-1"}){let[x,k]=react.useState("details"),[h,N]=react.useState(false),[T,D]=react.useState({}),[C,B]=react.useState(""),[E,w]=react.useState(false),[U,$]=react.useState({});if(!t||!e)return null;let Z=react.useCallback(()=>{N(false),D({}),k("details"),B(""),$({}),a();},[a]),F=react.useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),D({}),N(false));},[e.id,T,r]),K=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Z());},[e.id,o,Z]),le=react.useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),B(""));},[e.id,C,p]),Ie=react.useCallback(async()=>{if(v){w(true);try{let O=await v(e);$(Q=>({...Q,assignees:O}));}catch(O){console.error("Failed to suggest assignee:",O);}finally{w(false);}}},[e,v]),A=react.useCallback(async()=>{if(b){w(true);try{let O=await b(e);$(Q=>({...Q,subtasks:O}));}catch(O){console.error("Failed to generate subtasks:",O);}finally{w(false);}}},[e,b]),_=react.useCallback(async()=>{if(y){w(true);try{let O=await y(e);$(Q=>({...Q,effort:O}));}catch(O){console.error("Failed to estimate effort:",O);}finally{w(false);}}},[e,y]),ve={...e,...T},Qe=s.filter(O=>ve.assignedUserIds?.includes(O.id));return jsxRuntime.jsx(Pt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:Z,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:O=>O.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:ve.priority==="URGENT"?"#EF4444":ve.priority==="HIGH"?"#F59E0B":ve.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),h?jsxRuntime.jsx("input",{type:"text",value:T.title??ve.title,onChange:O=>D({...T,title:O.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ve.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[h?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(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:K,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:Z,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:()=>k("details"),className:`card-detail-tab ${x==="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:()=>k("comments"),className:`card-detail-tab ${x==="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:()=>k("activity"),className:`card-detail-tab ${x==="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:()=>k("attachments"),className:`card-detail-tab ${x==="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:()=>k("ai"),className:`card-detail-tab ${x==="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:[x==="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"}),h?jsxRuntime.jsx("textarea",{value:T.description??ve.description??"",onChange:O=>D({...T,description:O.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ve.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),h?jsxRuntime.jsx("select",{multiple:true,value:T.assignedUserIds??ve.assignedUserIds??[],onChange:O=>{let Q=Array.from(O.target.selectedOptions,te=>te.value);D({...T,assignedUserIds:Q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(O=>jsxRuntime.jsx("option",{value:O.id,children:O.name},O.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Qe.length>0?Qe.map(O=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:O.color},children:O.initials}),jsxRuntime.jsx("span",{children:O.name})]},O.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"}),h?jsxRuntime.jsxs("select",{value:T.priority??ve.priority??"",onChange:O=>D({...T,priority:O.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:ve.priority==="URGENT"?"#EF4444":ve.priority==="HIGH"?"#F59E0B":ve.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ve.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:ve.labels&&ve.labels.length>0?ve.labels.map(O=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:O},O)):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"}),h?jsxRuntime.jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:ve.startDate?new Date(ve.startDate).toISOString().split("T")[0]:"",onChange:O=>D({...T,startDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ve.startDate?new Date(ve.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),h?jsxRuntime.jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:ve.endDate?new Date(ve.endDate).toISOString().split("T")[0]:"",onChange:O=>D({...T,endDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ve.endDate?new Date(ve.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),h?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??ve.estimatedTime??"",onChange:O=>D({...T,estimatedTime:O.target.value?parseFloat(O.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:ve.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:ve.dependencies&&ve.dependencies.length>0?ve.dependencies.map(O=>{let Q=typeof O=="string"?O:O.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Q.slice(-4)]},Q)}):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:ve.createdAt?new Date(ve.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:O=>B(O.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:le,disabled:!C.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(O=>{let Q=s.find(te=>te.id===O.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:[Q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Q.color},children:Q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(O.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(O.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:O.content})]},O.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"})]})})]}),x==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(O=>{let Q=s.find(te=>te.id===O.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("COMMENT")&&"\u{1F4AC}",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",O.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:Q?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:O.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.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"})]})}),x==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Br,{cardId:e.id,attachments:i,onUpload:m?O=>m(e.id,O):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),x==="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:Ie,disabled:E||!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("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:A,disabled:E||!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("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:_,disabled:E||!y,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"]})]}),U.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),U.assignees.map((O,Q)=>{let te=s.find(Ue=>Ue.id===O.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[te&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:te?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:O.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(O.confidence*100).toFixed(0),"%"]})]})]},Q)})]}),U.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),U.subtasks.map((O,Q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:O.title}),O.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:O.description}),O.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",O.estimatedTime,"h"]})]},Q))]}),U.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:[U.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(U.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(O=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${O.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:O.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:O.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:O.description}),O.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",O.suggestedAction]})]},O.id))]}),!U.assignees&&!U.subtasks&&!U.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 Ln({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),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,v=4,b=d.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let y=m-d.bottom,f=d.top,x;return y>=s+v?x=d.bottom+v:f>=s+v?x=d.top-s-v:y>=f?x=d.bottom+v:x=Math.max(10,d.top-s-v),{top:x,left:b}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let v=g.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&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(Pt,{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 yh=["LOW","MEDIUM","HIGH","URGENT"],xh=["todo","in-progress","review","done"];function Dl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:v=[],availableLabels:b=[],availableTags:y=[],onCreateTag:f,onUploadCoverImage:x,unsplashAccessKey:k,theme:h,onSubtasksChange:N,attachments:T=[],onUploadAttachments:D,onDeleteAttachment:C}){let B=_o(),E=h||B?.themeName||"dark",[w,U]=react.useState(e),[$,Z]=react.useState(false),[F,K]=react.useState(()=>[...e?.subtasks||[]].sort((J,G)=>(J.position??0)-(G.position??0))),[le,Ie]=react.useState(false),[A,_]=react.useState(""),[ve,Qe]=react.useState(""),[O,Q]=react.useState("all"),[te,Ue]=react.useState(false),[rt,Ze]=react.useState(false),[mt,Ce]=react.useState(false),[se,j]=react.useState(false),[ue,ae]=react.useState(false),[Fe,$e]=react.useState(false),Re=react.useRef(null),ct=react.useRef(null),je=react.useRef(null),et=react.useRef(null),Le=react.useRef(null),pt=react.useRef(null),P=react.useRef(null),ee=react.useRef(null),ke=react.useRef(null),Be=react.useRef(null),W=react.useRef(null),pe=react.useRef(null);react.useEffect(()=>{if(e&&!w){U({...e});let I=[...e.subtasks||[]].sort((J,G)=>(J.position??0)-(G.position??0));K(I);}else if(e&&w&&e.id!==w.id){U({...e});let I=[...e.subtasks||[]].sort((J,G)=>(J.position??0)-(G.position??0));K(I);}},[e,w]),react.useEffect(()=>{let I=J=>{let G=J.target;et.current&&!et.current.contains(G)&&Ue(false),Le.current&&!Le.current.contains(G)&&Ze(false),pt.current&&!pt.current.contains(G)&&Ce(false),P.current&&!P.current.contains(G)&&j(false);};if(te||rt||mt||se)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[te,rt,mt,se]),react.useEffect(()=>{if(!t)return;let I=J=>{let G=J.target,ge=G.tagName==="INPUT"||G.tagName==="TEXTAREA"||G.isContentEditable;if(J.key==="Escape"){J.preventDefault(),te||rt||mt||se||ue||Fe?(Ue(false),Ze(false),Ce(false),j(false),ae(false),$e(false)):ge||a();return}if(ge&&J.key!=="Escape")return;let Je=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),Ue(true);break;case "a":J.preventDefault(),Ce(true);break;case "p":J.preventDefault(),Ze(true);break;case "l":J.preventDefault(),j(true);break;case "d":Je||(J.preventDefault(),ae(true),setTimeout(()=>ee.current?.focus(),0));break;case "e":Je||(J.preventDefault(),$e(true));break;case "i":J.preventDefault(),Z(true),setTimeout(()=>ct.current?.focus(),0);break;case "t":J.preventDefault(),Ie(true);break;case "c":J.preventDefault(),je.current?.focus();break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,a,te,rt,mt,se,ue,Fe]);let dt=react.useCallback(I=>{let J=I.currentTarget.textContent?.trim()||"";if(w&&J!==w.title){let G={...w,title:J};U(G),r?.(w.id,{title:J});}},[w,r]),Ee=react.useCallback(I=>{I.key==="Enter"&&(I.preventDefault(),I.currentTarget.blur()),I.key==="Escape"&&(I.preventDefault(),I.currentTarget.textContent=w?.title||"",I.currentTarget.blur());},[w]),qe=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),Z(false);},[w,e,r]),Ke=react.useCallback(I=>{if(w){let J={...w,columnId:I};U(J),r?.(w.id,{columnId:I}),Ue(false);}},[w,r]),Xe=react.useCallback(I=>{if(w){let J={...w,priority:I};U(J),r?.(w.id,{priority:I}),Ze(false);}},[w,r]),ot=react.useCallback(I=>{if(w){let J=w.assignedUserIds||[],G=J.includes(I)?J.filter(Je=>Je!==I):[...J,I],ge={...w,assignedUserIds:G};U(ge),r?.(w.id,{assignedUserIds:G});}},[w,r]),R=react.useCallback(I=>{if(w){let J=w.labels||[],G=J.includes(I)?J.filter(Je=>Je!==I):[...J,I],ge={...w,labels:G};U(ge),r?.(w.id,{labels:G});}},[w,r]),de=react.useCallback(I=>{if(w){let J={...w,tags:I};U(J),r?.(w.id,{tags:I});}},[w,r]),Ne=react.useCallback(I=>{if(w){let J=I.target.value,G={...w,endDate:J};U(G),r?.(w.id,{endDate:J}),ae(false);}},[w,r]),ye=react.useCallback(I=>{if(w){let J={...w,estimatedTime:parseFloat(I)||0};U(J),r?.(w.id,{estimatedTime:parseFloat(I)||0});}},[w,r]),he=react.useCallback(()=>{if(A.trim()&&w){let I={id:`subtask-${Date.now()}`,title:A.trim(),completed:false,position:F.length,createdAt:new Date},J=[...F,I];K(J),_(""),Ie(false),N?.(w.id,J);}},[A,F,w,N]),tt=react.useCallback(I=>{let J=F.map(G=>G.id===I?{...G,completed:!G.completed,updatedAt:new Date}:G);K(J),w&&N?.(w.id,J);},[F,w,N]),fe=react.useCallback(I=>{let J=F.filter(G=>G.id!==I);K(J),w&&N?.(w.id,J);},[F,w,N]),Y=react.useCallback(()=>{ve.trim()&&w&&c&&(c(w.id,ve.trim()),Qe(""));},[ve,w,c]),De=react.useCallback(I=>{(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&(I.preventDefault(),Y());},[Y]),be=I=>jsxRuntime.jsx(fh__default.default,{remarkPlugins:[bh__default.default],rehypePlugins:[hh__default.default],components:{a:({node:J,...G})=>jsxRuntime.jsx("a",{...G,target:"_blank",rel:"noopener noreferrer"})},children:I}),We=l.filter(I=>O==="comments"?I.type.includes("COMMENT"):O==="history"?!I.type.includes("COMMENT"):true);if(!t||!e)return null;let H=w||e,ne=s.filter(I=>H.assignedUserIds?.includes(I.id)),He=F.filter(I=>I.completed).length;return jsxRuntime.jsx(Pt,{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:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":E,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Re,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:dt,onKeyDown:Ee,children:H.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:et,children:[jsxRuntime.jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>Ue(!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("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:H.columnId||"No status"})]}),jsxRuntime.jsx(Ln,{triggerRef:ke,isOpen:te,onClose:()=>Ue(false),width:250,estimatedHeight:200,children:(v.length>0?v:xh.map(I=>({id:I,title:I}))).map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${H.columnId===I.id?"active":""}`,onClick:()=>Ke(I.id),children:I.title},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:pt,children:[jsxRuntime.jsxs("button",{ref:Be,className:"modal-v2-field",onClick:()=>Ce(!mt),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(I=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:I.color},title:I.name,children:I.initials},I.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Ln,{triggerRef:Be,isOpen:mt,onClose:()=>Ce(false),width:280,estimatedHeight:300,children:s.map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${H.assignedUserIds?.includes(I.id)?"active":""}`,onClick:()=>ot(I.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:I.color},children:I.initials}),I.name,H.assignedUserIds?.includes(I.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"})})]},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Le,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ze(!rt),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:H.priority||"None"})]}),jsxRuntime.jsxs(Ln,{triggerRef:W,isOpen:rt,onClose:()=>Ze(false),width:180,estimatedHeight:220,children:[yh.map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${I.toLowerCase()} ${H.priority===I?"active":""}`,onClick:()=>Xe(I),children:I},I)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Xe(""),children:"None"})]})]}),y.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(to,{selectedTags:H.tags||[],availableTags:y,onChange:de,onCreateTag:f,theme:it[E]||it.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:P,children:[jsxRuntime.jsxs("button",{ref:pe,className:"modal-v2-field",onClick:()=>j(!se),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:H.labels&&H.labels.length>0?jsxRuntime.jsx("span",{children:H.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Ln,{triggerRef:pe,isOpen:se,onClose:()=>j(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${H.labels?.includes(I)?"active":""}`,onClick:()=>R(I),children:[I,H.labels?.includes(I)&&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"})})]},I))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ae(!ue),setTimeout(()=>ee.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:H.endDate?new Date(H.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ee,type:"date",value:typeof H.endDate=="string"?H.endDate.split("T")[0]:H.endDate?(()=>{let I=new Date(H.endDate),J=I.getUTCFullYear(),G=String(I.getUTCMonth()+1).padStart(2,"0"),ge=String(I.getUTCDate()).padStart(2,"0");return `${J}-${G}-${ge}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>$e(!Fe),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:H.estimatedTime?`${H.estimatedTime}h`:"Not set"})]}),Fe&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:H.estimatedTime||"",onChange:I=>ye(I.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>$e(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"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:H.description||"",onChange:I=>{if(w){let J={...w,description:I.target.value};U(J);}},onBlur:qe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>Z(true),children:H.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:be(H.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"}),F.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[He,"/",F.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ie(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:[F.map(I=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${I.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>tt(I.id),children:I.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:I.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>fe(I.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"})]})})]},I.id)),le&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:A,onChange:I=>_(I.target.value),onKeyDown:I=>{I.key==="Enter"&&he(),I.key==="Escape"&&(Ie(false),_(""));},onBlur:he,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||T.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"}),T.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:T.length})]}),jsxRuntime.jsx(Br,{cardId:H.id,attachments:T,onUpload:D?I=>D(H.id,I):void 0,onDelete:C,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 ${O==="all"?"active":""}`,onClick:()=>Q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${O==="comments"?"active":""}`,onClick:()=>Q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${O==="history"?"active":""}`,onClick:()=>Q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:je,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ve,onChange:I=>Qe(I.target.value),onKeyDown:De,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:Y,disabled:!ve.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[We.map(I=>{let J=s.find(ge=>ge.id===I.userId);if(I.type.includes("COMMENT")){let ge=n.find(Je=>Je.id===I.metadata?.commentId);return ge?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[J&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:J.color},children:J.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:J?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ge.content})]})]},I.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.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:J?.name||"Unknown"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)}),We.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 Eh({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 El({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(Eh,{})}),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 Oh({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 Fl({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(Oh,{})}),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 jh={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Ju=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Kh({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 Qu({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 Pl({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||jh[c.name]||Ju[e.indexOf(c)%Ju.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?Kh: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(Qu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.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(Qu,{})}),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 Hs=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),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let v=e.map(h=>h.id),b=h=>{r.onBulkUpdate?.(v,{priority:h}),l(false);},y=h=>{r.onBulkMove?.(v,h),i(false),a();},f=h=>{r.onBulkUpdate?.(v,{assignedUserIds:h}),d(false);},x=h=>{let N=new Set;e.forEach(D=>{D.labels?.forEach(C=>N.add(C));});let T=Array.from(new Set([...N,...h]));r.onBulkUpdate?.(v,{labels:T}),g(false);},k=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),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(h=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(h),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",h==="LOW"&&"bg-asakaa-priority-low",h==="MEDIUM"&&"bg-asakaa-priority-medium",h==="HIGH"&&"bg-asakaa-priority-high",h==="URGENT"&&"bg-asakaa-priority-urgent")}),h]},h))})]}),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(h=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(h.id),children:h.title},h.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(h=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([h.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:h.color},children:h.initials}),h.name]},h.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(h=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([h]),children:h},h))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:k,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"})})]})]})})});Hs.displayName="BulkOperationsToolbar";function Qh(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 p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let v=a?.find(b=>b.id===g);n=`assignee-${g}`,l=v?.name||`User ${g}`,c=v?.color,i=v?.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 Ml({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Qh(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(oo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let p=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":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(oo,{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 Al=[{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 Ll({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=Al.find(i=>i.value===e)||Al[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.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:u("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:u("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:Al.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:u("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 In=[{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 ty(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 rp(e={}){let{shortcuts:t=In,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 p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(ty(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 ry(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function oy(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 ny(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=oy(e),r=t?ry(t):"";return a?`${a} + ${r}`:r}function sy(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 Il({shortcuts:e=In,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=sy(e);return jsxRuntime.jsxs("div",{className:u("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:ny(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 Bl=[{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=y=>{y.stopPropagation();let b=r<a.length-1?r+1:0;i(),o(b);},n.appendChild(l),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Th(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 Nh(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 Ml(e){return e.startsWith("image/")}function Or({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[u,i]=react.useState(false),[c,l]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((T,L)=>{L.preventDefault(),L.stopPropagation();let A=g.current.filter(O=>Ml(O.type)),N=A.findIndex(O=>O.id===T.id),Y=O=>{let le=g.current.filter(q=>Ml(q.type)),P=le[O];P&&rp(P.url,P.name,le,O,Y);};rp(T.url,T.name,A,N,Y);},[]),b=react.useCallback(T=>{let L=[],A=[];return e.length+T.length>s?(A.push(`Maximum ${s} files allowed`),{valid:L,errors:A}):(T.forEach(N=>{if(N.size/1048576>r){A.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>N.type.match(O))){A.push(`${N.name} has invalid file type`);return}L.push(N);}),{valid:L,errors:A})},[e.length,s,r,o]),v=react.useCallback(async T=>{let{valid:L,errors:A}=b(T);if(A.length>0){l(A.join(", ")),setTimeout(()=>l(null),5e3);return}if(L.length!==0){i(true),l(null);try{await t?.(L);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[b,t]),f=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),x=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),k=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),h=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let L=Array.from(T.dataTransfer.files);v(L);},[v]),w=react.useCallback(T=>{let L=T.target.files?Array.from(T.target.files):[];v(L),m.current&&(m.current.value="");},[v]),C=react.useCallback(()=>{m.current?.click();},[]),S=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:x,onDragOver:k,onDrop:h,onClick:C,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:w,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:Ml(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(T,L),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:Nh(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:Th(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:()=>S(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 Al({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:l,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:f="user-1"}){let[x,k]=react.useState("details"),[h,w]=react.useState(false),[C,S]=react.useState({}),[T,L]=react.useState(""),[A,N]=react.useState(false),[Y,O]=react.useState({});if(!t||!e)return null;let le=react.useCallback(()=>{w(false),S({}),k("details"),L(""),O({}),a();},[a]),P=react.useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),S({}),w(false));},[e.id,C,r]),q=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),le());},[e.id,o,le]),fe=react.useCallback(()=>{c&&T.trim()&&(c(e.id,T.trim()),L(""));},[e.id,T,c]),Ke=react.useCallback(async()=>{if(y){N(true);try{let R=await y(e);O(J=>({...J,assignees:R}));}catch(R){console.error("Failed to suggest assignee:",R);}finally{N(false);}}},[e,y]),F=react.useCallback(async()=>{if(b){N(true);try{let R=await b(e);O(J=>({...J,subtasks:R}));}catch(R){console.error("Failed to generate subtasks:",R);}finally{N(false);}}},[e,b]),U=react.useCallback(async()=>{if(v){N(true);try{let R=await v(e);O(J=>({...J,effort:R}));}catch(R){console.error("Failed to estimate effort:",R);}finally{N(false);}}},[e,v]),ae={...e,...C},Ne=s.filter(R=>ae.assignedUserIds?.includes(R.id));return jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:le,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:R=>R.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:ae.priority==="URGENT"?"#EF4444":ae.priority==="HIGH"?"#F59E0B":ae.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),h?jsxRuntime.jsx("input",{type:"text",value:C.title??ae.title,onChange:R=>S({...C,title:R.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ae.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[h?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:P,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{w(false),S({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>w(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:q,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:le,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:()=>k("details"),className:`card-detail-tab ${x==="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:()=>k("comments"),className:`card-detail-tab ${x==="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:()=>k("activity"),className:`card-detail-tab ${x==="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",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>k("attachments"),className:`card-detail-tab ${x==="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:()=>k("ai"),className:`card-detail-tab ${x==="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:[x==="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"}),h?jsxRuntime.jsx("textarea",{value:C.description??ae.description??"",onChange:R=>S({...C,description:R.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ae.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),h?jsxRuntime.jsx("select",{multiple:true,value:C.assignedUserIds??ae.assignedUserIds??[],onChange:R=>{let J=Array.from(R.target.selectedOptions,X=>X.value);S({...C,assignedUserIds:J});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(R=>jsxRuntime.jsx("option",{value:R.id,children:R.name},R.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ne.length>0?Ne.map(R=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:R.color},children:R.initials}),jsxRuntime.jsx("span",{children:R.name})]},R.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"}),h?jsxRuntime.jsxs("select",{value:C.priority??ae.priority??"",onChange:R=>S({...C,priority:R.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:ae.priority==="URGENT"?"#EF4444":ae.priority==="HIGH"?"#F59E0B":ae.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ae.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:ae.labels&&ae.labels.length>0?ae.labels.map(R=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:R},R)):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"}),h?jsxRuntime.jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:ae.startDate?new Date(ae.startDate).toISOString().split("T")[0]:"",onChange:R=>S({...C,startDate:R.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.startDate?new Date(ae.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),h?jsxRuntime.jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:ae.endDate?new Date(ae.endDate).toISOString().split("T")[0]:"",onChange:R=>S({...C,endDate:R.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.endDate?new Date(ae.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),h?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??ae.estimatedTime??"",onChange:R=>S({...C,estimatedTime:R.target.value?parseFloat(R.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:ae.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:ae.dependencies&&ae.dependencies.length>0?ae.dependencies.map(R=>{let J=typeof R=="string"?R:R.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",J.slice(-4)]},J)}):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:ae.createdAt?new Date(ae.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:R=>L(R.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:fe,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(R=>{let J=s.find(X=>X.id===R.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:[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-comment-author-name",children:J?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(R.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(R.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:R.content})]},R.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"})]})})]}),x==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(R=>{let J=s.find(X=>X.id===R.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[R.type.includes("CREATED")&&"\u2795",R.type.includes("UPDATED")&&"\u270F\uFE0F",R.type.includes("MOVED")&&"\u27A1\uFE0F",R.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",R.type.includes("COMMENT")&&"\u{1F4AC}",R.type.includes("ASSIGNED")&&"\u{1F464}",R.type.includes("PRIORITY")&&"\u{1F3AF}",R.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",R.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:J?.name||"Unknown"})," ",R.type.replace(/_/g," ").toLowerCase(),R.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:R.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(R.timestamp).toLocaleString()})]})]},R.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"})]})}),x==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Or,{cardId:e.id,attachments:i,onUpload:m?R=>m(e.id,R):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),x==="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:Ke,disabled:A||!y,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:F,disabled:A||!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("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:U,disabled:A||!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"]})]}),Y.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),Y.assignees.map((R,J)=>{let X=s.find(ue=>ue.id===R.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:R.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(R.confidence*100).toFixed(0),"%"]})]})]},J)})]}),Y.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),Y.subtasks.map((R,J)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:R.title}),R.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:R.description}),R.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",R.estimatedTime,"h"]})]},J))]}),Y.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:[Y.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(Y.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(R=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${R.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:R.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:R.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:R.description}),R.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",R.suggestedAction]})]},R.id))]}),!Y.assignees&&!Y.subtasks&&!Y.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 Hn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,u]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,y=4,b=l.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let v=m-l.bottom,f=l.top,x;return v>=s+y?x=l.bottom+y:f>=s+y?x=l.top-s-y:v>=f?x=l.bottom+y:x=Math.max(10,l.top-s-y),{top:x,left:b}},[e,o,s]);return react.useEffect(()=>{t&&u(c());},[t,c]),react.useEffect(()=>{if(!t)return;let l=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ot={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 Lh=["LOW","MEDIUM","HIGH","URGENT"],Ih=["todo","in-progress","review","done"];function Bl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:l,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:y=[],availableLabels:b=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:x,unsplashAccessKey:k,theme:h,onSubtasksChange:w,attachments:C=[],onUploadAttachments:S,onDeleteAttachment:T}){let L=qo(),A=h||L?.themeName||"dark",[N,Y]=react.useState(e),[O,le]=react.useState(false),[P,q]=react.useState(()=>[...e?.subtasks||[]].sort((V,te)=>(V.position??0)-(te.position??0))),[fe,Ke]=react.useState(false),[F,U]=react.useState(""),[ae,Ne]=react.useState(""),[R,J]=react.useState("all"),[X,ue]=react.useState(false),[Ie,Xe]=react.useState(false),[dt,lt]=react.useState(false),[re,ct]=react.useState(false),[Be,ht]=react.useState(false),[mt,Ct]=react.useState(false),we=react.useRef(null),Je=react.useRef(null),tt=react.useRef(null),Qe=react.useRef(null),H=react.useRef(null),ne=react.useRef(null),D=react.useRef(null),K=react.useRef(null),se=react.useRef(null),be=react.useRef(null),G=react.useRef(null),Z=react.useRef(null);react.useEffect(()=>{if(e&&!N){Y({...e});let I=[...e.subtasks||[]].sort((V,te)=>(V.position??0)-(te.position??0));q(I);}else if(e&&N&&e.id!==N.id){Y({...e});let I=[...e.subtasks||[]].sort((V,te)=>(V.position??0)-(te.position??0));q(I);}},[e,N]),react.useEffect(()=>{let I=V=>{let te=V.target;Qe.current&&!Qe.current.contains(te)&&ue(false),H.current&&!H.current.contains(te)&&Xe(false),ne.current&&!ne.current.contains(te)&<(false),D.current&&!D.current.contains(te)&&ct(false);};if(X||Ie||dt||re)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[X,Ie,dt,re]),react.useEffect(()=>{if(!t)return;let I=V=>{let te=V.target,Ce=te.tagName==="INPUT"||te.tagName==="TEXTAREA"||te.isContentEditable;if(V.key==="Escape"){V.preventDefault(),X||Ie||dt||re||Be||mt?(ue(false),Xe(false),lt(false),ct(false),ht(false),Ct(false)):Ce||a();return}if(Ce&&V.key!=="Escape")return;let Pe=V.metaKey||V.ctrlKey;switch(V.key.toLowerCase()){case "s":V.preventDefault(),ue(true);break;case "a":V.preventDefault(),lt(true);break;case "p":V.preventDefault(),Xe(true);break;case "l":V.preventDefault(),ct(true);break;case "d":Pe||(V.preventDefault(),ht(true),setTimeout(()=>K.current?.focus(),0));break;case "e":Pe||(V.preventDefault(),Ct(true));break;case "i":V.preventDefault(),le(true),setTimeout(()=>Je.current?.focus(),0);break;case "t":V.preventDefault(),Ke(true);break;case "c":V.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,a,X,Ie,dt,re,Be,mt]);let ze=react.useCallback(I=>{let V=I.currentTarget.textContent?.trim()||"";if(N&&V!==N.title){let te={...N,title:V};Y(te),r?.(N.id,{title:V});}},[N,r]),ye=react.useCallback(I=>{I.key==="Enter"&&(I.preventDefault(),I.currentTarget.blur()),I.key==="Escape"&&(I.preventDefault(),I.currentTarget.textContent=N?.title||"",I.currentTarget.blur());},[N]),Ue=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),le(false);},[N,e,r]),Se=react.useCallback(I=>{if(N){let V={...N,columnId:I};Y(V),r?.(N.id,{columnId:I}),ue(false);}},[N,r]),He=react.useCallback(I=>{if(N){let V={...N,priority:I};Y(V),r?.(N.id,{priority:I}),Xe(false);}},[N,r]),$=react.useCallback(I=>{if(N){let V=N.assignedUserIds||[],te=V.includes(I)?V.filter(Pe=>Pe!==I):[...V,I],Ce={...N,assignedUserIds:te};Y(Ce),r?.(N.id,{assignedUserIds:te});}},[N,r]),pe=react.useCallback(I=>{if(N){let V=N.labels||[],te=V.includes(I)?V.filter(Pe=>Pe!==I):[...V,I],Ce={...N,labels:te};Y(Ce),r?.(N.id,{labels:te});}},[N,r]),ke=react.useCallback(I=>{if(N){let V={...N,tags:I};Y(V),r?.(N.id,{tags:I});}},[N,r]),Ve=react.useCallback(I=>{if(N){let V=I.target.value,te={...N,endDate:V};Y(te),r?.(N.id,{endDate:V}),ht(false);}},[N,r]),st=react.useCallback(I=>{if(N){let V={...N,estimatedTime:parseFloat(I)||0};Y(V),r?.(N.id,{estimatedTime:parseFloat(I)||0});}},[N,r]),Ze=react.useCallback(()=>{if(F.trim()&&N){let I={id:`subtask-${Date.now()}`,title:F.trim(),completed:false,position:P.length,createdAt:new Date},V=[...P,I];q(V),U(""),Ke(false),w?.(N.id,V);}},[F,P,N,w]),me=react.useCallback(I=>{let V=P.map(te=>te.id===I?{...te,completed:!te.completed,updatedAt:new Date}:te);q(V),N&&w?.(N.id,V);},[P,N,w]),qe=react.useCallback(I=>{let V=P.filter(te=>te.id!==I);q(V),N&&w?.(N.id,V);},[P,N,w]),gt=react.useCallback(()=>{ae.trim()&&N&&u&&(u(N.id,ae.trim()),Ne(""));},[ae,N,u]),Pt=react.useCallback(I=>{(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&(I.preventDefault(),gt());},[gt]),Fe=I=>jsxRuntime.jsx(Fh__default.default,{remarkPlugins:[Mh__default.default],rehypePlugins:[Ah__default.default],components:{a:({node:V,...te})=>jsxRuntime.jsx("a",{...te,target:"_blank",rel:"noopener noreferrer"})},children:I}),_e=d.filter(I=>R==="comments"?I.type.includes("COMMENT"):R==="history"?!I.type.includes("COMMENT"):true);if(!t||!e)return null;let j=N||e,xe=s.filter(I=>j.assignedUserIds?.includes(I.id)),ee=P.filter(I=>I.completed).length;return jsxRuntime.jsx(Lt,{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:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:we,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ze,onKeyDown:ye,children:j.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:se,className:"modal-v2-field",onClick:()=>ue(!X),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:j.columnId||"No status"})]}),jsxRuntime.jsx(Hn,{triggerRef:se,isOpen:X,onClose:()=>ue(false),width:250,estimatedHeight:200,children:(y.length>0?y:Ih.map(I=>({id:I,title:I}))).map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${j.columnId===I.id?"active":""}`,onClick:()=>Se(I.id),children:I.title},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:be,className:"modal-v2-field",onClick:()=>lt(!dt),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:xe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:xe.map(I=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:I.color},title:I.name,children:I.initials},I.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Hn,{triggerRef:be,isOpen:dt,onClose:()=>lt(false),width:280,estimatedHeight:300,children:s.map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${j.assignedUserIds?.includes(I.id)?"active":""}`,onClick:()=>$(I.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:I.color},children:I.initials}),I.name,j.assignedUserIds?.includes(I.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"})})]},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxRuntime.jsxs("button",{ref:G,className:"modal-v2-field",onClick:()=>Xe(!Ie),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:j.priority||"None"})]}),jsxRuntime.jsxs(Hn,{triggerRef:G,isOpen:Ie,onClose:()=>Xe(false),width:180,estimatedHeight:220,children:[Lh.map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${I.toLowerCase()} ${j.priority===I?"active":""}`,onClick:()=>He(I),children:I},I)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),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(oo,{selectedTags:j.tags||[],availableTags:v,onChange:ke,onCreateTag:f,theme:ot[A]||ot.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>ct(!re),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:j.labels&&j.labels.length>0?jsxRuntime.jsx("span",{children:j.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Hn,{triggerRef:Z,isOpen:re,onClose:()=>ct(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${j.labels?.includes(I)?"active":""}`,onClick:()=>pe(I),children:[I,j.labels?.includes(I)&&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"})})]},I))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ht(!Be),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:j.endDate?new Date(j.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:K,type:"date",value:typeof j.endDate=="string"?j.endDate.split("T")[0]:j.endDate?(()=>{let I=new Date(j.endDate),V=I.getUTCFullYear(),te=String(I.getUTCMonth()+1).padStart(2,"0"),Ce=String(I.getUTCDate()).padStart(2,"0");return `${V}-${te}-${Ce}`})():"",onChange:Ve,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(!mt),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:j.estimatedTime?`${j.estimatedTime}h`:"Not set"})]}),mt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:j.estimatedTime||"",onChange:I=>st(I.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"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:j.description||"",onChange:I=>{if(N){let V={...N,description:I.target.value};Y(V);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>le(true),children:j.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Fe(j.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"}),P.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ee,"/",P.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ke(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:[P.map(I=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${I.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>me(I.id),children:I.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:I.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>qe(I.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"})]})})]},I.id)),fe&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:F,onChange:I=>U(I.target.value),onKeyDown:I=>{I.key==="Enter"&&Ze(),I.key==="Escape"&&(Ke(false),U(""));},onBlur:Ze,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(S||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(Or,{cardId:j.id,attachments:C,onUpload:S?I=>S(j.id,I):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 ${R==="all"?"active":""}`,onClick:()=>J("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${R==="comments"?"active":""}`,onClick:()=>J("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${R==="history"?"active":""}`,onClick:()=>J("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:ae,onChange:I=>Ne(I.target.value),onKeyDown:Pt,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:gt,disabled:!ae.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[_e.map(I=>{let V=s.find(Ce=>Ce.id===I.userId);if(I.type.includes("COMMENT")){let Ce=n.find(Pe=>Pe.id===I.metadata?.commentId);return Ce?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[V&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:V.color},children:V.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:V?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ce.content})]})]},I.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.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:V?.name||"Unknown"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)}),_e.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 Gh({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 Ol({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,u)=>d+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(Gh,{})}),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,d)=>n+d.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,d)=>n+d.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,d)=>n+(d.planned||0),0)})]})]})]})}function Qh({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 $l({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=d;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(Qh,{})}),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 iy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},pp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ly({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:d,y:u,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function mp({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 Hl({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||iy[u.name]||pp[e.indexOf(u)%pp.length]})),d=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?ly:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(mp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,l=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.value} - ${l}%)`}})]}):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(mp,{})}),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:d[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 Ws=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[u,i]=react.useState(false),[c,l]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let y=e.map(h=>h.id),b=h=>{r.onBulkUpdate?.(y,{priority:h}),d(false);},v=h=>{r.onBulkMove?.(y,h),i(false),a();},f=h=>{r.onBulkUpdate?.(y,{assignedUserIds:h}),l(false);},x=h=>{let w=new Set;e.forEach(S=>{S.labels?.forEach(T=>w.add(T));});let C=Array.from(new Set([...w,...h]));r.onBulkUpdate?.(y,{labels:C}),g(false);},k=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),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:()=>d(!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(h=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(h),children:[jsxRuntime.jsx("span",{className:p("asakaa-priority-dot",h==="LOW"&&"bg-asakaa-priority-low",h==="MEDIUM"&&"bg-asakaa-priority-medium",h==="HIGH"&&"bg-asakaa-priority-high",h==="URGENT"&&"bg-asakaa-priority-urgent")}),h]},h))})]}),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(h=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(h.id),children:h.title},h.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(h=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([h.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:h.color},children:h.initials}),h.name]},h.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(h=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([h]),children:h},h))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:k,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"})})]})]})})});Ws.displayName="BulkOperationsToolbar";function my(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let y=a?.find(b=>b.id===g);n=`assignee-${g}`,d=y?.name||`User ${g}`,u=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,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];d=m.title,u=m.color,r.has(n)||r.set(n,{id:n,title:d,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}`,d=g,u="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:d,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 zl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>my(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(c=>{let l=new Set(c);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(io,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:p("asakaa-swimlane-view",o),children:[d.map(i=>{let c=s.has(i.id),l=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:l};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(io,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),d.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 Ul=[{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 Wl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=Ul.find(i=>i.value===e)||Ul[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:d.icon}),jsxRuntime.jsx("span",{children:d.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:Ul.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 zn=[{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 by(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&d&&u}function yp(e={}){let{shortcuts:t=zn,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];},[]),d=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 l of o.current)if(by(i,l)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function yy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function xy(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 vy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=xy(e),r=t?yy(t):"";return a?`${a} + ${r}`:r}function ky(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 Gl({shortcuts:e=zn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=ky(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(([d,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"}),d]}),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:vy(i)})]},i.action))})]},d))})}),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 Vl=[{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,8 +122,13 @@
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Rl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.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,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxRuntime.jsxs("div",{className:u("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:u("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,p])=>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:p.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 $l({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,y=await Fc(e,c,b);Pc(y,c);},v=async b=>{let y=b.target.files?.[0];if(y){try{let f=await Lc(y),x=y.name.endsWith(".json")?"json":"csv",k=Ac(f,x);d(k),k.success&&r&&r(k,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:u("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:u("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:u("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(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:u("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:v,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"})]})]}),p&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((b,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},y))})]})]})]})]})]})}var uy=["URGENT","HIGH","MEDIUM","LOW"],py=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],my=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Hl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:v}){let[b,y]=react.useState(true),f=react.useCallback(T=>{a({search:T.target.value});},[a]),x=react.useCallback(T=>{a({dateFilter:T.target.value});},[a]),k=react.useCallback(T=>{r({by:T.target.value});},[r]),h=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=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":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.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:b?"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"}),N&&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)"]})]}),!b&&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:x,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:T=>{let D=T.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),uy.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let D=T.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsxRuntime.jsx("option",{value:T.id,children:T.name},T.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let D=T.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),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:k,className:"filter-bar__select filter-bar__select--sm",children:py.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:h,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:T=>v(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:my.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function zl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=v=>{d.current&&!d.current.contains(v.target)&&p(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!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 Ul={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"}},Wl={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"}},Gl={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"}},Fo={dark:Ul,light:Wl,neutral:Gl},Us="dark";var Ws=react.createContext(void 0),Cy="asakaa-theme";function sp({children:e,defaultTheme:t=Us,storageKey:a=Cy}){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=Fo[r];Object.entries(c.colors).forEach(([p,d])=>{d&&l.style.setProperty(`--theme-${Ty(p)}`,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(([p,d])=>{let m=c.colors[p];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:Fo};return jsxRuntime.jsx(Ws.Provider,{value:n,children:e})}function tn(){let e=react.useContext(Ws);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Ty(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Vl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=tn();return e?jsxRuntime.jsxs("div",{className:u("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(Fo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("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 ip(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 Gs={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",baselines:"Baselines",visibility:"Visibility",share:"Share"},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"}},lp={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",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir"},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"}},_l={en:Gs,es:lp};function dp(e){return _l[e]||_l.en}function jl(e,t){let a=dp(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 rn=react.createContext(Gs);function wr(){return react.useContext(rn)}function Ks(e,t,a="left"){let[r,o]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let s=e.current.getBoundingClientRect(),n=s.bottom+4,l;a==="right"?l=s.right:l=s.left,o({top:n,left:l});},[t,a,e]),r}function mp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,p]=react.useState(null),d=react.useRef(null),m=react.useRef(null),g=wr(),v=Ks(d,l,"right");if(react.useEffect(()=>{if(!l)return;let x=k=>{let h=k.target;d.current&&!d.current.contains(h)&&m.current&&!m.current.contains(h)&&c(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(x=>x.handler),f=async(x,k)=>{if(k){p(x);try{await k();}catch(h){console.error(`Export ${x} failed:`,h);}finally{p(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:v.top,left:v.left-176,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((x,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(x.id,x.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===x.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"})}):x.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:x.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:x.description})]})]},x.id))})})}),document.body)]})}function qy({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 Xy({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 gp({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=wr(),c=Ks(s,r,"left");react.useEffect(()=>{if(!r)return;let d=m=>{let g=m.target;s.current&&!s.current.contains(g)&&n.current&&!n.current.contains(g)&&o(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let i=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=i.find(d=>d.value===t)?.label||"Normal";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:s,onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{ref:n,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-32 rounded-xl overflow-hidden",style:{top:c.top,left:c.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:i.map((d,m)=>{let g=t===d.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(d.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:g?e.accentLight:"transparent",borderBottom:m<i.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:g?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:g?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:g?600:500},children:d.label}),g&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},d.value)})})})}),document.body)]})}function fp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=wr(),i=Ks(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let v=g.target;n.current&&!n.current.contains(v)&&l.current&&!l.current.contains(v)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{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:p.map((m,g)=>{let v=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:v?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:v?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:v?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:v?600:500},children:m.label}),v&&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=wr(),p=Ks(l,s,"left");react.useEffect(()=>{if(!s)return;let v=setTimeout(()=>{let b=f=>{let x=f.target;l.current&&!l.current.contains(x)&&c.current&&!c.current.contains(x)&&n(false);},y=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(v),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:v=>{v.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[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:p.top,left:p.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(v=>{let b=t===v.value&&!r,y=()=>v.value==="all"?b?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"}):v.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(v.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?v.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:v.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},v.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 Jy({value:e,onChange:t,theme:a}){let r=wr(),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 Qy({theme:e,forecast:t}){let a=wr(),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&&s!==0,l=s!=null?s>0?`+${s}d Delay`:s<0?`${s}d Early`:"On Time":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,p=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",v=t?.budgetVariancePercent,b=v!=null&&v!==0,y=v!=null?v>0?`+${v.toFixed(0)}% Over`:`${v.toFixed(0)}% Under`:null,f=v!=null&&v>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:v!=null&&v<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:p,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}),b&&y&&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:y})]})]})]})}function Ys({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:y,toolbarRightContent:f,wbsLevel:x,onWbsLevelChange:k,maxWbsDepth:h=4,viewMode:N="execution",onViewModeChange:T,projectForecast:D,onExportPNG:C,onExportPDF:B,onExportExcel:E,onExportCSV:w,onExportJSON:U,onExportMSProject:$}){let Z=wr(),F=C||B||E||w||U||$,K=!!e.glassToolbar,[le,Ie]=react.useState(false),A=react.useRef(null);react.useEffect(()=>{le&&A.current&&A.current.focus();},[le]);let _=[{value:"day",label:Z.toolbar.day},{value:"week",label:Z.toolbar.week},{value:"month",label:Z.toolbar.month}],ve=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Qe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(K){let O=Qe?"rgba(255,255,255,0.08)":e.borderLight,Q=Qe?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";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:Qe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:le?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ie(!le),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"})}),le&&jsxRuntime.jsx("input",{ref:A,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:()=>Ie(false),onKeyDown:te=>{te.key==="Escape"&&Ie(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:O}}),jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Qe?"#000000":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T?.("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:Z.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T?.("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Qe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:Z.toolbar.viewOracle})]})]}),p&&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 ${Qe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"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||Z.toolbar.createTask})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Jy,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:O}}),jsxRuntime.jsx(gp,{theme:e,value:l,onChange:c}),k&&jsxRuntime.jsx(fp,{theme:e,value:x??"all",onChange:k,maxDepth:h}),v&&jsxRuntime.jsx(bp,{theme:e,value:g,onChange:v,hideCompleted:b,onHideCompletedChange:y}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:O}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:O}}),jsxRuntime.jsx(framerMotion.motion.button,{className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:e.textTertiary,backgroundColor:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:Q},title:Z.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.motion.button,{className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:e.textTertiary,backgroundColor:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:Q},title:Z.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),F&&jsxRuntime.jsx(mp,{theme:e,onExportPNG:C,onExportPDF:B,onExportExcel:E,onExportCSV:w,onExportJSON:U,onExportMSProject:$}),jsxRuntime.jsxs(framerMotion.motion.button,{className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-[11px] font-medium",style:{backgroundColor:"transparent",border:"1px solid rgba(168,85,247,0.4)",color:"#A855F7",fontFamily:"Inter, sans-serif",background:"linear-gradient(135deg, rgba(168,85,247,0.1) 0%, rgba(139,92,246,0.05) 100%)"},whileHover:{borderColor:"rgba(168,85,247,0.7)",boxShadow:"0 0 12px rgba(168,85,247,0.2)"},children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:Z.toolbar.simulateScenario})]})]})]}),jsxRuntime.jsx(Qy,{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(Xy,{options:_,value:t,onChange:O=>a(O),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}}),jsxRuntime.jsx(gp,{theme:e,value:l,onChange:c}),k&&jsxRuntime.jsx(fp,{theme:e,value:x??"all",onChange:k,maxDepth:h}),v&&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:v,hideCompleted:b,onHideCompletedChange:y})]})]}),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}})]}),p&&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||Z.toolbar.createTask})]}),(F||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mp,{theme:e,onExportPNG:C,onExportPDF:B,onExportExcel:E,onExportCSV:w,onExportJSON:U,onExportMSProject:$}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(qy,{options:ve,value:s,onChange:O=>n(O),theme:e})]})]})}function qs({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 p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.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(Pt,{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(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function nn({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 p=200,d=r.length*36+8,m=8,g=window.innerWidth,v=window.innerHeight,b=t,y=a;t+p+m>g&&(b=t-p,b<m&&(b=m)),a+d+m>v&&(y=v-d-m,y<m&&(y=m)),c({x:b,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return 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(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var Ut={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 Cp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),v=react.useCallback(k=>{g.current=k;},[]),b=react.useCallback(k=>{let h=[],N=T=>{for(let D of T)h.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&N(D.subtasks);};return N(k),h},[]),y=react.useCallback(()=>{let k=b(e);for(let h of k)if(t.has(h.id))return h;return null},[e,t,b]),f=react.useCallback((k,h)=>{let N=b(e);if(N.length===0)return;let T=y();if(!T){a(N[0].id,false);return}let D=N.findIndex(E=>E.id===T.id);if(D===-1)return;let C=k==="up"?D-1:D+1;if(C<0||C>=N.length)return;let B=N[C];a(B.id,h);},[e,y,b,a]),x=react.useCallback(k=>{if(!m)return;let h=k.target;if(h.tagName==="INPUT"||h.tagName==="TEXTAREA"||h.isContentEditable||g.current){k.key==="Escape"&&(h.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,C=Array.from(t),B=y();if(k.key==="ArrowUp"){k.preventDefault(),f("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),f("down",k.shiftKey);return}if(B&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!B.isExpanded||k.key==="ArrowLeft"&&B.isExpanded)&&p(B.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){C.length>0&&(k.preventDefault(),n(C,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){C.length>0&&(k.preventDefault(),l(C));return}if(k.key==="Tab"&&k.shiftKey){C.length>0&&(k.preventDefault(),c(C));return}if(k.key==="Enter"&&!k.shiftKey&&!D){B&&(k.preventDefault(),r(B.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!D){B&&(k.preventDefault(),r(B.id,"above"));return}if(k.key==="Enter"&&D){B&&(k.preventDefault(),d(B.id));return}if(k.key==="F2"){B&&(k.preventDefault(),i(B.id));return}if(k.key==="Delete"||k.key==="Backspace"&&D){C.length>0&&(k.preventDefault(),o(C));return}if(k.key==="d"&&D&&!k.shiftKey){C.length>0&&(k.preventDefault(),s(C));return}},[m,t,y,f,r,o,s,n,l,c,i,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[m,x]),{setIsEditing:v}}function Np(){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),v=m.indexOf(d);if(g===-1||v===-1){o(d);return}let b=Math.min(g,v),y=Math.max(g,v),f=m.slice(b,y+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,v)=>{v?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let v=new Set(g);return v.add(d),v}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:p}}function ql(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?ql(t.subtasks):t.subtasks}))}function sn(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 Xs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Xs(a.subtasks,t);if(r)return r}}return null}function Yl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Yl(a.subtasks,t);if(r)return r}return null}function Xl(e,t){if(t.length===0)return e;let a=sn(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 v=[];return {tasks:m.filter(y=>{if(g.has(y.id))return v.push(y),false;if(y.subtasks){let f=n(y.subtasks,g);y.subtasks=f.tasks,v.push(...f.removed);}return true}),removed:v}},l=(m,g,v)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...v],isExpanded:true}:b.subtasks?{...b,subtasks:l(b.subtasks,g,v)}:b),c=new Set(t),{tasks:i,removed:p}=n(e,c),d=l(i,s.id,p);return ql(d)}function Jl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Yl(a,r);if(!o)continue;let s=Yl(a,o.id),n=(i,p,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===p&&g.subtasks){let v=g.subtasks.findIndex(b=>b.id===d);if(v!==-1){let[b]=g.subtasks.splice(v,1);return b}}if(g.subtasks){let v=n(g.subtasks,p,d);if(v)return v}}return null},l=(i,p,d)=>{let m=i.findIndex(g=>g.id===p);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,p,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 ql(a)}function Ql(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 p=c==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],n[i]={...n[i],position:i},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function Zl(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 Rn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:p.subtasks?s(p.subtasks,`${p.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 v=n(g.subtasks);if(v)return v}return null}let p=c[i],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.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 Dp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=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 p=a==="above"?i:i+1;return c.splice(p,0,n),true};return l(r),{tasks:r,newTask:n}}function ed(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ed(r.subtasks,t,a)}:r)}function td(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:td(a.subtasks,t)}:a)}function ad(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let v=a(g.subtasks);if(v)return v}}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 v=c(g.subtasks);if(v>=0)return v}}return 0},i=c(e),p={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 v=g.subtasks||[];return {...g,subtasks:[...v,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function Sp(e,t,a,r){if(t===a)return e;let o=Xs(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===i||l(p,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(p=>p.id!==t),i=c.length<l.length;return c.map((p,d)=>{let m=i?{...p,position:d}:p;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 p=i.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((v,b)=>({...v,position:b}));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 cr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=cr(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 Qs({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:v,onTaskOutdent:b,onTaskMove:y,onMultiTaskDelete:f,onTaskDuplicate:x,onTaskCreate:k,onTaskRename:h,onCreateSubtask:N,onOpenTaskModal:T,onDeleteRequest:D,onTaskReparent:C,scrollContainerRef:B}){let E=react.useContext(rn),[w,U]=react.useState(null),[$,Z]=react.useState(null),[F,K]=react.useState(""),le=react.useRef(null),[Ie,A]=react.useState(null),[_,ve]=react.useState(0),[Qe,O]=react.useState(0),[Q,te]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Ue,rt]=react.useState(null),[Ze,mt]=react.useState(null),[Ce,se]=react.useState(null),j=react.useRef(0),ue=5,ae=react.useRef(false),[Fe,$e]=react.useState(null),[Re,ct]=react.useState(false),je=react.useRef(null),[et,Le]=react.useState(null),[pt,P]=react.useState(false),ee=react.useRef(null);react.useEffect(()=>{function H(ne){ee.current&&!ee.current.contains(ne.target)&&P(false);}if(pt)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[pt]),react.useEffect(()=>{$&&le.current&&(le.current.focus(),le.current.select());},[$]),react.useEffect(()=>{if(!Ie)return;let H=He=>{let I=He.clientX-_,J=Qe+I;m?.(Ie,J);},ne=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",H),document.addEventListener("mouseup",ne),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",ne),document.body.style.cursor="",document.body.style.userSelect="";}},[Ie,_,Qe,m]);let{selectedTaskIds:ke,handleTaskClick:Be,isTaskSelected:W}=Np(),{setIsEditing:pe}=Cp({tasks:e,selectedTaskIds:ke,onTaskSelect:(H,ne)=>{let I=sn(e).map(J=>J.id);Be(H,I,ne||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:H=>{let ne=sn(e).find(He=>He.id===H);ne&&ot(ne);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:H=>{let ne=sn(e).find(He=>He.id===H);ne&&T&&T(ne);},enableKeyboard:true}),dt=(H,ne=0,He="")=>{let I=[],J=[...H].sort((G,ge)=>(G.position??0)-(ge.position??0));for(let G=0;G<J.length;G++){let ge=J[G],Je=G+1,ft=He?`${He}.${Je}`:`${Je}.0`;if(ge.wbsCode=ft,I.push({task:ge,level:ne}),ge.subtasks&&ge.subtasks.length>0&&ge.isExpanded){let bt=He?`${He}.${Je}`:`${Je}`;I.push(...dt(ge.subtasks,ne+1,bt));}}return I},Ee=dt(e),qe=48,Ke=Math.max(Ee.length*a,600-qe),Xe=H=>!H.startDate||!H.endDate?"-":`${Math.ceil((H.endDate.getTime()-H.startDate.getTime())/(1e3*60*60*24))}d`,ot=H=>{Z(H.id),K(H.name),pe(true);},R=H=>{F.trim()&&F!==e.find(ne=>ne.id===H)?.name&&h?.(H,F.trim()),Z(null),K(""),pe(false);},de=()=>{Z(null),K(""),pe(false);},Ne=(H,ne)=>{ne.stopPropagation(),N?.(H.id);},ye=(H,ne)=>{ne.preventDefault(),j.current=ne.clientY,rt(H),ae.current=false,ct(false),$e({x:ne.clientX,y:ne.clientY});},he=H=>{if(!Ue||(Math.abs(H.clientY-j.current)>ue&&!ae.current&&(ae.current=true,ct(true)),$e({x:H.clientX,y:H.clientY}),!ae.current))return;if(B?.current){let G=B.current,ge=G.getBoundingClientRect(),Je=60,ft=12;je.current&&(cancelAnimationFrame(je.current),je.current=null);let bt=H.clientY-ge.top,Fa=ge.bottom-H.clientY;if(bt<Je&&G.scrollTop>0){let Yt=Math.round(ft*(1-bt/Je)),Pa=()=>{G.scrollTop-=Yt,ae.current&&G.scrollTop>0&&(je.current=requestAnimationFrame(Pa));};je.current=requestAnimationFrame(Pa);}else if(Fa<Je&&G.scrollTop<G.scrollHeight-G.clientHeight){let Yt=Math.round(ft*(1-Fa/Je)),Pa=()=>{G.scrollTop+=Yt,ae.current&&G.scrollTop<G.scrollHeight-G.clientHeight&&(je.current=requestAnimationFrame(Pa));};je.current=requestAnimationFrame(Pa);}}let He=document.querySelectorAll("[data-task-row]"),I=null,J=null;He.forEach(G=>{let ge=G.getBoundingClientRect(),Je=G.getAttribute("data-task-row");if(Je&&Je!==Ue&&H.clientY>=ge.top&&H.clientY<=ge.bottom){I=Je;let ft=H.clientY-ge.top,bt=ge.height;ft<bt*.25?J="above":ft>bt*.75?J="below":J="child";}}),mt(I),se(J);},tt=()=>{if(ae.current&&Ue&&Ze&&Ce){if(Ce==="child")C?.(Ue,Ze);else if(Ce==="above"||Ce==="below"){let H=(J,G,ge=null)=>{for(let Je of J){if(Je.id===G)return ge;if(Je.subtasks){let ft=H(Je.subtasks,G,Je.id);if(ft!==void 0)return ft}}},ne=H(e,Ue,null),He=H(e,Ze,null),I=(J,G,ge,Je)=>{let ft=J.findIndex(Yt=>Yt.id===G),bt=Je?J.findIndex(Yt=>Yt.id===ge):-1,Fa=Ce==="below"?ft+1:ft;return Je&&bt!==-1&&bt<ft&&(Fa-=1),Math.max(0,Fa)};if(He===null){let G=I(e,Ze,Ue,ne===null);C?.(Ue,null,G);}else {let J=Ee.find(G=>G.task.id===He)?.task;if(J?.subtasks){let G=ne===He,ge=I(J.subtasks,Ze,Ue,G);C?.(Ue,He,ge);}}}}je.current&&(cancelAnimationFrame(je.current),je.current=null),rt(null),mt(null),se(null),$e(null),ae.current=false,ct(false);};react.useEffect(()=>{if(Ue)return document.addEventListener("mousemove",he),document.addEventListener("mouseup",tt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",tt),document.body.style.cursor="",document.body.style.userSelect="";}},[Ue,Ze,Ce]);let fe=(H,ne,He)=>{let I=ne.subtasks&&ne.subtasks.length>0;switch(H.id){case "name":let J=$===ne.id,G=w===ne.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${He*20}px`},children:[C&&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:G?1:.3},onMouseDown:Ae=>ye(ne.id,Ae),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ne.subtasks&&ne.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Ae=>{Ae.stopPropagation(),c?.(ne.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ne.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"}),J?jsxRuntime.jsx("input",{ref:le,type:"text",value:F,onChange:Ae=>K(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"?R(ne.id):Ae.key==="Escape"&&de();},onBlur:()=>R(ne.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:Ae=>Ae.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:ne.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ne.parentId?"13px":"14px",fontWeight:ne.isMilestone?600:ne.parentId?400:600,letterSpacing:ne.parentId?"0":"-0.01em"},title:ne.name,children:[ne.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ne.wbsCode}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne.name})]}),G&&!J&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Ae=>Ae.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Ae=>Ne(ne,Ae),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:Ae=>{Ae.stopPropagation(),ot(ne);},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=H.id==="startDate"?"startDate":"endDate",ft=ne[Je],bt=et?.taskId===ne.id&&et?.field===Je,Fa=Ae=>Ae?(typeof Ae=="string"?new Date(Ae):Ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Ae=>Ae.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:I?.5:1,cursor:I?"default":"pointer"},title:I?"Auto-calculated from subtasks":void 0,onClick:Ae=>{if(!I)if(bt)Le(null);else {let q=Ae.currentTarget.getBoundingClientRect();Le({taskId:ne.id,field:Je,month:ft?typeof ft=="string"?new Date(ft):ft:new Date,position:{top:q.bottom+4,left:q.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Fa(ft)}),I&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),bt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Le(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:et?.position.top,left:et?.position.left},onClick:Ae=>Ae.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Ae=new Date,q=new Date(Ae);q.setDate(Ae.getDate()+1);let at=new Date(Ae);at.setDate(Ae.getDate()+7);let At=new Date(Ae);return At.setDate(Ae.getDate()+14),[{label:"Hoy",date:Ae},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:at},{label:"2 semanas",date:At}].map((ie,ze)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ge=>Ge.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ge=>Ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ne.id,{[Je]:ie.date}),Le(null);},children:ie.label},ze))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Ae=>Ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ae=>Ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ne.id,{[Je]:void 0}),Le(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:()=>Le(Ae=>Ae?{...Ae,month:new Date(Ae.month.getFullYear(),Ae.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:et?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Le(Ae=>Ae?{...Ae,month:new Date(Ae.month.getFullYear(),Ae.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((Ae,q)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Ae},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Ae=et?.month||new Date,q=Ae.getFullYear(),at=Ae.getMonth(),At=new Date(q,at,1).getDay(),S=new Date(q,at+1,0).getDate(),ie=new Date,ze=[];for(let xt=At-1;xt>=0;xt--)ze.push({day:new Date(q,at,-xt).getDate(),date:new Date(q,at-1,new Date(q,at,-xt).getDate()),isCurrentMonth:false});for(let xt=1;xt<=S;xt++)ze.push({day:xt,date:new Date(q,at,xt),isCurrentMonth:true});let Ge=42-ze.length;for(let xt=1;xt<=Ge;xt++)ze.push({day:xt,date:new Date(q,at+1,xt),isCurrentMonth:false});return ze.map((xt,pa)=>{let ma=xt.date.toDateString()===ie.toDateString(),ga=(ft?typeof ft=="string"?new Date(ft):ft:null)?.toDateString()===xt.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:xt.isCurrentMonth?ga?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ga?"#2E94FF":"transparent",boxShadow:ma&&!ga?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(ne.id,{[Je]:xt.date}),Le(null);},children:xt.day},pa)})})()})]})]})]}),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:Xe(ne)})});case "assignees":if(I)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 Yt=r.filter(Ae=>ne.assignees?.some(q=>q.name===Ae.name||q.initials===Ae.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Ae=>Ae.stopPropagation(),children:jsxRuntime.jsx(Co,{assignedUsers:Yt,availableUsers:r,onChange:Ae=>{let q=Ae.map(at=>({id:at.id,name:at.name,initials:at.initials,color:at.color}));g?.(ne.id,{assignees:q.length>0?q:void 0});}})});case "status":if(I){let Ae=ne.progress===100?"\u2713":ne.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:Ae})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Ae=>Ae.stopPropagation(),children:jsxRuntime.jsx(Qc,{status:ne.status||"todo",onChange:Ae=>{g?.(ne.id,{status:Ae,progress:Ae==="completed"?100:ne.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:I?.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:`${ne.progress}%`,backgroundColor:ne.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:[ne.progress,"%"]})]});case "priority":let Pa={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Fr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ya=Pa[ne.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Ae=>Ae.stopPropagation(),children:jsxRuntime.jsx(ko,{priority:Ya,onChange:Ae=>{Ae&&g?.(ne.id,{priority:Fr[Ae]||"medium"});}})});default:return null}},Y=H=>[{id:"hide",label:"Hide Column",icon:Ut.Hide,onClick:()=>d(H),disabled:H==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ut.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ut.SortDesc,onClick:()=>{}}],De=H=>H.subtasks&&H.subtasks.length>0?[{id:"addSubtask",label:E?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{N?.(H.id);}},{id:"duplicate",label:E?.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{x?.([H.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:E?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{D?D(H.id,H.name):f?.([H.id]);}}]:[{id:"edit",label:E?.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{n?.(H);}},{id:"addSubtask",label:E?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{N?.(H.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:E?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{g?.(H.id,{status:"todo",progress:0});},disabled:H.status==="todo"},{id:"setInProgress",label:E?.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{g?.(H.id,{status:"in-progress"});},disabled:H.status==="in-progress"},{id:"markComplete",label:E?.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{g?.(H.id,{status:"completed",progress:100});},disabled:H.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:E?.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{x?.([H.id]);}},{id:"split",label:E?.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:E?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{D?D(H.id,H.name):f?.([H.id]);}}],be=p.filter(H=>H.visible),We=be.reduce((H,ne)=>H+ne.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:We},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${qe}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((H,ne)=>{let He=ne===be.length-1,I=H.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${I?"":"justify-center"}`,style:{width:`${H.width}px`,minWidth:`${H.minWidth??(I?200:60)}px`,maxWidth:`${H.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:He?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:J=>{J.preventDefault(),te({isOpen:true,x:J.clientX,y:J.clientY,type:"header",columnId:H.id});},onMouseEnter:J=>{J.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:J=>{J.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:H.label,children:H.label}),H.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Ie===H.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:J=>{J.preventDefault(),J.stopPropagation(),A(H.id),ve(J.clientX),O(H.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"}})})]},H.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(qs,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>P(!pt),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"})}),pt&&jsxRuntime.jsxs("div",{ref:ee,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:H=>H.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:()=>P(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:Ke},children:Ee.map(({task:H,level:ne},He)=>{let I=W(H.id),J=Ze===H.id,G=J&&Ce==="above",ge=J&&Ce==="below",Je=J&&Ce==="child",ft={};return Je&&(ft.backgroundColor=`${t.accent}15`,ft.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":H.id,className:`flex items-center cursor-pointer group ${Ue===H.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:I?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:I?t.accentLight:Je?`${t.accent}15`:He%2===0?t.bgPrimary:t.bgGrid,...ft},onMouseEnter:()=>U(H.id),onMouseLeave:()=>U(null),onClick:bt=>{let Yt=sn(e).map(Ya=>Ya.id),Fr=navigator.platform.toUpperCase().indexOf("MAC")>=0?bt.metaKey:bt.ctrlKey;Be(H.id,Yt,Fr,bt.shiftKey),s?.(H);},onDoubleClick:bt=>{bt.stopPropagation(),n?.(H);},onContextMenu:bt=>{bt.preventDefault(),te({isOpen:true,x:bt.clientX,y:bt.clientY,type:"task",task:H}),l?.(H,bt);},whileHover:{backgroundColor:I?t.accentLight:t.hoverBg},children:[G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ge&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),be.map((bt,Fa)=>{let Yt=Fa===be.length-1,Pa=bt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Pa?"justify-start":"justify-center"}`,style:{width:`${bt.width}px`,minWidth:`${bt.minWidth??(Pa?200:60)}px`,maxWidth:`${bt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Yt?"none":`1px solid ${w===H.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:fe(bt,H,Pa?ne:0)},`${H.id}-${bt.id}`)})]},H.id)})}),jsxRuntime.jsx(nn,{isOpen:Q.isOpen,x:Q.x,y:Q.y,items:Q.type==="header"&&Q.columnId?Y(Q.columnId):Q.type==="task"&&Q.task?De(Q.task):[],onClose:()=>te({...Q,isOpen:false}),theme:t}),Re&&Fe&&Ue&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Fe.x+12,top:Fe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let H=Ee.find(ne=>ne.task.id===Ue)?.task;return H?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:H.name})}):null})()}),document.body)]})}function Ap(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[v,b]=react.useState(null),[y,f]=react.useState(null),[x,k]=react.useState(0),[h,N]=react.useState(0),[T,D]=react.useState(null),[C,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:v,setActiveZone:b,draggedSegmentIndex:y,setDraggedSegmentIndex:f,draggedSegmentStartX:x,setDraggedSegmentStartX:k,segmentDragOffsetX:h,setSegmentDragOffsetX:N,hoveredSegmentIndex:T,setHoveredSegmentIndex:D,isHovered:C,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Z,F)=>{r("none"),d(null),g(null),l(Z),i(F),N(0),f(null),k(0);}}}function ti({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:v,onHoverChange:b,showBaseline:y}){let f=Ap(t,r),x=react.useRef(null),k=react.useRef(false),h=react.useRef(null),N=react.useRef(null),{dragMode:T,setDragMode:D,dragOffset:C,setDragOffset:B,ghostX:E,setGhostX:w,ghostWidth:U,setGhostWidth:$,connectionLine:Z,setConnectionLine:F,hoveredTaskId:K,setHoveredTaskId:le,activeZone:Ie,setActiveZone:A,draggedSegmentIndex:_,setDraggedSegmentIndex:ve,draggedSegmentStartX:Qe,setDraggedSegmentStartX:O,segmentDragOffsetX:Q,setSegmentDragOffsetX:te,hoveredSegmentIndex:Ue,setHoveredSegmentIndex:rt,isHovered:Ze,setIsHovered:mt,isDragging:Ce,isResizing:se,isConnecting:j,resetDragState:ue}=f,ae=24,Fe=!!o.executionBarBg,$e=Fe?4:8,Re=e.subtasks&&e.subtasks.length>0,ct=e.endDate&&e.endDate<new Date&&e.progress<100,je=e.isCriticalPath,et=o.name==="neutral"||o.today==="#1C1917",Le=e.status==="completed"||e.progress===100,pt={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=e.isCriticalPath||ct?"#EF4444":e.color?e.color:e.priority&&pt[e.priority]?pt[e.priority]:o.taskBarPrimary,Be=(Y=>Y>=80?20:Y>=60?15:Y>=50?12:10)(r),W=r<50,pe=r<40;react.useEffect(()=>{if(b)if(Ze&&!Ce&&!e.segments){let Y=a<100;b({task:e,x:t,y:a,width:r,height:ae,showBelow:Y});}else b(null);},[Ze,Ce,e,t,a,r,ae,b]);let dt=Y=>Y.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ee=()=>{let Y=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Y} day${Y!==1?"s":""}`},qe=Y=>Math.round(Y/s)*s,Ke=Y=>{let De=Math.round(Y/s),be=new Date(n);return be.setDate(be.getDate()+De),be},Xe=(Y,De)=>{for(let be of g){if(be.id===e.id)continue;let We=5;if(Y>=be.x-We&&Y<=be.x+be.width+We&&De>=be.y-We&&De<=be.y+be.height+We)return be.id}return null},ot=react.useCallback((Y,De,be)=>{Y.preventDefault(),Y.stopPropagation();let We=x.current?.ownerSVGElement;if(!We)return;let H=We.createSVGPoint();H.x=Y.clientX,H.y=Y.clientY;let ne=H.matrixTransform(We.getScreenCTM()?.inverse()),He=be!==void 0?be:t,I=De;if(!I){let J=ne.x-He;Y.shiftKey?(I="connect",F({x:t+r,y:a+ae/2})):Y.ctrlKey||Y.metaKey?I="move":Y.altKey?I=J<r/2?"resize-start":"resize-end":pe?J<r/2?I="move":I="resize-end":W?J<=Be/2?I="resize-start":J>=r-Be/2?I="resize-end":I="move":J<=Be?I="resize-start":J>=r-Be?I="resize-end":I="move";}k.current=false,D(I),mt(false),A(null),I==="move"?B(ne.x-He):I==="connect"?F({x:t+r,y:a+ae/2}):B(0),w(He),$(r);},[t,r,a,ae]),R=react.useCallback(Y=>{let De=x.current?.ownerSVGElement;if(!De)return;let be=De.closest(".gantt-timeline-scroll");if(!be)return;let We=be.getBoundingClientRect(),H=60,ne=15,He=0;if(Y.clientX<We.left+H){let I=We.left+H-Y.clientX;He=-Math.min(ne,I/2);}else if(Y.clientX>We.right-H){let I=Y.clientX-(We.right-H);He=Math.min(ne,I/2);}return He!==0&&(be.scrollLeft+=He),He!==0},[]),de=react.useCallback(Y=>{if(T==="none")return;k.current=true,N.current=Y;let De=x.current?.ownerSVGElement;if(!De)return;if(T==="move"||T==="resize-start"||T==="resize-end"){let H=R(Y);H&&!h.current?h.current=window.setInterval(()=>{N.current&&(R(N.current),de(N.current));},16):!H&&h.current&&(window.clearInterval(h.current),h.current=null);}let be=De.createSVGPoint();be.x=Y.clientX,be.y=Y.clientY;let We=be.matrixTransform(De.getScreenCTM()?.inverse());if(T==="connect"){F({x:We.x,y:We.y});let H=Xe(We.x,We.y);le(H);}else if(T==="move"){let H=We.x-C,ne=qe(H);w(ne),$(r);let He=Math.round((ne-t)/s);if(v?.(e.id,He,true),e.segments&&e.segments.length>0&&_!==null){let I=ne-Qe;te(I);}}else if(T==="resize-start"){let H=We.x,ne=qe(H),He=t+r-ne;He>=s&&(w(ne),$(He));}else if(T==="resize-end"){let H=We.x,He=qe(H)-t;He>=s&&$(He);}},[T,t,r,s,C,e,qe,_,Qe,Xe,le,F,w,$,te,v,R]),Ne=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),N.current=null,T!=="none"){if(T==="connect")K&&m&&m(e,K),F(null),le(null);else {let Y=e.endDate.getTime()-e.startDate.getTime(),De,be,We=true;if(T==="move"){if(De=Ke(E),be=new Date(De.getTime()+Y),e.segments&&e.segments.length>0&&_!==null){let H=Math.round(Q/s),ne=e.segments.map((G,ge)=>{if(ge===_){let Je=new Date(G.startDate),ft=new Date(G.endDate);return Je.setDate(Je.getDate()+H),ft.setDate(ft.getDate()+H),{startDate:Je,endDate:ft}}return G}),He=ne.flatMap(G=>[G.startDate,G.endDate]),I=new Date(Math.min(...He.map(G=>G.getTime()))),J=new Date(Math.max(...He.map(G=>G.getTime())));d?.({...e,segments:ne},I,J),ue(t,r);return}}else T==="resize-start"?(De=Ke(E),be=e.endDate,De>be&&(console.warn("Invalid date range: start date must be before or equal to end date"),We=false)):T==="resize-end"?(De=e.startDate,be=Ke(E+U),be<De&&(console.warn("Invalid date range: end date must be after or equal to start date"),We=false)):We=false;We&&De&&be&&(be.getTime()<De.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,De,be));}v?.(e.id,0,false),ue(t,r);}},[T,E,U,e,d,K,m,t,r,s,Ke,Q,_,ue,v]);react.useEffect(()=>{if(T==="none")return;let Y=be=>{de(be);},De=()=>{Ne();};return window.addEventListener("mousemove",Y),window.addEventListener("mouseup",De),()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",De),h.current&&(window.clearInterval(h.current),h.current=null);}},[T,de,Ne]);let ye=Ce&&!j?E:t,he=Ce&&!j?U:r,tt=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,"data-task-bar":"true",onClick:()=>{!Ce&&!k.current&&c?.(e),k.current=false;},onDoubleClick:Y=>{!Ce&&!k.current&&(Y.stopPropagation(),i?.(e));},onContextMenu:Y=>{Y.preventDefault(),p?.(e,Y);},onMouseEnter:()=>!Ce&&mt(true),onMouseLeave:()=>{Ce||(mt(false),A(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:ae,fill:"transparent",style:{pointerEvents:"all"}}),Ze&&!Ce&&!W&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Be,height:ae,fill:Ie==="resize-start"?o.accent:"transparent",opacity:Ie==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>A("resize-start"),onMouseDown:Y=>ot(Y,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Be,y:a,width:r-Be*2,height:ae,fill:Ie==="move"?o.accent:"transparent",opacity:Ie==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>A("move"),onMouseDown:Y=>ot(Y,"move")}),jsxRuntime.jsx("rect",{x:t+r-Be,y:a,width:Be,height:ae,fill:Ie==="resize-end"?o.accent:"transparent",opacity:Ie==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>A("resize-end"),onMouseDown:Y=>ot(Y,"resize-end")})]}),Ze&&!Ce&&pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ae,fill:Ie==="move"?o.accent:"transparent",opacity:Ie==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>A("move"),onMouseDown:Y=>ot(Y,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ae,fill:Ie==="resize-end"?o.accent:"transparent",opacity:Ie==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>A("resize-end"),onMouseDown:Y=>ot(Y,"resize-end")}),Ze&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ae-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ce&&!j&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:a,width:U,height:ae,rx:$e,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!Ce&&(()=>{let Y=e.baselineStartDate.getTime(),De=e.baselineEndDate.getTime(),be=n.getTime(),We=864e5,H=(Y-be)/We,ne=(De-Y)/We,He=H*s,I=Math.max(ne*s,s),J=ye+he,G=He+I,ge=e.endDate?.getTime()??0,Je=Math.ceil((ge-De)/We),ft=Je>0,bt=Je<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:He,y:a-2,width:I,height:ae+4,rx:$e+1,fill:"none",stroke:o.textTertiary,strokeWidth:1.5,strokeDasharray:"4 3",opacity:.5}),ft&&J>G&&jsxRuntime.jsx("rect",{x:G,y:a,width:J-G,height:ae,rx:0,fill:"#EF4444",opacity:.2}),ft&&jsxRuntime.jsxs("text",{x:Math.max(J,G)+6,y:a+ae/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Je,"d"]}),bt&&jsxRuntime.jsxs("text",{x:J+6,y:a+ae/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Je,"d"]})]})})(),!e.segments&&Fe&&Re&&(()=>{let De=a+(ae-6)/2,be=14,We=a+(ae-be)/2,H=2;return jsxRuntime.jsxs("g",{"data-task-class":tt,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ye,y:De,width:he,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsxRuntime.jsx("rect",{x:ye,y:We,width:H,height:be,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsxRuntime.jsx("rect",{x:ye+he-H,y:We,width:H,height:be,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&Fe&&!Re&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ye,y:a,width:he,height:ae,rx:$e,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:Fe&&o.border?o.border:"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":tt,initial:{opacity:0,scale:.95},animate:{opacity:Ce&&!j?.15:1,scale:Ze&&!Ce?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Y=>ot(Y),style:{cursor:Ce?j?"crosshair":se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&!Fe&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ye,y:a,width:he,height:ae,rx:$e,fill:ee,"data-task-class":tt,initial:{opacity:0,scale:.95},animate:{opacity:Ce&&!j?.15:e.parentId?.6:Ze?.9:.8,scale:Ze&&!Ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Re?void 0:Y=>ot(Y),style:{cursor:Re?"default":Ce?j?"crosshair":se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),Fe&&(ct||je)&&!e.segments&&jsxRuntime.jsx("rect",{x:ye,y:a,width:he,height:ae,rx:$e,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&&(Fe&&Re?null:jsxRuntime.jsx("rect",{x:ye,y:a,width:Math.max(he*(e.progress/100),$e*2),height:ae,rx:$e,fill:ee,opacity:1,style:{pointerEvents:"none"}})),Fe&&!e.segments&&e.progress>0&&e.progress<100&&!Re&&!Ce&&(()=>{let Y=ye+he*(e.progress/100),De=8,be=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:Y,cy:a+ae/2,r:De,fill:be?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:Y,y:a+ae/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:be?.initials||be?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((Y,De)=>{let be=(Y.startDate.getTime()-n.getTime())/864e5*s,H=(Y.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-be+s,ne=Ce&&T==="move"&&_===De,He=Ue===De,I=ne?be+Q:be;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Ce&&rt(De),onMouseLeave:()=>!Ce&&rt(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:I,y:a,width:H,height:ae,rx:$e,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:ne||e.parentId?.6:He?.9:.8,scale:He&&!Ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:J=>{J.stopPropagation(),ve(De),O(be),ot(J,void 0,be);},style:{cursor:Ce?j?"crosshair":se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:I,y:a,width:H*(e.progress/100),height:ae,rx:$e,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${De}`)}),et&&(ct||je)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[je&&!ct&&jsxRuntime.jsx("rect",{x:ye,y:a,width:he,height:ae,rx:$e,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ct&&jsxRuntime.jsx("rect",{x:ye,y:a,width:he,height:ae,rx:$e,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),he>60&&!e.segments&&!(Fe&&Re)&&(()=>{let Y=l.taskLabel(e),De=typeof Y=="string"?Y:e.name,be=De.length>Math.floor(he/8)?`${De.substring(0,Math.floor(he/8))}...`:De;return jsxRuntime.jsx("text",{x:ye+12,y:a+ae/2,dominantBaseline:"middle",fill:Le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Le?"line-through":"none"},children:be})})(),!Ce&&!e.segments&&!Re&&e.progress>0&&e.progress<100&&(Fe?jsxRuntime.jsxs("text",{x:ye+he+6,y:a+ae/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):he>100?jsxRuntime.jsxs("text",{x:ye+he-12,y:a+ae/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&&he>80&&!Ce&&!e.segments&&!(Fe&&Re)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ye+he-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ye+he-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ze||se)&&!j&&!e.segments&&!Re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:ye-2,y:a,width:16,height:ae,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>A("resize-start"),onMouseLeave:()=>A(null),onMouseDown:Y=>{Y.stopPropagation(),ot(Y,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ye+4,y:a+8,width:3,height:ae-16,rx:1.5,fill:Ie==="resize-start"||T==="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:ye+he-14,y:a,width:16,height:ae,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>A("resize-end"),onMouseLeave:()=>A(null),onMouseDown:Y=>{Y.stopPropagation(),ot(Y,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ye+he-7,y:a+8,width:3,height:ae-16,rx:1.5,fill:Ie==="resize-end"||T==="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:Ze&&!Ce&&!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+ae/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>A("connect"),onMouseLeave:()=>A(null),onMouseDown:Y=>{Y.stopPropagation(),ot(Y,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ae/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ie==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),j&&Z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ae/2,x2:Z.x,y2:Z.y,stroke:K?o.statusCompleted:o.accent,strokeWidth:K?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:K?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Z.x,cy:Z.y,r:K?8:6,fill:K?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),K&&jsxRuntime.jsx(framerMotion.motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(Ze||Ce)&&!j&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ye-1,y:a-1,width:he+2,height:ae+2,rx:$e+1,fill:"none",stroke:Ce?o.accent:Fe?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:Fe?1:2,opacity:Ce||Fe?.6:.4,initial:{opacity:0},animate:{opacity:Ce||Fe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),se&&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+U,y1:0,x2:E+U,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&!Ce&&!e.segments&&!b&&(()=>{let be=a<100,We=be?a+ae+13:a-82-13,H=be?`M ${ye+he/2-6} ${a+ae+3} L ${ye+he/2} ${a+ae+13} L ${ye+he/2+6} ${a+ae+3}`:`M ${ye+he/2-6} ${a-13} L ${ye+he/2} ${a-3} L ${ye+he/2+6} ${a-13}`,ne=We+22,He=We+40,I=We+55,J=We+70,G=be?We+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:be?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:be?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:H,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ye+he/2-120,y:We,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:ye+he/2,y:ne,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:ye+he/2-110,y:He,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ye+he/2-70,y:He,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.startDate)}),jsxRuntime.jsx("text",{x:ye+he/2-110,y:I,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ye+he/2-70,y:I,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.endDate)}),jsxRuntime.jsx("text",{x:ye+he/2+10,y:He,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ye+he/2+65,y:He,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ee()}),jsxRuntime.jsx("text",{x:ye+he/2+10,y:I,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ye+he/2+65,y:I,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:ye+he/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ye+he/2-50,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ge=>ge.name).join(", ").substring(0,30),e.assignees.map(ge=>ge.name).join(", ").length>30?"...":""]})]}),!be&&jsxRuntime.jsx("text",{x:ye+he/2,y:G,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:pe?"Left: move \u2022 Right: resize":W?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Bp({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:c}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,p=i?130:82,d=13,m=c?s+l+d:s-p-d,g=c?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=m+22,b=m+40,y=m+55,f=m+70,x=m+90,k=m+105,h=m+120,N=w=>w.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),T=()=>{if(!r.startDate||!r.endDate)return "N/A";let w=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${w} day${w!==1?"s":""}`},D=w=>{if(w==null||w===0)return "N/A";let U=Math.floor(w/60),$=w%60;return U===0?`${$}m`:$===0?`${U}h`:`${U}h ${$}m`},C={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:g,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?N(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?N(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T()}),jsxRuntime.jsx("text",{x:o+n/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(w=>w.name).join(", ").substring(0,30),r.assignees.map(w=>w.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:D(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y:k,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:D(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:C.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:D(r.soldEffortMinutes)})]})]})]})})}function Un({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false}){let[,p]=react.useState(false),d=r-t,m=d>0,g=Math.abs(d)<5,v=20,b=!g&&a<=e,y,f,x=a-e,k=e+x/2;if(f=k,n==="squared")if(g)y=`M ${e} ${t} L ${a} ${r}`;else if(b){let F=e+15,K=a-v,le=m?t+20:t-20;f=K,y=`M ${e} ${t} L ${F} ${t} L ${F} ${le} L ${K} ${le} L ${K} ${r} L ${a} ${r}`;}else f=a-v,y=`M ${e} ${t} L ${f} ${t} L ${f} ${r} L ${a} ${r}`;else y=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let h=5,N=`M ${a} ${r} L ${a-h} ${r-h*.5} M ${a} ${r} L ${a-h} ${r+h*.5}`,T=o.dependency,D=o.dependencyHover||T,C="#f87171",B="rgba(248, 113, 113, 0.15)",E,w;if(n==="squared")if(g)E=(e+a)/2,w=t;else if(b){let Z=a-v,F=m?t+20:t-20;E=Z,w=(F+r)/2;}else E=f,w=(t+r)/2;else E=.125*e+.375*k+.375*k+.125*a,w=.125*t+.375*t+.375*r+.125*r;let U=()=>{p(false),c?.(false);},$=()=>{p(true),c?.(true);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:U,children:[jsxRuntime.jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:D,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:D,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:D,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:D,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Z=>{Z.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:E,cy:w,r:9,fill:B,stroke:C,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:E-3,y1:w-3,x2:E+3,y2:w+3,stroke:C,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E+3,y1:w-3,x2:E-3,y2:w+3,stroke:C,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:$,onMouseLeave:U,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:D,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:D,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:D,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:D,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Z=>{Z.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:E,cy:w,r:9,fill:B,stroke:C,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:E-3,y1:w-3,x2:E+3,y2:w+3,stroke:C,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E+3,y1:w-3,x2:E-3,y2:w+3,stroke:C,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:$,onMouseLeave:U,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:y,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:N,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",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:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function ri({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(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.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 p=r.get(i)||[];for(let d of p){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(`
|
|
126
|
-
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _l({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 d=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].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(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.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:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.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 Kl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[u,i]=react.useState("json"),[c,l]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Gc(e,u,b);Vc(v,u);},y=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Kc(v),x=v.name.endsWith(".json")?"json":"csv",k=jc(f,x);l(k),k.success&&r&&r(k,f);}catch(f){l({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:()=>d("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),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(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",u===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:y,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((b,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var Dy=["URGENT","HIGH","MEDIUM","LOW"],Sy=[{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"}],Ey=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Yl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:y}){let[b,v]=react.useState(true),f=react.useCallback(C=>{a({search:C.target.value});},[a]),x=react.useCallback(C=>{a({dateFilter:C.target.value});},[a]),k=react.useCallback(C=>{r({by:C.target.value});},[r]),h=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),w=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":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children: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"}),w&&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)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&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"}),d&&jsxRuntime.jsx("button",{onClick:d,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:x,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 S=C.target.value;a({priorities:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Dy.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 S=C.target.value;a({assignees:S==="all"?[]:[S]});},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 S=C.target.value;a({labels:S==="all"?[]:[S]});},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:k,className:"filter-bar__select filter-bar__select--sm",children:Sy.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:h,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:C=>y(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ey.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))})}),w&&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:d,onExportGanttCSV:u}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.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:l,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 d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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 Xl={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"}},Jl={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"}},Ql={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Mo={dark:Xl,light:Jl,neutral:Ql},Vs="dark";var _s=react.createContext(void 0),$y="asakaa-theme";function kp({children:e,defaultTheme:t=Vs,storageKey:a=$y}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,u=Mo[r];Object.entries(u.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${Hy(c)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,l])=>{let m=u.colors[c];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Mo};return jsxRuntime.jsx(_s.Provider,{value:n,children:e})}function nn(){let e=react.useContext(_s);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Hy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();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(Mo).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 wp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ot[e]||ot.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ot[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ot[e].bgSecondary),bgGrid:r("--theme-bg-card",ot[e].bgGrid),bgWeekend:r("--theme-bg-hover",ot[e].bgWeekend),border:r("--theme-border-primary",ot[e].border),borderLight:r("--theme-border-subtle",ot[e].borderLight),textPrimary:r("--theme-text-primary",ot[e].textPrimary),textSecondary:r("--theme-text-secondary",ot[e].textSecondary),textTertiary:r("--theme-text-tertiary",ot[e].textTertiary),accent:r("--theme-accent-primary",ot[e].accent),accentHover:r("--theme-accent-hover",ot[e].accentHover),accentLight:r("--theme-accent-primary",ot[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ot[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ot[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ot[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ot[e].dependency),dependencyHover:r("--theme-border-secondary",ot[e].dependencyHover),criticalPath:r("--theme-error",ot[e].criticalPath),criticalPathLight:r("--theme-error",ot[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ot[e].today):e==="neutral"?r("--theme-text-primary",ot[e].today):r("--theme-error",ot[e].today),todayLight:e==="light"?r("--theme-accent-primary",ot[e].todayLight):e==="neutral"?r("--theme-text-primary",ot[e].todayLight):r("--theme-error",ot[e].todayLight),milestone:r("--theme-warning",ot[e].milestone),milestoneLight:r("--theme-warning",ot[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ot[e].statusTodo),statusInProgress:r("--theme-accent-primary",ot[e].statusInProgress),statusCompleted:r("--theme-success",ot[e].statusCompleted),hoverBg:r("--theme-bg-hover",ot[e].hoverBg),focusRing:r("--theme-accent-primary",ot[e].focusRing),...ot[e].dotGrid&&{dotGrid:ot[e].dotGrid},...ot[e].glassHeader&&{glassHeader:ot[e].glassHeader},...ot[e].glassToolbar&&{glassToolbar:ot[e].glassToolbar},...ot[e].forecastHud&&{forecastHud:ot[e].forecastHud},...ot[e].neonRedGlow&&{neonRedGlow:ot[e].neonRedGlow},...ot[e].executionBarBg&&{executionBarBg:ot[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"}},Cp={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"}},ed={en:js,es:Cp};function Tp(e){return ed[e]||ed.en}function td(e,t){let a=Tp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ln=react.createContext(js);function Tr(){return react.useContext(ln)}function qs(e,t,a="left"){let[r,o]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let s=e.current.getBoundingClientRect(),n=s.bottom+4,d;a==="right"?d=s.right:d=s.left,o({top:n,left:d});},[t,a,e]),r}function Dp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=react.useState(false),[u,i]=react.useState(null),[c,l]=react.useState(false),m=react.useRef(null),g=react.useRef(null),y=Tr(),b=qs(m,n,"right"),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let w=C=>{let S=C.target;m.current&&!m.current.contains(S)&&g.current&&!g.current.contains(S)&&d(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[n]);let x=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(w=>w.handler),k=async(w,C)=>{if(C){i(w);try{await C();}catch(S){console.error(`Export ${w} failed:`,S);}finally{i(null),d(false);}}},h=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.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:b.top,left:b.left-224,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:[x.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:x.map((w,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(w.id,w.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===w.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"})}):w.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.label})]},w.id))})]}),x.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:h,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:x.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?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function ux({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 px({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 Sp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),d=react.useRef(null),u=Tr(),i=qs(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let y=g.target;n.current&&!n.current.contains(y)&&d.current&&!d.current.contains(y)&&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}`}))],l=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"}: ${l}`,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:l})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((m,g)=>{let y=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:y?e.accentLight:"transparent",borderBottom:g<c.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:m.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Ep({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),u=react.useRef(null),i=Tr(),c=qs(d,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let b=f=>{let x=f.target;d.current&&!d.current.contains(x)&&u.current&&!u.current.contains(x)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),u._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(y),u._cleanup&&u._cleanup();}},[s]);let l=[{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:d,onClick:y=>{y.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[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:l.map(y=>{let b=t===y.value&&!r,v=()=>y.value==="all"?b?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"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?y.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:y.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.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 mx({value:e,onChange:t,theme:a}){let r=Tr(),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 d=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:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function gx({theme:e,forecast:t}){let a=Tr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,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,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,b=y!=null&&y!==0,v=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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&&d&&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:d})]})]}),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}),b&&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 fx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:u,rowDensity:i,onRowDensityChange:c}){let[l,m]=react.useState(false),g=react.useRef(null),y=react.useRef(null),b=Tr(),v=qs(g,l,"left"),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!l)return;let h=w=>{let C=w.target;g.current&&!g.current.contains(C)&&y.current&&!y.current.contains(C)&&m(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]);let x=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:d,onChange:u}],k=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:y,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:x.map((h,w)=>{let C=h.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>h.onChange?.(!h.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsxRuntime.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:h.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:h.label}),h.active&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},h.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((h,w)=>{let C=i===h.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(h.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+w)*.03},children:[jsxRuntime.jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:h.label}),C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},h.value)})]})]})}),document.body)]})}function Xs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:x,onWbsLevelChange:k,maxWbsDepth:h=4,viewMode:w="execution",onViewModeChange:C,projectForecast:S,onExportPNG:T,onExportPDF:L,onExportExcel:A,onExportCSV:N,onExportJSON:Y,onExportMSProject:O,showCriticalPath:le=true,onShowCriticalPathChange:P,showDependencies:q=true,onShowDependenciesChange:fe,highlightWeekends:Ke=true,onHighlightWeekendsChange:F,showBaseline:U=false,onShowBaselineChange:ae,onCopySnapshotLink:Ne}){let R=Tr(),J=T||L||A||N||Y||O,X=!!e.glassToolbar,[ue,Ie]=react.useState(false),Xe=react.useRef(null);react.useEffect(()=>{ue&&Xe.current&&Xe.current.focus();},[ue]);let dt=[{value:"day",label:R.toolbar.day},{value:"week",label:R.toolbar.week},{value:"month",label:R.toolbar.month}],lt=[{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"})}],re=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(X){let ct=re?"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:re?"#1A1A1A":e.bgSecondary,border:`1px solid ${re?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ue?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ie(!ue),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"})}),ue&&jsxRuntime.jsx("input",{ref:Xe,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:()=>Ie(false),onKeyDown:Be=>{Be.key==="Escape"&&Ie(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),C&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:re?"#000000":e.bgSecondary,border:`1px solid ${re?"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:w==="execution"?re?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:w==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:w!=="execution"?{color:e.textSecondary}:{},children:R.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:w==="oracle"?re?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:w==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:w!=="oracle"?{color:e.textSecondary}:{},children:R.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(mx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),k&&jsxRuntime.jsx(Sp,{theme:e,value:x??"all",onChange:k,maxDepth:h}),y&&jsxRuntime.jsx(Ep,{theme:e,value:g,onChange:y,hideCompleted:b,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),jsxRuntime.jsx(fx,{theme:e,showCriticalPath:le,onShowCriticalPathChange:P,showBaseline:U,onShowBaselineChange:ae,highlightWeekends:Ke,onHighlightWeekendsChange:F,showDependencies:q,onShowDependenciesChange:fe,rowDensity:d,onRowDensityChange:u}),jsxRuntime.jsx(Dp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:A,onExportMSProject:O,onCopySnapshotLink:Ne}),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 ${re?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${re?"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:l||R.toolbar.createTask})]})]})]}),S&&jsxRuntime.jsx(gx,{theme:e,forecast:S})]})}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(px,{options:dt,value:t,onChange:ct=>a(ct),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}}),k&&jsxRuntime.jsx(Sp,{theme:e,value:x??"all",onChange:k,maxDepth:h}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Ep,{theme:e,value:g,onChange:y,hideCompleted:b,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:l||R.toolbar.createTask})]}),(J||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Dp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:A,onExportMSProject:O,onCopySnapshotLink:Ne}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(ux,{options:lt,value:s,onChange:ct=>n(ct),theme:e})]})]})}function Js({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.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(Lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children: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:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.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 un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,m=8,g=window.innerWidth,y=window.innerHeight,b=t,v=a;t+c+m>g&&(b=t-c,b<m&&(b=m)),a+l+m>y&&(v=y-l-m,v<m&&(v=m)),u({x:b,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[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:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children: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:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.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 Vt={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 Rp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:m=true}){let g=react.useRef(false),y=react.useCallback(k=>{g.current=k;},[]),b=react.useCallback(k=>{let h=[],w=C=>{for(let S of C)h.push(S),S.subtasks&&S.subtasks.length>0&&S.isExpanded&&w(S.subtasks);};return w(k),h},[]),v=react.useCallback(()=>{let k=b(e);for(let h of k)if(t.has(h.id))return h;return null},[e,t,b]),f=react.useCallback((k,h)=>{let w=b(e);if(w.length===0)return;let C=v();if(!C){a(w[0].id,false);return}let S=w.findIndex(A=>A.id===C.id);if(S===-1)return;let T=k==="up"?S-1:S+1;if(T<0||T>=w.length)return;let L=w[T];a(L.id,h);},[e,v,b,a]),x=react.useCallback(k=>{if(!m)return;let h=k.target;if(h.tagName==="INPUT"||h.tagName==="TEXTAREA"||h.isContentEditable||g.current){k.key==="Escape"&&(h.blur(),g.current=false);return}let S=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,T=Array.from(t),L=v();if(k.key==="ArrowUp"){k.preventDefault(),f("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),f("down",k.shiftKey);return}if(L&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!L.isExpanded||k.key==="ArrowLeft"&&L.isExpanded)&&c(L.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){T.length>0&&(k.preventDefault(),n(T,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){T.length>0&&(k.preventDefault(),d(T));return}if(k.key==="Tab"&&k.shiftKey){T.length>0&&(k.preventDefault(),u(T));return}if(k.key==="Enter"&&!k.shiftKey&&!S){L&&(k.preventDefault(),r(L.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!S){L&&(k.preventDefault(),r(L.id,"above"));return}if(k.key==="Enter"&&S){L&&(k.preventDefault(),l(L.id));return}if(k.key==="F2"){L&&(k.preventDefault(),i(L.id));return}if(k.key==="Delete"||k.key==="Backspace"&&S){T.length>0&&(k.preventDefault(),o(T));return}if(k.key==="d"&&S&&!k.shiftKey){T.length>0&&(k.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,u,i,c,l]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[m,x]),{setIsEditing:y}}function $p(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=react.useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),y=m.indexOf(l);if(g===-1||y===-1){o(l);return}let b=Math.min(g,y),v=Math.max(g,y),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=react.useCallback((l,m,g,y)=>{y?n(l,m):g?s(l):o(l);},[o,s,n]),u=react.useCallback((l,m)=>{m?t(g=>{let y=new Set(g);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:c}}function od(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?od(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,u)=>(d.position??0)-(u.position??0));for(let d=0;d<n.length;d++){let u={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.id,s+1);}};return a(e),t}function Qs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Qs(a.subtasks,t);if(r)return r}}return null}function rd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=rd(a.subtasks,t);if(r)return r}return null}function nd(e,t){if(t.length===0)return e;let a=pn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let y=[];return {tasks:m.filter(v=>{if(g.has(v.id))return y.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},d=(m,g,y)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...y],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,y)}:b),u=new Set(t),{tasks:i,removed:c}=n(e,u),l=d(i,s.id,c);return od(l)}function sd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=rd(a,r);if(!o)continue;let s=rd(a,o.id),n=(i,c,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===c&&g.subtasks){let y=g.subtasks.findIndex(b=>b.id===l);if(y!==-1){let[b]=g.subtasks.splice(y,1);return b}}if(g.subtasks){let y=n(g.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let m=i.findIndex(g=>g.id===c);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,c,l);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?d(s.subtasks,o.id,u):d(a,o.id,u));}return od(a)}function id(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,u)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,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 ld(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 Wn(e,t){let a=[...e],r=[];for(let o of t){let s=(u,i)=>u.map((c,l)=>({...c,id:`${c.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${l}`):void 0})),n=u=>{let i=u.findIndex(g=>g.id===o);if(i===-1){for(let g of u)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let c=u[i],l=`${c.id}-copy-${Date.now()}`,m={...c,id:l,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,l):void 0};return u.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function Hp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},d=u=>{let i=u.findIndex(l=>l.id===t);if(i===-1){for(let l of u)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function dd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:dd(r.subtasks,t,a)}:r)}function cd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:cd(a.subtasks,t)}:a)}function ud(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,u=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=u(g.subtasks);if(y>=0)return y}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,c],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:c}}function zp(e,t,a,r){if(t===a)return e;let o=Qs(e,t);if(!o)return e;if(a){let d=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>{let u=d.filter(c=>c.id!==t),i=u.length<d.length;return u.map((c,l)=>{let m=i?{...c,position:l}:c;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let d=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,m=[...c];m.splice(l,0,{...o,parentId:a});let g=m.map((y,b)=>({...y,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function mr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=mr(t.subtasks),r=a.reduce((d,u)=>(u.startDate&&d.starts.push(new Date(u.startDate).getTime()),u.endDate&&d.ends.push(new Date(u.endDate).getTime()),d.progresses.push(u.progress??0),d),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,u)=>d+u,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ei({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:x,onTaskCreate:k,onTaskRename:h,onCreateSubtask:w,onOpenTaskModal:C,onDeleteRequest:S,onTaskReparent:T,scrollContainerRef:L}){let A=react.useContext(ln),[N,Y]=react.useState(null),[O,le]=react.useState(null),[P,q]=react.useState(""),fe=react.useRef(null),[Ke,F]=react.useState(null),[U,ae]=react.useState(0),[Ne,R]=react.useState(0),[J,X]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ue,Ie]=react.useState(null),[Xe,dt]=react.useState(null),[lt,re]=react.useState(null),ct=react.useRef(0),Be=5,ht=react.useRef(false),[mt,Ct]=react.useState(null),[we,Je]=react.useState(false),tt=react.useRef(null),[Qe,H]=react.useState(null),[ne,D]=react.useState(false),K=react.useRef(null);react.useEffect(()=>{function j(xe){K.current&&!K.current.contains(xe.target)&&D(false);}if(ne)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[ne]),react.useEffect(()=>{O&&fe.current&&(fe.current.focus(),fe.current.select());},[O]),react.useEffect(()=>{if(!Ke)return;let j=ee=>{let I=ee.clientX-U,V=Ne+I;m?.(Ke,V);},xe=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",xe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",xe),document.body.style.cursor="",document.body.style.userSelect="";}},[Ke,U,Ne,m]);let{selectedTaskIds:se,handleTaskClick:be,isTaskSelected:G}=$p(),{setIsEditing:Z}=Rp({tasks:e,selectedTaskIds:se,onTaskSelect:(j,xe)=>{let I=pn(e).map(V=>V.id);be(j,I,xe||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:j=>{let xe=pn(e).find(ee=>ee.id===j);xe&&$(xe);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:j=>{let xe=pn(e).find(ee=>ee.id===j);xe&&C&&C(xe);},enableKeyboard:true}),ze=(j,xe=0,ee="")=>{let I=[],V=[...j].sort((te,Ce)=>(te.position??0)-(Ce.position??0));for(let te=0;te<V.length;te++){let Ce=V[te],Pe=te+1,Ye=ee?`${ee}.${Pe}`:`${Pe}.0`;if(Ce.wbsCode=Ye,I.push({task:Ce,level:xe}),Ce.subtasks&&Ce.subtasks.length>0&&Ce.isExpanded){let Re=ee?`${ee}.${Pe}`:`${Pe}`;I.push(...ze(Ce.subtasks,xe+1,Re));}}return I},ye=ze(e),Ue=48,Se=Math.max(ye.length*a,600-Ue),He=j=>!j.startDate||!j.endDate?"-":`${Math.ceil((j.endDate.getTime()-j.startDate.getTime())/(1e3*60*60*24))}d`,$=j=>{le(j.id),q(j.name),Z(true);},pe=j=>{P.trim()&&P!==e.find(xe=>xe.id===j)?.name&&h?.(j,P.trim()),le(null),q(""),Z(false);},ke=()=>{le(null),q(""),Z(false);},Ve=(j,xe)=>{xe.stopPropagation(),w?.(j.id);},st=(j,xe)=>{xe.preventDefault(),ct.current=xe.clientY,Ie(j),ht.current=false,Je(false),Ct({x:xe.clientX,y:xe.clientY});},Ze=j=>{if(!ue||(Math.abs(j.clientY-ct.current)>Be&&!ht.current&&(ht.current=true,Je(true)),Ct({x:j.clientX,y:j.clientY}),!ht.current))return;if(L?.current){let te=L.current,Ce=te.getBoundingClientRect(),Pe=60,Ye=12;tt.current&&(cancelAnimationFrame(tt.current),tt.current=null);let Re=j.clientY-Ce.top,Dt=Ce.bottom-j.clientY;if(Re<Pe&&te.scrollTop>0){let pt=Math.round(Ye*(1-Re/Pe)),Ut=()=>{te.scrollTop-=pt,ht.current&&te.scrollTop>0&&(tt.current=requestAnimationFrame(Ut));};tt.current=requestAnimationFrame(Ut);}else if(Dt<Pe&&te.scrollTop<te.scrollHeight-te.clientHeight){let pt=Math.round(Ye*(1-Dt/Pe)),Ut=()=>{te.scrollTop+=pt,ht.current&&te.scrollTop<te.scrollHeight-te.clientHeight&&(tt.current=requestAnimationFrame(Ut));};tt.current=requestAnimationFrame(Ut);}}let ee=document.querySelectorAll("[data-task-row]"),I=null,V=null;ee.forEach(te=>{let Ce=te.getBoundingClientRect(),Pe=te.getAttribute("data-task-row");if(Pe&&Pe!==ue&&j.clientY>=Ce.top&&j.clientY<=Ce.bottom){I=Pe;let Ye=j.clientY-Ce.top,Re=Ce.height;Ye<Re*.25?V="above":Ye>Re*.75?V="below":V="child";}}),dt(I),re(V);},me=()=>{if(ht.current&&ue&&Xe&<){if(lt==="child")T?.(ue,Xe);else if(lt==="above"||lt==="below"){let j=(V,te,Ce=null)=>{for(let Pe of V){if(Pe.id===te)return Ce;if(Pe.subtasks){let Ye=j(Pe.subtasks,te,Pe.id);if(Ye!==void 0)return Ye}}},xe=j(e,ue,null),ee=j(e,Xe,null),I=(V,te,Ce,Pe)=>{let Ye=V.findIndex(pt=>pt.id===te),Re=Pe?V.findIndex(pt=>pt.id===Ce):-1,Dt=lt==="below"?Ye+1:Ye;return Pe&&Re!==-1&&Re<Ye&&(Dt-=1),Math.max(0,Dt)};if(ee===null){let te=I(e,Xe,ue,xe===null);T?.(ue,null,te);}else {let V=ye.find(te=>te.task.id===ee)?.task;if(V?.subtasks){let te=xe===ee,Ce=I(V.subtasks,Xe,ue,te);T?.(ue,ee,Ce);}}}}tt.current&&(cancelAnimationFrame(tt.current),tt.current=null),Ie(null),dt(null),re(null),Ct(null),ht.current=false,Je(false);};react.useEffect(()=>{if(ue)return document.addEventListener("mousemove",Ze),document.addEventListener("mouseup",me),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ze),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,Xe,lt]);let qe=(j,xe,ee)=>{let I=xe.subtasks&&xe.subtasks.length>0;switch(j.id){case "name":let V=O===xe.id,te=N===xe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ee*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:te?1:.3},onMouseDown:Ae=>st(xe.id,Ae),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),xe.subtasks&&xe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Ae=>{Ae.stopPropagation(),u?.(xe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:xe.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"}),V?jsxRuntime.jsx("input",{ref:fe,type:"text",value:P,onChange:Ae=>q(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"?pe(xe.id):Ae.key==="Escape"&&ke();},onBlur:()=>pe(xe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:Ae=>Ae.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:xe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:xe.parentId?"13px":"14px",fontWeight:xe.isMilestone?600:xe.parentId?400:600,letterSpacing:xe.parentId?"0":"-0.01em"},title:xe.name,children:[xe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:xe.wbsCode}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:xe.name})]}),te&&!V&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Ae=>Ae.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Ae=>Ve(xe,Ae),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:Ae=>{Ae.stopPropagation(),$(xe);},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 Pe=j.id==="startDate"?"startDate":"endDate",Ye=xe[Pe],Re=Qe?.taskId===xe.id&&Qe?.field===Pe,Dt=Ae=>Ae?(typeof Ae=="string"?new Date(Ae):Ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Ae=>Ae.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:I?.5:1,cursor:I?"default":"pointer"},title:I?"Auto-calculated from subtasks":void 0,onClick:Ae=>{if(!I)if(Re)H(null);else {let z=Ae.currentTarget.getBoundingClientRect();H({taskId:xe.id,field:Pe,month:Ye?typeof Ye=="string"?new Date(Ye):Ye:new Date,position:{top:z.bottom+4,left:z.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Dt(Ye)}),I&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Re&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(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:Qe?.position.top,left:Qe?.position.left},onClick:Ae=>Ae.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Ae=new Date,z=new Date(Ae);z.setDate(Ae.getDate()+1);let ve=new Date(Ae);ve.setDate(Ae.getDate()+7);let Ot=new Date(Ae);return Ot.setDate(Ae.getDate()+14),[{label:"Hoy",date:Ae},{label:"Ma\xF1ana",date:z},{label:"Pr\xF3xima semana",date:ve},{label:"2 semanas",date:Ot}].map((de,$e)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:et=>et.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:et=>et.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(xe.id,{[Pe]:de.date}),H(null);},children:de.label},$e))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Ae=>Ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ae=>Ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(xe.id,{[Pe]:void 0}),H(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:()=>H(Ae=>Ae?{...Ae,month:new Date(Ae.month.getFullYear(),Ae.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Qe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(Ae=>Ae?{...Ae,month:new Date(Ae.month.getFullYear(),Ae.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((Ae,z)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Ae},z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Ae=Qe?.month||new Date,z=Ae.getFullYear(),ve=Ae.getMonth(),Ot=new Date(z,ve,1).getDay(),M=new Date(z,ve+1,0).getDate(),de=new Date,$e=[];for(let yt=Ot-1;yt>=0;yt--)$e.push({day:new Date(z,ve,-yt).getDate(),date:new Date(z,ve-1,new Date(z,ve,-yt).getDate()),isCurrentMonth:false});for(let yt=1;yt<=M;yt++)$e.push({day:yt,date:new Date(z,ve,yt),isCurrentMonth:true});let et=42-$e.length;for(let yt=1;yt<=et;yt++)$e.push({day:yt,date:new Date(z,ve+1,yt),isCurrentMonth:false});return $e.map((yt,Ha)=>{let ta=yt.date.toDateString()===de.toDateString(),na=(Ye?typeof Ye=="string"?new Date(Ye):Ye:null)?.toDateString()===yt.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:yt.isCurrentMonth?na?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:na?"#2E94FF":"transparent",boxShadow:ta&&!na?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(xe.id,{[Pe]:yt.date}),H(null);},children:yt.day},Ha)})})()})]})]})]}),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:He(xe)})});case "assignees":if(I)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 pt=r.filter(Ae=>xe.assignees?.some(z=>z.name===Ae.name||z.initials===Ae.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Ae=>Ae.stopPropagation(),children:jsxRuntime.jsx(No,{assignedUsers:pt,availableUsers:r,onChange:Ae=>{let z=Ae.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));g?.(xe.id,{assignees:z.length>0?z:void 0});}})});case "status":if(I){let Ae=xe.progress===100?"\u2713":xe.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:Ae})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Ae=>Ae.stopPropagation(),children:jsxRuntime.jsx(pu,{status:xe.status||"todo",onChange:Ae=>{g?.(xe.id,{status:Ae,progress:Ae==="completed"?100:xe.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:I?.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:`${xe.progress}%`,backgroundColor:xe.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:[xe.progress,"%"]})]});case "priority":let Ut={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ca={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ha=Ut[xe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Ae=>Ae.stopPropagation(),children:jsxRuntime.jsx(Co,{priority:ha,onChange:Ae=>{Ae&&g?.(xe.id,{priority:Ca[Ae]||"medium"});}})});default:return null}},gt=j=>[{id:"hide",label:"Hide Column",icon:Vt.Hide,onClick:()=>l(j),disabled:j==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Vt.SortDesc,onClick:()=>{}}],Pt=j=>j.subtasks&&j.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{w?.(j.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{x?.([j.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{S?S(j.id,j.name):f?.([j.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{n?.(j);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{w?.(j.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{g?.(j.id,{status:"todo",progress:0});},disabled:j.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{g?.(j.id,{status:"in-progress"});},disabled:j.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{g?.(j.id,{status:"completed",progress:100});},disabled:j.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{x?.([j.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{S?S(j.id,j.name):f?.([j.id]);}}],Fe=c.filter(j=>j.visible),_e=Fe.reduce((j,xe)=>j+xe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:_e},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ue}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Fe.map((j,xe)=>{let ee=xe===Fe.length-1,I=j.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${I?"":"justify-center"}`,style:{width:`${j.width}px`,minWidth:`${j.minWidth??(I?200:60)}px`,maxWidth:`${j.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:V=>{V.preventDefault(),X({isOpen:true,x:V.clientX,y:V.clientY,type:"header",columnId:j.id});},onMouseEnter:V=>{V.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:V=>{V.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:j.label,children:j.label}),j.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Ke===j.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:V=>{V.preventDefault(),V.stopPropagation(),F(j.id),ae(V.clientX),R(j.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"}})})]},j.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(Js,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>D(!ne),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"})}),ne&&jsxRuntime.jsxs("div",{ref:K,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:j=>j.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:()=>D(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:Se},children:ye.map(({task:j,level:xe},ee)=>{let I=G(j.id),V=Xe===j.id,te=V&<==="above",Ce=V&<==="below",Pe=V&<==="child",Ye={};return Pe&&(Ye.backgroundColor=`${t.accent}15`,Ye.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":j.id,className:`flex items-center cursor-pointer group ${ue===j.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:I?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:I?t.accentLight:Pe?`${t.accent}15`:ee%2===0?t.bgPrimary:t.bgGrid,...Ye},onMouseEnter:()=>Y(j.id),onMouseLeave:()=>Y(null),onClick:Re=>{let pt=pn(e).map(ha=>ha.id),Ca=navigator.platform.toUpperCase().indexOf("MAC")>=0?Re.metaKey:Re.ctrlKey;be(j.id,pt,Ca,Re.shiftKey),s?.(j);},onDoubleClick:Re=>{Re.stopPropagation(),n?.(j);},onContextMenu:Re=>{Re.preventDefault(),X({isOpen:true,x:Re.clientX,y:Re.clientY,type:"task",task:j}),d?.(j,Re);},whileHover:{backgroundColor:I?t.accentLight:t.hoverBg},children:[te&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ce&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Fe.map((Re,Dt)=>{let pt=Dt===Fe.length-1,Ut=Re.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ut?"justify-start":"justify-center"}`,style:{width:`${Re.width}px`,minWidth:`${Re.minWidth??(Ut?200:60)}px`,maxWidth:`${Re.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:pt?"none":`1px solid ${N===j.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:qe(Re,j,Ut?xe:0)},`${j.id}-${Re.id}`)})]},j.id)})}),jsxRuntime.jsx(un,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?gt(J.columnId):J.type==="task"&&J.task?Pt(J.task):[],onClose:()=>X({...J,isOpen:false}),theme:t}),we&&mt&&ue&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:mt.x+12,top:mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let j=ye.find(xe=>xe.task.id===ue)?.task;return j?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:j.name})}):null})()}),document.body)]})}function _p(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[u,i]=react.useState(t),[c,l]=react.useState(null),[m,g]=react.useState(null),[y,b]=react.useState(null),[v,f]=react.useState(null),[x,k]=react.useState(0),[h,w]=react.useState(0),[C,S]=react.useState(null),[T,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:y,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:x,setDraggedSegmentStartX:k,segmentDragOffsetX:h,setSegmentDragOffsetX:w,hoveredSegmentIndex:C,setHoveredSegmentIndex:S,isHovered:T,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(le,P)=>{r("none"),l(null),g(null),d(le),i(P),w(0),f(null),k(0);}}}function ri({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:y,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:x=true,readOnly:k=false}){let h=_p(t,r),w=react.useRef(null),C=react.useRef(false),S=react.useRef(null),T=react.useRef(null),{dragMode:L,setDragMode:A,dragOffset:N,setDragOffset:Y,ghostX:O,setGhostX:le,ghostWidth:P,setGhostWidth:q,connectionLine:fe,setConnectionLine:Ke,hoveredTaskId:F,setHoveredTaskId:U,activeZone:ae,setActiveZone:Ne,draggedSegmentIndex:R,setDraggedSegmentIndex:J,draggedSegmentStartX:X,setDraggedSegmentStartX:ue,segmentDragOffsetX:Ie,setSegmentDragOffsetX:Xe,hoveredSegmentIndex:dt,setHoveredSegmentIndex:lt,isHovered:re,setIsHovered:ct,isDragging:Be,isResizing:ht,isConnecting:mt,resetDragState:Ct}=h,we=18,Je=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=Je?3:6,H=e.subtasks&&e.subtasks.length>0,ne=e.endDate&&(()=>{let ee=new Date;ee.setHours(0,0,0,0);let I=new Date(e.endDate);return I.setHours(0,0,0,0),I<ee})()&&e.progress<100,D=x&&e.isCriticalPath,K=o.name==="neutral"||o.today==="#1C1917",se=e.status==="completed"||e.progress===100,be={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Z=x&&e.isCriticalPath||ne?"#EF4444":e.color?e.color:e.priority&&be[e.priority]?be[e.priority]:o.taskBarPrimary,ze=k?"default":Be?mt?"crosshair":ht?"ew-resize":"grabbing":"grab",ye=k?"default":"ew-resize",Se=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),He=r<50,$=r<40;react.useEffect(()=>{if(b)if(re&&!Be&&!e.segments){let ee=a<100;b({task:e,x:t,y:a,width:r,height:we,showBelow:ee});}else b(null);},[re,Be,e,t,a,r,we,b]);let pe=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ke=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},Ve=ee=>Math.round(ee/s)*s,st=ee=>{let I=Math.round(ee/s),V=new Date(n);return V.setDate(V.getDate()+I),V},Ze=(ee,I)=>{for(let V of g){if(V.id===e.id)continue;let te=5;if(ee>=V.x-te&&ee<=V.x+V.width+te&&I>=V.y-te&&I<=V.y+V.height+te)return V.id}return null},me=react.useCallback((ee,I,V)=>{if(k)return;ee.preventDefault(),ee.stopPropagation();let te=w.current?.ownerSVGElement;if(!te)return;let Ce=te.createSVGPoint();Ce.x=ee.clientX,Ce.y=ee.clientY;let Pe=Ce.matrixTransform(te.getScreenCTM()?.inverse()),Ye=V!==void 0?V:t,Re=I;if(!Re){let Dt=Pe.x-Ye;ee.shiftKey?(Re="connect",Ke({x:t+r,y:a+we/2})):ee.ctrlKey||ee.metaKey?Re="move":ee.altKey?Re=Dt<r/2?"resize-start":"resize-end":$?Dt<r/2?Re="move":Re="resize-end":He?Dt<=Se/2?Re="resize-start":Dt>=r-Se/2?Re="resize-end":Re="move":Dt<=Se?Re="resize-start":Dt>=r-Se?Re="resize-end":Re="move";}C.current=false,A(Re),ct(false),Ne(null),Re==="move"?Y(Pe.x-Ye):Re==="connect"?Ke({x:t+r,y:a+we/2}):Y(0),le(Ye),q(r);},[t,r,a,we,k]),qe=react.useCallback(ee=>{let I=w.current?.ownerSVGElement;if(!I)return;let V=I.closest(".gantt-timeline-scroll");if(!V)return;let te=V.getBoundingClientRect(),Ce=60,Pe=15,Ye=0;if(ee.clientX<te.left+Ce){let Re=te.left+Ce-ee.clientX;Ye=-Math.min(Pe,Re/2);}else if(ee.clientX>te.right-Ce){let Re=ee.clientX-(te.right-Ce);Ye=Math.min(Pe,Re/2);}return Ye!==0&&(V.scrollLeft+=Ye),Ye!==0},[]),gt=react.useCallback(ee=>{if(L==="none")return;C.current=true,T.current=ee;let I=w.current?.ownerSVGElement;if(!I)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ce=qe(ee);Ce&&!S.current?S.current=window.setInterval(()=>{T.current&&(qe(T.current),gt(T.current));},16):!Ce&&S.current&&(window.clearInterval(S.current),S.current=null);}let V=I.createSVGPoint();V.x=ee.clientX,V.y=ee.clientY;let te=V.matrixTransform(I.getScreenCTM()?.inverse());if(L==="connect"){Ke({x:te.x,y:te.y});let Ce=Ze(te.x,te.y);U(Ce);}else if(L==="move"){let Ce=te.x-N,Pe=Ve(Ce);le(Pe),q(r);let Ye=Math.round((Pe-t)/s);if(y?.(e.id,Ye,true),e.segments&&e.segments.length>0&&R!==null){let Re=Pe-X;Xe(Re);}}else if(L==="resize-start"){let Ce=te.x,Pe=Ve(Ce),Ye=t+r-Pe;Ye>=s&&(le(Pe),q(Ye));}else if(L==="resize-end"){let Ce=te.x,Ye=Ve(Ce)-t;Ye>=s&&q(Ye);}},[L,t,r,s,N,e,Ve,R,X,Ze,U,Ke,le,q,Xe,y,qe]),Pt=react.useCallback(()=>{if(S.current&&(window.clearInterval(S.current),S.current=null),T.current=null,L!=="none"){if(L==="connect")F&&m&&m(e,F),Ke(null),U(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),I,V,te=true;if(L==="move"){if(I=st(O),V=new Date(I.getTime()+ee),e.segments&&e.segments.length>0&&R!==null){let Ce=Math.round(Ie/s),Pe=e.segments.map((pt,Ut)=>{if(Ut===R){let Ca=new Date(pt.startDate),ha=new Date(pt.endDate);return Ca.setDate(Ca.getDate()+Ce),ha.setDate(ha.getDate()+Ce),{startDate:Ca,endDate:ha}}return pt}),Ye=Pe.flatMap(pt=>[pt.startDate,pt.endDate]),Re=new Date(Math.min(...Ye.map(pt=>pt.getTime()))),Dt=new Date(Math.max(...Ye.map(pt=>pt.getTime())));l?.({...e,segments:Pe},Re,Dt),Ct(t,r);return}}else L==="resize-start"?(I=st(O),V=e.endDate,I>V&&(console.warn("Invalid date range: start date must be before or equal to end date"),te=false)):L==="resize-end"?(I=e.startDate,V=st(O+P),V.setDate(V.getDate()-1),V<I&&(console.warn("Invalid date range: end date must be after or equal to start date"),te=false)):te=false;te&&I&&V&&(V.getTime()<I.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,I,V));}y?.(e.id,0,false),Ct(t,r);}},[L,O,P,e,l,F,m,t,r,s,st,Ie,R,Ct,y]);react.useEffect(()=>{if(L==="none")return;let ee=V=>{gt(V);},I=()=>{Pt();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",I),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",I),S.current&&(window.clearInterval(S.current),S.current=null);}},[L,gt,Pt]);let Fe=Be&&!mt?O:t,_e=Be&&!mt?P:r,j=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:w,"data-task-bar":"true",onClick:()=>{!Be&&!C.current&&u?.(e),C.current=false;},onDoubleClick:ee=>{!Be&&!C.current&&(ee.stopPropagation(),i?.(e));},onContextMenu:ee=>{ee.preventDefault(),c?.(e,ee);},onMouseEnter:()=>!Be&&ct(true),onMouseLeave:()=>{Be||(ct(false),Ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:we,fill:"transparent",style:{pointerEvents:"all"}}),re&&!Be&&!He&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Se,height:we,fill:ae==="resize-start"?o.accent:"transparent",opacity:ae==="resize-start"?.15:0,style:{cursor:ye,pointerEvents:"all"},onMouseEnter:()=>Ne("resize-start"),onMouseDown:ee=>me(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Se,y:a,width:r-Se*2,height:we,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.1:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ne("move"),onMouseDown:ee=>me(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-Se,y:a,width:Se,height:we,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.15:0,style:{cursor:ye,pointerEvents:"all"},onMouseEnter:()=>Ne("resize-end"),onMouseDown:ee=>me(ee,"resize-end")})]}),re&&!Be&&$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:we,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.2:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ne("move"),onMouseDown:ee=>me(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.2:0,style:{cursor:ye,pointerEvents:"all"},onMouseEnter:()=>Ne("resize-end"),onMouseDown:ee=>me(ee,"resize-end")}),re&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Be&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:P,height:we,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&&!Be&&(()=>{let ee=e.baselineStartDate.getTime(),I=e.baselineEndDate.getTime(),V=n.getTime(),te=864e5,Ce=(ee-V)/te,Pe=(I-ee)/te,Ye=Ce*s,Re=Math.max(Pe*s,s),Dt=Fe+_e,pt=Ye+Re,Ut=e.endDate?.getTime()??0,Ca=Math.ceil((Ut-I)/te),ha=Ca>0,Ae=Ca<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Ye,y:a,width:Re,height:we,rx:Qe,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ha&&Dt>pt&&jsxRuntime.jsx("rect",{x:pt,y:a,width:Dt-pt,height:we,rx:0,fill:"#EF4444",opacity:.2}),ha&&jsxRuntime.jsxs("text",{x:Math.max(Dt,pt)+6,y:a+we/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ca,"d"]}),Ae&&jsxRuntime.jsxs("text",{x:Dt+6,y:a+we/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ca,"d"]})]})})(),!e.segments&&Je&&H&&(()=>{let I=a+(we-6)/2,V=14,te=a+(we-V)/2,Ce=2;return jsxRuntime.jsxs("g",{"data-task-class":j,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Fe,y:I,width:_e,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsxRuntime.jsx("rect",{x:Fe,y:te,width:Ce,height:V,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsxRuntime.jsx("rect",{x:Fe+_e-Ce,y:te,width:Ce,height:V,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&Je&&!H&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe,y:a,width:_e,height:we,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":j,initial:{opacity:0,scale:.95},animate:{opacity:Be&&!mt?.15:1,scale:re&&!Be?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>me(ee),style:{cursor:ze,pointerEvents:"all"}}),!e.segments&&!Je&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe,y:a,width:_e,height:we,rx:Qe,fill:Z,"data-task-class":j,initial:{opacity:0,scale:.95},animate:{opacity:Be&&!mt?.15:e.parentId?.6:re?.9:.8,scale:re&&!Be?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:ee=>me(ee),style:{cursor:H?"default":ze,pointerEvents:"all"}}),Je&&(ne||D)&&!e.segments&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:_e,height:we,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&&(Je&&H?null:jsxRuntime.jsx("rect",{x:Fe,y:a,width:Math.max(_e*(e.progress/100),Qe*2),height:we,rx:Qe,fill:Z,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let ee=e.progress>0?_e*(e.progress/100):0,I=Fe+ee,V=_e-ee,te=e.progress===0?Qe:0,Ce=e.progress===0?Fe:I,Pe=e.progress===0?_e:V;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Ce,y:a,width:Pe,height:we,rx:te,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Ce,y:a,width:Pe,height:we,rx:te,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),Je&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Be&&(()=>{let ee=Fe+_e*(e.progress/100),I=8,V=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:ee,cy:a+we/2,r:I,fill:V?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:ee,y:a+we/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:V?.initials||V?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((ee,I)=>{let V=(ee.startDate.getTime()-n.getTime())/864e5*s,Ce=(ee.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-V+s,Pe=Be&&L==="move"&&R===I,Ye=dt===I,Re=Pe?V+Ie:V;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Be&<(I),onMouseLeave:()=>!Be&<(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Re,y:a,width:Ce,height:we,rx:Qe,fill:Z,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Ye?.9:.8,scale:Ye&&!Be?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Dt=>{Dt.stopPropagation(),J(I),ue(V),me(Dt,void 0,V);},style:{cursor:ze,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Re,y:a,width:Ce*(e.progress/100),height:we,rx:Qe,fill:Z,opacity:1,style:{pointerEvents:"none"}})]},`segment-${I}`)}),K&&(ne||D)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D&&!ne&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:_e,height:we,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:_e,height:we,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&_e>60&&!e.segments&&!(Je&&H)&&(()=>{let ee=d.taskLabel(e),I=typeof ee=="string"?ee:e.name,V=I.length>Math.floor(_e/8)?`${I.substring(0,Math.floor(_e/8))}...`:I;return jsxRuntime.jsx("text",{x:Fe+8,y:a+we/2,dominantBaseline:"middle",fill:se?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:se?"line-through":"none"},children:V})})(),!Be&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(Je?jsxRuntime.jsxs("text",{x:Fe+_e+6,y:a+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):_e>100?jsxRuntime.jsxs("text",{x:Fe+_e-12,y:a+we/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&&_e>80&&!Be&&!e.segments&&!(Je&&H)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Fe+_e-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Fe+_e-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(re||ht)&&!mt&&!e.segments&&!H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Fe-2,y:a,width:16,height:we,fill:"transparent",style:{cursor:ye},onMouseEnter:()=>Ne("resize-start"),onMouseLeave:()=>Ne(null),onMouseDown:ee=>{ee.stopPropagation(),me(ee,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe+4,y:a+8,width:3,height:we-16,rx:1.5,fill:ae==="resize-start"||L==="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:Fe+_e-14,y:a,width:16,height:we,fill:"transparent",style:{cursor:ye},onMouseEnter:()=>Ne("resize-end"),onMouseLeave:()=>Ne(null),onMouseDown:ee=>{ee.stopPropagation(),me(ee,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe+_e-7,y:a+8,width:3,height:we-16,rx:1.5,fill:ae==="resize-end"||L==="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:re&&!Be&&!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+we/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ne("connect"),onMouseLeave:()=>Ne(null),onMouseDown:ee=>{ee.stopPropagation(),me(ee,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+we/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ae==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&fe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+we/2,x2:fe.x,y2:fe.y,stroke:F?o.statusCompleted:o.accent,strokeWidth:F?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:F?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:fe.x,cy:fe.y,r:F?8:6,fill:F?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),F&&jsxRuntime.jsx(framerMotion.motion.text,{x:fe.x+15,y:fe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:fe.x+10},animate:{opacity:1,x:fe.x+15},transition:{duration:.2},children:"Connect"})]}),(re||Be)&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe-1,y:a-1,width:_e+2,height:we+2,rx:Qe+1,fill:"none",stroke:Be?o.accent:Je?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:Je?1:2,opacity:Be||Je?.6:.4,initial:{opacity:0},animate:{opacity:Be||Je?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ht&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O+P,y1:0,x2:O+P,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&!Be&&!e.segments&&!b&&(()=>{let V=a<100,te=V?a+we+13:a-82-13,Ce=V?`M ${Fe+_e/2-6} ${a+we+3} L ${Fe+_e/2} ${a+we+13} L ${Fe+_e/2+6} ${a+we+3}`:`M ${Fe+_e/2-6} ${a-13} L ${Fe+_e/2} ${a-3} L ${Fe+_e/2+6} ${a-13}`,Pe=te+22,Ye=te+40,Re=te+55,Dt=te+70,pt=V?te+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:V?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:V?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ce,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Fe+_e/2-120,y:te,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:Fe+_e/2,y:Pe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Fe+_e/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Fe+_e/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pe(e.startDate)}),jsxRuntime.jsx("text",{x:Fe+_e/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Fe+_e/2-70,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pe(e.endDate)}),jsxRuntime.jsx("text",{x:Fe+_e/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Fe+_e/2+65,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ke()}),jsxRuntime.jsx("text",{x:Fe+_e/2+10,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Fe+_e/2+65,y:Re,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:Fe+_e/2-110,y:Dt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Fe+_e/2-50,y:Dt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ut=>Ut.name).join(", ").substring(0,30),e.assignees.map(Ut=>Ut.name).join(", ").length>30?"...":""]})]}),!V&&jsxRuntime.jsx("text",{x:Fe+_e/2,y:pt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:$?"Left: move \u2022 Right: resize":He?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var oi=260,ni=10,mn=8;function Yp({tooltipData:e,theme:t,locale:a="en",svgRef:r}){let[o,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e||!r?.current){s(null);return}let h=r.current.getBoundingClientRect(),{x:w,y:C,width:S,height:T,task:L}=e,N=L.effortMinutes!=null||L.timeLoggedMinutes!=null||L.soldEffortMinutes!=null?155:105,Y=h.left+w,O=h.top+C,le=O+T,P=Y+S/2,q=O-mn,Ke=q<N+ni?true:(false),F=Ke?le+ni:O-ni-N,U=P-oi/2;U<mn&&(U=mn),U+oi>window.innerWidth-mn&&(U=window.innerWidth-mn-oi),s({left:U,top:F,showBelow:Ke});},[e,r]),!e||!o)return null;let{task:n}=e,d=n.effortMinutes!=null||n.timeLoggedMinutes!=null||n.soldEffortMinutes!=null,u={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"},i=k=>k.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),c=()=>{if(!n.startDate||!n.endDate)return "N/A";let k=Math.ceil((n.endDate.getTime()-n.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${k} d\xEDa${k!==1?"s":""}`:`${k} day${k!==1?"s":""}`},l=k=>{if(k==null||k===0)return "N/A";let h=Math.floor(k/60),w=k%60;return h===0?`${w}m`:w===0?`${h}h`:`${h}h ${w}m`},m=t.textTertiary||"#9CA3AF",g=t.textSecondary||"#D1D5DB",y=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",v=t.bgSecondary||"#1F2937",f=t.border||"#374151",x=jsxRuntime.jsxs("div",{style:{position:"fixed",left:o.left,top:o.top,width:oi,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.15s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:v,border:`1px solid ${f}`,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:y,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(si,{label:u.start,value:n.startDate?i(n.startDate):"N/A",labelColor:m,valueColor:g}),jsxRuntime.jsx(si,{label:u.duration,value:c(),labelColor:m,valueColor:g}),jsxRuntime.jsx(si,{label:u.end,value:n.endDate?i(n.endDate):"N/A",labelColor:m,valueColor:g}),jsxRuntime.jsx(si,{label:u.progress,value:`${n.progress}%`,labelColor:m,valueColor:g})]}),n.assignees&&n.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:m},children:[u.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:g,fontWeight:500},children:n.assignees.map(k=>k.name).join(", ")})]}),d&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[n.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:m},children:[u.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:g,fontWeight:600},children:l(n.effortMinutes)})]}),n.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:m},children:[u.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:b,fontWeight:600},children:l(n.timeLoggedMinutes)})]}),n.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:m},children:[u.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:g,fontWeight:600},children:l(n.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
126
|
+
@keyframes gantt-tooltip-fade {
|
|
127
|
+
from { opacity: 0; transform: translateY(${o.showBelow?"-6px":"6px"}); }
|
|
128
|
+
to { opacity: 1; transform: translateY(0); }
|
|
129
|
+
}
|
|
130
|
+
`})]});return reactDom.createPortal(x,document.body)}function si({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 Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false,onHoverChange:u,hoverOverlayOnly:i=false}){let[,c]=react.useState(false),[l,m]=react.useState(null),g=r-t,y=g>0,b=Math.abs(g)<5,v=20,f=!b&&a<=e,x,k,h=a-e,w=e+h/2;if(k=w,n==="squared")if(b)x=`M ${e} ${t} L ${a} ${r}`;else if(f){let U=e+15,ae=a-v,Ne=y?t+20:t-20;k=ae,x=`M ${e} ${t} L ${U} ${t} L ${U} ${Ne} L ${ae} ${Ne} L ${ae} ${r} L ${a} ${r}`;}else k=a-v,x=`M ${e} ${t} L ${k} ${t} L ${k} ${r} L ${a} ${r}`;else x=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let C=5,S=`M ${a} ${r} L ${a-C} ${r-C*.5} M ${a} ${r} L ${a-C} ${r+C*.5}`,T=o.dependency,L=o.dependencyHover||T,A="#f87171",N="rgba(248, 113, 113, 0.15)",Y=k,O=(t+r)/2;if(l)if(n==="squared")if(b)Y=Math.max(e+10,Math.min(a-10,l.x)),O=t;else if(f){let F=e+15,U=a-v,ae=y?t+20:t-20,Ne=[[e,t,F,t],[F,t,F,ae],[F,ae,U,ae],[U,ae,U,r],[U,r,a,r]],R=1/0,J={x:Y,y:O};for(let X of Ne){let ue=le(l.x,l.y,X[0],X[1],X[2],X[3]),Ie=Math.hypot(l.x-ue.x,l.y-ue.y);Ie<R&&(R=Ie,J=ue);}Y=J.x,O=J.y;}else {let F=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],U=1/0,ae={x:Y,y:O};for(let Ne of F){let R=le(l.x,l.y,Ne[0],Ne[1],Ne[2],Ne[3]),J=Math.hypot(l.x-R.x,l.y-R.y);J<U&&(U=J,ae=R);}Y=ae.x,O=ae.y;}else {let F=w,U=t,ae=w,Ne=r,R=1/0,J=Y,X=O;for(let ue=0;ue<=1;ue+=.02){let Ie=1-ue,Xe=Ie*Ie*Ie*e+3*Ie*Ie*ue*F+3*Ie*ue*ue*ae+ue*ue*ue*a,dt=Ie*Ie*Ie*t+3*Ie*Ie*ue*U+3*Ie*ue*ue*Ne+ue*ue*ue*r,lt=Math.hypot(l.x-Xe,l.y-dt);lt<R&&(R=lt,J=Xe,X=dt);}Y=J,O=X;}function le(F,U,ae,Ne,R,J){let X=R-ae,ue=J-Ne,Ie=X*X+ue*ue;if(Ie===0)return {x:ae,y:Ne};let Xe=((F-ae)*X+(U-Ne)*ue)/Ie;return Xe=Math.max(0,Math.min(1,Xe)),{x:ae+Xe*X,y:Ne+Xe*ue}}let P=F=>{let U=F.currentTarget.ownerSVGElement;if(!U)return;let ae=U.getScreenCTM();if(!ae)return;let Ne=ae.inverse();m({x:Ne.a*F.clientX+Ne.c*F.clientY+Ne.e,y:Ne.b*F.clientX+Ne.d*F.clientY+Ne.f});},q=()=>{c(false),m(null),u?.(false);},fe=()=>{c(true),u?.(true);},Ke=F=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:F,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:U=>{U.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:Y,cy:O,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Y,cy:O,r:9,fill:N,stroke:A,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:Y-3,y1:O-3,x2:Y+3,y2:O+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:Y+3,y1:O-3,x2:Y-3,y2:O+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:q,onMouseMove:P,children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:L,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:L,opacity:.9,style:{pointerEvents:"none"}}),Ke({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:fe,onMouseLeave:q,onMouseMove:P,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:L,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:L,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:L,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:L,style:{pointerEvents:"none"}}),Ke({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:fe,onMouseLeave:q,onMouseMove:P,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:x,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",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:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function ci({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=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:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),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 Me={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(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,d=new Set,u=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&u(l))return true;if(d.has(l))return true}}return d.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=Me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Me.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Me.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Me.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Me.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Me.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Me.findTaskById(e,t);return !a||!a.dependencies?[]:Me.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Me.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Me.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Me.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Me.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Me.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],d=s.map(u=>{let i=u.startDate&&u.endDate?Me.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?Me.formatDate(u.startDate):"N/A",u.endDate?Me.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:d,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t)=>{let a=await import('xlsx'),r=Me.flattenTasks(e),o=new Map,s=(c,l="")=>{[...c].sort((g,y)=>(g.position??0)-(y.position??0)).forEach((g,y)=>{let b=l?`${l}.${y+1}`:`${y+1}`;o.set(g.id,b),g.subtasks?.length&&s(g.subtasks,b);});};s(e);let n=r.map(c=>{let l=c.startDate&&c.endDate?Me.calculateDuration(c.startDate,c.endDate):0,m=c.effortMinutes,g=c.timeLoggedMinutes,y=c.soldEffortMinutes;return {WBS:o.get(c.id)||"","Task Name":c.name,"Start Date":c.startDate?Me.formatDate(c.startDate):"","End Date":c.endDate?Me.formatDate(c.endDate):"","Duration (days)":l>0?l:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(b=>b.name).join(", ")||"","Estimated (h)":typeof m=="number"?+(m/60).toFixed(1):"","Logged (h)":typeof g=="number"?+(g/60).toFixed(1):"","Quoted (h)":typeof y=="number"?+(y/60).toFixed(1):"","Is Milestone":c.isMilestone?"Yes":"No"}}),d=a.utils.json_to_sheet(n),u=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},{wch:12}];d["!cols"]=u;let i=a.utils.book_new();if(a.utils.book_append_sheet(i,d,"Gantt Tasks"),!t){let c=new Date,l=g=>String(g).padStart(2,"0");t=`Project_${`${c.getFullYear()}-${l(c.getMonth()+1)}-${l(c.getDate())}_${l(c.getHours())}${l(c.getMinutes())}`}.xlsx`;}a.writeFile(i,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Me.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Me.getEarliestStartDate(e)||new Date,d=Me.getLatestEndDate(e)||new Date,u=r.map((m,g)=>{let y=o.get(m.id),b=m.startDate&&m.endDate?Me.calculateDuration(m.startDate,m.endDate):0,v=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
127
132
|
<PredecessorLink>
|
|
128
133
|
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
129
134
|
<Type>1</Type>
|
|
@@ -132,7 +137,7 @@
|
|
|
132
137
|
<LagFormat>7</LagFormat>
|
|
133
138
|
</PredecessorLink>`).join("");return `
|
|
134
139
|
<Task>
|
|
135
|
-
<UID>${
|
|
140
|
+
<UID>${y}</UID>
|
|
136
141
|
<ID>${g+1}</ID>
|
|
137
142
|
<Name>${m.name.replace(/[<>&'"]/g,f=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[f]||f)}</Name>
|
|
138
143
|
<Type>0</Type>
|
|
@@ -205,7 +210,7 @@
|
|
|
205
210
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
206
211
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
207
212
|
<IsPublished>1</IsPublished>
|
|
208
|
-
<CommitmentType>0</CommitmentType>${
|
|
213
|
+
<CommitmentType>0</CommitmentType>${v}
|
|
209
214
|
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
210
215
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
211
216
|
<SaveVersion>14</SaveVersion>
|
|
@@ -215,7 +220,7 @@
|
|
|
215
220
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
216
221
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
217
222
|
<StartDate>${s(n)}</StartDate>
|
|
218
|
-
<FinishDate>${s(
|
|
223
|
+
<FinishDate>${s(d)}</FinishDate>
|
|
219
224
|
<FYStartDate>1</FYStartDate>
|
|
220
225
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
221
226
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -351,16 +356,16 @@
|
|
|
351
356
|
</WeekDays>
|
|
352
357
|
</Calendar>
|
|
353
358
|
</Calendars>
|
|
354
|
-
<Tasks>${
|
|
359
|
+
<Tasks>${u}
|
|
355
360
|
</Tasks>
|
|
356
|
-
</Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),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 p=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 v=t.find(b=>b.id===g);if(v){o(v);let b=r.get(g)?.ef||0;d=Math.max(d,b);}}let m=d+p;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 p=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),m=s;if(d.length>0)for(let v of d){l(v);let b=n.get(v.id)?.ls||0;m=Math.min(m,b);}let g=m-p;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(i.id);}}return c},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)=>{let r=Pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Pe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=Pe.calculateDuration(n.startDate,n.endDate),c;a!==void 0?(c=new Date(n.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=Pe.calculateEndDate(c,l),p=d=>d.map(m=>m.id===n.id?{...m,startDate:c,endDate:i}:m.subtasks?{...m,subtasks:p(m.subtasks)}:m);s=p(s),s=Pe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),p=1e3*60*60*24,d=Pe.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,v,b=new Set)=>{if(b.has(g))return;b.add(g);let y=Pe.getDependentTasks(e,g);for(let f of y){if(!f.startDate||!f.endDate)continue;let x=r.findIndex(w=>w.id===f.id);if(x===-1)continue;let k=f.startDate.getTime(),N=(f.endDate.getTime()-k)/p,D=(k-i)/p*s,C=D+v*s,B=Math.max(N*s,s),E=l+x*n+12;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:C,width:B,y:E,rowIndex:x,daysDelta:v,color:f.color}),m(f.id,v,b);}};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=p=>p.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function ni({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:g,onDependencyCreate:v,onDependencyDelete:b,showBaseline:y}){let x=wr(),[k,h]=react.useState([]),[N,T]=react.useState(null),[D,C]=react.useState(null),B=react.useRef(false),[E,w]=react.useState(new Set),[U,$]=react.useState(null),Z=react.useCallback(j=>{if(D&&!B.current){let ue=j.target,ae=false;for(;ue&&ue!==j.currentTarget;){if(ue.getAttribute?.("data-dependency-line")==="true"||ue.getAttribute?.("data-dependency-hover-overlay")==="true"){ae=true;break}ue=ue.parentElement;}ae||C(null);}},[D]),F=react.useCallback(j=>{T(j);},[]),K=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),le=r==="day"?60:r==="week"?20:8,Ie=K*le*n,A=j=>{let ue=new Date(Date.UTC(j.getFullYear(),j.getMonth(),j.getDate())),ae=ue.getUTCDay()||7;ue.setUTCDate(ue.getUTCDate()+4-ae);let Fe=new Date(Date.UTC(ue.getUTCFullYear(),0,1));return Math.ceil(((ue.getTime()-Fe.getTime())/864e5+1)/7)},_=j=>{let ue=j.getDay();return ue===0||ue===6},ve=react.useCallback(j=>{let ue=Math.round(j/(le*n)),ae=new Date(o);return ae.setDate(ae.getDate()+ue),ae},[o,le,n]),Qe=react.useCallback((j,ue)=>{if(ue.startDate&&ue.endDate)return;let ae=j.currentTarget.ownerSVGElement;if(!ae)return;let Fe=ae.createSVGPoint();Fe.x=j.clientX,Fe.y=j.clientY;let $e=Fe.matrixTransform(ae.getScreenCTM()?.inverse()),Re=ve($e.x),ct=new Date(Re);ct.setDate(ct.getDate()+1),$(null),g?.(ue,Re,ct);},[ve,g]),O=react.useCallback((j,ue,ae)=>{let Fe=j.currentTarget.ownerSVGElement;if(!Fe)return;let $e=Fe.createSVGPoint();$e.x=j.clientX,$e.y=j.clientY;let Re=$e.matrixTransform(Fe.getScreenCTM()?.inverse()),ct=ve(Re.x),et=Math.round(Re.x/(le*n))*le*n;$({taskId:ue.id,x:et,y:ae*a+a/2,date:ct});},[ve,le,n,a]),Q=react.useCallback(()=>{$(null);},[]),te=react.useMemo(()=>{let j=$e=>$e.map(Re=>{if(Re.subtasks&&Re.subtasks.length>0){let ct=j(Re.subtasks),je=ct.filter(et=>et.startDate&&et.endDate);if(je.length>0){let et=je.map(ee=>ee.startDate.getTime()),Le=je.map(ee=>ee.endDate.getTime()),pt=new Date(Math.min(...et)),P=new Date(Math.max(...Le));return {...Re,subtasks:ct,startDate:pt,endDate:P}}return {...Re,subtasks:ct}}return Re}),ue=($e,Re=[])=>{let ct=[...$e].sort((je,et)=>(je.position??0)-(et.position??0));for(let je of ct)Re.push(je),je.subtasks&&je.subtasks.length>0&&(je.isExpanded===void 0||je.isExpanded)&&ue(je.subtasks,Re);return Re},ae=j(e);return ue(ae)},[e]),Ue=react.useCallback(j=>{if(!j.startDate||!j.endDate)return {x:0,width:0};let ue=j.startDate.getTime(),ae=j.endDate.getTime(),Fe=o.getTime(),$e=(ue-Fe)/(1e3*60*60*24),Re=(ae-ue)/(1e3*60*60*24),ct=$e*le*n,je=Math.max(le*n,40),et=Math.max(Re*le*n,je);return {x:ct,width:et}},[o,le,n]),rt=react.useMemo(()=>te.filter(j=>j.startDate&&j.endDate).map(j=>{let{x:ue,width:ae}=Ue(j),$e=te.findIndex(Re=>Re.id===j.id)*a+14;return {id:j.id,x:ue,y:$e,width:ae,height:24}}),[te,Ue]),Ze=react.useCallback((j,ue,ae)=>{if(!ae||ue===0){h([]);return}let Fe=Pe.calculateCascadePreview(e,j,ue,te,o,le*n,a,48);h(Fe);},[e,te,o,le,n,a,48]),mt=react.useMemo(()=>{let j=[],ue=new Date(o);for(;ue<=s;){let $e=(ue.getTime()-o.getTime())/864e5*le*n;if(r==="day")j.push({date:new Date(ue),label:ue.toLocaleDateString(l,{day:"numeric",month:"short"}),x:$e}),ue.setDate(ue.getDate()+1);else if(r==="week"){let Re=A(ue);j.push({date:new Date(ue),label:`${x.labels.week} ${Re}`,x:$e}),ue.setDate(ue.getDate()+7);}else j.push({date:new Date(ue),label:ue.toLocaleDateString(l,{month:"short",year:"numeric"}),x:$e}),ue.setMonth(ue.getMonth()+1);}return j},[o,s,r,le,n,l,x.labels.week]),Ce=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*le*n,[o,le,n]),se=Math.max(te.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(Ie,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ie,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),mt.map((j,ue)=>jsxRuntime.jsxs("g",{children:[ue>0&&jsxRuntime.jsx("line",{x1:j.x,y1:0,x2:j.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:j.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:j.label})]},`header-${ue}`)),Ce>=0&&Ce<=Ie&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:Ce,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:Ce,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${Ce-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:x.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{width:Math.max(Ie,1e3),height:se,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Z,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:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(-45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"10",stroke:"rgba(255,255,255,0.015)",strokeWidth:"5"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ie,1e3),height:se,fill:t.bgPrimary}),mt.map((j,ue)=>{let ae=mt[ue+1]?.x||Ie,Fe=_(j.date);return jsxRuntime.jsxs("g",{children:[Fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:j.x,y:0,width:ae-j.x,height:te.length*a,fill:t.neonRedGlow?"rgba(17,17,17,0.4)":t.bgWeekend,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("rect",{x:j.x,y:0,width:ae-j.x,height:te.length*a,fill:"url(#weekend-hatch)",opacity:1})]}),ue>0&&jsxRuntime.jsx("line",{x1:j.x,y1:0,x2:j.x,y2:te.length*a,stroke:t.borderLight,strokeWidth:1,opacity:t.neonRedGlow?1:.1})]},ue)}),te.map((j,ue)=>{let ae=j.startDate&&j.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:ue*a,width:Ie,height:a,fill:ue%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${j.id}`),!ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ue*a,width:Ie,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Fe=>Qe(Fe,j),onMouseMove:Fe=>O(Fe,j,ue),onMouseLeave:()=>{Q();}},`clickable-${j.id}`),U&&U.taskId===j.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:U.x,y1:ue*a+4,x2:U.x,y2:ue*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:U.x,cy:U.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:U.x,cy:U.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${U.x}, ${ue*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:U.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!U||U.taskId!==j.id)&&jsxRuntime.jsx("text",{x:Ce>0?Ce:100,y:ue*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:x.labels.clickToSetDates},`placeholder-${j.id}`)]})]},`row-group-${j.id}`)}),te.map((j,ue)=>{if(!j.startDate||!j.endDate)return null;let{x:ae,width:Fe}=Ue(j),$e=ue*a+14,Re=j.subtasks&&j.subtasks.length>0&&!j.isMilestone;if(j.isMilestone)return jsxRuntime.jsx(ri,{task:j,x:ae+Fe/2,y:$e+12,theme:t,onClick:p},j.id);if(Re){let je=$e+12,et=2,Le=8,pt="rgba(255,255,255,0.25)";return jsxRuntime.jsxs("g",{onClick:()=>p?.(j),onContextMenu:P=>{P.preventDefault(),P.stopPropagation(),m?.(j,P);},onMouseEnter:()=>{F({task:j,x:ae,y:je,width:Fe,height:4,showBelow:je<100});},onMouseLeave:()=>F(null),style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:ae,y:$e,width:Fe,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ae,y:je,width:Fe,height:4,fill:pt}),jsxRuntime.jsx("rect",{x:ae,y:je,width:et,height:4+Le,fill:pt}),jsxRuntime.jsx("rect",{x:ae+Fe-et,y:je,width:et,height:4+Le,fill:pt})]},j.id)}return jsxRuntime.jsx(ti,{task:j,x:ae,y:$e,width:Fe,theme:t,dayWidth:le*n,startDate:o,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:g,onDependencyCreate:v,allTaskPositions:rt,onDragMove:Ze,onHoverChange:F,showBaseline:y},j.id)}),te.map((j,ue)=>!j.dependencies||j.dependencies.length===0||!j.startDate||!j.endDate?null:j.dependencies.map(ae=>{let Fe=te.find(ee=>ee.id===ae);if(!Fe||!Fe.startDate||!Fe.endDate)return null;let $e=te.findIndex(ee=>ee.id===ae),Re=Ue(Fe),ct=Ue(j),je=Re.x+Re.width,et=$e*a+26,Le=ct.x,pt=ue*a+26,P=`dep-${ae}-${j.id}`;return E.has(P)?null:jsxRuntime.jsx(Un,{x1:je,y1:et,x2:Le,y2:pt,theme:t,lineStyle:i,onDelete:()=>b?.(j.id,ae),onHoverChange:ee=>{B.current=ee,ee&&C({key:P,fromId:ae,toId:j.id,exitX:je,exitY:et,enterX:Le,enterY:pt});}},P)})),k.map(j=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:j.previewX,y:j.y-48,width:j.width,height:32,rx:8,fill:j.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(j.daysDelta)>0&&jsxRuntime.jsx("text",{x:j.previewX+j.width/2,y:j.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:j.daysDelta>0?`+${j.daysDelta}d`:`${j.daysDelta}d`})]},`cascade-preview-${j.taskId}`)),D&&jsxRuntime.jsx(Un,{x1:D.exitX,y1:D.exitY,x2:D.enterX,y2:D.enterY,theme:t,lineStyle:i,onDelete:()=>{let j=D.key;C(null),B.current=false,w(ue=>new Set(ue).add(j)),b?.(D.toId,D.fromId);},hoverOverlayOnly:true,onHoverChange:j=>{B.current=j,j||C(null);}},`${D.key}-hover-overlay`),Ce>=0&&Ce<=Ie&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:Ce,y1:0,x2:Ce,y2:se,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:Ce,y1:0,x2:Ce,y2:se,stroke:t.today,strokeWidth:1,opacity:1})]}),N&&jsxRuntime.jsx(Bp,{tooltipData:N,theme:t,locale:l==="es"?"es":"en"})]})]})}var Wx=['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"'],Op=({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"})}),Gx=()=>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"})}),Vx=()=>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"})}),_x=()=>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"})}),jx=()=>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 li({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,p]=react.useState(false),[d,m]=react.useState(false),[g,v]=react.useState([]),[b,y]=react.useState(""),[f,x]=react.useState(false),[k,h]=react.useState(true),[N,T]=react.useState(""),[D,C]=react.useState(-1),[B,E]=react.useState(false),[w,U]=react.useState(0),$=react.useRef(null),Z=react.useRef(null),F=react.useRef(null),K=react.useRef(null),{enabled:le=true,placeholder:Ie='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:_,suggestions:ve=Wx,maxHistory:Qe=50,persistHistory:O,mentionableUsers:Q=[]}=a,te=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ue=te?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",rt=te?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ze=te?"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)",mt=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Ce=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",se=te?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",j=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",ue=te?"rgba(46, 148, 255, 0.9)":"#2E94FF",ae=te?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Fe=te?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",$e=te?"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)",Re=te?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ct=te?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",je=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",et=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Le=te?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",pt=te?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",P=te?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",ee=te?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ke=te?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Be="rgba(46, 148, 255, 0.04)",W=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",pe=te?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",dt=te?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ee=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",qe=te?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ke=te?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Xe=te?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ot=te?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",R="rgba(46, 148, 255, 0.06)",de=te?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ne=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",ye=te?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",he=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",tt=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",fe=te?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Y=te?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",De=te?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",be=te?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",We=te?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",H=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=te?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",He=te?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",I=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",J=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",G=O?.storageKey||"gantt-ai-history",ge=O?.maxMessages??5,Je=Q.filter(q=>{if(!N)return true;let at=N.toLowerCase();return q.name.toLowerCase().includes(at)||q.email&&q.email.toLowerCase().includes(at)}).slice(0,5),ft=react.useCallback(q=>{if(y(q),Q.length===0)return;let at=$.current;if(!at)return;let At=at.selectionStart||q.length,S=q.slice(0,At),ie=S.lastIndexOf("@");if(ie>=0&&((ie>0?S[ie-1]:" ")===" "||ie===0)){let Ge=S.slice(ie+1);if(Ge.length<=40){T(Ge),C(ie),E(true),U(0);return}}E(false),T(""),C(-1);},[Q.length]),bt=react.useCallback(q=>{let at=b.slice(0,D),At=b.slice(D+1+N.length),S=`${at}@${q.name} ${At}`;y(S),E(false),T(""),C(-1),setTimeout(()=>$.current?.focus(),0);},[b,D,N]),Fa=react.useCallback(q=>{if(!B||Je.length===0)return false;if(q.key==="ArrowDown")return q.preventDefault(),U(at=>at<Je.length-1?at+1:0),true;if(q.key==="ArrowUp")return q.preventDefault(),U(at=>at>0?at-1:Je.length-1),true;if(q.key==="Enter"||q.key==="Tab"){q.preventDefault();let at=Je[w];return at&&bt(at),true}return q.key==="Escape"?(E(false),true):false},[B,Je,w,bt]);react.useEffect(()=>{if(O?.enabled)try{let q=localStorage.getItem(G);if(q){let At=JSON.parse(q).map(S=>({...S,timestamp:new Date(S.timestamp)}));v(At.slice(-ge));}}catch(q){console.warn("[GanttAIAssistant] Failed to load persisted history:",q);}},[O?.enabled,G,ge]),react.useEffect(()=>{if(O?.enabled&&g.length>0)try{let q=g.filter(at=>!at.isLoading).slice(-ge);localStorage.setItem(G,JSON.stringify(q));}catch(q){console.warn("[GanttAIAssistant] Failed to persist history:",q);}},[g,O?.enabled,G,ge]),react.useEffect(()=>{Z.current&&Z.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&$.current&&setTimeout(()=>$.current?.focus(),100);},[i,d]);let Yt=react.useCallback(q=>{if(q.success)switch(q.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":q.taskId&&q.updates&&o?.(q.taskId,q.updates);break;case "create_task":q.newTask&&s?.(q.newTask);break;case "delete_task":q.taskId&&n?.(q.taskId);break;case "link_tasks":q.dependencyFrom&&q.dependencyTo&&l?.(q.dependencyFrom,q.dependencyTo);break;case "unlink_tasks":q.taskId&&q.dependencyFrom&&c?.(q.taskId,q.dependencyFrom);break}},[o,s,n,l,c]),Pa=react.useCallback(async q=>{if(!q.trim()||f)return;let at={id:`user-${Date.now()}`,role:"user",content:q,timestamp:new Date};v(S=>[...S.slice(-(Qe-1)),at]),y(""),h(false),x(true);let At={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(S=>[...S,At]);try{if(_){let S=await _(q,e);v(ie=>{let ze=ie.filter(xt=>!xt.isLoading),Ge={id:`assistant-${Date.now()}`,role:"assistant",content:S.message,timestamp:new Date,command:S};return [...ze,Ge]}),Yt(S);}else v(S=>[...S.filter(ze=>!ze.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(S){v(ie=>[...ie.filter(Ge=>!Ge.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[f,Qe,_,e,Yt]),Fr=q=>{q.preventDefault(),Pa(b);},Ya=q=>{y(q),$.current?.focus();};if(react.useEffect(()=>{let q=at=>{(at.metaKey||at.ctrlKey)&&at.key==="k"&&(at.preventDefault(),p(At=>!At),i||m(false)),at.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[i]),react.useEffect(()=>{if(!i)return;let q=At=>{let S=At.target;F.current&&!F.current.contains(S)&&p(false);},at=setTimeout(()=>{document.addEventListener("mousedown",q);},100);return ()=>{clearTimeout(at),document.removeEventListener("mousedown",q);}},[i]),!le)return null;let Ae={"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(Pt,{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 ${Ae[A]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ue,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${rt}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ze,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${mt}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Ce}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Op,{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:se,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${j}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
361
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(c),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=Me.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Me.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let y=t.find(b=>b.id===g);if(y){o(y);let b=r.get(g)?.ef||0;l=Math.max(l,b);}}let m=l+c;r.set(i.id,{es:l,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Me.calculateDuration(i.startDate,i.endDate):0,l=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),m=s;if(l.length>0)for(let y of l){d(y);let b=n.get(y.id)?.ls||0;m=Math.min(m,b);}let g=m-c;n.set(i.id,{ls:g,lf:m});};a.forEach(d);let u=[];for(let i of a){let c=r.get(i.id),l=n.get(i.id);if(c&&l){let m=l.ls-c.es;Math.abs(m)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=Me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Me.calculateCriticalPath(e).includes(t))return 0;let o=Me.getDependentTasks(e,t);if(o.length===0){let d=Me.getLatestEndDate(e);if(!d)return null;let u=Me.calculateDuration(a.endDate,d);return Math.max(0,u)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,u)=>d-u)[0];if(!s)return null;let n=Me.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Me.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Me.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=Me.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=Me.calculateEndDate(u,d),c=l=>l.map(m=>m.id===n.id?{...m,startDate:u,endDate:i}:m.subtasks?{...m,subtasks:c(m.subtasks)}:m);s=c(s),s=Me.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,l=Me.findTaskById(e,t);if(!l||!l.endDate)return [];let m=(g,y,b=new Set)=>{if(b.has(g))return;b.add(g);let v=Me.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let x=r.findIndex(N=>N.id===f.id);if(x===-1)continue;let k=f.startDate.getTime(),w=(f.endDate.getTime()-k)/c,S=(k-i)/c*s,T=S+y*s,L=Math.max(w*s,s),A=d+x*n+(n-18)/2;u.push({taskId:f.id,taskName:f.name,originalX:S,previewX:T,width:L,y:A,rowIndex:x,daysDelta:y,color:f.color}),m(f.id,y,b);}};return m(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Me.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=c=>c.map(l=>l.id===o.id?{...l,endDate:d,segments:u}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function pi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:u,dependencyLineStyle:i="curved",showTaskBarLabels:c=true,onTaskClick:l,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:b,onDependencyDelete:v,showBaseline:f,showCriticalPath:x=true,showDependencies:k=true,highlightWeekends:h=true,canEditTask:w}){let S=Tr(),T=react.useRef(null),[L,A]=react.useState([]),[N,Y]=react.useState(null),[O,le]=react.useState(null),[P,q]=react.useState(null),fe=react.useRef(false),[Ke,F]=react.useState(new Set),[U,ae]=react.useState(null),Ne=react.useCallback(H=>{if(P&&!fe.current){let ne=H.target,D=false;for(;ne&&ne!==H.currentTarget;){if(ne.getAttribute?.("data-dependency-line")==="true"||ne.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}ne=ne.parentElement;}D||q(null);}},[P]),R=react.useCallback(H=>{le(H);},[]),J=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),X=r==="day"?60:r==="week"?20:8,ue=J*X*n,Ie=H=>{let ne=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=ne.getUTCDay()||7;ne.setUTCDate(ne.getUTCDate()+4-D);let K=new Date(Date.UTC(ne.getUTCFullYear(),0,1));return Math.ceil(((ne.getTime()-K.getTime())/864e5+1)/7)},Xe=H=>{let ne=H.getDay();return ne===0||ne===6},dt=react.useCallback(H=>{let ne=Math.round(H/(X*n)),D=new Date(o);return D.setDate(D.getDate()+ne),D},[o,X,n]),lt=react.useCallback((H,ne)=>{if(ne.startDate&&ne.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let K=D.createSVGPoint();K.x=H.clientX,K.y=H.clientY;let se=K.matrixTransform(D.getScreenCTM()?.inverse()),be=dt(se.x),G=new Date(be);G.setDate(G.getDate()+1),ae(null),y?.(ne,be,G);},[dt,y]),re=react.useCallback((H,ne,D)=>{let K=H.currentTarget.ownerSVGElement;if(!K)return;let se=K.createSVGPoint();se.x=H.clientX,se.y=H.clientY;let be=se.matrixTransform(K.getScreenCTM()?.inverse()),G=dt(be.x),ze=Math.round(be.x/(X*n))*X*n;ae({taskId:ne.id,x:ze,y:D*a+a/2,date:G});},[dt,X,n,a]),ct=react.useCallback(()=>{ae(null);},[]),Be=react.useMemo(()=>{let H=se=>se.map(be=>{if(be.subtasks&&be.subtasks.length>0){let G=H(be.subtasks),Z=G.filter(ze=>ze.startDate&&ze.endDate);if(Z.length>0){let ze=Z.map(He=>He.startDate.getTime()),ye=Z.map(He=>He.endDate.getTime()),Ue=new Date(Math.min(...ze)),Se=new Date(Math.max(...ye));return {...be,subtasks:G,startDate:Ue,endDate:Se}}return {...be,subtasks:G}}return be}),ne=(se,be=[])=>{let G=[...se].sort((Z,ze)=>(Z.position??0)-(ze.position??0));for(let Z of G)be.push(Z),Z.subtasks&&Z.subtasks.length>0&&(Z.isExpanded===void 0||Z.isExpanded)&&ne(Z.subtasks,be);return be},D=H(e);return ne(D)},[e]),ht=react.useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let ne=H.startDate.getTime(),D=H.endDate.getTime(),K=o.getTime(),se=(ne-K)/(1e3*60*60*24),be=(D-ne)/(1e3*60*60*24)+1,G=se*X*n,Z=Math.max(X*n,40),ze=Math.max(be*X*n,Z);return {x:G,width:ze}},[o,X,n]),mt=react.useMemo(()=>Be.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:ne,width:D}=ht(H),se=Be.findIndex(be=>be.id===H.id)*a+(a-18)/2;return {id:H.id,x:ne,y:se,width:D,height:18}}),[Be,ht]),Ct=react.useCallback((H,ne,D)=>{if(!D){A([]),Y(null);return}if(Y({taskId:H,daysDelta:ne}),ne===0){A([]);return}let K=Me.calculateCascadePreview(e,H,ne,Be,o,X*n,a,48);A(K);},[e,Be,o,X,n,a,48]),we=react.useCallback((H,ne)=>{if(!N)return ne;let D=X*n,K=N.daysDelta*D;if(H===N.taskId)return {x:ne.x+K,width:ne.width};let se=L.find(be=>be.taskId===H);return se?{x:se.previewX,width:se.width}:ne},[N,L,X,n]),Je=react.useMemo(()=>{let H=[],ne=new Date(o);for(;ne<=s;){let se=(ne.getTime()-o.getTime())/864e5*X*n;if(r==="day")H.push({date:new Date(ne),label:ne.toLocaleDateString(d,{day:"numeric",month:"short"}),x:se}),ne.setDate(ne.getDate()+1);else if(r==="week"){let be=Ie(ne);H.push({date:new Date(ne),label:`${S.labels.week} ${be}`,x:se}),ne.setDate(ne.getDate()+7);}else H.push({date:new Date(ne),label:ne.toLocaleDateString(d,{month:"short",year:"numeric"}),x:se}),ne.setMonth(ne.getMonth()+1);}return H},[o,s,r,X,n,d,S.labels.week]),tt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*X*n,[o,X,n]),Qe=Math.max(Be.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(ue,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ue,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),Je.map((H,ne)=>jsxRuntime.jsxs("g",{children:[ne>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-${ne}`)),tt>=0&&tt<=ue&&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:S.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:T,width:Math.max(ue,1e3),height:Qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ne,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(ue,1e3),height:Qe,fill:t.bgPrimary}),Be.map((H,ne)=>jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Math.max(ue,1e3),height:a,fill:ne%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),Je.map((H,ne)=>ne>0?jsxRuntime.jsx("line",{x1:H.x,y1:0,x2:H.x,y2:Be.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ne}`):null),h&&Je.map((H,ne)=>{let D=Je[ne+1]?.x||ue;return Xe(H.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:H.x,y:0,width:D-H.x,height:Be.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:D-H.x,height:Be.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ne}`):null}),Be.map((H,ne)=>{let D=H.startDate&&H.endDate;return jsxRuntime.jsx("g",{children:!D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ne*a,width:ue,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>lt(K,H),onMouseMove:K=>re(K,H,ne),onMouseLeave:()=>{ct();}},`clickable-${H.id}`),U&&U.taskId===H.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:U.x,y1:ne*a+4,x2:U.x,y2:ne*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:U.x,cy:U.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:U.x,cy:U.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${U.x}, ${ne*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:U.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!U||U.taskId!==H.id)&&jsxRuntime.jsx("text",{x:tt>0?tt:100,y:ne*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:S.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),Be.map((H,ne)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:K}=ht(H),se=ne*a+(a-18)/2,be=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsxRuntime.jsx(ci,{task:H,x:D+K/2,y:se+12,theme:t,onClick:l},H.id);if(be){let Z=se+(a-18)/2+8,ze=1.5,ye=6,Ue="rgba(255,255,255,0.25)";return jsxRuntime.jsxs("g",{onClick:()=>l?.(H),onContextMenu:Se=>{Se.preventDefault(),Se.stopPropagation(),g?.(H,Se);},onMouseEnter:()=>{R({task:H,x:D,y:Z,width:K,height:2,showBelow:Z<100});},onMouseLeave:()=>R(null),style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:D,y:se,width:K,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:D,y:Z,width:K,height:2,fill:Ue}),jsxRuntime.jsx("rect",{x:D,y:Z,width:ze,height:2+ye,fill:Ue}),jsxRuntime.jsx("rect",{x:D+K-ze,y:Z,width:ze,height:2+ye,fill:Ue})]},H.id)}return jsxRuntime.jsx(ri,{task:H,x:D,y:se,width:K,theme:t,dayWidth:X*n,startDate:o,templates:u,onClick:l,onDoubleClick:m,onContextMenu:g,onDateChange:y,onDependencyCreate:b,allTaskPositions:mt,onDragMove:Ct,onHoverChange:R,showBaseline:f,showTaskBarLabels:c,showCriticalPath:x,readOnly:w?!w(H):false},H.id)}),k&&Be.map((H,ne)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let K=Be.find(He=>He.id===D);if(!K||!K.startDate||!K.endDate)return null;let se=Be.findIndex(He=>He.id===D),be=we(K.id,ht(K)),G=we(H.id,ht(H)),Z=be.x+be.width,ze=se*a+26,ye=G.x,Ue=ne*a+26,Se=`dep-${D}-${H.id}`;return Ke.has(Se)?null:jsxRuntime.jsx(Vn,{x1:Z,y1:ze,x2:ye,y2:Ue,theme:t,lineStyle:i,onDelete:()=>v?.(H.id,D),onHoverChange:He=>{fe.current=He,He&&q({key:Se,fromId:D,toId:H.id,exitX:Z,exitY:ze,enterX:ye,enterY:Ue});}},Se)})),L.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}`)),k&&P&&jsxRuntime.jsx(Vn,{x1:P.exitX,y1:P.exitY,x2:P.enterX,y2:P.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=P.key;q(null),fe.current=false,F(ne=>new Set(ne).add(H)),v?.(P.toId,P.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{fe.current=H,H||q(null);}},`${P.key}-hover-overlay`),tt>=0&&tt<=ue&&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})]})]}),O&&jsxRuntime.jsx(Yp,{tooltipData:O,theme:t,locale:d==="es"?"es":"en",svgRef:T})]})}var nv=['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"'],Jp=({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"})}),sv=()=>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"})}),iv=()=>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"})}),lv=()=>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"})}),dv=()=>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 fi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:u}){let[i,c]=react.useState(false),[l,m]=react.useState(false),[g,y]=react.useState([]),[b,v]=react.useState(""),[f,x]=react.useState(false),[k,h]=react.useState(true),[w,C]=react.useState(""),[S,T]=react.useState(-1),[L,A]=react.useState(false),[N,Y]=react.useState(0),O=react.useRef(null),le=react.useRef(null),P=react.useRef(null),q=react.useRef(null),{enabled:fe=true,placeholder:Ke='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:F="bottom-right",onCommand:U,suggestions:ae=nv,maxHistory:Ne=50,persistHistory:R,mentionableUsers:J=[]}=a,X=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",ue=X?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ie=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Xe=X?"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)",dt=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",lt=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",re=X?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",ct=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Be=X?"rgba(46, 148, 255, 0.9)":"#2E94FF",ht=X?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ct=X?"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)",we=X?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",Je=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Qe=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=X?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ne=X?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=X?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",K=X?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",se=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",be="rgba(46, 148, 255, 0.04)",G=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",Z=X?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",ze=X?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ye=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Se=X?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",He=X?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",$=X?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",pe="rgba(46, 148, 255, 0.06)",ke=X?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ve=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",st=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ze=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",me=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",qe=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Pt=X?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Fe=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",_e=X?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",j=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",xe=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ee=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",I=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",V=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",te=R?.storageKey||"gantt-ai-history",Ce=R?.maxMessages??5,Pe=J.filter(z=>{if(!w)return true;let ve=w.toLowerCase();return z.name.toLowerCase().includes(ve)||z.email&&z.email.toLowerCase().includes(ve)}).slice(0,5),Ye=react.useCallback(z=>{if(v(z),J.length===0)return;let ve=O.current;if(!ve)return;let Ot=ve.selectionStart||z.length,M=z.slice(0,Ot),de=M.lastIndexOf("@");if(de>=0&&((de>0?M[de-1]:" ")===" "||de===0)){let et=M.slice(de+1);if(et.length<=40){C(et),T(de),A(true),Y(0);return}}A(false),C(""),T(-1);},[J.length]),Re=react.useCallback(z=>{let ve=b.slice(0,S),Ot=b.slice(S+1+w.length),M=`${ve}@${z.name} ${Ot}`;v(M),A(false),C(""),T(-1),setTimeout(()=>O.current?.focus(),0);},[b,S,w]),Dt=react.useCallback(z=>{if(!L||Pe.length===0)return false;if(z.key==="ArrowDown")return z.preventDefault(),Y(ve=>ve<Pe.length-1?ve+1:0),true;if(z.key==="ArrowUp")return z.preventDefault(),Y(ve=>ve>0?ve-1:Pe.length-1),true;if(z.key==="Enter"||z.key==="Tab"){z.preventDefault();let ve=Pe[N];return ve&&Re(ve),true}return z.key==="Escape"?(A(false),true):false},[L,Pe,N,Re]);react.useEffect(()=>{if(R?.enabled)try{let z=localStorage.getItem(te);if(z){let Ot=JSON.parse(z).map(M=>({...M,timestamp:new Date(M.timestamp)}));y(Ot.slice(-Ce));}}catch(z){console.warn("[GanttAIAssistant] Failed to load persisted history:",z);}},[R?.enabled,te,Ce]),react.useEffect(()=>{if(R?.enabled&&g.length>0)try{let z=g.filter(ve=>!ve.isLoading).slice(-Ce);localStorage.setItem(te,JSON.stringify(z));}catch(z){console.warn("[GanttAIAssistant] Failed to persist history:",z);}},[g,R?.enabled,te,Ce]),react.useEffect(()=>{le.current&&le.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!l&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,l]);let pt=react.useCallback(z=>{if(z.success)switch(z.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":z.taskId&&z.updates&&o?.(z.taskId,z.updates);break;case "create_task":z.newTask&&s?.(z.newTask);break;case "delete_task":z.taskId&&n?.(z.taskId);break;case "link_tasks":z.dependencyFrom&&z.dependencyTo&&d?.(z.dependencyFrom,z.dependencyTo);break;case "unlink_tasks":z.taskId&&z.dependencyFrom&&u?.(z.taskId,z.dependencyFrom);break}},[o,s,n,d,u]),Ut=react.useCallback(async z=>{if(!z.trim()||f)return;let ve={id:`user-${Date.now()}`,role:"user",content:z,timestamp:new Date};y(M=>[...M.slice(-(Ne-1)),ve]),v(""),h(false),x(true);let Ot={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(M=>[...M,Ot]);try{if(U){let M=await U(z,e);y(de=>{let $e=de.filter(yt=>!yt.isLoading),et={id:`assistant-${Date.now()}`,role:"assistant",content:M.message,timestamp:new Date,command:M};return [...$e,et]}),pt(M);}else y(M=>[...M.filter($e=>!$e.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(M){y(de=>[...de.filter(et=>!et.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${M instanceof Error?M.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[f,Ne,U,e,pt]),Ca=z=>{z.preventDefault(),Ut(b);},ha=z=>{v(z),O.current?.focus();};if(react.useEffect(()=>{let z=ve=>{(ve.metaKey||ve.ctrlKey)&&ve.key==="k"&&(ve.preventDefault(),c(Ot=>!Ot),i||m(false)),ve.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),react.useEffect(()=>{if(!i)return;let z=Ot=>{let M=Ot.target;P.current&&!P.current.contains(M)&&c(false);},ve=setTimeout(()=>{document.addEventListener("mousedown",z);},100);return ()=>{clearTimeout(ve),document.removeEventListener("mousedown",z);}},[i]),!fe)return null;let Ae={"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(Lt,{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 ${Ae[F]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ue,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ie}`,color:"#2E94FF",cursor:"pointer",boxShadow:Xe,overflow:"visible"},onClick:()=>c(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${dt}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${lt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Jp,{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:Be,background:re,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ct}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
357
362
|
@keyframes ai-fab-pulse {
|
|
358
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
359
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
360
365
|
}
|
|
361
|
-
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:F,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 ${Ae[A]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ae,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Fe}`,boxShadow:$e},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Re,borderBottom:`1px solid ${ct}`},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:je,border:`1px solid ${et}`,color:"#2E94FF"},children:jsxRuntime.jsx(Op,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Le},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(q=>!q),className:"p-1.5 rounded-lg transition-colors",style:{color:pt},onMouseEnter:q=>{q.currentTarget.style.background=ee,q.currentTarget.style.color=P;},onMouseLeave:q=>{q.currentTarget.style.background="transparent",q.currentTarget.style.color=pt;},children:jsxRuntime.jsx(_x,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:pt},onMouseEnter:q=>{q.currentTarget.style.background=ee,q.currentTarget.style.color=P;},onMouseLeave:q=>{q.currentTarget.style.background="transparent",q.currentTarget.style.color=pt;},children:jsxRuntime.jsx(Vx,{})})]})]}),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&&k&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ke,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ve.slice(0,4).map((q,at)=>jsxRuntime.jsx("button",{onClick:()=>Ya(q),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Be,color:pe,border:`1px solid ${W}`},onMouseEnter:At=>{At.currentTarget.style.borderColor=dt,At.currentTarget.style.color="#2E94FF";},onMouseLeave:At=>{At.currentTarget.style.borderColor=W,At.currentTarget.style.color=pe;},children:q.length>30?q.slice(0,30)+"...":q},at))})]}),g.map(q=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${q.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${q.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:q.role==="user"?Ee:Ke,color:q.role==="user"?"#2E94FF":ot,border:q.role==="user"?`1px solid ${qe}`:`1px solid ${Xe}`},children:[q.isLoading?jsxRuntime.jsx(jx,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:q.content}),q.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:q.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:q.command.success?"#10B981":"#EF4444",border:`1px solid ${q.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[q.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:q.command.type.replace(/_/g," ")})]})]})},q.id)),jsxRuntime.jsx("div",{ref:Z})]}),jsxRuntime.jsxs("form",{onSubmit:q=>{if(B&&Je.length>0){q.preventDefault();return}Fr(q);},className:"p-3 relative",style:{borderTop:`1px solid ${R}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&Je.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:K,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:De,border:`1px solid ${be}`,boxShadow:We,backdropFilter:"blur(12px)"},children:Je.map((q,at)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>bt(q),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:at===w?H:"transparent",color:ne},onMouseEnter:()=>U(at),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:I,border:`1px solid ${J}`,color:"#2E94FF"},children:q.name.split(" ").map(At=>At[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:q.name}),q.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:He},children:q.email})]})]},q.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:de,border:`1px solid ${Ne}`},children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:b,onChange:q=>ft(q.target.value),onKeyDown:q=>{Fa(q);},placeholder:Ie,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:ye,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?he:"transparent",color:b.trim()?"#2E94FF":fe,border:b.trim()?`1px solid ${tt}`:"1px solid transparent"},children:jsxRuntime.jsx(Gx,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Y,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function $p(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)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 p=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:p,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,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 Hp({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 Xx={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 zp(e){return {...Xx,...e}}var ov=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Gp=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,availableUsers:p=[],templates:d,enableAutoCriticalPath:m=true,persistExpandedState:g,persistFilter:v,clearFiltersKey:b,aiAssistant:y,locale:f="en",customTranslations:x,showCreateTaskButton:k=false,createTaskLabel:h,onCreateTask:N,taskFilter:T,onTaskFilterChange:D,toolbarRightContent:C,showBaseline:B,viewMode:E,onViewModeChange:w,projectForecast:U,onThemeChange:$,onTaskClick:Z,onTaskDblClick:F,onTaskContextMenu:K,onTaskUpdate:le,onProgressChange:Ie,onTaskEdit:A,onTaskAddSubtask:_,onTaskMarkIncomplete:ve,onTaskSetInProgress:Qe,onDependencyCreate:O,onDependencyDelete:Q,onBeforeTaskAdd:te,onAfterTaskAdd:Ue,onBeforeTaskUpdate:rt,onAfterTaskUpdate:Ze,onBeforeTaskDelete:mt,onAfterTaskDelete:Ce,permissions:se}=a,ue=react.useContext(Ws)?.theme,[ae,Fe]=react.useState(ue||s||"dark"),[$e,Re]=react.useState(n),[ct,je]=react.useState(l),[et,Le]=react.useState(1),[pt,P]=react.useState("all"),[ee,ke]=react.useState(E||"execution"),Be=E??ee,W=react.useCallback(M=>{ke(M),w?.(M);},[w]),pe=B??Be==="oracle";react.useEffect(()=>{a.onTimeScaleChange?.($e);},[$e]),react.useEffect(()=>{a.onZoomChange?.(et);},[et]);let dt=react.useRef(a.onDateRangeChange);dt.current=a.onDateRangeChange;let Ee=react.useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[qe,Ke]=react.useState(()=>{if(!v)return "all";try{let M=typeof v=="string"?v:"gantt-filter-state",L=localStorage.getItem(M);if(L){let V=JSON.parse(L);if(V.taskFilter)return V.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Xe=T??qe,ot=D??Ke,[R,de]=react.useState(()=>{if(!v)return false;try{let M=typeof v=="string"?v:"gantt-filter-state",L=localStorage.getItem(M);if(L){let V=JSON.parse(L);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=Ee();if(M)try{let L={taskFilter:Xe,hideCompleted:R};localStorage.setItem(M,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving filter state to localStorage:",L);}},[Xe,R,Ee]);let Ne=react.useRef(b);react.useEffect(()=>{if(Ne.current!==b&&b!==void 0){Ke("all"),de(false);let M=Ee();if(M)try{localStorage.removeItem(M);}catch(L){console.warn("[GanttBoard] Error clearing filter state from localStorage:",L);}}Ne.current=b;},[b,Ee]);let[ye,he]=react.useState(0),[tt,fe]=react.useState(false),[Y,De]=react.useState(null),[be,We]=react.useState({isOpen:false,x:0,y:0,task:null}),[H,ne]=react.useState(null),[He,I]=react.useState(null);react.useEffect(()=>{ue&&ue!==ae&&Fe(ue);},[ue]),react.useEffect(()=>{s&&s!==ae&&Fe(s);},[s]);let J=react.useCallback(M=>{Fe(M),$?.(M);},[$]),{state:G,setState:ge,undo:Je,redo:ft,canUndo:bt,canRedo:Fa,clearHistory:Yt}=$p(t,50),Pa=react.useMemo(()=>{let M=(L,V=0)=>{let X=V;for(let xe of L)xe.subtasks?.length&&(X=Math.max(X,M(xe.subtasks,V+1)));return X};return M(G)+1},[G]),Fr=react.useCallback(()=>g?typeof g=="string"?g:"gantt-expanded-tasks":null,[g]),Ya=react.useRef(new Map),Ae=react.useRef(false);if(!Ae.current&&g){Ae.current=true;let M=typeof g=="string"?g:"gantt-expanded-tasks";try{let L=localStorage.getItem(M);if(L){let V=JSON.parse(L);Array.isArray(V)&&(Ya.current=new Map(V));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let q=react.useCallback(()=>{let M=Fr();if(M)try{let L=Array.from(Ya.current.entries());localStorage.setItem(M,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[Fr]),at=react.useRef(0),At=react.useRef(false),S=react.useCallback(M=>{P(M),at.current+=1,ge(L=>{let V=(xe,Se=0)=>xe.map(Ct=>{let st=M==="all"||Se<M-1;return Ct.subtasks?.length&&Ya.current.set(Ct.id,st),{...Ct,isExpanded:st,subtasks:Ct.subtasks?V(Ct.subtasks,Se+1):void 0}}),X=V(L);return q(),X});},[ge,q]);react.useEffect(()=>{if(at.current>0){at.current-=1;return}let M=V=>{let X=new Map;for(let xe of V){let Se=xe.id;X.get(Se)||X.set(Se,xe);}return Array.from(X.values())},L=V=>V.map(X=>{let xe=Ya.current.get(X.id),Se=xe!==void 0?{...X,isExpanded:xe}:X;if(Se.subtasks?.length){let Ct=M(Se.subtasks);return {...Se,subtasks:L(Ct)}}return Se});if(Ya.current.size>0)ge(cr(L(t)));else {let V=X=>X.map(xe=>xe.subtasks?.length?{...xe,subtasks:M(V(xe.subtasks))}:xe);ge(cr(V(t)));}},[t,ge]);let ie=react.useRef(t),ze=react.useRef(true);react.useEffect(()=>{if(ze.current){ze.current=false,ie.current=G;return}if(At.current){At.current=false,ie.current=G;return}if(!r)return;let M=JSON.stringify(ie.current),L=JSON.stringify(G);M!==L&&(ie.current=G,r(G));},[G,r]);let Ge=react.useMemo(()=>jl(f,x),[f,x]),xt=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}],[]),[pa,ma]=react.useState(()=>xt(Ge));react.useEffect(()=>{ma(M=>M.map(L=>({...L,label:Ge.columns[L.id==="name"?"taskName":L.id]||L.label})));},[Ge]);let Wa=react.useMemo(()=>pa.filter(L=>L.visible).reduce((L,V)=>L+V.width,0),[pa]),ga=react.useRef(pa.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=pa.filter(X=>X.visible),L=M.map(X=>X.id).join(","),V=ga.current;if(L!==V){let X=M.some(Se=>Se.id!=="name"),xe=V.includes(",");X?!xe&&X&&De(null):De(null),ga.current=L;}},[pa]);let Oa=60,zo=.6,h0=react.useMemo(()=>{let L=Wa+Oa,V=typeof window<"u"?window.innerWidth*zo:800,X=Math.max(L,V);return Y!==null?Math.max(200,Math.min(Y,X)):Math.max(200,L)},[Y,Wa]),Xr=react.useRef(null),ls=react.useRef(null),Pr=react.useRef(null),bn=react.useRef(null),jt=react.useMemo(()=>ip(ae),[ae]),y0=react.useMemo(()=>({theme:jt,themeName:ae}),[jt,ae]),mc=react.useMemo(()=>zp(d),[d]),Ri=react.useMemo(()=>{if(!m)return G;let M=Pe.calculateCriticalPath(G),L=V=>V.map(X=>({...X,isCriticalPath:M.includes(X.id),subtasks:X.subtasks?L(X.subtasks):void 0}));return L(G)},[G,m]),gc=react.useMemo(()=>{if(Xe==="all"&&!R)return Ri;let M=L=>{let V=[];for(let X of L){let xe=X.subtasks?.length?M(X.subtasks):void 0,Se=false;if(R)Se=X.progress<100;else switch(Xe){case "all":Se=true;break;case "incomplete":Se=X.progress<100;break;case "in_progress":Se=X.progress>0&&X.progress<100;break;case "completed":Se=X.progress===100;break}(Se||xe&&xe.length>0)&&V.push({...X,subtasks:xe});}return V};return M(Ri)},[Ri,Xe,R]),ds=ov(ct);Hp({undo:Je,redo:ft,canUndo:bt,canRedo:Fa,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>Pe.findTaskById(G,M),addTask:(M,L)=>{ge(V=>{if(!L)return [...V,{...M,level:0}];let X=xe=>xe.map(Se=>Se.id===L?{...Se,subtasks:[...Se.subtasks||[],{...M,parentId:L,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:X(Se.subtasks)}:Se);return X(V)});},updateTask:(M,L)=>{ge(V=>{let X=xe=>xe.map(Se=>Se.id===M?{...Se,...L}:Se.subtasks?{...Se,subtasks:X(Se.subtasks)}:Se);return X(V)});},deleteTask:M=>{ge(L=>{let V=X=>X.filter(xe=>xe.id===M?false:(xe.subtasks&&(xe.subtasks=V(xe.subtasks)),true));return V(L)});},deleteTasks:M=>{ge(L=>Zl(L,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let L=Pe.findTaskById(G,M);L&&a.onTaskDuplicate(L);}else ge(L=>Rn(L,[M]).tasks);},splitTask:(M,L,V=3)=>{ge(X=>Pe.splitTask(X,M,L,V));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(M,L)=>!Pe.validateDependencies(G,M,L),getAllTasks:()=>Pe.flattenTasks(G),getTasksByStatus:M=>Pe.flattenTasks(G).filter(L=>L.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=>{ge(L=>cr(Xl(L,[M])));},outdentTask:M=>{ge(L=>cr(Jl(L,[M])));},moveTask:(M,L)=>{ge(V=>Ql(V,[M],L));},createSubtask:async M=>{let{tasks:L,newTask:V}=ad(G,M);if(te){let X=te({...V,parentId:M});if((X instanceof Promise?await X:X)===false)return}ge(cr(L)),Ue&&Ue({...V,parentId:M});},scrollToTask:M=>{let V=Pe.flattenTasks(G).findIndex(X=>X.id===M);if(V!==-1&&Xr.current){let X=V*ds;Xr.current.scrollTo({top:X,behavior:"smooth"}),Pr.current&&Pr.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(M,L=2e3)=>{},expandTask:M=>{ge(L=>{let V=X=>X.map(xe=>xe.id===M?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe);return V(L)});},collapseTask:M=>{ge(L=>{let V=X=>X.map(xe=>xe.id===M?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe);return V(L)});},expandAll:()=>{ge(M=>{let L=V=>V.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?L(X.subtasks):void 0}));return L(M)});},collapseAll:()=>{ge(M=>{let L=V=>V.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?L(X.subtasks):void 0}));return L(M)});},collapseToLevel:M=>{S(M);},undo:Je,redo:ft,canUndo:()=>bt,canRedo:()=>Fa,clearHistory:Yt,exportToPNG:async()=>{if(!bn.current||!Xr.current||!Pr.current)throw new Error("Gantt container not found");let M=bn.current,L=Xr.current,V=ls.current||L.querySelector(".gantt-grid-scroll"),X=Pr.current,xe=V?.scrollTop||0,Se=X.scrollTop,Ct=M.style.overflow,st=M.style.height,Ta=L.style.overflow;try{let Ft=V?.querySelector(".gantt-taskgrid-content"),Na=X.querySelector("svg"),er=Ft?.scrollHeight||V?.scrollHeight||600,xo=Na?.getBoundingClientRect().height||X.scrollHeight,yn=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(er,xo)+20;V&&(V.scrollTop=0),X.scrollTop=0,M.style.overflow="visible",M.style.height=`${yn}px`,L.style.overflow="visible",await new Promise(Vo=>setTimeout(Vo,100));let Jr=await htmlToImage.toPng(M,{backgroundColor:jt.bgPrimary,pixelRatio:2,filter:Vo=>{if(!(Vo instanceof Element))return !0;let ps=window.getComputedStyle(Vo),xn=parseInt(ps.zIndex,10);return (isNaN(xn)||xn<50)&&ps.position!=="fixed"}});return await(await fetch(Jr)).blob()}finally{M.style.overflow=Ct,M.style.height=st,L.style.overflow=Ta,V&&(V.scrollTop=xe),X.scrollTop=Se;}},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 L=Pe.importFromJSON(M);ge(L);},getTasks:()=>G,refresh:()=>{ge(M=>[...M]);},clearAll:()=>{ge([]);}}),[G,Je,ft,bt,Fa,Yt,jt,ds]);let x0=react.useCallback(M=>{ma(L=>L.map(V=>V.id===M?{...V,visible:!V.visible}:V));},[]),v0=react.useCallback((M,L)=>{ma(V=>V.map(X=>{if(X.id!==M)return X;let xe=X.minWidth??100,Se=X.maxWidth??800,Ct=Math.max(xe,Math.min(Se,L));return {...X,width:Ct}}));},[]),k0=react.useCallback(M=>{ge(L=>{let V=td(L,M),X=xe=>{for(let Se of xe){if(Se.id===M){Ya.current.set(M,Se.isExpanded??true);return}Se.subtasks?.length&&X(Se.subtasks);}};return X(V),q(),V}),a.onTaskToggleExpand?.(M);},[a,q]),Uo=react.useCallback((M,L)=>{if(rt&&rt(M,L)===false)return;let X=Pe.findTaskById(G,M)?.progress,xe=Ct=>Ct.map(st=>st.id===M?{...st,...L}:st.subtasks?{...st,subtasks:xe(st.subtasks)}:st);ge(xe(G));let Se=Pe.findTaskById(xe(G),M);Se&&(le?.(Se),Ze?.(Se),L.progress!==void 0&&X!==void 0&&L.progress!==X&&Ie?.(M,X,L.progress));},[G,le,rt,Ze,Ie]),w0=react.useCallback(M=>{M.length!==0&&(at.current+=1,At.current=true,ge(L=>cr(Xl(L,M))),a.onTaskIndent?.(M[0]));},[a]),C0=react.useCallback(M=>{M.length!==0&&(at.current+=1,At.current=true,ge(L=>cr(Jl(L,M))),a.onTaskOutdent?.(M[0]));},[a]),T0=react.useCallback((M,L,V)=>{at.current+=1,At.current=true,ge(X=>cr(Sp(X,M,L,V))),a.onTaskReparent?.(M,L,V);},[a]),N0=react.useCallback((M,L)=>{M.length!==0&&(at.current+=1,At.current=true,ge(V=>Ql(V,M,L)),a.onTaskMove?.(M[0],L));},[a]),Oi=react.useCallback(async M=>{let L=[];for(let V of M)mt&&await Promise.resolve(mt(V))===false||L.push(V);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(ge(V=>cr(Zl(V,L))),L.forEach(V=>a.onTaskDelete?.(V))),Ce&&L.forEach(V=>Ce(V)));},[a,mt,Ce]),D0=react.useCallback(M=>{a.onTaskDuplicate?M.forEach(L=>{let V=Pe.findTaskById(G,L);V&&a.onTaskDuplicate(V);}):ge(L=>Rn(L,M).tasks);},[a,G]),S0=react.useCallback((M,L)=>{ge(V=>{let{tasks:X,newTask:xe}=Dp(V,M,L);return te&&te(xe)===false?V:(a.onTaskCreate?.(xe.parentId,xe.position||0),Ue?.(xe),X)});},[a,te,Ue]),E0=react.useCallback((M,L)=>{ge(V=>ed(V,M,L)),a.onTaskRename?.(M,L);},[a]),$i=react.useCallback(M=>{let{onTaskAddSubtask:L}=a;if(L){let V=Xs(G,M);if(V){L(V);return}}ge(V=>{let{tasks:X}=ad(V,M);return a.onTaskCreate?.(M,0),X});},[a,G]),F0=react.useCallback((M,L,V)=>{let X=!M.startDate&&!M.endDate,xe=M.startDate?Math.round((L.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Se=Ta=>Ta.map(Ft=>Ft.id===M.id?{...Ft,startDate:L,endDate:V,...M.segments&&{segments:M.segments}}:Ft.subtasks?{...Ft,subtasks:Se(Ft.subtasks)}:Ft),Ct=Se(G);Ct=Pe.autoScheduleDependents(Ct,M.id,xe),Ct=cr(Ct),ge(Ct);let st={...M,startDate:L,endDate:V};X&&a?.onTaskDateChange?a.onTaskDateChange(M,L,V):le?.(st);},[G,le,a]),P0=react.useCallback((M,L)=>{K?.(M,L),We({isOpen:true,x:L.clientX,y:L.clientY,task:M});},[K]),M0=react.useCallback((M,L)=>{let V=Pe.splitTask(G,M.id,L);ge(V),We({isOpen:false,x:0,y:0,task:null});},[G]),fc=react.useCallback(M=>{let L=Pe.findTaskById(G,M.id)||M;F?.(L),A||ne(L);},[G,F,A]),bc=react.useCallback((M,L,V)=>{let X=new Map,xe=Ft=>{Ft.forEach(Na=>{Na.dependencies&&X.set(Na.id,Na.dependencies),Na.subtasks&&xe(Na.subtasks);});};xe(V);let Se=X.get(L)||[];X.set(L,[...Se,M]);let Ct=new Set,st=new Set,Ta=Ft=>{if(!Ct.has(Ft)){Ct.add(Ft),st.add(Ft);let Na=X.get(Ft)||[];for(let er of Na){if(!Ct.has(er)&&Ta(er))return true;if(st.has(er))return true}}return st.delete(Ft),false};return Ta(L)},[]),hc=react.useCallback((M,L)=>{if(bc(M.id,L,G)){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:P,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ae[F]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ht,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Ct},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:we,borderBottom:`1px solid ${Je}`},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(Jp,{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(z=>!z),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:z=>{z.currentTarget.style.background=K,z.currentTarget.style.color=D;},onMouseLeave:z=>{z.currentTarget.style.background="transparent",z.currentTarget.style.color=ne;},children:jsxRuntime.jsx(lv,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:z=>{z.currentTarget.style.background=K,z.currentTarget.style.color=D;},onMouseLeave:z=>{z.currentTarget.style.background="transparent",z.currentTarget.style.color=ne;},children:jsxRuntime.jsx(iv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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&&k&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:se,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ae.slice(0,4).map((z,ve)=>jsxRuntime.jsx("button",{onClick:()=>ha(z),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:be,color:Z,border:`1px solid ${G}`},onMouseEnter:Ot=>{Ot.currentTarget.style.borderColor=ze,Ot.currentTarget.style.color="#2E94FF";},onMouseLeave:Ot=>{Ot.currentTarget.style.borderColor=G,Ot.currentTarget.style.color=Z;},children:z.length>30?z.slice(0,30)+"...":z},ve))})]}),g.map(z=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${z.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${z.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:z.role==="user"?ye:Se,color:z.role==="user"?"#2E94FF":$,border:z.role==="user"?`1px solid ${Ue}`:`1px solid ${He}`},children:[z.isLoading?jsxRuntime.jsx(dv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:z.content}),z.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:z.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:z.command.success?"#10B981":"#EF4444",border:`1px solid ${z.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[z.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:z.command.type.replace(/_/g," ")})]})]})},z.id)),jsxRuntime.jsx("div",{ref:le})]}),jsxRuntime.jsxs("form",{onSubmit:z=>{if(L&&Pe.length>0){z.preventDefault();return}Ca(z);},className:"p-3 relative",style:{borderTop:`1px solid ${pe}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&Pe.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:q,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:Pt,border:`1px solid ${Fe}`,boxShadow:_e,backdropFilter:"blur(12px)"},children:Pe.map((z,ve)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Re(z),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ve===N?j:"transparent",color:xe},onMouseEnter:()=>Y(ve),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:I,border:`1px solid ${V}`,color:"#2E94FF"},children:z.name.split(" ").map(Ot=>Ot[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:z.name}),z.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:ee},children:z.email})]})]},z.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ke,border:`1px solid ${Ve}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:b,onChange:z=>Ye(z.target.value),onKeyDown:z=>{Dt(z);},placeholder:Ke,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:st,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?Ze:"transparent",color:b.trim()?"#2E94FF":qe,border:b.trim()?`1px solid ${me}`:"1px solid transparent"},children:jsxRuntime.jsx(sv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Qp(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(l=>{let m=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:m};if(!c)return {...l,present:m};let g=[...l.past,l.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],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:c,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:l}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function Zp({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=d?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&u&&n.key==="y"){n.preventDefault(),t();return}if(d&&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 mv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Me.formatDate(e.startDate)} - ${Me.formatDate(e.endDate)}`);let a=Me.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function em(e){return {...mv,...e}}var kv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},rm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:u=true,showExportButton:i=true,projectName:c,availableUsers:l=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:b,clearFiltersKey:v,aiAssistant:f,locale:x="en",customTranslations:k,showCreateTaskButton:h=false,createTaskLabel:w,onCreateTask:C,taskFilter:S,onTaskFilterChange:T,toolbarRightContent:L,showBaseline:A,viewMode:N,onViewModeChange:Y,projectForecast:O,onThemeChange:le,onTaskClick:P,onTaskDblClick:q,onTaskContextMenu:fe,onTaskUpdate:Ke,onProgressChange:F,onTaskEdit:U,onTaskAddSubtask:ae,onTaskMarkIncomplete:Ne,onTaskSetInProgress:R,onDependencyCreate:J,onDependencyDelete:X,onBeforeTaskAdd:ue,onAfterTaskAdd:Ie,onBeforeTaskUpdate:Xe,onAfterTaskUpdate:dt,onBeforeTaskDelete:lt,onAfterTaskDelete:re,permissions:ct,onCopySnapshotLink:Be}=a,mt=react.useContext(_s)?.theme,[Ct,we]=react.useState(mt||s||"dark"),[Je,tt]=react.useState(n),[Qe,H]=react.useState(d),[ne,D]=react.useState(1),[K,se]=react.useState("all"),[be,G]=react.useState(N||"execution"),Z=N??be,ze=react.useCallback(E=>{G(E),Y?.(E);},[Y]),ye=A??Z==="oracle",[Ue,Se]=react.useState(a.showCriticalPath!==false),[He,$]=react.useState(a.showDependencies!==false),[pe,ke]=react.useState(a.highlightWeekends!==false),Ve=react.useCallback(E=>{Se(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),st=react.useCallback(E=>{$(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),Ze=react.useCallback(E=>{ke(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(Je);},[Je]),react.useEffect(()=>{a.onZoomChange?.(ne);},[ne]);let me=react.useRef(a.onDateRangeChange);me.current=a.onDateRangeChange;let qe=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[gt,Pt]=react.useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",B=localStorage.getItem(E);if(B){let _=JSON.parse(B);if(_.taskFilter)return _.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Fe=S??gt,_e=T??Pt,[j,xe]=react.useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",B=localStorage.getItem(E);if(B){let _=JSON.parse(B);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=qe();if(E)try{let B={taskFilter:Fe,hideCompleted:j};localStorage.setItem(E,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Fe,j,qe]);let ee=react.useRef(v);react.useEffect(()=>{if(ee.current!==v&&v!==void 0){Pt("all"),xe(false);let E=qe();if(E)try{localStorage.removeItem(E);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}ee.current=v;},[v,qe]);let[I,V]=react.useState(0),[te,Ce]=react.useState(false),[Pe,Ye]=react.useState(null),[Re,Dt]=react.useState({isOpen:false,x:0,y:0,task:null}),[pt,Ut]=react.useState(null),[Ca,ha]=react.useState(null);react.useEffect(()=>{mt&&mt!==Ct&&we(mt);},[mt]),react.useEffect(()=>{s&&s!==Ct&&we(s);},[s]);let Ae=react.useCallback(E=>{we(E),le?.(E);},[le]),{state:z,setState:ve,undo:Ot,redo:M,canUndo:de,canRedo:$e,clearHistory:et}=Qp(t,50),yt=react.useMemo(()=>{let E=(B,_=0)=>{let Q=_;for(let he of B)he.subtasks?.length&&(Q=Math.max(Q,E(he.subtasks,_+1)));return Q};return E(z)+1},[z]),Ha=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),ta=react.useRef(new Map),tr=react.useRef(false);if(!tr.current&&y){tr.current=true;let E=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(E);if(B){let _=JSON.parse(B);Array.isArray(_)&&(ta.current=new Map(_));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let na=react.useCallback(()=>{let E=Ha();if(E)try{let B=Array.from(ta.current.entries());localStorage.setItem(E,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[Ha]),sa=react.useRef(0),Wo=react.useRef(z);react.useEffect(()=>{Wo.current=z;},[z]);let Go=react.useRef(false),wc=react.useCallback(E=>{se(E),sa.current+=1,ve(B=>{let _=(he,Ee=0)=>he.map(Tt=>{let rt=E==="all"||Ee<E-1;return Tt.subtasks?.length&&ta.current.set(Tt.id,rt),{...Tt,isExpanded:rt,subtasks:Tt.subtasks?_(Tt.subtasks,Ee+1):void 0}}),Q=_(B);return na(),Q});},[ve,na]);react.useEffect(()=>{if(sa.current>0){sa.current-=1;return}let E=_=>{let Q=new Map;for(let he of _){let Ee=he.id;Q.get(Ee)||Q.set(Ee,he);}return Array.from(Q.values())},B=_=>_.map(Q=>{let he=ta.current.get(Q.id),Ee=he!==void 0?{...Q,isExpanded:he}:Q;if(Ee.subtasks?.length){let Tt=E(Ee.subtasks);return {...Ee,subtasks:B(Tt)}}return Ee});if(ta.current.size>0)ve(mr(B(t)));else {let _=Q=>Q.map(he=>he.subtasks?.length?{...he,subtasks:E(_(he.subtasks))}:he);ve(mr(_(t)));}},[t,ve]);let ds=react.useRef(t),Cc=react.useRef(true);react.useEffect(()=>{if(Cc.current){Cc.current=false,ds.current=z;return}if(Go.current){Go.current=false,ds.current=z;return}if(!r)return;let E=JSON.stringify(ds.current),B=JSON.stringify(z);E!==B&&(ds.current=z,r(z));},[z,r]);let za=react.useMemo(()=>td(x,k),[x,k]),M0=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Vo,Vi]=react.useState(()=>M0(za));react.useEffect(()=>{Vi(E=>E.map(B=>({...B,label:za.columns[B.id==="name"?"taskName":B.id]||B.label})));},[za]);let cs=react.useMemo(()=>Vo.filter(B=>B.visible).reduce((B,_)=>B+_.width,0),[Vo]),Tc=react.useRef(Vo.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=Vo.filter(Q=>Q.visible),B=E.map(Q=>Q.id).join(","),_=Tc.current;if(B!==_){let Q=E.some(Ee=>Ee.id!=="name"),he=_.includes(",");Q?!he&&Q&&Ye(null):Ye(null),Tc.current=B;}},[Vo]);let Nc=60,Dc=.6,A0=react.useMemo(()=>{let B=cs+Nc,_=typeof window<"u"?window.innerWidth*Dc:800,Q=Math.max(B,_);return Pe!==null?Math.max(200,Math.min(Pe,Q)):Math.max(200,B)},[Pe,cs]),Zr=react.useRef(null),us=react.useRef(null),Ar=react.useRef(null),wn=react.useRef(null),qt=react.useMemo(()=>wp(Ct),[Ct]),L0=react.useMemo(()=>({theme:qt,themeName:Ct}),[qt,Ct]),Sc=react.useMemo(()=>em(m),[m]),_i=react.useMemo(()=>{if(!g)return z;let E=Me.calculateCriticalPath(z),B=_=>_.map(Q=>({...Q,isCriticalPath:E.includes(Q.id),subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(z)},[z,g]),Ec=react.useMemo(()=>{if(Fe==="all"&&!j)return _i;let E=B=>{let _=[];for(let Q of B){let he=Q.subtasks?.length?E(Q.subtasks):void 0,Ee=false;if(j)Ee=Q.progress<100;else switch(Fe){case "all":Ee=true;break;case "incomplete":Ee=Q.progress<100;break;case "in_progress":Ee=Q.progress>0&&Q.progress<100;break;case "completed":Ee=Q.progress===100;break}(Ee||he&&he.length>0)&&_.push({...Q,subtasks:he});}return _};return E(_i)},[_i,Fe,j]),ps=kv(Qe);Zp({undo:Ot,redo:M,canUndo:de,canRedo:$e,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>Me.findTaskById(z,E),addTask:(E,B)=>{ve(_=>{if(!B)return [..._,{...E,level:0}];let Q=he=>he.map(Ee=>Ee.id===B?{...Ee,subtasks:[...Ee.subtasks||[],{...E,parentId:B,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:Q(Ee.subtasks)}:Ee);return Q(_)});},updateTask:(E,B)=>{ve(_=>{let Q=he=>he.map(Ee=>Ee.id===E?{...Ee,...B}:Ee.subtasks?{...Ee,subtasks:Q(Ee.subtasks)}:Ee);return Q(_)});},deleteTask:E=>{ve(B=>{let _=Q=>Q.filter(he=>he.id===E?false:(he.subtasks&&(he.subtasks=_(he.subtasks)),true));return _(B)});},deleteTasks:E=>{ve(B=>ld(B,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let B=Me.findTaskById(z,E);B&&a.onTaskDuplicate(B);}else ve(B=>Wn(B,[E]).tasks);},splitTask:(E,B,_=3)=>{ve(Q=>Me.splitTask(Q,E,B,_));},calculateEndDate:Me.calculateEndDate,calculateDuration:Me.calculateDuration,validateDependency:(E,B)=>!Me.validateDependencies(z,E,B),getAllTasks:()=>Me.flattenTasks(z),getTasksByStatus:E=>Me.flattenTasks(z).filter(B=>B.status===E),getTasksByParent:E=>E?Me.findTaskById(z,E)?.subtasks||[]:z.filter(_=>!_.parentId),getCriticalPath:()=>Me.flattenTasks(z).filter(E=>E.isCriticalPath),indentTask:E=>{ve(B=>mr(nd(B,[E])));},outdentTask:E=>{ve(B=>mr(sd(B,[E])));},moveTask:(E,B)=>{ve(_=>id(_,[E],B));},createSubtask:async E=>{let{tasks:B,newTask:_}=ud(z,E);if(ue){let Q=ue({..._,parentId:E});if((Q instanceof Promise?await Q:Q)===false)return}ve(mr(B)),Ie&&Ie({..._,parentId:E});},scrollToTask:E=>{let _=Me.flattenTasks(z).findIndex(Q=>Q.id===E);if(_!==-1&&Zr.current){let Q=_*ps;Zr.current.scrollTo({top:Q,behavior:"smooth"}),Ar.current&&Ar.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(E,B=2e3)=>{},expandTask:E=>{ve(B=>{let _=Q=>Q.map(he=>he.id===E?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:_(he.subtasks)}:he);return _(B)});},collapseTask:E=>{ve(B=>{let _=Q=>Q.map(he=>he.id===E?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:_(he.subtasks)}:he);return _(B)});},expandAll:()=>{ve(E=>{let B=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(E)});},collapseAll:()=>{ve(E=>{let B=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(E)});},collapseToLevel:E=>{wc(E);},undo:Ot,redo:M,canUndo:()=>de,canRedo:()=>$e,clearHistory:et,exportToPNG:async()=>{if(!wn.current||!Zr.current||!Ar.current)throw new Error("Gantt container not found");let E=wn.current,B=Zr.current,_=us.current||B.querySelector(".gantt-grid-scroll"),Q=Ar.current,he=_?.scrollTop||0,Ee=Q.scrollTop,Tt=E.style.overflow,rt=E.style.height,Sa=B.style.overflow;try{let At=_?.querySelector(".gantt-taskgrid-content"),Ea=Q.querySelector("svg"),ar=At?.scrollHeight||_?.scrollHeight||600,ko=Ea?.getBoundingClientRect().height||Q.scrollHeight,Tn=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ar,ko)+20;_&&(_.scrollTop=0),Q.scrollTop=0,E.style.overflow="visible",E.style.height=`${Tn}px`,B.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let eo=await htmlToImage.toPng(E,{backgroundColor:qt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let fs=window.getComputedStyle(Yo),Nn=parseInt(fs.zIndex,10);return (isNaN(Nn)||Nn<50)&&fs.position!=="fixed"}});return await(await fetch(eo)).blob()}finally{E.style.overflow=Tt,E.style.height=rt,B.style.overflow=Sa,_&&(_.scrollTop=he),Q.scrollTop=Ee;}},exportToPDF:async E=>{await Me.exportToPDF(z,E);},exportToExcel:async E=>{await Me.exportToExcel(z,E);},exportToJSON:()=>Me.exportToJSON(z),exportToCSV:()=>Me.exportToCSV(z),importFromJSON:E=>{let B=Me.importFromJSON(E);ve(B);},getTasks:()=>z,refresh:()=>{ve(E=>[...E]);},clearAll:()=>{ve([]);}}),[z,Ot,M,de,$e,et,qt,ps]);let I0=react.useCallback(E=>{Vi(B=>B.map(_=>_.id===E?{..._,visible:!_.visible}:_));},[]),B0=react.useCallback((E,B)=>{Vi(_=>_.map(Q=>{if(Q.id!==E)return Q;let he=Q.minWidth??100,Ee=Q.maxWidth??800,Tt=Math.max(he,Math.min(Ee,B));return {...Q,width:Tt}}));},[]),R0=react.useCallback(E=>{ve(B=>{let _=cd(B,E),Q=he=>{for(let Ee of he){if(Ee.id===E){ta.current.set(E,Ee.isExpanded??true);return}Ee.subtasks?.length&&Q(Ee.subtasks);}};return Q(_),na(),_}),a.onTaskToggleExpand?.(E);},[a,na]),_o=react.useCallback((E,B)=>{if(Xe&&Xe(E,B)===false)return;let Q=Me.findTaskById(z,E)?.progress,he=Tt=>Tt.map(rt=>rt.id===E?{...rt,...B}:rt.subtasks?{...rt,subtasks:he(rt.subtasks)}:rt);ve(he(z));let Ee=Me.findTaskById(he(z),E);Ee&&(Ke?.(Ee),dt?.(Ee),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&F?.(E,Q,B.progress));},[z,Ke,Xe,dt,F]),O0=react.useCallback(E=>{E.length!==0&&(sa.current+=1,Go.current=true,ve(B=>mr(nd(B,E))),a.onTaskIndent?.(E[0]));},[a]),$0=react.useCallback(E=>{E.length!==0&&(sa.current+=1,Go.current=true,ve(B=>mr(sd(B,E))),a.onTaskOutdent?.(E[0]));},[a]),H0=react.useCallback((E,B,_)=>{sa.current+=1,Go.current=true,ve(Q=>mr(zp(Q,E,B,_))),a.onTaskReparent?.(E,B,_);},[a]),z0=react.useCallback((E,B)=>{E.length!==0&&(sa.current+=1,Go.current=true,ve(_=>id(_,E,B)),a.onTaskMove?.(E[0],B));},[a]),ji=react.useCallback(async E=>{let B=[];for(let _ of E)lt&&await Promise.resolve(lt(_))===false||B.push(_);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):(ve(_=>mr(ld(_,B))),B.forEach(_=>a.onTaskDelete?.(_))),re&&B.forEach(_=>re(_)));},[a,lt,re]),U0=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(B=>{let _=Me.findTaskById(z,B);_&&a.onTaskDuplicate(_);}):ve(B=>Wn(B,E).tasks);},[a,z]),W0=react.useCallback((E,B)=>{ve(_=>{let{tasks:Q,newTask:he}=Hp(_,E,B);return ue&&ue(he)===false?_:(a.onTaskCreate?.(he.parentId,he.position||0),Ie?.(he),Q)});},[a,ue,Ie]),G0=react.useCallback((E,B)=>{ve(_=>dd(_,E,B)),a.onTaskRename?.(E,B);},[a]),Ki=react.useCallback(E=>{let{onTaskAddSubtask:B}=a;if(B){let _=Qs(z,E);if(_){B(_);return}}ve(_=>{let{tasks:Q}=ud(_,E);return a.onTaskCreate?.(E,0),Q});},[a,z]),V0=react.useCallback((E,B,_)=>{let Q=!E.startDate&&!E.endDate,he=E.startDate?Math.round((B.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,Ee=Sa=>Sa.map(At=>At.id===E.id?{...At,startDate:B,endDate:_,...E.segments&&{segments:E.segments}}:At.subtasks?{...At,subtasks:Ee(At.subtasks)}:At),Tt=Ee(z);Tt=Me.autoScheduleDependents(Tt,E.id,he),Tt=mr(Tt),ve(Tt);let rt={...E,startDate:B,endDate:_};Q&&a?.onTaskDateChange?a.onTaskDateChange(E,B,_):Ke?.(rt);},[z,Ke,a]),_0=react.useCallback((E,B)=>{fe?.(E,B),Dt({isOpen:true,x:B.clientX,y:B.clientY,task:E});},[fe]),j0=react.useCallback((E,B)=>{let _=Me.splitTask(z,E.id,B);ve(_),Dt({isOpen:false,x:0,y:0,task:null});},[z]),Pc=react.useCallback(E=>{let B=Me.findTaskById(z,E.id)||E;q?.(B),U||Ut(B);},[z,q,U]),Fc=react.useCallback((E,B,_)=>{let Q=new Map,he=At=>{At.forEach(Ea=>{Ea.dependencies&&Q.set(Ea.id,Ea.dependencies),Ea.subtasks&&he(Ea.subtasks);});};he(_);let Ee=Q.get(B)||[];Q.set(B,[...Ee,E]);let Tt=new Set,rt=new Set,Sa=At=>{if(!Tt.has(At)){Tt.add(At),rt.add(At);let Ea=Q.get(At)||[];for(let ar of Ea){if(!Tt.has(ar)&&Sa(ar))return true;if(rt.has(ar))return true}}return rt.delete(At),false};return Sa(B)},[]),Mc=react.useCallback((E,B)=>{if(Fc(E.id,B,Wo.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
362
367
|
|
|
363
|
-
Task dependencies must flow in one direction only.`);return}let V=X=>X.map(xe=>{if(xe.id===L){let Se=xe.dependencies||[];if(!Se.includes(M.id))return {...xe,dependencies:[...Se,M.id]}}return xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe});ge(V(G)),O?.(M.id,L);},[G,O,bc]),yc=react.useCallback((M,L)=>{let V=X=>X.map(xe=>{if(xe.id===M&&xe.dependencies){let Se=xe.dependencies.filter(Ct=>Ct!==L);return {...xe,dependencies:Se}}return xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe});ge(V(G)),Q?.(M,L);},[G,Q]),{startDate:Wo,endDate:Hi}=react.useMemo(()=>{let M=G.filter(Se=>Se.startDate&&Se.endDate);if(M.length===0){let Se=new Date,Ct=new Date(Se);Ct.setDate(Ct.getDate()-30);let st=new Date(Se);return st.setDate(st.getDate()+60),{startDate:Ct,endDate:st}}let L=M.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),V=new Date(Math.min(...L.map(Se=>Se.getTime()))),X=new Date(Math.max(...L.map(Se=>Se.getTime()))),xe=$e==="day"?7:$e==="week"?14:30;return V.setDate(V.getDate()-xe),X.setDate(X.getDate()+xe),{startDate:V,endDate:X}},[G,$e]);react.useEffect(()=>{dt.current?.(Wo,Hi);},[Wo,Hi]);let A0=react.useCallback(async()=>{if(!bn.current||!Xr.current||!Pr.current)return;await new Promise(yn=>setTimeout(yn,200));let M=bn.current,L=Xr.current,V=ls.current||L.querySelector(".gantt-grid-scroll"),X=Pr.current,xe=V?.scrollTop||0,Se=V?.scrollLeft||0,Ct=X.scrollTop,st=X.scrollLeft,Ta=M.style.overflow,Ft=M.style.height,Na=V?.style.overflow||"",er=X.style.overflow,xo=L.style.overflow,cs=M.style.width,us=X.style.width;try{let yn=V?.querySelector(".gantt-taskgrid-content"),Jr=X.querySelector("svg"),Ui=Jr?.getAttribute("height")?parseInt(Jr.getAttribute("height"),10):Jr?.getBoundingClientRect().height||0,Vo=yn?.scrollHeight||V?.scrollHeight||600,ps=Math.max(Ui,X.scrollHeight),xn=Jr?.getAttribute("width")?parseInt(Jr.getAttribute("width"),10):Jr?.getBoundingClientRect().width||X.scrollWidth,z0=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Wi=Math.max(Vo,ps,Ui),kc=z0+Wi+50,wc=(V?.offsetWidth||L.offsetWidth||300)+xn+10;V&&(V.scrollTop=0,V.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,M.style.overflow="visible",M.style.height=`${kc}px`,M.style.width=`${wc}px`,L.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${Wi+50}px`),X.style.overflow="visible",X.style.height=`${Wi+50}px`,X.style.width=`${xn+10}px`,await new Promise(ms=>setTimeout(ms,150));let U0=await htmlToImage.toPng(M,{backgroundColor:jt.bgPrimary,pixelRatio:2,width:wc,height:kc,skipFonts:!1,filter:ms=>{if(!(ms instanceof Element))return !0;let Cc=window.getComputedStyle(ms),Tc=parseInt(Cc.zIndex,10);return !(!isNaN(Tc)&&Tc>=50||Cc.position==="fixed")}}),Gi=document.createElement("a");Gi.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Gi.href=U0,Gi.click();}finally{M.style.overflow=Ta,M.style.height=Ft,M.style.width=cs,L.style.overflow=xo,V&&(V.style.overflow=Na,V.style.height="",V.scrollTop=xe,V.scrollLeft=Se),X.style.overflow=er,X.style.height="",X.style.width=us,X.scrollTop=Ct,X.scrollLeft=st;}},[jt]),L0=react.useCallback(async()=>{await Pe.exportToPDF(G);},[G]),I0=react.useCallback(async()=>{await Pe.exportToExcel(G);},[G]),B0=react.useCallback(()=>{let M=Pe.exportToCSV(G),L=new Blob([M],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[G]),R0=react.useCallback(()=>{let M=Pe.exportToJSON(G),L=new Blob([M],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[G]),O0=react.useCallback(()=>{Pe.exportToMSProject(G,"Gantt Project","project.xml");},[G]),$0=M=>{M.preventDefault(),fe(true);},Go=react.useRef(false),[zi,xc]=react.useState(false),hn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=Pr.current,L=Xr.current?.querySelector(".gantt-grid-scroll");if(!M||!L)return;let V=()=>{if(Go.current)return;Go.current=true;let st=M.scrollTop;he(st),L.scrollTop=st,requestAnimationFrame(()=>{Go.current=false;});},X=()=>{if(Go.current)return;Go.current=true;let st=L.scrollTop;he(st),M.scrollTop=st,requestAnimationFrame(()=>{Go.current=false;});},xe=st=>{if(tt&&L){let Ft=L.parentElement?.getBoundingClientRect()?.left||0,Na=st.clientX-Ft,er=200,xo=Wa+Oa,cs=window.innerWidth*zo,us=Math.max(xo,cs);Na>=er&&Na<=us&&De(Na);}if(zi&&M){let Ta=st.clientX-hn.current.x,Ft=st.clientY-hn.current.y;M.scrollLeft=hn.current.scrollLeft-Ta,M.scrollTop=hn.current.scrollTop-Ft;}},Se=()=>{fe(false),xc(false);},Ct=st=>{if(st.button!==0)return;let Ta=st.target;Ta.closest("[data-task-bar]")||Ta.closest("[data-dependency-line]")||Ta.closest("button")||Ta.closest('[role="button"]')||Ta.tagName==="rect"&&Ta.getAttribute("data-clickable")==="true"||(xc(true),hn.current={x:st.clientX,y:st.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},st.preventDefault());};return M.addEventListener("scroll",V),L.addEventListener("scroll",X),M.addEventListener("mousedown",Ct),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Se),()=>{M.removeEventListener("scroll",V),L.removeEventListener("scroll",X),M.removeEventListener("mousedown",Ct),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Se);}},[tt,zi,Wa]);let vc=react.useRef(false),H0=react.useRef(null);return react.useLayoutEffect(()=>{if(vc.current||G.length===0||!Pr.current)return;vc.current=true,H0.current=Wo;let M=Pr.current,L=new Date,V=$e==="day"?60:$e==="week"?20:8,X=(L.getTime()-Wo.getTime())/(1e3*60*60*24),xe=M.clientWidth,Ct=X*V*et-xe/2;X>=0&&xe>0&&(M.scrollLeft=Math.max(0,Ct));},[G.length,Wo,$e,et]),jsxRuntime.jsx(rn.Provider,{value:Ge,children:jsxRuntime.jsx(Yi.Provider,{value:y0,children:jsxRuntime.jsxs("div",{ref:bn,className:"flex flex-col h-full w-full",style:{backgroundColor:jt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...jt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${jt.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(Ys,{theme:jt,timeScale:$e,onTimeScaleChange:Re,zoom:et,onZoomChange:Le,currentTheme:ae,onThemeChange:J,rowDensity:ct,onRowDensityChange:je,showThemeSelector:c,showCreateTaskButton:k&&se?.canCreateTask!==false&&!se?.canCreateSubtaskOnly,createTaskLabel:h,onCreateTask:N,taskFilter:Xe,onTaskFilterChange:ot,hideCompleted:R,onHideCompletedChange:de,toolbarRightContent:C,wbsLevel:pt,onWbsLevelChange:S,maxWbsDepth:Pa,viewMode:Be,onViewModeChange:W,projectForecast:U,onExportPNG:i?A0:void 0,onExportPDF:i?L0:void 0,onExportExcel:i?I0:void 0,onExportCSV:i?B0:void 0,onExportJSON:i?R0:void 0,onExportMSProject:i?O0:void 0})}),jsxRuntime.jsxs("div",{ref:Xr,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ls,className:"gantt-grid-scroll flex-shrink-0",style:{width:h0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Qs,{tasks:gc,theme:jt,rowHeight:ds,availableUsers:p,templates:mc,onTaskClick:Z,onTaskDblClick:fc,onTaskContextMenu:K,onTaskToggle:k0,scrollTop:ye,columns:pa,onToggleColumn:x0,onColumnResize:v0,onTaskUpdate:Uo,onTaskIndent:w0,onTaskOutdent:C0,onTaskMove:N0,onMultiTaskDelete:Oi,onTaskDuplicate:D0,onTaskCreate:S0,onTaskRename:E0,onCreateSubtask:$i,onOpenTaskModal:Z?M=>Z(M):void 0,onDeleteRequest:(M,L)=>I({taskId:M,taskName:L}),onTaskReparent:T0,scrollContainerRef:ls})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:jt.border,zIndex:15},onMouseDown:$0}),jsxRuntime.jsx("div",{ref:Pr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:zi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(ni,{tasks:gc,theme:jt,rowHeight:ds,timeScale:$e,startDate:Wo,endDate:Hi,zoom:et,locale:f,templates:mc,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:Z,onTaskDblClick:fc,onTaskContextMenu:P0,onTaskDateChange:F0,onDependencyCreate:hc,onDependencyDelete:yc,showBaseline:pe})})]}),be.task&&jsxRuntime.jsx(nn,{isOpen:be.isOpen,x:be.x,y:be.y,theme:jt,onClose:()=>We({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=be.task;if(!M)return [];let L=Pe.findTaskById(G,M.id)||M,V=L.subtasks&&L.subtasks.length>0,X=se?.canCreateTask!==false,xe=se?.canDeleteTask!==false;if(V){let Ft=[],Na=se?.canDuplicateTask!==false;return X&&Ft.push({id:"addSubtask",label:Ge.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{_?_(L):$i(L.id);}}),Na&&Ft.push({id:"duplicate",label:Ge.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(L):ge(er=>Rn(er,[L.id]).tasks),We({isOpen:false,x:0,y:0,task:null});}}),xe&&(Ft.length>0&&Ft.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ft.push({id:"delete",label:Ge.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{I({taskId:L.id,taskName:L.name});}})),Ft}let Se=se?.canUpdateTask!==false,Ct=se?.canDuplicateTask!==false,st=[];return Se&&st.push({id:"edit",label:Ge.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{A?A(L):ne(L);}}),X&&st.push({id:"addSubtask",label:Ge.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{_?_(L):$i(L.id);}}),st.length>0&&Se&&st.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Se&&(st.push({id:"markIncomplete",label:Ge.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{ve?ve(L):Uo(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"}),st.push({id:"setInProgress",label:Ge.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{Qe?Qe(L):Uo(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"}),st.push({id:"markComplete",label:Ge.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{Uo(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"})),(Ct||Se&&L.startDate&&L.endDate)&&st.length>0&&st.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ct&&st.push({id:"duplicate",label:Ge.contextMenu?.duplicateTask||"Duplicate Task",icon:Ut.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(L):ge(Ft=>Rn(Ft,[L.id]).tasks),We({isOpen:false,x:0,y:0,task:null});}}),Se&&L.startDate&&L.endDate&&st.push({id:"split",label:Ge.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{let Ft=L.startDate.getTime(),Na=L.endDate.getTime(),er=Ft+(Na-Ft)/2,xo=new Date(er);M0(L,xo);}}),xe&&(st.length>0&&st.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),st.push({id:"delete",label:Ge.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{I({taskId:L.id,taskName:L.name});}})),st})()}),jsxRuntime.jsx(Gr,{task:H,isOpen:!!H,onClose:()=>ne(null),onTaskUpdate:M=>{H&&(Uo(H.id,M),ne(null));},theme:ae==="light"?"light":"dark",locale:f==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:He&&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:()=>I(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:jt.bgSecondary,border:`1px solid ${jt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${jt.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:jt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ge.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:jt.textSecondary,fontFamily:"Inter, sans-serif"},children:f==="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:jt.textSecondary,fontFamily:"Inter, sans-serif"},children:[f==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:jt.textPrimary},children:['"',He.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:jt.bgPrimary,borderTop:`1px solid ${jt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:jt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=jt.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:f==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Oi([He.taskId]),I(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"}),f==="es"?"Eliminar":"Delete"]})]})]})})}),y?.enabled&&jsxRuntime.jsx(li,{tasks:G,theme:jt,config:y,onTasksUpdate:ge,onTaskUpdate:Uo,onTaskCreate:M=>{ge(L=>[...L,M]);},onTaskDelete:M=>{Oi([M]);},onDependencyCreate:(M,L)=>{let V=Pe.findTaskById(G,M);V&&hc(V,L);},onDependencyDelete:yc})]})})})});function fv(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 bv(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 od=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],nd=[{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 Kp({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:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:v,defaultStatus:b}){let y=[...od,...i.filter(P=>!od.some(ee=>ee.id===P.id))],f=it[c]||it.dark,[x,k]=react.useState(false),[h,N]=react.useState(false),[T,D]=react.useState(false),[C,B]=react.useState(false),[E,w]=react.useState({top:0,left:0}),[U,$]=react.useState(null),[Z,F]=react.useState(new Date),[K,le]=react.useState({top:0,left:0}),[Ie,A]=react.useState(false),[_,ve]=react.useState([]),[Qe,O]=react.useState(false),[Q,te]=react.useState(""),Ue=react.useRef(null),rt=react.useRef(null),Ze=react.useRef(null),mt=react.useRef(null),Ce=react.useRef(null),[se,j]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ue,ae]=react.useState({});react.useEffect(()=>{a?(j({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&A(true)):(j({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),A(false),ve([]));},[a,e,b]),react.useEffect(()=>{let P=ee=>{Ue.current&&!Ue.current.contains(ee.target)&&k(false),rt.current&&!rt.current.contains(ee.target)&&N(false),Ze.current&&!Ze.current.contains(ee.target)&&D(false),mt.current&&!mt.current.contains(ee.target)&&B(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Fe=()=>{let P={};return se.name.trim()||(P.name="El nombre es requerido"),se.startDate&&se.endDate&&se.startDate>se.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),ae(P),Object.keys(P).length===0},$e=async P=>{if(P.preventDefault(),!!Fe())try{let ee=l==="create"&&_.length>0?{...se,pendingFiles:_}:se;await s(ee),ve([]),t();}catch(ee){console.error("Error submitting task:",ee);}},Re=(P,ee)=>{j(ke=>{let Be={...ke,[P]:ee};if(P==="status"){let W=ee;W==="todo"?Be.progress=0:W==="in-progress"?(ke.progress===0||ke.progress===100)&&(Be.progress=50):W==="completed"||W==="closed"?Be.progress=100:(W==="in-review"||W==="review")&&(Be.progress=75);}if(P==="progress"){let W=typeof ee=="number"?ee:parseInt(ee,10);W===100&&ke.status!=="completed"?Be.status="completed":W>0&&W<100&&ke.status==="todo"?Be.status="in-progress":W===0&&ke.status!=="todo"&&(Be.status="todo");}return Be}),ue[P]&&ae(ke=>{let Be={...ke};return delete Be[P],Be});},ct=y.find(P=>P.id===se.status)??od[0],je=nd.find(P=>P.id===se.priority)??nd[1],et=No.find(P=>P.value===se.color)??No[0],Le=c==="dark",pt={backgroundColor:Le?"rgba(255, 255, 255, 0.04)":f.bgSecondary,border:`1px solid ${Le?"rgba(255, 255, 255, 0.08)":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:Le?"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:Le?"rgba(10, 10, 10, 0.97)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,WebkitBackdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:Le?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:P=>P.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:ct.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:P=>{P.currentTarget.style.backgroundColor=f.hoverBg,P.currentTarget.style.color=f.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:$e,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:se.name,onChange:P=>Re("name",P.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:se.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:se.description||"",onChange:P=>Re("description",P.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:Ue,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:{...pt,borderColor:ct.color,backgroundColor:`${ct.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsxRuntime.jsx("span",{style:{color:ct.color},children:ct.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ct.color}})]}),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-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Le?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(P=>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:ee=>ee.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ee=>ee.currentTarget.style.backgroundColor="transparent",onClick:()=>{Re("status",P.id),k(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,se.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:rt,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:pt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:je.color}}),jsxRuntime.jsx("span",{children:je.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Le?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:nd.map(P=>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:ee=>ee.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ee=>ee.currentTarget.style.backgroundColor="transparent",onClick:()=>{Re("priority",P.id),N(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,se.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:pt,disabled:n,children:[se.assignees&&se.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:se.assignees.slice(0,3).map((P,ee)=>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:P.color||f.accent,borderColor:f.bgSecondary},children:P.initials},ee))}),se.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",se.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:T&&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:Le?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(P=>{let ee=se.assignees?.some(ke=>ke.name===P.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:ke=>ke.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ke=ee?(se.assignees||[]).filter(Be=>Be.name!==P.name):[...se.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(Be=>Be[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Re("assignees",ke);},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:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:P.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:mt,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)B(false);else {if(mt.current){let P=mt.current.getBoundingClientRect(),ee=window.innerHeight,ke=120,W=ee-P.bottom<ke?P.top-ke-8:P.bottom+8;w({top:W,left:P.left});}B(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:pt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:se.color}}),jsxRuntime.jsx("span",{children:et.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(Pt,{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:`${E.top}px`,left:`${E.left}px`,zIndex:99999,backgroundColor:Le?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:P=>P.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:No.slice(0,18).map(P=>{let ee=se.color===P.value;return jsxRuntime.jsx("button",{type:"button",onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),Re("color",P.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:P.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:ee?`2px solid ${P.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},P.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(to,{selectedTags:se.tags||[],availableTags:p,onChange:P=>Re("tags",P),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:Ce,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!se.isMilestone)if(U==="start")$(null);else {if(Ce.current){let P=Ce.current.getBoundingClientRect(),ee=window.innerHeight,ke=320,W=ee-P.bottom<ke?P.top-ke-8:P.bottom+8;le({top:W,left:P.left});}$("start"),F(se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...pt,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:n||se.isMilestone,children:se.startDate?se.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&&!se.isMilestone)if(U==="end")$(null);else {if(Ce.current){let P=Ce.current.getBoundingClientRect(),ee=window.innerHeight,ke=320,W=ee-P.bottom<ke?P.top-ke-8:P.bottom+8;le({top:W,left:P.left});}$("end"),F(se.endDate||se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...pt,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:n||se.isMilestone,children:se.endDate?se.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(Pt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(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:`${K.top}px`,left:`${K.left}px`,zIndex:99999,backgroundColor:Le?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`},children:[(()=>{let P=new Date,ee=new Date(P);ee.setDate(P.getDate()+1);let ke=new Date(P);ke.setDate(P.getDate()+7);let Be=new Date(P);return Be.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:ee},{label:"Pr\xF3xima semana",date:ke},{label:"2 semanas",date:Be}].map((pe,dt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="transparent",onClick:()=>{U==="start"?(Re("startDate",pe.date),(!se.endDate||pe.date>se.endDate)&&Re("endDate",pe.date),$("end")):(Re("endDate",pe.date),(!se.startDate||pe.date<se.startDate)&&Re("startDate",pe.date),$(null));},children:pe.label},dt))})(),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:P=>P.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{Re("startDate",void 0),Re("endDate",void 0),$(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:()=>F(new Date(Z.getFullYear(),Z.getMonth()-1)),className:"p-1 rounded",onMouseEnter:P=>P.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:P=>P.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:Z.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(Z.getFullYear(),Z.getMonth()+1)),className:"p-1 rounded",onMouseEnter:P=>P.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:P=>P.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((P,ee)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:P},ee))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=Z.getFullYear(),ee=Z.getMonth(),ke=new Date(P,ee,1).getDay(),Be=new Date(P,ee+1,0).getDate(),W=new Date,pe=[];for(let Ee=ke-1;Ee>=0;Ee--)pe.push({day:new Date(P,ee,-Ee).getDate(),date:new Date(P,ee-1,new Date(P,ee,-Ee).getDate()),isCurrentMonth:false});for(let Ee=1;Ee<=Be;Ee++)pe.push({day:Ee,date:new Date(P,ee,Ee),isCurrentMonth:true});let dt=42-pe.length;for(let Ee=1;Ee<=dt;Ee++)pe.push({day:Ee,date:new Date(P,ee+1,Ee),isCurrentMonth:false});return pe.map((Ee,qe)=>{let Ke=Ee.date.toDateString()===W.toDateString(),Xe=se.startDate?.toDateString()===Ee.date.toDateString(),ot=se.endDate?.toDateString()===Ee.date.toDateString(),R=se.startDate&&se.endDate&&Ee.date>=se.startDate&&Ee.date<=se.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:Ee.isCurrentMonth?Xe||ot?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Xe?f.accent:ot?"#7C3AED":R?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ke&&!Xe&&!ot?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{U==="start"?(Re("startDate",Ee.date),se.endDate&&Ee.date>se.endDate&&Re("endDate",Ee.date),$("end")):(Re("endDate",Ee.date),se.startDate&&Ee.date<se.startDate&&Re("startDate",Ee.date),$(null));},children:Ee.day},qe)})})()})]})]})]})})]}),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:se.progress,onChange:P=>Re("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:se.progress<30?"#EF4444":se.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:`${se.progress<30?"#EF4444":se.progress<70?"#F59E0B":"#10B981"}20`,color:se.progress<30?"#EF4444":se.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[se.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(!Ie),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 ${Ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&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:se.effortMinutes?fv(se.effortMinutes):"",onChange:P=>{let ee=bv(P.target.value);Re("effortMinutes",ee);},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"?_.length>0&&`(${_.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(Br,{cardId:"pending",attachments:_.map((P,ee)=>({id:`pending-${ee}`,cardId:"pending",name:P.name,size:P.size,type:P.type,url:URL.createObjectURL(P),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:P=>ve(ee=>[...ee,...P]),onDelete:P=>{let ee=parseInt(P.replace("pending-",""),10);ve(ke=>ke.filter((Be,W)=>W!==ee));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Br,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?P=>g(a.id,P):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&_.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.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:P=>P.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:se.isMilestone,onChange:P=>Re("isMilestone",P.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"]}),se.dependencies&&se.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:se.dependencies.map(P=>{let ee=r.find(ke=>ke.id===P);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:[ee?.name||P.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ke=(se.dependencies||[]).filter(Be=>Be!==P);Re("dependencies",ke);},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"})})]},P)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{O(!Qe),te("");},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:Qe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),te("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Le?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:Le?"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:Q,onChange:P=>te(P.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(P=>P.id!==a?.id).filter(P=>Q===""||P.name.toLowerCase().includes(Q.toLowerCase())).map(P=>{let ee=se.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ke=se.dependencies||[],Be;ee?Be=ke.filter(W=>W!==P.id):Be=[...ke,P.id],Re("dependencies",Be);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ee?`${f.accent}10`:"transparent"},onMouseEnter:ke=>{ee||(ke.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ke=>{ke.currentTarget.style.backgroundColor=ee?`${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:ee?f.accent:"transparent",borderColor:ee?f.accent:f.borderLight},children:ee&&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:P.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:P.id.slice(0,8)})]})]},P.id)}),r.filter(P=>P.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:P=>P.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:P=>P.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:P=>!n&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!n&&(P.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 Yp=`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 _=Q=>Q.map(he=>{if(he.id===B){let Ee=he.dependencies||[];if(!Ee.includes(E.id))return {...he,dependencies:[...Ee,E.id]}}return he.subtasks?{...he,subtasks:_(he.subtasks)}:he});sa.current+=1,ve(Q=>_(Q)),J?.(E.id,B);},[J,Fc]),Ac=react.useCallback((E,B)=>{let _=Q=>Q.map(he=>{if(he.id===E&&he.dependencies){let Ee=he.dependencies.filter(Tt=>Tt!==B);return {...he,dependencies:Ee}}return he.subtasks?{...he,subtasks:_(he.subtasks)}:he});sa.current+=1,ve(Q=>_(Q)),X?.(E,B);},[X]),{startDate:jo,endDate:Yi}=react.useMemo(()=>{let E=z.filter(Ee=>Ee.startDate&&Ee.endDate);if(E.length===0){let Ee=new Date,Tt=new Date(Ee);Tt.setDate(Tt.getDate()-30);let rt=new Date(Ee);return rt.setDate(rt.getDate()+60),{startDate:Tt,endDate:rt}}let B=E.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),_=new Date(Math.min(...B.map(Ee=>Ee.getTime()))),Q=new Date(Math.max(...B.map(Ee=>Ee.getTime()))),he=Je==="day"?7:Je==="week"?14:30;return _.setDate(_.getDate()-he),Q.setDate(Q.getDate()+he),{startDate:_,endDate:Q}},[z,Je]);react.useEffect(()=>{me.current?.(jo,Yi);},[jo,Yi]);let K0=react.useCallback(async()=>{if(!wn.current||!Zr.current||!Ar.current)return;await new Promise(Tn=>setTimeout(Tn,200));let E=wn.current,B=Zr.current,_=us.current||B.querySelector(".gantt-grid-scroll"),Q=Ar.current,he=_?.scrollTop||0,Ee=_?.scrollLeft||0,Tt=Q.scrollTop,rt=Q.scrollLeft,Sa=E.style.overflow,At=E.style.height,Ea=_?.style.overflow||"",ar=Q.style.overflow,ko=B.style.overflow,ms=E.style.width,gs=Q.style.width;try{let Tn=_?.querySelector(".gantt-taskgrid-content"),eo=Q.querySelector("svg"),Xi=eo?.getAttribute("height")?parseInt(eo.getAttribute("height"),10):eo?.getBoundingClientRect().height||0,Yo=Tn?.scrollHeight||_?.scrollHeight||600,fs=Math.max(Xi,Q.scrollHeight),Nn=eo?.getAttribute("width")?parseInt(eo.getAttribute("width"),10):eo?.getBoundingClientRect().width||Q.scrollWidth,tf=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Ji=Math.max(Yo,fs,Xi),Bc=tf+Ji+50,Rc=(_?.offsetWidth||B.offsetWidth||300)+Nn+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Bc}px`,E.style.width=`${Rc}px`,B.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${Ji+50}px`),Q.style.overflow="visible",Q.style.height=`${Ji+50}px`,Q.style.width=`${Nn+10}px`,await new Promise(bs=>setTimeout(bs,150));let af=await htmlToImage.toPng(E,{backgroundColor:qt.bgPrimary,pixelRatio:2,width:Rc,height:Bc,skipFonts:!1,filter:bs=>{if(!(bs instanceof Element))return !0;let Oc=window.getComputedStyle(bs),$c=parseInt(Oc.zIndex,10);return !(!isNaN($c)&&$c>=50||Oc.position==="fixed")}}),Qi=document.createElement("a");Qi.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Qi.href=af,Qi.click();}finally{E.style.overflow=Sa,E.style.height=At,E.style.width=ms,B.style.overflow=ko,_&&(_.style.overflow=Ea,_.style.height="",_.scrollTop=he,_.scrollLeft=Ee),Q.style.overflow=ar,Q.style.height="",Q.style.width=gs,Q.scrollTop=Tt,Q.scrollLeft=rt;}},[qt]),Y0=react.useCallback(async()=>{await Me.exportToPDF(z);},[z]),q0=react.useCallback(async()=>{let E=new Date,B=he=>String(he).padStart(2,"0"),_=`${E.getFullYear()}-${B(E.getMonth()+1)}-${B(E.getDate())}_${B(E.getHours())}${B(E.getMinutes())}`,Q=c?c.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Me.exportToExcel(z,`${Q}_${_}.xlsx`);},[z,c]),X0=react.useCallback(()=>{let E=Me.exportToCSV(z),B=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(B),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[z]),J0=react.useCallback(()=>{let E=Me.exportToJSON(z),B=new Blob([E],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(B),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[z]),Q0=react.useCallback(()=>{Me.exportToMSProject(z,"Gantt Project","project.xml");},[z]),Z0=E=>{E.preventDefault(),Ce(true);},Ko=react.useRef(false),[qi,Lc]=react.useState(false),Cn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Ar.current,B=Zr.current?.querySelector(".gantt-grid-scroll");if(!E||!B)return;let _=()=>{if(Ko.current)return;Ko.current=true;let rt=E.scrollTop;V(rt),B.scrollTop=rt,requestAnimationFrame(()=>{Ko.current=false;});},Q=()=>{if(Ko.current)return;Ko.current=true;let rt=B.scrollTop;V(rt),E.scrollTop=rt,requestAnimationFrame(()=>{Ko.current=false;});},he=rt=>{if(te&&B){let At=B.parentElement?.getBoundingClientRect()?.left||0,Ea=rt.clientX-At,ar=200,ko=cs+Nc,ms=window.innerWidth*Dc,gs=Math.max(ko,ms);Ea>=ar&&Ea<=gs&&Ye(Ea);}if(qi&&E){let Sa=rt.clientX-Cn.current.x,At=rt.clientY-Cn.current.y;E.scrollLeft=Cn.current.scrollLeft-Sa,E.scrollTop=Cn.current.scrollTop-At;}},Ee=()=>{Ce(false),Lc(false);},Tt=rt=>{if(rt.button!==0)return;let Sa=rt.target;Sa.closest("[data-task-bar]")||Sa.closest("[data-dependency-line]")||Sa.closest("button")||Sa.closest('[role="button"]')||Sa.tagName==="rect"&&Sa.getAttribute("data-clickable")==="true"||(Lc(true),Cn.current={x:rt.clientX,y:rt.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},rt.preventDefault());};return E.addEventListener("scroll",_),B.addEventListener("scroll",Q),E.addEventListener("mousedown",Tt),document.addEventListener("mousemove",he),document.addEventListener("mouseup",Ee),()=>{E.removeEventListener("scroll",_),B.removeEventListener("scroll",Q),E.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Ee);}},[te,qi,cs]);let Ic=react.useRef(false),ef=react.useRef(null);return react.useLayoutEffect(()=>{if(Ic.current||z.length===0||!Ar.current)return;Ic.current=true,ef.current=jo;let E=Ar.current,B=new Date,_=Je==="day"?60:Je==="week"?20:8,Q=(B.getTime()-jo.getTime())/(1e3*60*60*24),he=E.clientWidth,Tt=Q*_*ne-he/2;Q>=0&&he>0&&(E.scrollLeft=Math.max(0,Tt));},[z.length,jo,Je,ne]),jsxRuntime.jsx(ln.Provider,{value:za,children:jsxRuntime.jsx(rl.Provider,{value:L0,children:jsxRuntime.jsxs("div",{ref:wn,className:"flex flex-col h-full w-full",style:{backgroundColor:qt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...qt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${qt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Xs,{theme:qt,timeScale:Je,onTimeScaleChange:tt,zoom:ne,onZoomChange:D,currentTheme:Ct,onThemeChange:Ae,rowDensity:Qe,onRowDensityChange:H,showThemeSelector:u,showCreateTaskButton:h&&ct?.canCreateTask!==false&&!ct?.canCreateSubtaskOnly,createTaskLabel:w,onCreateTask:C,taskFilter:Fe,onTaskFilterChange:_e,hideCompleted:j,onHideCompletedChange:xe,toolbarRightContent:L,wbsLevel:K,onWbsLevelChange:wc,maxWbsDepth:yt,viewMode:Z,onViewModeChange:ze,projectForecast:O,onExportPNG:i?K0:void 0,onExportPDF:i?Y0:void 0,onExportExcel:i?q0:void 0,onExportCSV:i?X0:void 0,onExportJSON:i?J0:void 0,onExportMSProject:i?Q0:void 0,showCriticalPath:Ue,onShowCriticalPathChange:Ve,showDependencies:He,onShowDependenciesChange:st,highlightWeekends:pe,onHighlightWeekendsChange:Ze,showBaseline:ye,onShowBaselineChange:E=>{E&&Z!=="oracle"&&ze("oracle"),!E&&Z==="oracle"&&ze("execution");},onCopySnapshotLink:Be})}),jsxRuntime.jsxs("div",{ref:Zr,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:us,className:"gantt-grid-scroll flex-shrink-0",style:{width:A0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ei,{tasks:Ec,theme:qt,rowHeight:ps,availableUsers:l,templates:Sc,onTaskClick:P,onTaskDblClick:Pc,onTaskContextMenu:fe,onTaskToggle:R0,scrollTop:I,columns:Vo,onToggleColumn:I0,onColumnResize:B0,onTaskUpdate:_o,onTaskIndent:O0,onTaskOutdent:$0,onTaskMove:z0,onMultiTaskDelete:ji,onTaskDuplicate:U0,onTaskCreate:W0,onTaskRename:G0,onCreateSubtask:Ki,onOpenTaskModal:P?E=>P(E):void 0,onDeleteRequest:(E,B)=>ha({taskId:E,taskName:B}),onTaskReparent:H0,scrollContainerRef:us})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:qt.border,zIndex:15},onMouseDown:Z0}),jsxRuntime.jsx("div",{ref:Ar,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(pi,{tasks:Ec,theme:qt,rowHeight:ps,timeScale:Je,startDate:jo,endDate:Yi,zoom:ne,locale:x,templates:Sc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:P,onTaskDblClick:Pc,onTaskContextMenu:_0,onTaskDateChange:V0,onDependencyCreate:Mc,onDependencyDelete:Ac,showBaseline:ye,showCriticalPath:Ue,showDependencies:He,highlightWeekends:pe,canEditTask:ct?.canEditTask})})]}),Re.task&&jsxRuntime.jsx(un,{isOpen:Re.isOpen,x:Re.x,y:Re.y,theme:qt,onClose:()=>Dt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Re.task;if(!E)return [];let B=Me.findTaskById(z,E.id)||E,_=B.subtasks&&B.subtasks.length>0,Q=ct?.canCreateTask!==false,he=ct?.canDeleteTask!==false;if(_){let At=[],Ea=ct?.canDuplicateTask!==false;return Q&&At.push({id:"addSubtask",label:za.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{ae?ae(B):Ki(B.id);}}),Ea&&At.push({id:"duplicate",label:za.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):ve(ar=>Wn(ar,[B.id]).tasks),Dt({isOpen:false,x:0,y:0,task:null});}}),he&&(At.length>0&&At.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),At.push({id:"delete",label:za.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{ha({taskId:B.id,taskName:B.name});}})),At}let Ee=ct?.canUpdateTask!==false,Tt=ct?.canDuplicateTask!==false,rt=[];return Ee&&rt.push({id:"edit",label:za.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{U?U(B):Ut(B);}}),Q&&rt.push({id:"addSubtask",label:za.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{ae?ae(B):Ki(B.id);}}),rt.length>0&&Ee&&rt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ee&&(rt.push({id:"markIncomplete",label:za.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{Ne?Ne(B):_o(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),rt.push({id:"setInProgress",label:za.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{R?R(B):_o(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),rt.push({id:"markComplete",label:za.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{_o(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Tt||Ee&&B.startDate&&B.endDate)&&rt.length>0&&rt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Tt&&rt.push({id:"duplicate",label:za.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):ve(At=>Wn(At,[B.id]).tasks),Dt({isOpen:false,x:0,y:0,task:null});}}),Ee&&B.startDate&&B.endDate&&rt.push({id:"split",label:za.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{let At=B.startDate.getTime(),Ea=B.endDate.getTime(),ar=At+(Ea-At)/2,ko=new Date(ar);j0(B,ko);}}),he&&(rt.length>0&&rt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),rt.push({id:"delete",label:za.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{ha({taskId:B.id,taskName:B.name});}})),rt})()}),jsxRuntime.jsx(jr,{task:pt,isOpen:!!pt,onClose:()=>Ut(null),onTaskUpdate:E=>{pt&&(_o(pt.id,E),Ut(null));},theme:Ct==="light"?"light":"dark",locale:x==="es"?"es":"en",availableUsers:l,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ca&&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:()=>ha(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:qt.bgSecondary,border:`1px solid ${qt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${qt.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:qt.textPrimary,fontFamily:"Inter, sans-serif"},children:[za.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},children:x==="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:qt.textSecondary,fontFamily:"Inter, sans-serif"},children:[x==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:qt.textPrimary},children:['"',Ca.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:qt.bgPrimary,borderTop:`1px solid ${qt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ha(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=qt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:x==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ji([Ca.taskId]),ha(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),x==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(fi,{tasks:z,theme:qt,config:f,onTasksUpdate:ve,onTaskUpdate:_o,onTaskCreate:E=>{ve(B=>[...B,E]);},onTaskDelete:E=>{ji([E]);},onDependencyCreate:(E,B)=>{let _=Me.findTaskById(z,E);_&&Mc(_,B);},onDependencyDelete:Ac})]})})})});function Av(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 Lv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),u=parseInt(a[2],10);return d*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 md=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function im({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:l,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:b}){let v=[...md,...i.filter(D=>!md.some(K=>K.id===D.id))],f=ot[u]||ot.dark,[x,k]=react.useState(false),[h,w]=react.useState(false),[C,S]=react.useState(false),[T,L]=react.useState(false),[A,N]=react.useState({top:0,left:0}),[Y,O]=react.useState(null),[le,P]=react.useState(new Date),[q,fe]=react.useState({top:0,left:0}),[Ke,F]=react.useState(false),[U,ae]=react.useState([]),[Ne,R]=react.useState(false),[J,X]=react.useState(""),ue=react.useRef(null),Ie=react.useRef(null),Xe=react.useRef(null),dt=react.useRef(null),lt=react.useRef(null),[re,ct]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Be,ht]=react.useState({});react.useEffect(()=>{a?(ct({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&F(true)):(ct({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),F(false),ae([]));},[a,e,b]),react.useEffect(()=>{let D=K=>{ue.current&&!ue.current.contains(K.target)&&k(false),Ie.current&&!Ie.current.contains(K.target)&&w(false),Xe.current&&!Xe.current.contains(K.target)&&S(false),dt.current&&!dt.current.contains(K.target)&&L(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let mt=()=>{let D={};return re.name.trim()||(D.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),ht(D),Object.keys(D).length===0},Ct=async D=>{if(D.preventDefault(),!!mt())try{let K=d==="create"&&U.length>0?{...re,pendingFiles:U}:re;await s(K),ae([]),t();}catch(K){console.error("Error submitting task:",K);}},we=(D,K)=>{ct(se=>{let be={...se,[D]:K};if(D==="status"){let G=K;G==="todo"?be.progress=0:G==="in-progress"?(se.progress===0||se.progress===100)&&(be.progress=50):G==="completed"||G==="closed"?be.progress=100:(G==="in-review"||G==="review")&&(be.progress=75);}if(D==="progress"){let G=typeof K=="number"?K:parseInt(K,10);G===100&&se.status!=="completed"?be.status="completed":G>0&&G<100&&se.status==="todo"?be.status="in-progress":G===0&&se.status!=="todo"&&(be.status="todo");}return be}),Be[D]&&ht(se=>{let be={...se};return delete be[D],be});},Je=v.find(D=>D.id===re.status)??md[0],tt=gd.find(D=>D.id===re.priority)??gd[1],Qe=So.find(D=>D.value===re.color)??So[0],H=u==="dark",ne={backgroundColor:H?"rgba(255, 255, 255, 0.04)":f.bgSecondary,border:`1px solid ${H?"rgba(255, 255, 255, 0.08)":f.borderLight}`,color:f.textPrimary};return 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?"rgba(10, 10, 10, 0.97)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:D=>D.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:Je.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=f.hoverBg,D.currentTarget.style.color=f.textPrimary;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.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:re.name,onChange:D=>we("name",D.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:re.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Be.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"}),Be.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:re.description||"",onChange:D=>we("description",D.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:ue,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:{...ne,borderColor:Je.color,backgroundColor:`${Je.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Je.color}}),jsxRuntime.jsx("span",{style:{color:Je.color},children:Je.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Je.color}})]}),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-[140px] rounded-lg overflow-hidden",style:{backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(D=>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:()=>{we("status",D.id),k(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,re.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,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:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:gd.map(D=>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:()=>{we("priority",D.id),w(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,re.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Xe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((D,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:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},K))}),re.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",re.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?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let K=re.assignees?.some(se=>se.name===D.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:se=>se.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let se=K?(re.assignees||[]).filter(be=>be.name!==D.name):[...re.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(be=>be[0]).join("").toUpperCase().slice(0,2),color:f.accent}];we("assignees",se);},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:D.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:D.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}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:dt,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)L(false);else {if(dt.current){let D=dt.current.getBoundingClientRect(),K=window.innerHeight,se=120,G=K-D.bottom<se?D.top-se-8:D.bottom+8;N({top:G,left:D.left});}L(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.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(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>L(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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:So.slice(0,18).map(D=>{let K=re.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:se=>{se.preventDefault(),se.stopPropagation(),we("color",D.value),L(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:K?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),c.length>0||l?jsxRuntime.jsx(oo,{selectedTags:re.tags||[],availableTags:c,onChange:D=>we("tags",D),onCreateTag:l,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:lt,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(Y==="start")O(null);else {if(lt.current){let D=lt.current.getBoundingClientRect(),K=window.innerHeight,se=320,G=K-D.bottom<se?D.top-se-8:D.bottom+8;fe({top:G,left:D.left});}O("start"),P(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.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&&!re.isMilestone)if(Y==="end")O(null);else {if(lt.current){let D=lt.current.getBoundingClientRect(),K=window.innerHeight,se=320,G=K-D.bottom<se?D.top-se-8:D.bottom+8;fe({top:G,left:D.left});}O("end"),P(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${q.top}px`,left:`${q.left}px`,zIndex:99999,backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`},children:[(()=>{let D=new Date,K=new Date(D);K.setDate(D.getDate()+1);let se=new Date(D);se.setDate(D.getDate()+7);let be=new Date(D);return be.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:se},{label:"2 semanas",date:be}].map((Z,ze)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{Y==="start"?(we("startDate",Z.date),(!re.endDate||Z.date>re.endDate)&&we("endDate",Z.date),O("end")):(we("endDate",Z.date),(!re.startDate||Z.date<re.startDate)&&we("startDate",Z.date),O(null));},children:Z.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("startDate",void 0),we("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>P(new Date(le.getFullYear(),le.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.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:le.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>P(new Date(le.getFullYear(),le.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.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((D,K)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=le.getFullYear(),K=le.getMonth(),se=new Date(D,K,1).getDay(),be=new Date(D,K+1,0).getDate(),G=new Date,Z=[];for(let ye=se-1;ye>=0;ye--)Z.push({day:new Date(D,K,-ye).getDate(),date:new Date(D,K-1,new Date(D,K,-ye).getDate()),isCurrentMonth:false});for(let ye=1;ye<=be;ye++)Z.push({day:ye,date:new Date(D,K,ye),isCurrentMonth:true});let ze=42-Z.length;for(let ye=1;ye<=ze;ye++)Z.push({day:ye,date:new Date(D,K+1,ye),isCurrentMonth:false});return Z.map((ye,Ue)=>{let Se=ye.date.toDateString()===G.toDateString(),He=re.startDate?.toDateString()===ye.date.toDateString(),$=re.endDate?.toDateString()===ye.date.toDateString(),pe=re.startDate&&re.endDate&&ye.date>=re.startDate&&ye.date<=re.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:ye.isCurrentMonth?He||$?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:He?f.accent:$?"#7C3AED":pe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Se&&!He&&!$?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{Y==="start"?(we("startDate",ye.date),re.endDate&&ye.date>re.endDate&&we("endDate",ye.date),O("end")):(we("endDate",ye.date),re.startDate&&ye.date<re.startDate&&we("startDate",ye.date),O(null));},children:ye.day},Ue)})})()})]})]})]})})]}),Be.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Be.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:re.progress,onChange:D=>we("progress",parseInt(D.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:re.progress<30?"#EF4444":re.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:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[re.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>F(!Ke),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 ${Ke?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ke&&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:re.effortMinutes?Av(re.effortMinutes):"",onChange:D=>{let K=Lv(D.target.value);we("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||d==="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 ",d==="create"?U.length>0&&`(${U.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsxRuntime.jsx(Or,{cardId:"pending",attachments:U.map((D,K)=>({id:`pending-${K}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>ae(K=>[...K,...D]),onDelete:D=>{let K=parseInt(D.replace("pending-",""),10);ae(se=>se.filter((be,G)=>G!==K));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Or,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),d==="create"&&U.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[U.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:re.isMilestone,onChange:D=>we("isMilestone",D.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"]}),re.dependencies&&re.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(D=>{let K=r.find(se=>se.id===D);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||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let se=(re.dependencies||[]).filter(be=>be!==D);we("dependencies",se);},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"})})]},D)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{R(!Ne),X("");},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:Ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),X("");}}),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?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:J,onChange:D=>X(D.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(D=>D.id!==a?.id).filter(D=>J===""||D.name.toLowerCase().includes(J.toLowerCase())).map(D=>{let K=re.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let se=re.dependencies||[],be;K?be=se.filter(G=>G!==D.id):be=[...se,D.id],we("dependencies",be);},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:se=>{K||(se.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:se=>{se.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:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.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:D=>!n&&(D.currentTarget.style.opacity="0.9"),onMouseLeave:D=>!n&&(D.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:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var lm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
364
369
|
|
|
365
370
|
AVAILABLE COMMANDS:
|
|
366
371
|
1. move_task - Move a task to a different date
|
|
@@ -401,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
401
406
|
|
|
402
407
|
Always try to match task names case-insensitively and handle partial matches.
|
|
403
408
|
If you can't find a task by name, search through the provided task list.
|
|
404
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
405
|
-
${
|
|
409
|
+
If ambiguous, ask for clarification in the message field.`;function dm(e){return `CURRENT TASKS:
|
|
410
|
+
${cm(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(`
|
|
406
411
|
`)}
|
|
407
412
|
|
|
408
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Xp(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function qr(e,t){let a=Xp(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 sd(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 v=new Date(r),b=v.getDay(),y=g-b;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}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(),v=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?v.setDate(v.getDate()+m):g==="week"||g==="semana"||g==="semanas"?v.setDate(v.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&v.setMonth(v.getMonth()+m),v}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,v=parseInt(l[3],10);return new Date(v,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()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(v,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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=p[d[1].toLowerCase()],g=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(v,m,g)}return null}function id(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 ld(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 Jp(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 Qp(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(),p=r[2].trim(),d=qr(t,i),m=sd(p);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 "${p}". 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,v=new Date(m);return v.setDate(v.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:v},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(),p=o[2].trim(),d=qr(t,i),m=id(p);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 "${p}".`,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(),p=s[2].trim(),d=qr(t,i),m=ld(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,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(),p=n[2].trim(),d=qr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,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(),p=l[2].trim(),d=qr(t,i),m=qr(t,p);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:p,message:`Could not find a task named "${p}".`,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(),p=qr(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.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 Zp(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 hv(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 ui(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>ui(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},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:hv(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 em(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 tm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>ui(r,e,t))}var dd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},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:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},pi={en:dd,es:cd};function ud(e){return pi[e]||pi.en}function mi(e,t){let a=ud(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 pd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#007BFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#32D74B]"}];function am(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 rm({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=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=am(e),i=pd[0],p=pd.find(g=>g.value===c)??i,d=p.icon,m=g=>{switch(am(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:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("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:u("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:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("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:pd.map(g=>{let v=g.icon;return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:u("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(v,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var md=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function nm({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 p=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=md.find(p=>p.value===e)??md[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("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:p=>{p.stopPropagation(),n(!s);},className:u("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:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("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:md.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function jn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function gd(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 dm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let b=y=>{p.current&&!p.current.contains(y.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(y=>y.name===b),v=b=>{if(a)if(g(b.name))a(e.filter(y=>y.name!==b.name));else {let y={name:b.name,initials:jn(b.name),color:b.color||gd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("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((b,y)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&gd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||jn(b.name)},`${b.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("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:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),l(!n);},className:u("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:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("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((b,y)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&gd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||jn(b.name)},`${b.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("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:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&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((b,y)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||jn(b.name)}),b.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${b.name}-${y}`))}),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(b=>{let y=g(b.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?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=>{y||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{y||(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:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):jn(b.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function pm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,p]=react.useState(false),[d,m]=react.useState(o),[g,v]=react.useState(()=>{let D=o==="start"?e:t;if(D){let C=D instanceof Date?D:new Date(D);return new Date(C.getFullYear(),C.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=react.useRef(null),y=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=C=>{b.current&&!b.current.contains(C.target)&&p(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let x=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",k=react.useCallback(()=>{let D=g.getFullYear(),C=g.getMonth(),B=new Date(D,C,1),w=new Date(D,C+1,0).getDate(),U=B.getDay(),$=[],F=new Date(D,C,0).getDate();for(let le=U-1;le>=0;le--)$.push({date:new Date(D,C-1,F-le),isCurrentMonth:false});for(let le=1;le<=w;le++)$.push({date:new Date(D,C,le),isCurrentMonth:true});let K=42-$.length;for(let le=1;le<=K;le++)$.push({date:new Date(D,C+1,le),isCurrentMonth:false});return $},[g]),h=D=>{if(r)o==="start"?a(D,f||void 0):a(y||void 0,D),p(false);else if(d==="start"){let C=f&&D>f?D:f;a(D,C||void 0),m("end");}else {let C=y&&D<y?D:y;a(C||void 0,D),p(false);}},N=()=>{let D=new Date,C=new Date(D);C.setDate(D.getDate()+1);let B=new Date(D);B.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let E=new Date(D);E.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let w=new Date(D);w.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let U=new Date(D);U.setDate(D.getDate()+14);let $=new Date(D);return $.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:C,display:C.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:E,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:U,display:U.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:$,display:$.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let D=r&&o==="start"?y:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:x(D)})]})}let T=r&&o==="start"?y:f;return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:D=>{D.stopPropagation(),p(!i);let C=o==="start"?y:f;C&&v(new Date(C.getFullYear(),C.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:x(T)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("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:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((D,C)=>jsxRuntime.jsxs("button",{className:u("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:()=>h(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},C)),jsxRuntime.jsx("div",{className:u("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(y||void 0,void 0):a(void 0,void 0),p(false);},className:u("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:u("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:u("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:()=>v(new Date),className:u("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:()=>v(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("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:u("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:k().map((D,C)=>{let B=D.date.toDateString()===new Date().toDateString(),E=y?.toDateString()===D.date.toDateString(),w=f?.toDateString()===D.date.toDateString(),U=E||w,$=!r&&y&&f&&D.date>=y&&D.date<=f;return jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.date)),className:u("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]",E&&"bg-[#007BFF] text-white",w&&!E&&"bg-[#7C3AED] text-white",$&&!U&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!U&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},C)})})]})]})]})]})}function bi({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(pm,{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 pn(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 hi(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),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,v=r/o;c(true);for(let b=1;b<=o;b++){let y=setTimeout(()=>{let f=b/o,x=1-Math.pow(1-f,3),k=Math.round(d+g*x);n(k),b===o&&(c(false),n(m));},v*b);p.current.push(y);}return i.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function mm(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),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let v=Date.now();i.current=setInterval(()=>{let b=Date.now()-v,y=Math.min(b/a*100,100);l(y);},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:p,cancelChange:d}}function bm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=pn(),{displayValue:c,isAnimating:i}=hi(e,{enabled:o,duration:300,steps:6}),p=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),v=m.clientX-g.left,b=Math.round(v/g.width*100),y=Math.max(0,Math.min(100,b));y!==e&&(t(y),s&&l());},d=c??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsxRuntime.jsx("div",{onClick:p,className:u("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:u("h-full rounded-full transition-[width]",d===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxRuntime.jsxs("span",{className:u("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function xm({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 p=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("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:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("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:u("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 wm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:v,triggerFlash:b}=pn(),{displayValue:y,isAnimating:f}=hi(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let x=()=>{let h=parseFloat(d);if(!isNaN(h)){let N=h;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&b());}p(false);},k=h=>{h.key==="Enter"?x():h.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:y!==void 0?y:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:h=>m(h.target.value),onBlur:x,onKeyDown:k,onClick:h=>h.stopPropagation(),min:o,max:s,className:u("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:h=>{h.stopPropagation(),p(true);},className:u("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",y===void 0&&(a?"text-white/30":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:y!==void 0?y:r})}function Cm({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=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("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:u("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:u("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:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("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:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),l(false);},className:u("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 Nm({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:p}=mm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?p():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:u("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(),p();},className:u("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 Em({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("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:u("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 e2(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 t2(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 Io({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[p,d]=react.useState(false),[m,g]=react.useState(""),v=react.useRef(null),{isFlashing:b,triggerFlash:y}=pn(),f=c==="financial"&&i>0,x=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:e2(e,r);react.useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),D=e%60;T>0&&D>0?g(`${T}h ${D}m`):T>0?g(`${T}h`):g(`${D}m`);}else g("");},[e,p]);let k=()=>{let T=t2(m);T!==e&&(t?.(T),n&&y()),d(false);},h=T=>{T.key==="Enter"?k():T.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:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("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 N=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(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:x})]}):p?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,onChange:T=>g(T.target.value),onBlur:k,onKeyDown:h,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("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:T=>{T.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:x})]})}function Am({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("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:"#007BFF"},children:l?"En Tiempo":"On Track"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",l?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",l?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("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 Lm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:l,lens:c="hours",hourlyRate:i=0}){let p=a==="es",d=c==="financial"&&i>0,m=A=>d?`$${Math.round(A*i).toLocaleString("en-US")}`:`${A}h`,[g,v]=react.useState(false),[b,y]=react.useState(false),[f,x]=react.useState(null),k=react.useRef(null),h=e.timeLoggedMinutes||0,N=e.effortMinutes||0,T=e.soldEffortMinutes||0,D=Math.round(h/60*10)/10,C=Math.round(N/60*10)/10,B=Math.round(T/60*10)/10,E=N>0?h/N*100:0,w=E>100?Math.round((h-N)/60*10)/10:0,U=E>100?"#FF453A":E>=80?"#FFD60A":"#32D74B";react.useEffect(()=>{if(!b&&!f)return;let A=_=>{k.current&&!k.current.contains(_.target)&&(y(false),x(null));};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[b,f]);let $=A=>{if(A.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){y(_=>!_),x(null);return}l&&l(e);},Z=A=>{y(false),x(A);},F=async(A,_)=>{f==="log"&&r&&A?r(e,A,_):f==="estimate"&&o?o(e,A):f==="quoted"&&s&&s(e,A),x(null);},K=r||o||s||l,le=[{mode:"log",icon:lucideReact.Clock,label:p?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:p?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:p?"T. Ofertado":"Quoted time",show:!!s}].filter(A=>A.show),Ie=f==="estimate"?N:f==="quoted"?T:void 0;return N===0&&h===0&&T===0?jsxRuntime.jsxs("div",{ref:k,className:"relative flex items-center gap-2",onClick:A=>A.stopPropagation(),onMouseEnter:()=>v(true),onMouseLeave:()=>v(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&K&&jsxRuntime.jsx("button",{onClick:$,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:p?"Tiempo":"Time"}),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:le.map(A=>jsxRuntime.jsxs("button",{onClick:_=>{_.stopPropagation(),Z(A.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:_=>{_.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:_=>{_.target.style.background="transparent";},children:[jsxRuntime.jsx(A.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),A.label]},A.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(Ar,{mode:f,locale:a,isDark:t,currentValue:Ie||void 0,onSave:F,onClose:()=>x(null)})})})})]}):jsxRuntime.jsxs("div",{ref:k,className:"relative flex items-center gap-2 w-full",onClick:A=>A.stopPropagation(),onMouseEnter:()=>v(true),onMouseLeave:()=>v(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)}),N>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(C)]}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF453A"},children:["+",m(w)," ",p?"Exceso":"Over"]})]}),N>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(E,100)}%`,backgroundColor:U,borderRadius:2,transition:"width 0.3s"}})}),T>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:[p?"Ofertado":"Quoted",":"]}),jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(B)})]})]}),K&&jsxRuntime.jsxs("button",{onClick:$,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"}),p?"Tiempo":"Time"]}),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:le.map(A=>jsxRuntime.jsxs("button",{onClick:_=>{_.stopPropagation(),Z(A.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:_=>{_.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:_=>{_.target.style.background="transparent";},children:[jsxRuntime.jsx(A.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),A.label]},A.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(Ar,{mode:f,locale:a,isDark:t,currentValue:Ie||void 0,onSave:F,onClose:()=>x(null)})})})})]})}function Im({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";return 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:u("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u("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:u("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var l2={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function Rm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("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:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",l2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function D2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function S2(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 zm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let v=react.useRef(null),b=r==="es"?$m.es:$m.en;if(react.useEffect(()=>{let h=T=>{v.current&&!v.current.contains(T.target)&&t();},N=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",h),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",N);}},[t]),!e.isOpen)return null;let y=()=>{if(!e.task)return [];let h=[];return o&&h.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),h.push({id:"sep1",label:"",icon:null,separator:true}),l&&(h.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.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:b.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:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),h.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.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:b.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:b.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:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),p.length>0&&h.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(N=>({id:`assign-${N.id}`,label:N.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:N.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],C=T.some(B=>B.name===N.name)?T.filter(B=>B.name!==N.name):[...T,{name:N.name,initials:D2(N.name),color:N.color||S2(N.name),avatar:N.avatarUrl}];l({...e.task,assignees:C}),t();}}))})),d&&h.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&h.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&h.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),h.push({id:"sep2",label:"",icon:null,separator:true}),s&&h.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&h.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),h},f=()=>{if(!e.columnId)return [];let h=[];return i&&(h.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),h.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(h.push({id:"sep-hide",label:"",icon:null,separator:true}),h.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),h},x=e.type==="task"?y():f(),k={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:v,style:k,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(h=>h.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},h.id):h.submenu?jsxRuntime.jsx(E2,{item:h,isDark:a},h.id):jsxRuntime.jsxs("button",{onClick:h.onClick,className:u("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",h.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(h.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:h.icon}),h.label]},h.id))})}function E2({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:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("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:u("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 $m={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 Ym={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"})},_2=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Xm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[p,d]=react.useState(null),m=react.useRef(null),g=l==="es"?qm.es:qm.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let h=()=>{if(!m.current)return;let N=m.current.getBoundingClientRect(),D=window.innerHeight-N.top-20;d(Math.max(300,D));};return requestAnimationFrame(h),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[e]),react.useEffect(()=>{if(!e)return;let h=setTimeout(()=>{let N=D=>{m.current&&!m.current.contains(D.target)&&t();},T=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",N),document.addEventListener("keydown",T),m._cleanup=()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(h),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let v=h=>g.columns[h]||h,b=h=>{if(h==="name")return;let N=a.map(T=>T.id===h?{...T,visible:!T.visible}:T);o(N);},y=(h,N)=>{let T=a.find(C=>C.type===h&&(!N||C.customFieldId===N));if(T){b(T.id);return}let D={id:N||h,type:h,label:N?r.find(C=>C.id===N)?.name||h:v(h),width:120,visible:true,sortable:true,resizable:true,customFieldId:N};o([...a,D]);},f=_2.filter(h=>v(h).toLowerCase().includes(c.toLowerCase())),x=r.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),k=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...p?{maxHeight:`${p}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:h=>{h.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",h.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent",h.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:h=>i(h.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:h=>{h&&h.style.setProperty("--focus-border",k);},onFocus:h=>{h.currentTarget.style.borderColor=k,h.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:h=>{h.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",h.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:h=>h.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(h=>{let N=a.find(C=>C.type===h&&!C.customFieldId),T=N?.visible??false,D=h==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(N?b(N.id):y(h));},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:C=>{D||(C.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:C=>{C.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:T?k:"transparent",border:T?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${k}40`:"none"},children:T&&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:T?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ym[h]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?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:v(h)})]},h)})})]}),x.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:x.map(h=>{let T=a.find(D=>D.customFieldId===h.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(h.type,h.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:T?k:"transparent",border:T?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${k}40`:"none"},children:T&&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:T?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ym[h.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?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:h.name})]},h.id)})})]})]})]})}var qm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var e1=[{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 Zm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,p]=react.useState([""]),d=o==="es"?Qm.es:Qm.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let y=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let m=()=>{if(!s.trim())return;let y={name:s.trim(),type:l};l==="dropdown"&&(y.options=i.filter(f=>f.trim())),a(y),t();},g=()=>{p([...i,""]);},v=(y,f)=>{let x=[...i];x[y]=f,p(x);},b=y=>{i.length>1&&p(i.filter((f,x)=>x!==y));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("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:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:y=>n(y.target.value),placeholder:d.fieldNamePlaceholder,className:u("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:u("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:e1.map(y=>jsxRuntime.jsxs("button",{onClick:()=>c(y.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===y.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===y.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:y.icon}),jsxRuntime.jsx("span",{className:u("text-xs",l===y.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[y.type]})]},y.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("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((y,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:y,onChange:x=>v(f,x.target.value),placeholder:`${d.option} ${f+1}`,className:u("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:()=>b(f),className:u("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:u("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:u("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:u("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:u("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 Qm={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 ag={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 rg({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),p=s==="es"?ag.es:ag.en;react.useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&l(false);},v=b=>{b.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.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(v=>!v);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#007BFF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("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:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let v=e===g.value&&!t,b=()=>g.value==="all"?v?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:u("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",v&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(v?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),v&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("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:u("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:u("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:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function og({data:e,isDark:t,locale:a="en"}){let r=a==="es";return jsxRuntime.jsxs("div",{className:u("w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:r?"SALUD DEL PROYECTO":"PROJECT HEALTH"})}),jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:r?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:r?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",(e.openRFIs??0)>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs??0})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:r?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",(e.submittalsApprovalPercent??0)>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent??0,"%"]})]})]})]}),jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:r?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let o=e.scheduleVarianceDays??0,s=o>0,n=o<0,l=e.scheduleVarianceLabel||(s?`+${o} ${r?"D\xEDas ADELANTE":"Days AHEAD"}`:n?`${o} ${r?"D\xEDas ATR\xC1S":"Days BEHIND"}`:r?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",s&&"bg-[#32D74B]/15 text-[#32D74B]",n&&"bg-[#FF453A]/15 text-[#FF453A]",!s&&!n&&"bg-[#007BFF]/15 text-[#007BFF]"),children:l})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:r?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((o,s)=>{let n=o.utilizationPercent>=100?"#FF453A":o.utilizationPercent>=80?"#FFD60A":o.color||"#32D74B";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[o.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("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(o.utilizationPercent,100)}%`,backgroundColor:n}})})]},`${o.name}-${s}`)})})]})]})}var g1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function dg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...dg(r.subtasks,t+1));return a}function f1(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 p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function b1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function cg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:v=true,tableColumns:b,allowColumnCustomization:y=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:k=false,onCreateTask:h,persistFilter:N=false,financialBlur:T,healthSidebar:D,lens:C="hours",hourlyRate:B=0}=t,E=mi(d,m),w=p==="dark",U=react.useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let R=localStorage.getItem(N);if(R){let de=JSON.parse(R);return {statusFilter:de.statusFilter||"all",hideCompleted:de.hideCompleted||!1}}}catch(R){console.error("Error loading persisted filter:",R);}return {statusFilter:"all",hideCompleted:false}},[N]),[$,Z]=react.useState("startDate"),[F,K]=react.useState("asc"),[le,Ie]=react.useState(""),[A,_]=react.useState(()=>U().statusFilter),[ve,Qe]=react.useState(()=>U().hideCompleted),[O,Q]=react.useState(b||g1),[te,Ue]=react.useState(false),[rt,Ze]=react.useState(false),[mt,Ce]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[se,j]=react.useState(null),[ue,ae]=react.useState(0),[Fe,$e]=react.useState(0),Re=react.useRef(null);react.useEffect(()=>{b&&Q(b);},[b]),react.useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:A,hideCompleted:ve}));}catch(R){console.error("Error persisting filter state:",R);}},[N,A,ve]);let ct=react.useMemo(()=>{let R=new Set;function de(Ne){for(let ye of Ne)ye.subtasks?.length&&(ye.isExpanded!==false&&R.add(ye.id),de(ye.subtasks));}return de(e),R},[e]),je=react.useMemo(()=>O.filter(R=>R.visible),[O]),et=react.useCallback(R=>{a.onTaskToggleExpand?.(R);},[a]),Le=react.useCallback(R=>{$===R?K(de=>de==="asc"?"desc":"asc"):(Z(R),K("asc")),a.onSortChange?.({column:R,direction:F==="asc"?"desc":"asc"});},[$,F,a]),pt=react.useCallback(R=>{Q(R),a.onColumnsChange?.(R);},[a]),P=react.useCallback(R=>{let de=O.map(Ne=>Ne.id===R?{...Ne,visible:false}:Ne);pt(de);},[O,pt]),ee=react.useCallback((R,de)=>{Z(R),K(de);},[]),ke=react.useCallback((R,de,Ne)=>{x&&(R.preventDefault(),Ce({isOpen:true,x:R.clientX,y:R.clientY,type:de?"task":"header",task:de,columnId:Ne}));},[x]),Be=react.useCallback(()=>{Ce(R=>({...R,isOpen:false}));},[]),W=react.useCallback((R,de)=>{if(!f)return;R.preventDefault(),R.stopPropagation();let Ne=O.find(ye=>ye.id===de);Ne&&(j(de),ae(R.clientX),$e(Ne.width));},[O,f]);react.useEffect(()=>{if(!se)return;let R=Ne=>{let ye=Ne.clientX-ue,he=Math.max(50,Fe+ye),tt=O.map(fe=>fe.id===se?{...fe,width:he}:fe);Q(tt);},de=()=>{se&&a.onColumnsChange?.(O),j(null);};return document.addEventListener("mousemove",R),document.addEventListener("mouseup",de),()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",de);}},[se,ue,Fe,O,a]);let pe=react.useCallback(async R=>{if(a.onCreateCustomField){let de={...R,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(de);}Ze(false);},[a]),dt=react.useCallback(R=>R.progress===100||R.status==="completed"?"completed":R.progress&&R.progress>0||R.status==="in-progress"?"in-progress":"todo",[]),Ee=react.useMemo(()=>{let R=dg(e);if(le.trim()){let de=le.toLowerCase();R=R.filter(Ne=>Ne.name.toLowerCase().includes(de));}return A!=="all"&&(R=R.filter(de=>dt(de)===A)),ve&&(R=R.filter(de=>dt(de)!=="completed")),R.sort((de,Ne)=>{let ye,he;switch($){case "name":ye=de.name.toLowerCase(),he=Ne.name.toLowerCase();break;case "startDate":ye=de.startDate?.getTime()||0,he=Ne.startDate?.getTime()||0;break;case "endDate":ye=de.endDate?.getTime()||0,he=Ne.endDate?.getTime()||0;break;case "progress":ye=de.progress||0,he=Ne.progress||0;break;case "status":ye=de.status||"todo",he=Ne.status||"todo";break;case "priority":let tt={urgent:0,high:1,medium:2,low:3,none:4};ye=tt[de.priority]??4,he=tt[Ne.priority]??4;break;default:return 0}return ye<he?F==="asc"?-1:1:ye>he?F==="asc"?1:-1:0}),R},[e,le,A,ve,$,F,dt]),qe=react.useCallback((R,de)=>{let Ne=tt=>{a.onTaskUpdate?.({...R,...tt});},ye=tt=>tt?R.customFields?.find(Y=>Y.fieldId===tt)?.value:void 0,he=(tt,fe)=>{if(!tt)return;let De=[...R.customFields||[]],be=De.findIndex(We=>We.fieldId===tt);be>=0?De[be]={fieldId:tt,value:fe}:De.push({fieldId:tt,value:fe}),Ne({customFields:De});};switch(de.type){case "name":return null;case "status":return jsxRuntime.jsx(rm,{value:R.status||(R.progress===100?"completed":R.progress&&R.progress>0?"in-progress":"todo"),onChange:fe=>{Ne({status:fe,progress:fe==="completed"?100:fe==="in-progress"?50:0});},isDark:w,locale:d,translations:E.status});case "priority":return jsxRuntime.jsx(nm,{value:R.priority,onChange:fe=>Ne({priority:fe}),isDark:w,locale:d});case "assignees":return jsxRuntime.jsx(dm,{value:R.assignees||[],availableUsers:l,onChange:fe=>Ne({assignees:fe}),isDark:w,locale:d});case "startDate":return jsxRuntime.jsx(bi,{value:R.startDate,onChange:fe=>Ne({startDate:fe}),isDark:w,locale:d,dateField:"start",startDate:R.startDate,endDate:R.endDate});case "endDate":return jsxRuntime.jsx(bi,{value:R.endDate,onChange:fe=>Ne({endDate:fe}),isDark:w,locale:d,dateField:"end",startDate:R.startDate,endDate:R.endDate});case "progress":return jsxRuntime.jsx(bm,{value:R.progress||0,onChange:fe=>{let Y=fe===100?"completed":fe>0?"in-progress":"todo";Ne({progress:fe,status:Y});},isDark:w});case "tags":return jsxRuntime.jsx(Em,{value:R.tags||[],isDark:w});case "text":return jsxRuntime.jsx(xm,{value:ye(de.customFieldId)||"",onChange:fe=>he(de.customFieldId,fe),isDark:w});case "number":return jsxRuntime.jsx(wm,{value:ye(de.customFieldId)||0,onChange:fe=>he(de.customFieldId,fe),isDark:w});case "date":let tt=ye(de.customFieldId);return jsxRuntime.jsx(bi,{value:tt?new Date(tt):void 0,onChange:fe=>he(de.customFieldId,fe),isDark:w,locale:d});case "dropdown":return jsxRuntime.jsx(Cm,{value:ye(de.customFieldId)||"",options:de.options||[],onChange:fe=>he(de.customFieldId,fe),isDark:w});case "checkbox":return jsxRuntime.jsx(Nm,{value:ye(de.customFieldId)||false,onChange:fe=>he(de.customFieldId,fe),isDark:w});case "estimatedTime":{let fe=R.status==="completed"||R.progress===100;return jsxRuntime.jsx(Io,{value:R.estimatedTime,onChange:Y=>Ne({estimatedTime:Y}),isDark:w,locale:d,disabled:fe,lens:C,hourlyRate:B})}case "quotedTime":{let fe=R.status==="completed"||R.progress===100,Y=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(Io,{value:R.quotedTime,onChange:De=>Ne({quotedTime:De}),isDark:w,locale:d,disabled:fe,isBlurred:Y,lens:C,hourlyRate:B})}case "elapsedTime":{let fe=R.status==="completed"||R.progress===100;return jsxRuntime.jsx(Io,{value:R.elapsedTime,onChange:Y=>Ne({elapsedTime:Y}),isDark:w,locale:d,disabled:fe,lens:C,hourlyRate:B})}case "effortMinutes":{let fe=R.status==="completed"||R.progress===100;return jsxRuntime.jsx(Io,{value:R.effortMinutes,onChange:Y=>Ne({effortMinutes:Y}),isDark:w,locale:d,disabled:fe,lens:C,hourlyRate:B})}case "timeLoggedMinutes":{let fe=R.status==="completed"||R.progress===100;return jsxRuntime.jsx(Io,{value:R.timeLoggedMinutes,onChange:a.onLogTime?Y=>{a.onLogTime?.(R,Y);}:void 0,isDark:w,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:fe,lens:C,hourlyRate:B})}case "soldEffortMinutes":{let fe=R.status==="completed"||R.progress===100,Y=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Io,{value:R.soldEffortMinutes,onChange:De=>Ne({soldEffortMinutes:De}),isDark:w,locale:d,disabled:fe,isBlurred:Y,lens:C,hourlyRate:B})}case "scheduleVariance":return jsxRuntime.jsx(Am,{startDate:R.startDate,endDate:R.endDate,scheduleVariance:R.scheduleVariance,isDark:w,locale:d});case "hoursBar":return jsxRuntime.jsx(Lm,{task:R,isDark:w,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:C,hourlyRate:B});case "teamLoad":return jsxRuntime.jsx(Im,{task:R,isDark:w});case "blockers":return jsxRuntime.jsx(Rm,{blockers:R.blockers,isDark:w,locale:d});default:return jsxRuntime.jsx("span",{className:u("text-sm",w?"text-white/60":"text-gray-500"),children:"-"})}},[a,w,d,l,E]),Ke=react.useCallback(R=>{let Ne={name:E.columns.name,status:E.columns.status,priority:E.columns.priority,assignees:E.columns.assignees,startDate:E.columns.startDate,endDate:E.columns.endDate,progress:E.columns.progress,tags:E.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:E.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:E.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:E.columns.elapsedTime||(d==="es"?"Tiempo":"Time Spent"),effortMinutes:E.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:E.columns.timeLoggedMinutes||(d==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:E.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),scheduleVariance:E.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:E.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:E.columns.teamLoad||(d==="es"?"Carga Equipo":"Team Load"),blockers:E.columns.blockers||(d==="es"?"Bloqueantes":"Blockers")}[R.type]||R.label;return typeof Ne=="string"?Ne:String(Ne||R.type)},[E,d]),Xe=react.useMemo(()=>je.reduce((R,de)=>R+de.width,0)+(y?48:0),[je,y]),ot=react.useMemo(()=>{let Ne=je.reduce((he,tt)=>he+tt.width,0)+(y?48:0),ye={};for(let he of je)ye[he.id]=`${he.width/Ne*100}%`;return ye},[je,y]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",w?"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:u("text-sm",w?"text-white/60":"text-gray-600"),children:[E.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",w?"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:u("text-lg font-semibold mb-2",w?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",w?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",w?"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:u("text-lg font-semibold mb-2",w?"text-white":"text-gray-900"),children:E.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",w?"text-white/60":"text-gray-600"),children:E.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Re,className:u(w?"bg-[#0D0D0D]":"bg-white",se&&"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:u("flex-shrink-0 px-6 py-4 border-b",w?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(rg,{value:A,hideCompleted:ve,onChange:_,onHideCompletedChange:Qe,isDark:w,locale:d}),jsxRuntime.jsxs("div",{className:u("text-sm",w?"text-white/60":"text-gray-600"),children:[Ee.length," ",E.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",w?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:le,onChange:R=>Ie(R.target.value),placeholder:E.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",w?"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}),k&&h&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:h,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:E.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%",minWidth:Xe},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",w?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[je.map(R=>jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2",w?"text-white/60":"text-gray-500"),style:{width:ot[R.id],minWidth:R.minWidth},onContextMenu:de=>ke(de,void 0,R.id),children:[R.sortable?jsxRuntime.jsxs("button",{onClick:()=>Le(R.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Ke(R),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",$===R.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{children:Ke(R)}),f&&R.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",se===R.id&&"bg-[#007BFF]"),onMouseDown:de=>W(de,R.id)})]},R.id)),y&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),Ue(de=>!de);},className:u("p-0.5 rounded transition-colors",w?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",te&&(w?"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(Xm,{isOpen:te,onClose:()=>Ue(false),columns:O,customFields:c,onColumnsChange:pt,onCreateCustomField:()=>{Ue(false),Ze(true);},isDark:w,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ee.map((R,de)=>{let Ne=ct.has(R.id),ye=Math.min(de*.01,.2),he=R.hasChildren&&R.level===0,tt=R.subtasks?.length||0;return he?jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:u("flex items-center border-y cursor-pointer",w?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>et(R.id),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),et(R.id);},className:u("p-0.5 rounded flex-shrink-0",w?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ne?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",w?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",w?"text-white/40":"text-gray-500")})}),Ne?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:w?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:w?"#FFD60A":"#B45309"}}),R.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:w?"#FFD60A":"#B45309"},children:R.wbsCode}),jsxRuntime.jsx("span",{className:u("text-xs font-bold font-mono uppercase tracking-wide truncate",w?"text-gray-200":"text-gray-800"),children:R.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",w?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",tt," ",d==="es"?tt===1?"Tarea":"Tareas":tt===1?"Item":"Items",")"]}),jsxRuntime.jsx("div",{className:"flex-1"}),(()=>{let fe=f1(R),Y=b1(R);return jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[fe!==null&&jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",fe>=1?"text-[#32D74B]":fe>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",fe.toFixed(2)]}),Y>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[d==="es"?"Conflicto Recurso":"Resource Conflict",": ",Y]}),R.progress!=null&&R.progress>0&&jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",R.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[R.progress,"%"]})]})})()]})},R.id):jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:u("flex items-center border-b transition-colors",w?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(R),onDoubleClick:()=>a.onTaskDoubleClick?.(R),onContextMenu:fe=>ke(fe,R),children:[je.map(fe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:ot[fe.id],minWidth:fe.minWidth},children:fe.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[v&&R.level>0&&jsxRuntime.jsx("div",{style:{width:`${R.level*24}px`},className:"flex-shrink-0"}),v&&R.hasChildren&&jsxRuntime.jsx("button",{onClick:Y=>{Y.stopPropagation(),et(R.id);},className:u("p-0.5 rounded flex-shrink-0",w?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ne?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",w?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",w?"text-white/60":"text-gray-400")})}),v&&!R.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(R.wbsCode||R.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[R.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",w?"text-[#007BFF]":"text-blue-600"),children:R.wbsCode}),R.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",w?"text-white/40":"text-gray-400"),children:R.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate font-bold text-[13px]",w?"text-white":"text-gray-900",R.progress===100&&(w?"line-through text-white/30":"line-through text-gray-400")),children:R.name}),R.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${R.tags[0].color}20`,color:R.tags[0].color},children:R.tags[0].name})]})]}):qe(R,fe)},fe.id)),y&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},R.id)})}),Ee.length===0&&le&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",w?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(w?"text-white/60":"text-gray-600"),children:E.empty.noResults})]})})]})}),D?.enabled&&D.data&&jsxRuntime.jsx(og,{data:D.data,isDark:w,locale:d})]}),jsxRuntime.jsx(zm,{state:mt,onClose:Be,isDark:w,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:P,onColumnSort:ee,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(Zm,{isOpen:rt,onClose:()=>Ze(false),onSave:pe,isDark:w,locale:d})]})}var ug=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],pg=[{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"}],mg=[{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 Fd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},Pd={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"},Md={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"},Ci={dark:Fd,light:Pd,neutral:Md};function gg(e){return Ci[e]||Ci.dark}var Ad={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"}},Ld={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"}},Ti={en:Ad,es:Ld};function Jn(e){return Ti[e]||Ti.en}function Ni(e,t){let a=Jn(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 fg(e){let t=Jn(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 bg(e,t=0,a=true){let r=Jn(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 Zn(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 Bd(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 xg({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:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var wg=26,T1=22,N1=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 Rd(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 Cg(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 kg(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 D1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",v=c.isCriticalPath,b=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",y=m?Rd(c.effortMinutes,n,l):null,f=m?Cg(c,n,l):null,x=m?c.blockers?.find(k=>k.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:k=>{k.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":v?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:`${p*wg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${T1}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)"}:v?{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?v?"#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:[v&&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&&(y||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[y&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",y]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),x&&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,": ",x.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 Tg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:v,onUploadCommentAttachments:b,onTaskOpen:y,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,timerState:h,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:D,onStartTimer:C,onStopTimer:B,onDiscardTimer:E,blurFinancials:w=false,suppressDetailModal:U=false,lens:$="hours",hourlyRate:Z=0}){let{theme:F="dark",locale:K="en",customTranslations:le,showBacklog:Ie=true}=t,A=Ni(K,le),_=F==="dark"||F==="neutral",[ve,Qe]=react.useState(r||new Date),[O,Q]=react.useState(null),[te,Ue]=react.useState(null),[rt,Ze]=react.useState(null),[mt,Ce]=react.useState({}),se=3,j=3,ue=react.useCallback(W=>{Ue(W.id),U||Q(W),y?.(W.id);},[U,y]),[ae,Fe]=react.useState(null),$e=react.useCallback(()=>{Qe(new Date(ve.getFullYear(),ve.getMonth()-1,1));},[ve]),Re=react.useCallback(()=>{Qe(new Date(ve.getFullYear(),ve.getMonth()+1,1));},[ve]),ct=react.useCallback(()=>{Qe(new Date);},[]),je=react.useMemo(()=>{let W=ve.getFullYear(),pe=ve.getMonth(),dt=new Date(W,pe,1),Ee=new Date(W,pe+1,0),qe=dt.getDay(),Ke=Ee.getDate(),Xe=Zn(e),ot=new Date;ot.setHours(0,0,0,0);let R=[],de=qe,Ne=new Date(W,pe,0).getDate();for(let he=de-1;he>=0;he--){let tt=new Date(W,pe-1,Ne-he);R.push({date:tt,isCurrentMonth:false,isToday:false,isWeekend:tt.getDay()===0||tt.getDay()===6,events:Xe.filter(fe=>Bd(tt,fe)).map(fe=>({id:fe.id,title:fe.name,start:fe.startDate,end:fe.endDate,task:fe}))});}for(let he=1;he<=Ke;he++){let tt=new Date(W,pe,he),fe=tt.getTime()===ot.getTime();R.push({date:tt,isCurrentMonth:true,isToday:fe,isWeekend:tt.getDay()===0||tt.getDay()===6,events:Xe.filter(Y=>Bd(tt,Y)).map(Y=>({id:Y.id,title:Y.name,start:Y.startDate,end:Y.endDate,task:Y}))});}let ye=42-R.length;for(let he=1;he<=ye;he++){let tt=new Date(W,pe+1,he);R.push({date:tt,isCurrentMonth:false,isToday:false,isWeekend:tt.getDay()===0||tt.getDay()===6,events:Xe.filter(fe=>Bd(tt,fe)).map(fe=>({id:fe.id,title:fe.name,start:fe.startDate,end:fe.endDate,task:fe}))});}return R},[ve,e]),et=react.useMemo(()=>Zn(e).filter(W=>!W.startDate||!W.endDate),[e]),Le=react.useMemo(()=>{let W=Zn(e),pe=0,dt=0,Ee=0,qe=0,Ke=0;W.forEach(Ne=>{Ne.effortMinutes&&(pe+=Ne.effortMinutes),Ne.soldEffortMinutes&&(dt+=Ne.soldEffortMinutes),Ne.scheduleVariance!=null&&(Ee+=Ne.scheduleVariance,qe++),Ne.soldEffortMinutes&&Ne.effortMinutes&&(Ke+=Ne.soldEffortMinutes-Ne.effortMinutes);});let Xe=dt>0?Math.min(100,Math.round(pe/dt*100)):0,ot=qe>0?Math.round(Ee/qe):0,de=`${Ke<0?"-":"+"}${kg(Ke,$,Z)}`;return {budgetUtil:Xe,avgVariance:ot,costDisplay:de,hasCostData:dt>0}},[e,$,Z]),pt=react.useMemo(()=>{let W=[0,0,0,0,0,0];return je.forEach((pe,dt)=>{let Ee=Math.floor(dt/7);pe.events.forEach(qe=>{if(qe.task.startDate&&qe.task.soldEffortMinutes){let Ke=new Date(qe.task.startDate),Xe=pe.date;Ke.getFullYear()===Xe.getFullYear()&&Ke.getMonth()===Xe.getMonth()&&Ke.getDate()===Xe.getDate()&&Ee<W.length&&(W[Ee]-=qe.task.soldEffortMinutes);}});}),W},[je]),P=react.useMemo(()=>{let W=Zn(e),pe=new Map,dt=new Set,Ee=[0,0,0,0,0,0];if(je.length===0)return {segmentsByCell:pe,multiDayTaskIds:dt,maxLanesPerRow:Ee};let qe=de=>new Date(de.getFullYear(),de.getMonth(),de.getDate()),Ke=qe(je[0].date),Xe=qe(je[je.length-1].date),ot=[];for(let de of W){if(!de.startDate||!de.endDate)continue;let Ne=qe(de.startDate),ye=qe(de.endDate);if(Ne.getTime()===ye.getTime()||ye<Ke||Ne>Xe)continue;let he=Ne<Ke?Ke:Ne,tt=ye>Xe?Xe:ye,fe=vg(he,Ke),Y=vg(tt,Ke);fe<0||fe>41||Y<0||Y>41||fe!==Y&&(dt.add(de.id),ot.push({task:de,startIdx:fe,endIdx:Y}));}ot.sort((de,Ne)=>de.startIdx!==Ne.startIdx?de.startIdx-Ne.startIdx:Ne.endIdx-Ne.startIdx-(de.endIdx-de.startIdx));let R=[[],[],[],[],[],[]];for(let{task:de,startIdx:Ne,endIdx:ye}of ot){let he=Math.floor(Ne/7),tt=Math.floor(ye/7),fe=qe(de.startDate),Y=qe(de.endDate),De=false;for(let be=he;be<=tt;be++){let We=be===he?Ne%7:0,H=be===tt?ye%7:6,ne=H-We+1,He=0,I=R[be]??[];for(R[be]||(R[be]=I);He<I.length&&(I[He]??-1)>=We;)He++;if(He>=N1){De=true;break}He>=I.length?I.push(H):I[He]=H,Ee[be]=Math.max(Ee[be]??0,He+1);let J=be===he&&fe>=Ke,G=be===tt&&Y<=Xe,ge=be*7+We,Je={taskId:de.id,task:de,rowIndex:be,startCol:We,endCol:H,spanCols:ne,lane:He,isStart:J,isEnd:G};pe.has(ge)||pe.set(ge,[]),pe.get(ge).push(Je);}De&&(dt.delete(de.id),pe.forEach((be,We)=>{let H=be.filter(ne=>ne.taskId!==de.id);H.length===0?pe.delete(We):pe.set(We,H);}));}return {segmentsByCell:pe,multiDayTaskIds:dt,maxLanesPerRow:Ee}},[je,e]),ee=K==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ke=ve.toLocaleDateString(K==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Be=ke.charAt(0).toUpperCase()+ke.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"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:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[A.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"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:u("w-12 h-12 rounded-full flex items-center justify-center",_?"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:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:A.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:A.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"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:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"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:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:K==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:$e,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"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:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",_?"text-white":"text-gray-900"),children:Be}),jsxRuntime.jsx("button",{onClick:Re,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"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:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:ct,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"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:A.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:ee.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"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:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ue(null),children:je.map((W,pe)=>{let dt=pe%7===6,Ee=pe>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!dt&&(_?"border-r border-[#222]":"border-r border-gray-200"),!Ee&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?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&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let qe=Math.floor(pe/7),Ke=(P.maxLanesPerRow[qe]??0)*wg,Xe=P.segmentsByCell.get(pe);return Ke===0&&!Xe?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ke}px`,zIndex:5},children:Xe?.map(ot=>jsxRuntime.jsx(D1,{segment:ot,isDark:_,blurFinancials:w,isSelected:te===ot.taskId,t:A,lens:$,hourlyRate:Z,onClick:()=>{ue(ot.task),a.onEventClick?.({id:ot.task.id,title:ot.task.name,start:ot.task.startDate,end:ot.task.endDate,task:ot.task});}},ot.taskId))})})(),(()=>{let qe=W.events.filter(Ke=>Ke.task.isMilestone&&!P.multiDayTaskIds.has(Ke.id));return qe.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[qe.slice(0,4).map(Ke=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ke.title,onClick:Xe=>{Xe.stopPropagation(),ue(Ke.task);}},Ke.id)),qe.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",qe.length-4]})]})})(),(()=>{let qe=[];W.events.forEach(Xe=>{Xe.task.blockers?.forEach(ot=>{(ot.severity==="warning"||ot.severity==="critical")&&qe.push({taskId:Xe.id,type:ot.type,severity:ot.severity,variance:Xe.task.scheduleVariance});});});let Ke=qe[0];return Ke?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ke.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:[A.labels.risk,": ",Ke.type,Ke.variance?` (+${Math.abs(Ke.variance)}d ${A.labels.delay})`:""]})]})}):null})(),(()=>{let qe=W.events.filter(R=>!P.multiDayTaskIds.has(R.id)),Ke=mt[pe]||se,Xe=qe.slice(0,Ke),ot=qe.length-Ke;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Xe.map(R=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{ue(R.task),a.onEventClick?.(R);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",R.task.progress===100||R.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?R.task.progress===100||R.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)"}:R.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:u("flex-shrink-0 text-[9px]",R.task.isMilestone?_?"text-amber-400":"text-amber-600":R.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:R.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:R.title})]},R.id)),ot>0&&jsxRuntime.jsxs("button",{onClick:R=>{R.stopPropagation(),Ce(de=>({...de,[pe]:Ke+j}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ot," ",K==="es"?"m\xE1s":"more"]}),Ke>se&&qe.length>se&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),Ce(de=>({...de,[pe]:se}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:K==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let qe=pe>=28,Ke=pe%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Xe=>{Xe.stopPropagation(),Fe(ae===pe?null:pe);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ae===pe?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"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:u("w-3.5 h-3.5 transition-transform",ae===pe&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae===pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:qe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:qe?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",qe?"bottom-full mb-1":"top-full mt-1",Ke?"right-0":"left-0",_?"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(Do,{onSubmit:Xe=>{a.onTaskCreate?.({name:Xe.name,startDate:Xe.startDate||W.date,endDate:Xe.endDate||W.date,priority:Xe.priority,assignees:Xe.assignee?[Xe.assignee]:void 0}),Fe(null);},onCancel:()=>Fe(null),availableUsers:t.availableUsers,isDark:_,locale:K==="es"?"es":"en",defaultDate:W.date,dropdownDirection:qe?"up":"down"})})]})})]})})()}),pe%7===6&&(()=>{let qe=Math.floor(pe/7),Ke=pt[qe];if(!Ke||Ke===0)return null;let Xe=kg(Ke,$,Z);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ke<0?"text-red-400":"text-emerald-400",w&&"blur-sm select-none"),children:[A.labels.cashOut,": ",Ke<0?"-":"+",Xe]})})()]},pe)})})})]}),Ie&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",_?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:A.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:et.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:et.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",_?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:K==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):et.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{ue(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"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:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",_?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"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(pe=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${pe.color}15`,color:pe.color,border:`1px solid ${pe.color}30`},children:pe.name},pe.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",w&&"blur-sm select-none"),children:[Rd(W.effortMinutes,$,Z)&&jsxRuntime.jsxs("span",{children:[A.labels.estimate,": ",Rd(W.effortMinutes,$,Z)]}),(()=>{let pe=Cg(W,$,Z);return pe?jsxRuntime.jsx("span",{className:pe.isNegative?"text-red-400":"text-emerald-400",children:pe.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:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(xg,{task:W,isDark:_})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((pe,dt)=>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:pe.color||"#007FFF"},title:pe.name,children:pe.initials||pe.name?.slice(0,2).toUpperCase()},dt))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:A.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"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="");}})}),Le.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",A.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:A.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",w&&"blur-sm select-none"),children:[Le.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Le.budgetUtil}%`,background:Le.budgetUtil>90?"#EF4444":Le.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:A.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",Le.avgVariance>0?"text-emerald-400":Le.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[Le.avgVariance>0?"+":"",Le.avgVariance," ",A.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:A.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",Le.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",w&&"blur-sm select-none"),children:Le.costDisplay})]})]})]})]})]}),!U&&jsxRuntime.jsx(Gr,{task:O,isOpen:!!O,onClose:()=>Q(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),Q(W);},theme:F==="dark"?"dark":"light",locale:K,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:O?p?.get(O.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Zn(e).filter(W=>W.id!==O?.id),comments:d?.filter(W=>W.taskId===O?.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:v,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,isTimerRunning:h?.isRunning,timerElapsedSeconds:h?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:D,onTimerStart:C,onTimerStop:B,onTimerDiscard:E,blurFinancials:w}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:rt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ze(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:u("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",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:rt.date.toLocaleDateString(K==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ze(null),className:u("p-1 rounded",_?"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:rt.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{Ze(null),ue(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(xg,{task:W.task,isDark:_}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",_?"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 Od={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)"},$d={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)"},Hd={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)"},Ei={dark:Od,light:$d,neutral:Hd};function Ng(e){return Ei[e]||Ei.dark}function E1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,v=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,b=p.map(f=>f.priority).filter(Boolean),y=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:v,priorities:b,labels:y}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("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:u("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:p.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:p.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:v=>{v.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 Sg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ts(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 as(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 Eg(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 Fg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...Sg,...n}),[n]),[i,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(k=>{let h=k.timestamp.toISOString().split("T")[0],N=x.get(h);N?N.push(k):x.set(h,[k]);}),Array.from(x.entries()).sort((k,h)=>h[0].localeCompare(k[0])).map(([k,h])=>({date:new Date(k),events:h.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:v}=react.useMemo(()=>{let x=new Set,k=new Set;return e.forEach(h=>{x.add(h.userId),k.add(h.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(k)}},[e]),b=x=>{p(k=>{let h=new Set(k);return h.has(x)?h.delete(x):h.add(x),h});},y=x=>{let h=new Date().getTime()-x.getTime(),N=Math.floor(h/6e4),T=Math.floor(h/36e5),D=Math.floor(h/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:D<7?`${D}d ago`:x.toLocaleDateString()},f=react.useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return react.useEffect(()=>{if(s&&d.current){let x=d.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("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:u("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:x=>{let k=x.target.value;a({...t,types:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(x=>jsxRuntime.jsxs("option",{value:x,children:[as(x)," ",x.replace("_"," ")]},x))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let k=x.target.value;a({...t,users:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.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(x=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&x.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:x.events.map((k,h)=>{let N=i.has(k.id),T=s===k.id,D=Eg(k.type);return jsxRuntime.jsxs("div",{"data-event-id":k.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(k),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:as(k.type)})}),h<x.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&&k.userAvatar&&jsxRuntime.jsx("img",{src:k.userAvatar,alt:k.userName||k.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:k.userName||k.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ts(k)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?y(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),b(k.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([C,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),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)})]})]},C)),k.metadata&&Object.keys(k.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(k.metadata).map(([C,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},C))]})]})]})]},k.id)})})]},x.date?.toISOString()||"all"))})]})}function Mg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let p=[.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:u("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:u("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&as(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&ts(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,v)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:ts(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:p.map(g=>jsxRuntime.jsxs("button",{className:u("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:u("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 zd(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 Ud(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 Ag(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 Lg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function I1(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(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(m-p.y)*o.centerForce*i,n.forEach(g=>{if(p.id===g.id)return;let v=p.x-g.x,b=p.y-g.y,y=Math.sqrt(v*v+b*b)||1,f=o.chargeStrength*i/(y*y);p.vx+=v/y*f,p.vy+=b/y*f;});}),t.forEach(p=>{let d=l.get(typeof p.source=="string"?p.source:p.source.id),m=l.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,v=m.y-d.y,b=Math.sqrt(g*g+v*v)||1,y=(b-o.linkDistance)/b*o.forceStrength*i;d.vx+=g*y,d.vy+=v*y,m.vx-=g*y,m.vy-=v*y;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function Ig({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[v,b]=react.useState(null),[y,f]=react.useState(null),[x,k]=react.useState(1),[h,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=I1(e,t,a.width,a.height,a,150);d($);},[e,t,a]);let T=react.useCallback(($,Z)=>{a.enableDragging&&(Z.stopPropagation(),g($));},[a.enableDragging]),D=react.useCallback($=>{if(!m||!i.current)return;let F=i.current.getBoundingClientRect(),K=($.clientX-F.left-h.x)/x,le=($.clientY-F.top-h.y)/x;d(Ie=>Ie.map(A=>A.id===m?{...A,x:K,y:le,fx:K,fy:le}:A));},[m,x,h]),C=react.useCallback(()=>{g(null);},[]),B=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"node-click",node:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),E=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),w=react.useCallback($=>{let Z=p.find(F=>F.id===$);return Z?{x:Z.x,y:Z.y}:{x:0,y:0}},[p]),U=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Z=$.card.priority;return Z==="URGENT"?"#ef4444":Z==="HIGH"?"#f59e0b":Z==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("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:u("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:()=>k($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:zd($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Ag($)," ",Ud($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${h.x}, ${h.y}) scale(${x})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let Z=w(typeof $.source=="string"?$.source:$.source.id),F=w(typeof $.target=="string"?$.target:$.target.id),K=Lg($.type),le=y===$.id,Ie=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",le&&"hovered",Ie&&"critical"),onMouseEnter:()=>f($.id),onMouseLeave:()=>f(null),onClick:A=>E($,A),children:[jsxRuntime.jsx("line",{x1:Z.x,y1:Z.y,x2:F.x,y2:F.y,stroke:zd($.type),strokeWidth:Ie?a.edgeWidth*2:a.edgeWidth,strokeOpacity:le?1:.6,markerEnd:K?"url(#arrowhead)":void 0}),a.showEdgeLabels&&le&&jsxRuntime.jsx("text",{x:(Z.x+F.x)/2,y:(Z.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ud($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let Z=v===$.id,F=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",Z&&"hovered",F&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:K=>T($.id,K),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:K=>B($,K),children:[jsxRuntime.jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:U($),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:Z?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),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 Og({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),v=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let x=k=>{k.key==="Escape"&&!v&&b();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,v]);let b=()=>{v||(n(""),p(null),m(null),t());},y=async()=>{if(!(!s.trim()||v)){c(true),p(null),m(null);try{let x=await r(s.trim());m(x);}catch(x){p(x instanceof Error?x.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),b());};return e?jsxRuntime.jsxs(Pt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),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:x=>x.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:b,disabled:v,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((x,k)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},k))})]}),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((x,k)=>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:x.title}),x.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},k)),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:x=>n(x.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:v}),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((x,k)=>jsxRuntime.jsx("button",{onClick:()=>n(x),disabled:v,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:x},k))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&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:b,disabled:v,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:y,disabled:!s.trim()||v,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:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Wd={"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 R1={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},O1={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 $1(e,t,a){let r=Wd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function rs(e){return `$${e.toFixed(4)}`}var Gd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=$1(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={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,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(p=>p.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)}},Ro=new Gd;function zg({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Ro.getStats()),[s,n]=react.useState(Ro.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Ro.getStats()),n(Ro.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=Ro.getRecentOperations(5);return jsxRuntime.jsxs(Pt,{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:rs(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 p=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:rs(p)})]})]}),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:rs(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 Gg({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[v,b]=react.useState(null),[y,f]=react.useState(null),[x,k]=react.useState(null),h=react.useRef(null),N=m||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let E=w=>{w.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[e,N]);let T=()=>{N||(l(""),i(""),d(""),b(null),f(null),k(null),t());},D=async()=>{if(!(!n.trim()||N)){g(true),b(null),f(null),k(null);try{let E=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f(E.tasks.tasks),k({from_cache:E.from_cache,tokens_used:E.tokens_used,mock_mode:E.mock_mode,similarity:E.similarity,tokens_saved:E.tokens_saved});}catch(E){b(E instanceof Error?E.message:"Failed to generate tasks");}finally{g(false);}}},C=()=>{y&&(a(y),T());};if(!e)return null;let B=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Pt,{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:E=>E.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:T,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[x?.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"}),x?.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:[x?.tokens_used||0," tokens"]}),x?.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:[x.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((E,w)=>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:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:E.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"})]}),E.start," \u2192 ",E.end]}),jsxRuntime.jsxs("span",{children:[E.duration," days"]}),E.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",E.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${E.priority==="high"?"bg-red-500/20 text-red-400":E.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:E.priority})]})},E.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:h,value:n,onChange:E=>l(E.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:N}),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:E=>i(E.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:N})]}),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:p,onChange:E=>d(E.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:N})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((E,w)=>jsxRuntime.jsx("button",{onClick:()=>l(E),disabled:N,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:E},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&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:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:D,disabled:!n.trim()||N,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:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Mi({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&hs(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,x,k)=>{console.warn(`Retry attempt ${x} after ${k}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(y,f,x)=>{r(k=>{let h=k.cards.find(E=>E.id===y);if(!h)return k;let N=h.columnId,T={...h,columnId:f,position:x},D=k.cards.map(E=>E.id===y?T:E),C=k.columns.map(E=>{if(E.id===N)return {...E,cardIds:E.cardIds.filter(w=>w!==y)};if(E.id===f){let w=D.filter(U=>U.columnId===f).sort((U,$)=>U.position-$.position);return {...E,cardIds:w.map(U=>U.id)}}return E}),B={...k,cards:D,columns:C};return o(B),B});},[o]),n=react.useCallback(async(y,f)=>{r(x=>{let k=x.cards.map(N=>N.id===y?{...N,...f}:N),h={...x,cards:k};return o(h),h});},[o]),l=react.useCallback(async y=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...y,id:f},h=x.columns.map(T=>T.id===y.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...x,cards:[...x.cards,k],columns:h};return o(N),N});},[o]),c=react.useCallback(async y=>{r(f=>{let x=f.cards.find(T=>T.id===y);if(!x)return f;let k=f.cards.filter(T=>T.id!==y),h=f.columns.map(T=>T.id===x.columnId?{...T,cardIds:T.cardIds.filter(D=>D!==y)}:T),N={...f,cards:k,columns:h};return o(N),N});},[o]),i=react.useCallback(async y=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...y,id:f,cardIds:[]},h={...x,columns:[...x.columns,k]};return o(h),h});},[o]),p=react.useCallback(async(y,f)=>{r(x=>{let k=x.columns.map(N=>N.id===y?{...N,...f}:N),h={...x,columns:k};return o(h),h});},[o]),d=react.useCallback(async y=>{r(f=>{let x=f.cards.filter(N=>N.columnId!==y),k=f.columns.filter(N=>N.id!==y),h={...f,cards:x,columns:k};return o(h),h});},[o]),m=react.useCallback(y=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),f},[l]),g=react.useCallback(y=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),f},[i]),v=react.useCallback(()=>{r(y=>{let f={...y,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:v}}}function _g({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Mi({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,p={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??p+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 os={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Kg={by:"none",order:"asc"};function Yg({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...os,...e}),[s,n]=react.useState({...Kg,...t}),l=react.useCallback(b=>{o(y=>({...y,...b}));},[]),c=react.useCallback(b=>{n(y=>({...y,...b}));},[]),i=react.useCallback(()=>{o(os),n(Kg);},[]),p=react.useCallback(()=>{a&&o({...os,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...os,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...os,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]),v=react.useCallback(b=>{let y=[...b];if(r.search){let f=r.search.toLowerCase();y=y.filter(x=>x.title.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,x=f.getFullYear(),k=String(f.getMonth()+1).padStart(2,"0"),h=String(f.getDate()).padStart(2,"0"),N=`${x}-${k}-${h}`;y=y.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let D=T.endDate||T.dueDate;if(!D)return false;let C;if(typeof D=="string")C=D.split("T")[0]||D;else {let B=D.getUTCFullYear(),E=String(D.getUTCMonth()+1).padStart(2,"0"),w=String(D.getUTCDate()).padStart(2,"0");C=`${B}-${E}-${w}`;}switch(r.dateFilter){case "overdue":return C<N;case "today":return C===N;case "this-week":let B=new Date(N+"T00:00:00"),E=new Date(C+"T00:00:00"),w=new Date(B);return w.setDate(w.getDate()+7),E>=B&&E<=w;case "custom":if(r.dateRange){let U=typeof D=="string"?new Date(D):D;return U>=r.dateRange.start&&U<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(y=y.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(y=y.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(y=y.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&y.sort((f,x)=>{let k=0;switch(s.by){case "created":let h=f.createdAt?new Date(f.createdAt).getTime():0,N=x.createdAt?new Date(x.createdAt).getTime():0;k=h-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=T[f.priority||"LOW"],C=T[x.priority||"LOW"];k=D-C;break;case "dueDate":let B=f.endDate||f.dueDate,E=x.endDate||x.dueDate;if(!B)return 1;if(!E)return -1;let w=typeof B=="string"?new Date(B).getTime():B.getTime(),U=typeof E=="string"?new Date(E).getTime():E.getTime();k=w-U;break;case "title":k=f.title.localeCompare(x.title);break;case "estimate":let $=f.estimatedTime||0,Z=x.estimatedTime||0;k=$-Z;break;default:k=0;}return s.order==="asc"?k:-k}),y},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:v,hasActiveFilters:g}}var Xg,Jg;if(typeof window<"u")try{let e=gs("ai");Xg=e.generateObject,Jg=e.generateText;}catch{}function Qg(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Xg&&Jg&&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]),p=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:p,isAvailable:s,isLoading:t,error:r}}function _d(){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 Zg(e){let{cards:t}=e,[a,r]=_d(),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,v=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let b=t.find(f=>f.id===d),y=t.find(f=>f.id===a.lastSelectedCardId);if(b&&y&&b.columnId===y.columnId){let f=t.filter(C=>C.columnId===b.columnId).sort((C,B)=>C.position-B.position),x=f.findIndex(C=>C.id===a.lastSelectedCardId),k=f.findIndex(C=>C.id===d),[h,N]=x<k?[x,k]:[k,x],T=f.slice(h,N+1).map(C=>C.id),D=Array.from(new Set([...a.selectedCardIds,...T]));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]),p=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:p}}var e0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function t0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...e0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((b,y,f,x,k)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let h={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:y,columnId:f,strategy:x,color:k,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,h]);},[o.minCardsPerStack,s]),c=react.useCallback(b=>{n(y=>y.filter(f=>f.id!==b));},[]),i=react.useCallback(b=>{n(y=>y.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((b,y)=>{n(f=>f.map(x=>x.id===b&&!x.cardIds.includes(y)?{...x,cardIds:[...x.cardIds,y]}:x));},[]),d=react.useCallback((b,y)=>{n(f=>f.map(x=>{if(x.id===b){let k=x.cardIds.filter(h=>h!==y);return k.length<o.minCardsPerStack?null:{...x,cardIds:k}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),m=react.useCallback(b=>s.filter(y=>y.columnId===b).sort((y,f)=>y.position-f.position),[s]),g=react.useCallback(async b=>{let y=t.filter(N=>N.columnId===b);if(y.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;y.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{x.has(T)||x.set(T,[]),x.get(T).push(N);});}),x.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(D=>D.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let k=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{k.has(T)||k.set(T,[]),k.get(T).push(N);});}),k.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(D=>D.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let h=new Map;if(y.forEach(N=>{N.priority&&(h.has(N.priority)||h.set(N.priority,[]),h.get(N.priority).push(N));}),h.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${T} Priority`,cardIds:N.map(C=>C.id),columnId:b,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of y){let D=(await r.findSimilar(N,y)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let C=[N.id,...D.map(E=>E.card.id)],B=D.reduce((E,w)=>E+w.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:C,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:B});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(b=>{l(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let f=await g(y),x=f[0];f.length>0&&x&&x.confidence>=.9&&v(x);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:v,config:o}}var a0=react.createContext(null);function r0({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}=gs("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=gs("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=gs("@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(a0.Provider,{value:{store:o},children:e})}function Ai(){let e=react.useContext(a0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ss(){let e=Ai(),[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(x=>{e.updateBoard(x);},[e]),c=react.useCallback(x=>{e.addColumn(x);},[e]),i=react.useCallback((x,k)=>{e.updateColumn(x,k);},[e]),p=react.useCallback(x=>{e.deleteColumn(x);},[e]),d=react.useCallback(x=>e.getColumn(x),[e]),m=react.useCallback(x=>{e.addCard(x);},[e]),g=react.useCallback((x,k)=>{e.updateCard(x,k);},[e]),v=react.useCallback(x=>{e.deleteCard(x);},[e]),b=react.useCallback((x,k,h)=>{e.moveCard(x,k,h);},[e]),y=react.useCallback(x=>e.getCard(x),[e]),f=react.useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:v,moveCard:b,getCard:y,getCardsByColumn:f}}function n0(e){let{cards:t}=ss();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 s0(e="position",t="asc"){let{cards:a}=ss();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 Li=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Sc.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);}},tk=new Li;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),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.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(v=>{let b=e[v.index];if(!b)return null;let y=c?c(b,v.index):v.index,f={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsxRuntime.jsx("div",{style:f,"data-index":v.index,children:r(b,v.index)},y)})})})}function d0(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 u0({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 p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.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"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:v,children:m.map(b=>{let y=e[b.index];if(!y)return null;let f=c?c(y,b.index):b.index,x={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:x,"data-index":b.index,children:o(y,b.index)},f)})})})}function p0(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 m0(e,t=10){return e>t}var qd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Xd={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Jd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Qd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Zd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},ec={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},tc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ac={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)"},rc={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)"},oc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},nc={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}},sc={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}},Ii={spacing:qd,borderRadius:Xd,fontSize:Jd,fontWeight:Qd,lineHeight:Zd,zIndex:ec,duration:tc,easing:ac,shadows:rc,opacity:oc,kanban:nc,gantt:sc};function g0(e,t,a){return e[t]??a}function ic(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)?ic(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function ok(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function lc(e="asakaa"){let t=ic(Ii),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=ok(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function cm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Qr(e,t){let a=cm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let u=d.name.toLowerCase();return n.every(i=>u.includes(i))})}function fd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),b=y.getDay(),v=g-b;return v<=0&&(v+=7),y.setDate(y.getDate()+v),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,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()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,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},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=c[l[1].toLowerCase()],g=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function bd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function hd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function um(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 pm(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(),l=Qr(t,i),m=fd(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:y},message:`Moved "${l.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),l=Qr(t,i),m=bd(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),l=Qr(t,i),m=hd(c);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),l=Qr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.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 d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=Qr(t,i),m=Qr(t,c);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName: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=Qr(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 mm(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 Iv(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 Bv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function yi(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(m=>m.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>yi(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},d=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||d&&u&&Math.abs(u.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:u,progress:e.progress||0,status:Iv(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 gm(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:Bv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function fm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>yi(r,e,t))}var yd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},xd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},xi={en:yd,es:xd};function vd(e){return xi[e]||xi.en}function vi(e,t){let a=vd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var kd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#007BFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#32D74B]"}];function bm(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 hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=bm(e),i=kd[0],c=kd.find(g=>g.value===u)??i,l=c.icon,m=g=>{switch(bm(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(l,{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:d,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(l,{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:kd.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",u===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{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 wd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function xm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=wd.find(c=>c.value===e)??wd[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:d,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:wd.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.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 Yn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Cm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[u,i]=react.useState(""),c=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{let b=v=>{c.current&&!c.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(u.toLowerCase())),g=b=>e.some(v=>v.name===b),y=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:Yn(b.name),color:b.color||Cd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?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((b,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",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Yn(b.name)},`${b.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:b=>{b.stopPropagation(),d(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?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((b,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",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Yn(b.name)},`${b.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:l,type:"text",value:u,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&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((b,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Yn(b.name)}),b.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${b.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(b=>{let v=g(b.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Yn(b.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.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"}})})]},b.id)})})]})]})}function Dm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:u}){let[i,c]=react.useState(false),[l,m]=react.useState(o),[g,y]=react.useState(()=>{let S=o==="start"?e:t;if(S){let T=S instanceof Date?S:new Date(S);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=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 S=T=>{b.current&&!b.current.contains(T.target)&&c(false);};return i&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let x=S=>S?S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",k=react.useCallback(()=>{let S=g.getFullYear(),T=g.getMonth(),L=new Date(S,T,1),N=new Date(S,T+1,0).getDate(),Y=L.getDay(),O=[],P=new Date(S,T,0).getDate();for(let fe=Y-1;fe>=0;fe--)O.push({date:new Date(S,T-1,P-fe),isCurrentMonth:false});for(let fe=1;fe<=N;fe++)O.push({date:new Date(S,T,fe),isCurrentMonth:true});let q=42-O.length;for(let fe=1;fe<=q;fe++)O.push({date:new Date(S,T+1,fe),isCurrentMonth:false});return O},[g]),h=S=>{if(r)o==="start"?a(S,f||void 0):a(v||void 0,S),c(false);else if(l==="start"){let T=f&&S>f?S:f;a(S,T||void 0),m("end");}else {let T=v&&S<v?S:v;a(T||void 0,S),c(false);}},w=()=>{let S=new Date,T=new Date(S);T.setDate(S.getDate()+1);let L=new Date(S);L.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let A=new Date(S);A.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let N=new Date(S);N.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let Y=new Date(S);Y.setDate(S.getDate()+14);let O=new Date(S);return O.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:A,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let S=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:x(S)})]})}let C=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:S=>{S.stopPropagation(),c(!i);let T=o==="start"?v:f;T&&y(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:x(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:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[w().map((S,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:()=>h(S.date),children:[jsxRuntime.jsx("span",{children:S.label}),jsxRuntime.jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:S.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:l==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),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:()=>y(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:()=>y(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:()=>y(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(S=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:k().map((S,T)=>{let L=S.date.toDateString()===new Date().toDateString(),A=v?.toDateString()===S.date.toDateString(),N=f?.toDateString()===S.date.toDateString(),Y=A||N,O=!r&&v&&f&&S.date>=v&&S.date<=f;return jsxRuntime.jsx("button",{onClick:()=>h(new Date(S.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),S.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",A&&"bg-[#007BFF] text-white",N&&!A&&"bg-[#7C3AED] text-white",O&&!Y&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Y&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:S.date.getDate()},T)})})]})]})]})]})}function Ci({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let u=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Dm,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(e=600){let[t,a]=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 Ti(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[d,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 l=i.current??0,m=e,g=m-l,y=r/o;u(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,x=1-Math.pow(1-f,3),k=Math.round(l+g*x);n(k),b===o&&(u(false),n(m));},y*b);c.current.push(v);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Sm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,d]=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),d(0);let y=Date.now();i.current=setInterval(()=>{let b=Date.now()-y,v=Math.min(b/a*100,100);d(v);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=react.useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),d(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:l}}function Fm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:u,isAnimating:i}=Ti(e,{enabled:o,duration:300,steps:6}),c=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),y=m.clientX-g.left,b=Math.round(y/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=u??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",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsxRuntime.jsx("div",{onClick:c,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]",l===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxRuntime.jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Lm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,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=()=>{d!==e&&t?.(d),n(false);},l=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:d,onChange:m=>u(m.target.value),onBlur:c,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):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 Rm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:u=true}){let[i,c]=react.useState(false),[l,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ti(e,{enabled:d&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let x=()=>{let h=parseFloat(l);if(!isNaN(h)){let w=h;o!==void 0&&(w=Math.max(o,w)),s!==void 0&&(w=Math.min(s,w)),w!==e&&(t?.(w),u&&b());}c(false);},k=h=>{h.key==="Enter"?x():h.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:l,onChange:h=>m(h.target.value),onBlur:x,onKeyDown:k,onClick:h=>h.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:h=>{h.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"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Om({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),u=react.useRef(null);return react.useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&d(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(),d(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[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),d(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[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 Hm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:u,startChange:i,cancelChange:c}=Sm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?c():i(!e):t(!e));},m=d?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&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"})}),d?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]}),d&&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 Wm({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 h2(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 y2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),u=parseInt(a[2],10);return d*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(d*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 Ro({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:u="hours",hourlyRate:i=0}){let[c,l]=react.useState(false),[m,g]=react.useState(""),y=react.useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=u==="financial"&&i>0,x=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:h2(e,r);react.useEffect(()=>{c&&y.current&&(y.current.focus(),y.current.select());},[c]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),S=e%60;C>0&&S>0?g(`${C}h ${S}m`):C>0?g(`${C}h`):g(`${S}m`);}else g("");},[e,c]);let k=()=>{let C=y2(m);C!==e&&(t?.(C),n&&v()),l(false);},h=C=>{C.key==="Enter"?k():C.key==="Escape"&&l(false);};if(d)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 w=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(w,{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:x})]}):c?jsxRuntime.jsx("input",{ref:y,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:k,onKeyDown:h,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(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(w,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:x})]})}function jm({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=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#007BFF"},children:d?"En Tiempo":"On Track"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",d?"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 Km({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:u="hours",hourlyRate:i=0}){let c=a==="es",l=u==="financial"&&i>0,m=F=>l?`$${Math.round(F*i).toLocaleString("en-US")}`:`${F}h`,[g,y]=react.useState(false),[b,v]=react.useState(false),[f,x]=react.useState(null),k=react.useRef(null),h=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,S=Math.round(h/60*10)/10,T=Math.round(w/60*10)/10,L=Math.round(C/60*10)/10,A=w>0?h/w*100:0,N=A>100?Math.round((h-w)/60*10)/10:0,Y=A>100?"#FF453A":A>=80?"#FFD60A":"#32D74B";react.useEffect(()=>{if(!b&&!f)return;let F=U=>{k.current&&!k.current.contains(U.target)&&(v(false),x(null));};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[b,f]);let O=F=>{if(F.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){v(U=>!U),x(null);return}d&&d(e);},le=F=>{v(false),x(F);},P=async(F,U)=>{f==="log"&&r&&F?r(e,F,U):f==="estimate"&&o?o(e,F):f==="quoted"&&s&&s(e,F),x(null);},q=r||o||s||d,fe=[{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(F=>F.show),Ke=f==="estimate"?w:f==="quoted"?C:void 0;return w===0&&h===0&&C===0?jsxRuntime.jsxs("div",{ref:k,className:"relative flex items-center gap-2",onClick:F=>F.stopPropagation(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),children:[jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsxRuntime.jsx("button",{onClick:O,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:c?"Tiempo":"Time"}),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:fe.map(F=>jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),le(F.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:U=>{U.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.target.style.background="transparent";},children:[jsxRuntime.jsx(F.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),F.label]},F.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(Ir,{mode:f,locale:a,isDark:t,currentValue:Ke||void 0,onSave:P,onClose:()=>x(null)})})})})]}):jsxRuntime.jsxs("div",{ref:k,className:"relative flex items-center gap-2 w-full",onClick:F=>F.stopPropagation(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(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(S)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),N>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF453A"},children:["+",m(N)," ",c?"Exceso":"Over"]})]}),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(A,100)}%`,backgroundColor:Y,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(L)})]})]}),q&&jsxRuntime.jsxs("button",{onClick:O,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"}),c?"Tiempo":"Time"]}),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:fe.map(F=>jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),le(F.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:U=>{U.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.target.style.background="transparent";},children:[jsxRuntime.jsx(F.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),F.label]},F.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(Ir,{mode:f,locale:a,isDark:t,currentValue:Ke||void 0,onSave:P,onClose:()=>x(null)})})})})]})}function Ym({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-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";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 N2={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function Xm({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",N2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function G2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function V2(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 eg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:u,onColumnSort:i,availableUsers:c=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let y=react.useRef(null),b=r==="es"?Qm.es:Qm.en;if(react.useEffect(()=>{let h=C=>{y.current&&!y.current.contains(C.target)&&t();},w=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",h),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",w);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let h=[];return o&&h.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),h.push({id:"sep1",label:"",icon:null,separator:true}),d&&(h.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),h.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&h.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(w=>({id:`assign-${w.id}`,label:w.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:w.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(L=>L.name===w.name)?C.filter(L=>L.name!==w.name):[...C,{name:w.name,initials:G2(w.name),color:w.color||V2(w.name),avatar:w.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&h.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&h.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&h.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),h.push({id:"sep2",label:"",icon:null,separator:true}),s&&h.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&h.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),h},f=()=>{if(!e.columnId)return [];let h=[];return i&&(h.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),h.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(h.push({id:"sep-hide",label:"",icon:null,separator:true}),h.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),h},x=e.type==="task"?v():f(),k={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:y,style:k,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(h=>h.separator?jsxRuntime.jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},h.id):h.submenu?jsxRuntime.jsx(_2,{item:h,isDark:a},h.id):jsxRuntime.jsxs("button",{onClick:h.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",h.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:p(h.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:h.icon}),h.label]},h.id))})}function _2({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(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var Qm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",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 lg={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"})},l1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function cg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[u,i]=react.useState(""),[c,l]=react.useState(null),m=react.useRef(null),g=d==="es"?dg.es:dg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let h=()=>{if(!m.current)return;let w=m.current.getBoundingClientRect(),S=window.innerHeight-w.top-20;l(Math.max(300,S));};return requestAnimationFrame(h),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[e]),react.useEffect(()=>{if(!e)return;let h=setTimeout(()=>{let w=S=>{m.current&&!m.current.contains(S.target)&&t();},C=S=>{S.key==="Escape"&&t();};document.addEventListener("mousedown",w),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(h),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let y=h=>g.columns[h]||h,b=h=>{if(h==="name")return;let w=a.map(C=>C.id===h?{...C,visible:!C.visible}:C);o(w);},v=(h,w)=>{let C=a.find(T=>T.type===h&&(!w||T.customFieldId===w));if(C){b(C.id);return}let S={id:w||h,type:h,label:w?r.find(T=>T.id===w)?.name||h:y(h),width:120,visible:true,sortable:true,resizable:true,customFieldId:w};o([...a,S]);},f=l1.filter(h=>y(h).toLowerCase().includes(u.toLowerCase())),x=r.filter(h=>h.name.toLowerCase().includes(u.toLowerCase())),k=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:h=>{h.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",h.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent",h.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:h=>i(h.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:h=>{h&&h.style.setProperty("--focus-border",k);},onFocus:h=>{h.currentTarget.style.borderColor=k,h.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:h=>{h.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",h.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:h=>h.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(h=>{let w=a.find(T=>T.type===h&&!T.customFieldId),C=w?.visible??false,S=h==="name";return jsxRuntime.jsxs("button",{onClick:()=>{S||(w?b(w.id):v(h));},disabled:S,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:S?.4:1,cursor:S?"not-allowed":"pointer"},onMouseEnter:T=>{S||(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?k:"transparent",border:C?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${k}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?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:lg[h]}),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:y(h)})]},h)})})]}),x.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:x.map(h=>{let C=a.find(S=>S.customFieldId===h.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(h.type,h.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:S=>{S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:S=>{S.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?k:"transparent",border:C?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${k}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?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:lg[h.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:h.name})]},h.id)})})]})]})]})}var dg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var h1=[{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 mg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,u]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?pg.es:pg.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:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{c([...i,""]);},y=(v,f)=>{let x=[...i];x[v]=f,c(x);},b=v=>{i.length>1&&c(i.filter((f,x)=>x!==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:l.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:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:h1.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",d===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:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.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:x=>y(f,x.target.value),placeholder:`${l.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>b(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children: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"}),l.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:l.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:l.create})]})]})]}):null}var pg={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 bg={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 hg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),u=react.useRef(null),i=react.useRef(0),c=s==="es"?bg.es:bg.en;react.useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||u.current&&!u.current.contains(b.target)&&d(false);},y=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let l=[{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()),d(y=>!y);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[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-[#007BFF]":"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:l.map(g=>{let y=e===g.value&&!t,b=()=>g.value==="all"?y?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),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p(y?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&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"),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[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 yg({data:e,isDark:t,locale:a="en"}){let r=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.jsx("div",{className:p("px-5 py-4 border-b",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:r?"SALUD DEL PROYECTO":"PROJECT HEALTH"})}),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:r?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",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:r?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",(e.openRFIs??0)>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs??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:r?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono font-bold",(e.submittalsApprovalPercent??0)>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent??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:r?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let o=e.scheduleVarianceDays??0,s=o>0,n=o<0,d=e.scheduleVarianceLabel||(s?`+${o} ${r?"D\xEDas ADELANTE":"Days AHEAD"}`:n?`${o} ${r?"D\xEDas ATR\xC1S":"Days BEHIND"}`:r?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",s&&"bg-[#32D74B]/15 text-[#32D74B]",n&&"bg-[#FF453A]/15 text-[#FF453A]",!s&&!n&&"bg-[#007BFF]/15 text-[#007BFF]"),children:d})})()]}),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:r?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((o,s)=>{let n=o.utilizationPercent>=100?"#FF453A":o.utilizationPercent>=80?"#FFD60A":o.color||"#32D74B";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:o.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[o.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(o.utilizationPercent,100)}%`,backgroundColor:n}})})]},`${o.name}-${s}`)})})]})]})}var M1=[{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 Cg(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(...Cg(r.subtasks,t+1));return a}function A1(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 l=(s.progress||0)/c;r+=l,o++;}return o>0?r/o:null}function L1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Tg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:u=[],toolbarRightContent:i}){let{theme:c="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:k=false,onCreateTask:h,persistFilter:w=false,financialBlur:C,healthSidebar:S,lens:T="hours",hourlyRate:L=0}=t,A=vi(l,m),N=c==="dark",Y=react.useCallback(()=>{if(!w||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let $=localStorage.getItem(w);if($){let pe=JSON.parse($);return {statusFilter:pe.statusFilter||"all",hideCompleted:pe.hideCompleted||!1}}}catch($){console.error("Error loading persisted filter:",$);}return {statusFilter:"all",hideCompleted:false}},[w]),[O,le]=react.useState("startDate"),[P,q]=react.useState("asc"),[fe,Ke]=react.useState(""),[F,U]=react.useState(()=>Y().statusFilter),[ae,Ne]=react.useState(()=>Y().hideCompleted),[R,J]=react.useState(b||M1),[X,ue]=react.useState(false),[Ie,Xe]=react.useState(false),[dt,lt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[re,ct]=react.useState(null),[Be,ht]=react.useState(0),[mt,Ct]=react.useState(0),we=react.useRef(null);react.useEffect(()=>{b&&J(b);},[b]),react.useEffect(()=>{if(!(!w||typeof window>"u"))try{localStorage.setItem(w,JSON.stringify({statusFilter:F,hideCompleted:ae}));}catch($){console.error("Error persisting filter state:",$);}},[w,F,ae]);let Je=react.useMemo(()=>{let $=new Set;function pe(ke){for(let Ve of ke)Ve.subtasks?.length&&(Ve.isExpanded!==false&&$.add(Ve.id),pe(Ve.subtasks));}return pe(e),$},[e]),tt=react.useMemo(()=>R.filter($=>$.visible),[R]),Qe=react.useCallback($=>{a.onTaskToggleExpand?.($);},[a]),H=react.useCallback($=>{O===$?q(pe=>pe==="asc"?"desc":"asc"):(le($),q("asc")),a.onSortChange?.({column:$,direction:P==="asc"?"desc":"asc"});},[O,P,a]),ne=react.useCallback($=>{J($),a.onColumnsChange?.($);},[a]),D=react.useCallback($=>{let pe=R.map(ke=>ke.id===$?{...ke,visible:false}:ke);ne(pe);},[R,ne]),K=react.useCallback(($,pe)=>{le($),q(pe);},[]),se=react.useCallback(($,pe,ke)=>{x&&($.preventDefault(),lt({isOpen:true,x:$.clientX,y:$.clientY,type:pe?"task":"header",task:pe,columnId:ke}));},[x]),be=react.useCallback(()=>{lt($=>({...$,isOpen:false}));},[]),G=react.useCallback(($,pe)=>{if(!f)return;$.preventDefault(),$.stopPropagation();let ke=R.find(Ve=>Ve.id===pe);ke&&(ct(pe),ht($.clientX),Ct(ke.width));},[R,f]);react.useEffect(()=>{if(!re)return;let $=ke=>{let Ve=ke.clientX-Be,st=Math.max(50,mt+Ve),Ze=R.map(me=>me.id===re?{...me,width:st}:me);J(Ze);},pe=()=>{re&&a.onColumnsChange?.(R),ct(null);};return document.addEventListener("mousemove",$),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",pe);}},[re,Be,mt,R,a]);let Z=react.useCallback(async $=>{if(a.onCreateCustomField){let pe={...$,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(pe);}Xe(false);},[a]),ze=react.useCallback($=>$.progress===100||$.status==="completed"?"completed":$.progress&&$.progress>0||$.status==="in-progress"?"in-progress":"todo",[]),ye=react.useMemo(()=>{let $=Cg(e);if(fe.trim()){let pe=fe.toLowerCase();$=$.filter(ke=>ke.name.toLowerCase().includes(pe));}return F!=="all"&&($=$.filter(pe=>ze(pe)===F)),ae&&($=$.filter(pe=>ze(pe)!=="completed")),$.sort((pe,ke)=>{let Ve,st;switch(O){case "name":Ve=pe.name.toLowerCase(),st=ke.name.toLowerCase();break;case "startDate":Ve=pe.startDate?.getTime()||0,st=ke.startDate?.getTime()||0;break;case "endDate":Ve=pe.endDate?.getTime()||0,st=ke.endDate?.getTime()||0;break;case "progress":Ve=pe.progress||0,st=ke.progress||0;break;case "status":Ve=pe.status||"todo",st=ke.status||"todo";break;case "priority":let Ze={urgent:0,high:1,medium:2,low:3,none:4};Ve=Ze[pe.priority]??4,st=Ze[ke.priority]??4;break;default:return 0}return Ve<st?P==="asc"?-1:1:Ve>st?P==="asc"?1:-1:0}),$},[e,fe,F,ae,O,P,ze]),Ue=react.useCallback(($,pe)=>{let ke=Ze=>{a.onTaskUpdate?.({...$,...Ze});},Ve=Ze=>Ze?$.customFields?.find(qe=>qe.fieldId===Ze)?.value:void 0,st=(Ze,me)=>{if(!Ze)return;let gt=[...$.customFields||[]],Pt=gt.findIndex(Fe=>Fe.fieldId===Ze);Pt>=0?gt[Pt]={fieldId:Ze,value:me}:gt.push({fieldId:Ze,value:me}),ke({customFields:gt});};switch(pe.type){case "name":return null;case "status":return jsxRuntime.jsx(hm,{value:$.status||($.progress===100?"completed":$.progress&&$.progress>0?"in-progress":"todo"),onChange:me=>{ke({status:me,progress:me==="completed"?100:me==="in-progress"?50:0});},isDark:N,locale:l,translations:A.status});case "priority":return jsxRuntime.jsx(xm,{value:$.priority,onChange:me=>ke({priority:me}),isDark:N,locale:l});case "assignees":return jsxRuntime.jsx(Cm,{value:$.assignees||[],availableUsers:d,onChange:me=>ke({assignees:me}),isDark:N,locale:l});case "startDate":return jsxRuntime.jsx(Ci,{value:$.startDate,onChange:me=>ke({startDate:me}),isDark:N,locale:l,dateField:"start",startDate:$.startDate,endDate:$.endDate});case "endDate":return jsxRuntime.jsx(Ci,{value:$.endDate,onChange:me=>ke({endDate:me}),isDark:N,locale:l,dateField:"end",startDate:$.startDate,endDate:$.endDate});case "progress":return jsxRuntime.jsx(Fm,{value:$.progress||0,onChange:me=>{let qe=me===100?"completed":me>0?"in-progress":"todo";ke({progress:me,status:qe});},isDark:N});case "tags":return jsxRuntime.jsx(Wm,{value:$.tags||[],isDark:N});case "text":return jsxRuntime.jsx(Lm,{value:Ve(pe.customFieldId)||"",onChange:me=>st(pe.customFieldId,me),isDark:N});case "number":return jsxRuntime.jsx(Rm,{value:Ve(pe.customFieldId)||0,onChange:me=>st(pe.customFieldId,me),isDark:N});case "date":let Ze=Ve(pe.customFieldId);return jsxRuntime.jsx(Ci,{value:Ze?new Date(Ze):void 0,onChange:me=>st(pe.customFieldId,me),isDark:N,locale:l});case "dropdown":return jsxRuntime.jsx(Om,{value:Ve(pe.customFieldId)||"",options:pe.options||[],onChange:me=>st(pe.customFieldId,me),isDark:N});case "checkbox":return jsxRuntime.jsx(Hm,{value:Ve(pe.customFieldId)||false,onChange:me=>st(pe.customFieldId,me),isDark:N});case "estimatedTime":{let me=$.status==="completed"||$.progress===100;return jsxRuntime.jsx(Ro,{value:$.estimatedTime,onChange:qe=>ke({estimatedTime:qe}),isDark:N,locale:l,disabled:me,lens:T,hourlyRate:L})}case "quotedTime":{let me=$.status==="completed"||$.progress===100,qe=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsxRuntime.jsx(Ro,{value:$.quotedTime,onChange:gt=>ke({quotedTime:gt}),isDark:N,locale:l,disabled:me,isBlurred:qe,lens:T,hourlyRate:L})}case "elapsedTime":{let me=$.status==="completed"||$.progress===100;return jsxRuntime.jsx(Ro,{value:$.elapsedTime,onChange:qe=>ke({elapsedTime:qe}),isDark:N,locale:l,disabled:me,lens:T,hourlyRate:L})}case "effortMinutes":{let me=$.status==="completed"||$.progress===100;return jsxRuntime.jsx(Ro,{value:$.effortMinutes,onChange:qe=>ke({effortMinutes:qe}),isDark:N,locale:l,disabled:me,lens:T,hourlyRate:L})}case "timeLoggedMinutes":{let me=$.status==="completed"||$.progress===100;return jsxRuntime.jsx(Ro,{value:$.timeLoggedMinutes,onChange:a.onLogTime?qe=>{a.onLogTime?.($,qe);}:void 0,isDark:N,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:me,lens:T,hourlyRate:L})}case "soldEffortMinutes":{let me=$.status==="completed"||$.progress===100,qe=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ro,{value:$.soldEffortMinutes,onChange:gt=>ke({soldEffortMinutes:gt}),isDark:N,locale:l,disabled:me,isBlurred:qe,lens:T,hourlyRate:L})}case "scheduleVariance":return jsxRuntime.jsx(jm,{startDate:$.startDate,endDate:$.endDate,scheduleVariance:$.scheduleVariance,isDark:N,locale:l});case "hoursBar":return jsxRuntime.jsx(Km,{task:$,isDark:N,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:L});case "teamLoad":return jsxRuntime.jsx(Ym,{task:$,isDark:N});case "blockers":return jsxRuntime.jsx(Xm,{blockers:$.blockers,isDark:N,locale:l});default:return jsxRuntime.jsx("span",{className:p("text-sm",N?"text-white/60":"text-gray-500"),children:"-"})}},[a,N,l,d,A]),Se=react.useCallback($=>{let ke={name:A.columns.name,status:A.columns.status,priority:A.columns.priority,assignees:A.columns.assignees,startDate:A.columns.startDate,endDate:A.columns.endDate,progress:A.columns.progress,tags:A.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:A.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:A.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:A.columns.elapsedTime||(l==="es"?"Tiempo":"Time Spent"),effortMinutes:A.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:A.columns.timeLoggedMinutes||(l==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:A.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),scheduleVariance:A.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:A.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:A.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:A.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[$.type]||$.label;return typeof ke=="string"?ke:String(ke||$.type)},[A,l]),He=react.useMemo(()=>{let ke=tt.reduce((st,Ze)=>st+Ze.width,0)+(v?48:0),Ve={};for(let st of tt)Ve[st.id]=`${st.width/ke*100}%`;return Ve},[tt,v]);return r?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",N?"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",N?"text-white/60":"text-gray-600"),children:[A.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",N?"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",N?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",N?"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",N?"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",N?"text-white":"text-gray-900"),children:A.empty.noTasks}),jsxRuntime.jsx("p",{className:p("text-sm",N?"text-white/60":"text-gray-600"),children:A.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:we,className:p(N?"bg-[#0D0D0D]":"bg-white",re&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",N?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(hg,{value:F,hideCompleted:ae,onChange:U,onHideCompletedChange:Ne,isDark:N,locale:l}),jsxRuntime.jsxs("div",{className:p("text-sm",N?"text-white/60":"text-gray-600"),children:[ye.length," ",A.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",N?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:fe,onChange:$=>Ke($.target.value),placeholder:A.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",N?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),k&&h&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:h,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:A.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",N?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[tt.map($=>jsxRuntime.jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2",N?"text-white/60":"text-gray-500"),style:{width:He[$.id],minWidth:$.minWidth},onContextMenu:pe=>se(pe,void 0,$.id),children:[$.sortable?jsxRuntime.jsxs("button",{onClick:()=>H($.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Se($),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:p("w-3 h-3",O===$.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{children:Se($)}),f&&$.resizable&&jsxRuntime.jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",re===$.id&&"bg-[#007BFF]"),onMouseDown:pe=>G(pe,$.id)})]},$.id)),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:$=>{$.stopPropagation(),ue(pe=>!pe);},className:p("p-0.5 rounded transition-colors",N?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",X&&(N?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(cg,{isOpen:X,onClose:()=>ue(false),columns:R,customFields:u,onColumnsChange:ne,onCreateCustomField:()=>{ue(false),Xe(true);},isDark:N,locale:l})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:ye.map(($,pe)=>{let ke=Je.has($.id),Ve=Math.min(pe*.01,.2),st=$.hasChildren&&$.level===0,Ze=$.subtasks?.length||0;return st?jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ve},className:p("flex items-center border-y cursor-pointer",N?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>Qe($.id),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),Qe($.id);},className:p("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ke?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",N?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",N?"text-white/40":"text-gray-500")})}),ke?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:N?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:N?"#FFD60A":"#B45309"}}),$.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:N?"#FFD60A":"#B45309"},children:$.wbsCode}),jsxRuntime.jsx("span",{className:p("text-xs font-bold font-mono uppercase tracking-wide truncate",N?"text-gray-200":"text-gray-800"),children:$.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",N?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",Ze," ",l==="es"?Ze===1?"Tarea":"Tareas":Ze===1?"Item":"Items",")"]}),jsxRuntime.jsx("div",{className:"flex-1"}),(()=>{let me=A1($),qe=L1($);return jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[me!==null&&jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",me>=1?"text-[#32D74B]":me>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",me.toFixed(2)]}),qe>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[l==="es"?"Conflicto Recurso":"Resource Conflict",": ",qe]}),$.progress!=null&&$.progress>0&&jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",$.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[$.progress,"%"]})]})})()]})},$.id):jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ve},className:p("flex items-center border-b transition-colors",N?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.($),onDoubleClick:()=>a.onTaskDoubleClick?.($),onContextMenu:me=>se(me,$),children:[tt.map(me=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:He[me.id],minWidth:me.minWidth},children:me.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&$.level>0&&jsxRuntime.jsx("div",{style:{width:`${$.level*24}px`},className:"flex-shrink-0"}),y&&$.hasChildren&&jsxRuntime.jsx("button",{onClick:qe=>{qe.stopPropagation(),Qe($.id);},className:p("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ke?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",N?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",N?"text-white/60":"text-gray-400")})}),y&&!$.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[($.wbsCode||$.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[$.wbsCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",N?"text-[#007BFF]":"text-blue-600"),children:$.wbsCode}),$.taskCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",N?"text-white/40":"text-gray-400"),children:$.taskCode})]}),jsxRuntime.jsx("span",{className:p("truncate font-bold text-[13px]",N?"text-white":"text-gray-900",$.progress===100&&(N?"line-through text-white/30":"line-through text-gray-400")),children:$.name}),$.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${$.tags[0].color}20`,color:$.tags[0].color},children:$.tags[0].name})]})]}):Ue($,me)},me.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},$.id)})}),ye.length===0&&fe&&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",N?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:p(N?"text-white/60":"text-gray-600"),children:A.empty.noResults})]})})]})}),S?.enabled&&S.data&&jsxRuntime.jsx(yg,{data:S.data,isDark:N,locale:l})]}),jsxRuntime.jsx(eg,{state:dt,onClose:be,isDark:N,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:D,onColumnSort:K,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(mg,{isOpen:Ie,onClose:()=>Xe(false),onSave:Z,isDark:N,locale:l})]})}var Ng=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Dg=[{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"}],Sg=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var $d={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},Hd={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"},zd={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"},Mi={dark:$d,light:Hd,neutral:zd};function Eg(e){return Mi[e]||Mi.dark}var Ud={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"}},Wd={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"}},Ai={en:Ud,es:Wd};function Qn(e){return Ai[e]||Ai.en}function Li(e,t){let a=Qn(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 Pg(e){let t=Qn(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 Fg(e,t=0,a=true){let r=Qn(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 es(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 Vd(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 Lg({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 Rg=26,U1=22,W1=10;function Ig(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 _d(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 Og(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 Bg(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 G1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:u,spanCols:i,lane:c,isStart:l,isEnd:m}=e,g=u.progress===100||u.status==="completed",y=u.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?_d(u.effortMinutes,n,d):null,f=m?Og(u,n,d):null,x=m?u.blockers?.find(k=>k.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:k=>{k.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?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*Rg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${U1}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)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:l?"3px":void 0,borderLeftColor:l?y?"#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:[y&&l&&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})]})]}),x&&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,": ",x.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 $g({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,timerState:h,onLogTime:w,onUpdateEstimate:C,onUpdateSoldEffort:S,onStartTimer:T,onStopTimer:L,onDiscardTimer:A,blurFinancials:N=false,suppressDetailModal:Y=false,lens:O="hours",hourlyRate:le=0}){let{theme:P="dark",locale:q="en",customTranslations:fe,showBacklog:Ke=true}=t,F=Li(q,fe),U=P==="dark"||P==="neutral",[ae,Ne]=react.useState(r||new Date),[R,J]=react.useState(null),[X,ue]=react.useState(null),[Ie,Xe]=react.useState(null),[dt,lt]=react.useState({}),re=3,ct=3,Be=react.useCallback(G=>{ue(G.id),Y||J(G),v?.(G.id);},[Y,v]),[ht,mt]=react.useState(null),Ct=react.useCallback(()=>{Ne(new Date(ae.getFullYear(),ae.getMonth()-1,1));},[ae]),we=react.useCallback(()=>{Ne(new Date(ae.getFullYear(),ae.getMonth()+1,1));},[ae]),Je=react.useCallback(()=>{Ne(new Date);},[]),tt=react.useMemo(()=>{let G=ae.getFullYear(),Z=ae.getMonth(),ze=new Date(G,Z,1),ye=new Date(G,Z+1,0),Ue=ze.getDay(),Se=ye.getDate(),He=es(e),$=new Date;$.setHours(0,0,0,0);let pe=[],ke=Ue,Ve=new Date(G,Z,0).getDate();for(let Ze=ke-1;Ze>=0;Ze--){let me=new Date(G,Z-1,Ve-Ze);pe.push({date:me,isCurrentMonth:false,isToday:false,isWeekend:me.getDay()===0||me.getDay()===6,events:He.filter(qe=>Vd(me,qe)).map(qe=>({id:qe.id,title:qe.name,start:qe.startDate,end:qe.endDate,task:qe}))});}for(let Ze=1;Ze<=Se;Ze++){let me=new Date(G,Z,Ze),qe=me.getTime()===$.getTime();pe.push({date:me,isCurrentMonth:true,isToday:qe,isWeekend:me.getDay()===0||me.getDay()===6,events:He.filter(gt=>Vd(me,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}let st=42-pe.length;for(let Ze=1;Ze<=st;Ze++){let me=new Date(G,Z+1,Ze);pe.push({date:me,isCurrentMonth:false,isToday:false,isWeekend:me.getDay()===0||me.getDay()===6,events:He.filter(qe=>Vd(me,qe)).map(qe=>({id:qe.id,title:qe.name,start:qe.startDate,end:qe.endDate,task:qe}))});}return pe},[ae,e]),Qe=react.useMemo(()=>es(e).filter(G=>!G.startDate||!G.endDate),[e]),H=react.useMemo(()=>{let G=es(e),Z=0,ze=0,ye=0,Ue=0,Se=0;G.forEach(Ve=>{Ve.effortMinutes&&(Z+=Ve.effortMinutes),Ve.soldEffortMinutes&&(ze+=Ve.soldEffortMinutes),Ve.scheduleVariance!=null&&(ye+=Ve.scheduleVariance,Ue++),Ve.soldEffortMinutes&&Ve.effortMinutes&&(Se+=Ve.soldEffortMinutes-Ve.effortMinutes);});let He=ze>0?Math.min(100,Math.round(Z/ze*100)):0,$=Ue>0?Math.round(ye/Ue):0,ke=`${Se<0?"-":"+"}${Bg(Se,O,le)}`;return {budgetUtil:He,avgVariance:$,costDisplay:ke,hasCostData:ze>0}},[e,O,le]),ne=react.useMemo(()=>{let G=[0,0,0,0,0,0];return tt.forEach((Z,ze)=>{let ye=Math.floor(ze/7);Z.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Se=new Date(Ue.task.startDate),He=Z.date;Se.getFullYear()===He.getFullYear()&&Se.getMonth()===He.getMonth()&&Se.getDate()===He.getDate()&&ye<G.length&&(G[ye]-=Ue.task.soldEffortMinutes);}});}),G},[tt]),D=react.useMemo(()=>{let G=es(e),Z=new Map,ze=new Set,ye=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:Z,multiDayTaskIds:ze,maxLanesPerRow:ye};let Ue=ke=>new Date(ke.getFullYear(),ke.getMonth(),ke.getDate()),Se=Ue(tt[0].date),He=Ue(tt[tt.length-1].date),$=[];for(let ke of G){if(!ke.startDate||!ke.endDate)continue;let Ve=Ue(ke.startDate),st=Ue(ke.endDate);if(Ve.getTime()===st.getTime()||st<Se||Ve>He)continue;let Ze=Ve<Se?Se:Ve,me=st>He?He:st,qe=Ig(Ze,Se),gt=Ig(me,Se);qe<0||qe>41||gt<0||gt>41||qe!==gt&&(ze.add(ke.id),$.push({task:ke,startIdx:qe,endIdx:gt}));}$.sort((ke,Ve)=>ke.startIdx!==Ve.startIdx?ke.startIdx-Ve.startIdx:Ve.endIdx-Ve.startIdx-(ke.endIdx-ke.startIdx));let pe=[[],[],[],[],[],[]];for(let{task:ke,startIdx:Ve,endIdx:st}of $){let Ze=Math.floor(Ve/7),me=Math.floor(st/7),qe=Ue(ke.startDate),gt=Ue(ke.endDate),Pt=false;for(let Fe=Ze;Fe<=me;Fe++){let _e=Fe===Ze?Ve%7:0,j=Fe===me?st%7:6,xe=j-_e+1,ee=0,I=pe[Fe]??[];for(pe[Fe]||(pe[Fe]=I);ee<I.length&&(I[ee]??-1)>=_e;)ee++;if(ee>=W1){Pt=true;break}ee>=I.length?I.push(j):I[ee]=j,ye[Fe]=Math.max(ye[Fe]??0,ee+1);let V=Fe===Ze&&qe>=Se,te=Fe===me&><=He,Ce=Fe*7+_e,Pe={taskId:ke.id,task:ke,rowIndex:Fe,startCol:_e,endCol:j,spanCols:xe,lane:ee,isStart:V,isEnd:te};Z.has(Ce)||Z.set(Ce,[]),Z.get(Ce).push(Pe);}Pt&&(ze.delete(ke.id),Z.forEach((Fe,_e)=>{let j=Fe.filter(xe=>xe.taskId!==ke.id);j.length===0?Z.delete(_e):Z.set(_e,j);}));}return {segmentsByCell:Z,multiDayTaskIds:ze,maxLanesPerRow:ye}},[tt,e]),K=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],se=ae.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),be=se.charAt(0).toUpperCase()+se.slice(1);return o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",U?"bg-[#050505]":"bg-white",n),style:d,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",U?"text-white/30":"text-gray-600"),children:[F.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",U?"bg-[#050505]":"bg-white",n),style:d,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",U?"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",U?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",U?"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",U?"bg-[#050505]":"bg-white",n),style:d,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",U?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-8 h-8",U?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",U?"text-white/90":"text-gray-900"),children:F.labels.noEvents}),jsxRuntime.jsx("p",{className:p("text-sm",U?"text-white/30":"text-gray-600"),children:F.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",U?"bg-[#050505]":"bg-white",n),style:d,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",U?"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",U?"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",U?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:p("font-medium",U?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:p("h-4 w-px",U?"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",U?"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",U?"text-white":"text-gray-900"),children:be}),jsxRuntime.jsx("button",{onClick:we,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",U?"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",U?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:Je,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",U?"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:F.navigation.today})]})]}),jsxRuntime.jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",U?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:K.map(G=>jsxRuntime.jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",U?"text-white/60 font-mono":"text-gray-500"),children:G},G))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",U?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>ue(null),children:tt.map((G,Z)=>{let ze=Z%7===6,ye=Z>=35;return jsxRuntime.jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!ze&&(U?"border-r border-[#222]":"border-r border-gray-200"),!ye&&(U?"border-b border-[#222]":"border-b border-gray-200"),U?G.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":G.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",G.isToday&&U&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",G.isToday&&!U&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:p("text-xs font-mono select-none relative z-20",G.isToday?U?"text-[#007FFF] font-bold":"text-blue-600 font-bold":G.isCurrentMonth?U?"text-white/60":"text-gray-900":U?"text-white/20":"text-gray-400"),children:String(G.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(Z/7),Se=(D.maxLanesPerRow[Ue]??0)*Rg,He=D.segmentsByCell.get(Z);return Se===0&&!He?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Se}px`,zIndex:5},children:He?.map($=>jsxRuntime.jsx(G1,{segment:$,isDark:U,blurFinancials:N,isSelected:X===$.taskId,t:F,lens:O,hourlyRate:le,onClick:()=>{Be($.task),a.onEventClick?.({id:$.task.id,title:$.task.name,start:$.task.startDate,end:$.task.endDate,task:$.task});}},$.taskId))})})(),(()=>{let Ue=G.events.filter(Se=>Se.task.isMilestone&&!D.multiDayTaskIds.has(Se.id));return Ue.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Se=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Se.title,onClick:He=>{He.stopPropagation(),Be(Se.task);}},Se.id)),Ue.length>4&&jsxRuntime.jsxs("span",{className:p("text-[8px] font-mono",U?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];G.events.forEach(He=>{He.task.blockers?.forEach($=>{($.severity==="warning"||$.severity==="critical")&&Ue.push({taskId:He.id,type:$.type,severity:$.severity,variance:He.task.scheduleVariance});});});let Se=Ue[0];return Se?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",Se.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[F.labels.risk,": ",Se.type,Se.variance?` (+${Math.abs(Se.variance)}d ${F.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=G.events.filter(pe=>!D.multiDayTaskIds.has(pe.id)),Se=dt[Z]||re,He=Ue.slice(0,Se),$=Ue.length-Se;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(pe=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{Be(pe.task),a.onEventClick?.(pe);},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",pe.task.progress===100||pe.task.status==="completed"?U?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":U?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:U?pe.task.progress===100||pe.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)"}:pe.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]",pe.task.isMilestone?U?"text-amber-400":"text-amber-600":pe.task.isCriticalPath?"text-red-400":U?"text-[#1264FF]":"text-gray-400"),children:pe.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:pe.title})]},pe.id)),$>0&&jsxRuntime.jsxs("button",{onClick:pe=>{pe.stopPropagation(),lt(ke=>({...ke,[Z]:Se+ct}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",U?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",$," ",q==="es"?"m\xE1s":"more"]}),Se>re&&Ue.length>re&&jsxRuntime.jsx("button",{onClick:pe=>{pe.stopPropagation(),lt(ke=>({...ke,[Z]:re}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",U?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),G.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=Z>=28,Se=Z%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:He=>{He.stopPropagation(),mt(ht===Z?null:Z);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",ht===Z?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",U?"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",ht===Z&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ht===Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Se?"right-0":"left-0",U?"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(Eo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||G.date,endDate:He.endDate||G.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:U,locale:q==="es"?"es":"en",defaultDate:G.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),Z%7===6&&(()=>{let Ue=Math.floor(Z/7),Se=ne[Ue];if(!Se||Se===0)return null;let He=Bg(Se,O,le);return jsxRuntime.jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Se<0?"text-red-400":"text-emerald-400",N&&"blur-sm select-none"),children:[F.labels.cashOut,": ",Se<0?"-":"+",He]})})()]},Z)})})})]}),Ke&&jsxRuntime.jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",U?"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",U?"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]",U?"text-white/40":"text-gray-500"),children:F.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:p("text-[10px] font-mono tabular-nums",U?"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",U?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-5 h-5",U?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:p("text-xs font-mono",U?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(G=>jsxRuntime.jsxs("button",{onClick:()=>{Be(G);},className:p("w-full text-left rounded-md p-3 transition-all group/card",U?"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",U?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",U?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:G.name})]}),G.tags&&G.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[G.tags.slice(0,3).map(Z=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${Z.color}15`,color:Z.color,border:`1px solid ${Z.color}30`},children:Z.name},Z.id)),G.tags.length>3&&jsxRuntime.jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",U?"text-white/20":"text-gray-400"),children:["+",G.tags.length-3]})]}),(G.effortMinutes||G.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",U?"text-white/25":"text-gray-400",N&&"blur-sm select-none"),children:[_d(G.effortMinutes,O,le)&&jsxRuntime.jsxs("span",{children:[F.labels.estimate,": ",_d(G.effortMinutes,O,le)]}),(()=>{let Z=Og(G,O,le);return Z?jsxRuntime.jsx("span",{className:Z.isNegative?"text-red-400":"text-emerald-400",children:Z.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:[G.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:p("w-3 h-3",G.priority==="urgent"||G.priority==="high"?"text-red-400":G.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(Lg,{task:G,isDark:U})]}),G.assignees&&G.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:G.assignees.slice(0,2).map((Z,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:Z.color||"#007FFF"},title:Z.name,children:Z.initials||Z.name?.slice(0,2).toUpperCase()},ze))})]})]},G.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",U?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:F.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",U?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:G=>{G.key==="Enter"&&G.target.value.trim()&&(a.onTaskCreate?.({name:G.target.value.trim()}),G.target.value="");}})}),H.hasCostData&&jsxRuntime.jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",U?"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]",U?"text-white/40":"text-gray-500"),children:["\u25C8 ",F.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",U?"text-white/40":"text-gray-500"),children:F.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",U?"text-white/60":"text-gray-700",N&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",U?"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",U?"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",U?"text-white/25":"text-gray-400"),children:F.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":U?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",F.labels.days]})]}),jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",U?"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",U?"text-white/25":"text-gray-400"),children:F.labels.cost}),jsxRuntime.jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",N&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!Y&&jsxRuntime.jsx(jr,{task:R,isOpen:!!R,onClose:()=>J(null),onTaskUpdate:G=>{a.onTaskUpdate?.(G),J(G);},theme:P==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(G=>({id:G.id,name:G.name,avatar:G.avatar,initials:G.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:u,onCreateTag:i,attachments:R?c?.get(R.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:es(e).filter(G=>G.id!==R?.id),comments:l?.filter(G=>G.taskId===R?.id).map(G=>({...G,createdAt:G.createdAt instanceof Date?G.createdAt:new Date(G.createdAt),updatedAt:G.updatedAt instanceof Date?G.updatedAt:G.updatedAt?new Date(G.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,isTimerRunning:h?.isRunning,timerElapsedSeconds:h?.elapsedSeconds,onTimeLog:w,onEstimateUpdate:C,onSoldEffortUpdate:S,onTimerStart:T,onTimerStop:L,onTimerDiscard:A,blurFinancials:N}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Xe(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",U?"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",U?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("font-medium text-sm",U?"text-white/90":"text-gray-900"),children:Ie.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Xe(null),className:p("p-1 rounded",U?"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:Ie.events.map(G=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(null),Be(G.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",U?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(Lg,{task:G.task,isDark:U}),jsxRuntime.jsx("span",{className:p("text-sm truncate flex-1",U?"text-white/80":"text-gray-900"),children:G.title}),(G.task.priority==="high"||G.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},G.id))})]})]})})]})}var jd={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)"},Kd={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)"},Yd={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)"},Ri={dark:jd,light:Kd,neutral:Yd};function Hg(e){return Ri[e]||Ri.dark}function _1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[u,i]=react.useState(false),c=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=react.useMemo(()=>{let g=c.length,y=new Set(c.flatMap(f=>f.assignedUserIds||[])).size,b=c.map(f=>f.priority).filter(Boolean),v=new Set(c.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:b,labels:v}},[c]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[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:l.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:[l.uniqueAssignees," assignees"]})]}),l.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:[l.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:y=>{y.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 Ug={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function as(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 rs(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 Wg(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 Gg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let u=react.useMemo(()=>({...Ug,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),m=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(k=>{let h=k.timestamp.toISOString().split("T")[0],w=x.get(h);w?w.push(k):x.set(h,[k]);}),Array.from(x.entries()).sort((k,h)=>h[0].localeCompare(k[0])).map(([k,h])=>({date:new Date(k),events:h.sort((w,C)=>C.timestamp.getTime()-w.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let x=new Set,k=new Set;return e.forEach(h=>{x.add(h.userId),k.add(h.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(k)}},[e]),b=x=>{c(k=>{let h=new Set(k);return h.has(x)?h.delete(x):h.add(x),h});},v=x=>{let h=new Date().getTime()-x.getTime(),w=Math.floor(h/6e4),C=Math.floor(h/36e5),S=Math.floor(h/864e5);return w<1?"just now":w<60?`${w}m ago`:C<24?`${C}h ago`:S<7?`${S}d ago`:x.toLocaleDateString()},f=react.useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return react.useEffect(()=>{if(s&&l.current){let x=l.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:p("history-timeline-empty",d),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",d),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:x=>{let k=x.target.value;a({...t,types:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(x=>jsxRuntime.jsxs("option",{value:x,children:[rs(x)," ",x.replace("_"," ")]},x))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let k=x.target.value;a({...t,users:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.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:l,children:m.map(x=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&x.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:x.events.map((k,h)=>{let w=i.has(k.id),C=s===k.id,S=Wg(k.type);return jsxRuntime.jsxs("div",{"data-event-id":k.id,className:p("history-timeline-event",w&&"expanded",C&&"selected"),onClick:()=>o?.(k),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:S},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:rs(k.type)})}),h<x.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:S}})]}),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&&k.userAvatar&&jsxRuntime.jsx("img",{src:k.userAvatar,alt:k.userName||k.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:k.userName||k.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:as(k)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?v(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(k.id);},children:[w?"\u25BC":"\u25B6"," Show changes"]}),w&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([T,L])=>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(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},T)),k.metadata&&Object.keys(k.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(k.metadata).map(([T,L])=>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(L)})]},T))]})]})]})]},k.id)})})]},x.date?.toISOString()||"all"))})]})}function _g({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],l=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:l&&rs(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&as(l)}),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:l&&l.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=>d(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,y)=>jsxRuntime.jsx("div",{className:p("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:as(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:l&&l.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 qd(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 Xd(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function jg(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 Kg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function J1(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})),d=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let l=a/2,m=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(m-c.y)*o.centerForce*i,n.forEach(g=>{if(c.id===g.id)return;let y=c.x-g.x,b=c.y-g.y,v=Math.sqrt(y*y+b*b)||1,f=o.chargeStrength*i/(v*v);c.vx+=y/v*f,c.vy+=b/v*f;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),m=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!m)return;let g=m.x-l.x,y=m.y-l.y,b=Math.sqrt(g*g+y*y)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=y*v,m.vx-=g*v,m.vy-=y*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 Yg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:u}){let i=react.useRef(null),[c,l]=react.useState([]),[m,g]=react.useState(null),[y,b]=react.useState(null),[v,f]=react.useState(null),[x,k]=react.useState(1),[h,w]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=J1(e,t,a.width,a.height,a,150);l(O);},[e,t,a]);let C=react.useCallback((O,le)=>{a.enableDragging&&(le.stopPropagation(),g(O));},[a.enableDragging]),S=react.useCallback(O=>{if(!m||!i.current)return;let P=i.current.getBoundingClientRect(),q=(O.clientX-P.left-h.x)/x,fe=(O.clientY-P.top-h.y)/x;l(Ke=>Ke.map(F=>F.id===m?{...F,x:q,y:fe,fx:q,fy:fe}:F));},[m,x,h]),T=react.useCallback(()=>{g(null);},[]),L=react.useCallback((O,le)=>{le.stopPropagation(),d?.({type:"node-click",node:O,position:{x:le.clientX,y:le.clientY}});},[d]),A=react.useCallback((O,le)=>{le.stopPropagation(),d?.({type:"edge-click",edge:O,position:{x:le.clientX,y:le.clientY}});},[d]),N=react.useCallback(O=>{let le=c.find(P=>P.id===O);return le?{x:le.x,y:le.y}:{x:0,y:0}},[c]),Y=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let le=O.card.priority;return le==="URGENT"?"#ef4444":le==="HIGH"?"#f59e0b":le==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.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:()=>k(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),w({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:qd(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[jg(O)," ",Xd(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:S,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${h.x}, ${h.y}) scale(${x})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let le=N(typeof O.source=="string"?O.source:O.source.id),P=N(typeof O.target=="string"?O.target:O.target.id),q=Kg(O.type),fe=v===O.id,Ke=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-edge",fe&&"hovered",Ke&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:F=>A(O,F),children:[jsxRuntime.jsx("line",{x1:le.x,y1:le.y,x2:P.x,y2:P.y,stroke:qd(O.type),strokeWidth:Ke?a.edgeWidth*2:a.edgeWidth,strokeOpacity:fe?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&fe&&jsxRuntime.jsx("text",{x:(le.x+P.x)/2,y:(le.y+P.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Xd(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(O=>{let le=y===O.id,P=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-node",le&&"hovered",P&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>C(O.id,q),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:q=>L(O,q),children:[jsxRuntime.jsx("circle",{r:P?a.nodeSize*1.2:a.nodeSize,fill:Y(O),stroke:P?"#fbbf24":"#ffffff",strokeWidth:P?3:2,opacity:le?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Jg({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,u]=react.useState(false),[i,c]=react.useState(null),[l,m]=react.useState(null),g=react.useRef(null),y=d||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let x=k=>{k.key==="Escape"&&!y&&b();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,y]);let b=()=>{y||(n(""),c(null),m(null),t());},v=async()=>{if(!(!s.trim()||y)){u(true),c(null),m(null);try{let x=await r(s.trim());m(x);}catch(x){c(x instanceof Error?x.message:"Failed to generate plan");}finally{u(false);}}},f=()=>{l&&(a(l),b());};return e?jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),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:x=>x.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:b,disabled:y,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:l?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!"})]}),l.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:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((x,k)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},k))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((x,k)=>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:x.title}),x.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},k)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.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:x=>n(x.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),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((x,k)=>jsxRuntime.jsx("button",{onClick:()=>n(x),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:x},k))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&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:b,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?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()||y,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:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Jd={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Z1={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},e5={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 t5(e,t,a){let r=Jd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function os(e){return `$${e.toFixed(4)}`}var Qd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=t5(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),u=a.reduce((l,m)=>l+m.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:u,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Qd;function e0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState($o.getStats()),[s,n]=react.useState($o.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o($o.getStats()),n($o.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 d=$o.getRecentOperations(5);return jsxRuntime.jsxs(Lt,{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:os(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,l=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:os(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:`${l}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.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:os(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 r0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[u,i]=react.useState(""),[c,l]=react.useState(""),[m,g]=react.useState(false),[y,b]=react.useState(null),[v,f]=react.useState(null),[x,k]=react.useState(null),h=react.useRef(null),w=m||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let A=N=>{N.key==="Escape"&&!w&&C();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,w]);let C=()=>{w||(d(""),i(""),l(""),b(null),f(null),k(null),t());},S=async()=>{if(!(!n.trim()||w)){g(true),b(null),f(null),k(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:c||void 0});f(A.tasks.tasks),k({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){b(A instanceof Error?A.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let L=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Lt,{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:A=>A.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:w,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:[x?.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"}),x?.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 (",L,"% 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:[x?.tokens_used||0," tokens"]}),x?.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:[x.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,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:A.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"})]}),A.start," \u2192 ",A.end]}),jsxRuntime.jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:A.priority})]})},A.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:h,value:n,onChange:A=>d(A.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:w}),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:A=>i(A.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:w})]}),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:A=>l(A.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:w})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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,N)=>jsxRuntime.jsx("button",{onClick:()=>d(A),disabled:w,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},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:w&&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:w,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:S,disabled:!n.trim()||w,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:w?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hi({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&vs(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,x,k)=>{console.warn(`Retry attempt ${x} after ${k}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,x)=>{r(k=>{let h=k.cards.find(A=>A.id===v);if(!h)return k;let w=h.columnId,C={...h,columnId:f,position:x},S=k.cards.map(A=>A.id===v?C:A),T=k.columns.map(A=>{if(A.id===w)return {...A,cardIds:A.cardIds.filter(N=>N!==v)};if(A.id===f){let N=S.filter(Y=>Y.columnId===f).sort((Y,O)=>Y.position-O.position);return {...A,cardIds:N.map(Y=>Y.id)}}return A}),L={...k,cards:S,columns:T};return o(L),L});},[o]),n=react.useCallback(async(v,f)=>{r(x=>{let k=x.cards.map(w=>w.id===v?{...w,...f}:w),h={...x,cards:k};return o(h),h});},[o]),d=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...v,id:f},h=x.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),w={...x,cards:[...x.cards,k],columns:h};return o(w),w});},[o]),u=react.useCallback(async v=>{r(f=>{let x=f.cards.find(C=>C.id===v);if(!x)return f;let k=f.cards.filter(C=>C.id!==v),h=f.columns.map(C=>C.id===x.columnId?{...C,cardIds:C.cardIds.filter(S=>S!==v)}:C),w={...f,cards:k,columns:h};return o(w),w});},[o]),i=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...v,id:f,cardIds:[]},h={...x,columns:[...x.columns,k]};return o(h),h});},[o]),c=react.useCallback(async(v,f)=>{r(x=>{let k=x.columns.map(w=>w.id===v?{...w,...f}:w),h={...x,columns:k};return o(h),h});},[o]),l=react.useCallback(async v=>{r(f=>{let x=f.cards.filter(w=>w.columnId!==v),k=f.columns.filter(w=>w.id!==v),h={...f,cards:x,columns:k};return o(h),h});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),y=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:u,deleteColumn:l,clearBoard:y}}}function n0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Hi({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(l=>l.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.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 ns={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},i0={by:"none",order:"asc"};function l0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...ns,...e}),[s,n]=react.useState({...i0,...t}),d=react.useCallback(b=>{o(v=>({...v,...b}));},[]),u=react.useCallback(b=>{n(v=>({...v,...b}));},[]),i=react.useCallback(()=>{o(ns),n(i0);},[]),c=react.useCallback(()=>{a&&o({...ns,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...ns,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...ns,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]),y=react.useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(x=>x.title.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,x=f.getFullYear(),k=String(f.getMonth()+1).padStart(2,"0"),h=String(f.getDate()).padStart(2,"0"),w=`${x}-${k}-${h}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let S=C.endDate||C.dueDate;if(!S)return false;let T;if(typeof S=="string")T=S.split("T")[0]||S;else {let L=S.getUTCFullYear(),A=String(S.getUTCMonth()+1).padStart(2,"0"),N=String(S.getUTCDate()).padStart(2,"0");T=`${L}-${A}-${N}`;}switch(r.dateFilter){case "overdue":return T<w;case "today":return T===w;case "this-week":let L=new Date(w+"T00:00:00"),A=new Date(T+"T00:00:00"),N=new Date(L);return N.setDate(N.getDate()+7),A>=L&&A<=N;case "custom":if(r.dateRange){let Y=typeof S=="string"?new Date(S):S;return Y>=r.dateRange.start&&Y<=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(k=>r.assignees.includes(k)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,x)=>{let k=0;switch(s.by){case "created":let h=f.createdAt?new Date(f.createdAt).getTime():0,w=x.createdAt?new Date(x.createdAt).getTime():0;k=h-w;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},S=C[f.priority||"LOW"],T=C[x.priority||"LOW"];k=S-T;break;case "dueDate":let L=f.endDate||f.dueDate,A=x.endDate||x.dueDate;if(!L)return 1;if(!A)return -1;let N=typeof L=="string"?new Date(L).getTime():L.getTime(),Y=typeof A=="string"?new Date(A).getTime():A.getTime();k=N-Y;break;case "title":k=f.title.localeCompare(x.title);break;case "estimate":let O=f.estimatedTime||0,le=x.estimatedTime||0;k=O-le;break;default:k=0;}return s.order==="asc"?k:-k}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var c0,u0;if(typeof window<"u")try{let e=hs("ai");c0=e.generateObject,u0=e.generateText;}catch{}function p0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(c0&&u0&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function ec(){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 m0(e){let{cards:t}=e,[a,r]=ec(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,L)=>T.position-L.position),x=f.findIndex(T=>T.id===a.lastSelectedCardId),k=f.findIndex(T=>T.id===l),[h,w]=x<k?[x,k]:[k,x],C=f.slice(h,w+1).map(T=>T.id),S=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:S,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:u,toggleCard:i,getSelectedCards:c}}var g0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function f0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...g0,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((b,v,f,x,k)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let h={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:x,color:k,isExpanded:true,position:s.filter(w=>w.columnId===f).length,createdAt:new Date};n(w=>[...w,h]);},[o.minCardsPerStack,s]),u=react.useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=react.useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),c=react.useCallback((b,v)=>{n(f=>f.map(x=>x.id===b&&!x.cardIds.includes(v)?{...x,cardIds:[...x.cardIds,v]}:x));},[]),l=react.useCallback((b,v)=>{n(f=>f.map(x=>{if(x.id===b){let k=x.cardIds.filter(h=>h!==v);return k.length<o.minCardsPerStack?null:{...x,cardIds:k}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),m=react.useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async b=>{let v=t.filter(w=>w.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;v.forEach(w=>{w.labels&&w.labels.length>0&&w.labels.forEach(C=>{x.has(C)||x.set(C,[]),x.get(C).push(w);});}),x.forEach((w,C)=>{w.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:w.map(S=>S.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${w.length} cards with label "${C}"`,confidence:.85});});let k=new Map;v.forEach(w=>{w.assignedUserIds&&w.assignedUserIds.length>0&&w.assignedUserIds.forEach(C=>{k.has(C)||k.set(C,[]),k.get(C).push(w);});}),k.forEach((w,C)=>{w.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:w.map(S=>S.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${w.length} cards assigned to the same user`,confidence:.8});});let h=new Map;if(v.forEach(w=>{w.priority&&(h.has(w.priority)||h.set(w.priority,[]),h.get(w.priority).push(w));}),h.forEach((w,C)=>{if(w.length>=o.minCardsPerStack){let S={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${S} ${C} Priority`,cardIds:w.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${w.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let w of v){let S=(await r.findSimilar(w,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(S.length>=o.minCardsPerStack-1){let T=[w.id,...S.map(A=>A.card.id)],L=S.reduce((A,N)=>A+N.similarity,0)/S.length;f.push({stack:{title:`\u2728 Similar to "${w.title.substring(0,30)}${w.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${S.length+1} similar tasks`,confidence:L});}}return f.filter(w=>w.confidence>=o.autoStackConfidenceThreshold).sort((w,C)=>C.confidence-w.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),x=f[0];f.length>0&&x&&x.confidence>=.9&&y(x);});},[]),{stacks:s,createStack:d,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var b0=react.createContext(null);function h0({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}=hs("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=hs("@libxai/core");n.set(u.id,new i(u));});let d=null;if(t?.board){let{Board:u}=hs("@libxai/core");d=new u(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(b0.Provider,{value:{store:o},children:e})}function zi(){let e=react.useContext(b0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function is(){let e=zi(),[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 d=react.useCallback(x=>{e.updateBoard(x);},[e]),u=react.useCallback(x=>{e.addColumn(x);},[e]),i=react.useCallback((x,k)=>{e.updateColumn(x,k);},[e]),c=react.useCallback(x=>{e.deleteColumn(x);},[e]),l=react.useCallback(x=>e.getColumn(x),[e]),m=react.useCallback(x=>{e.addCard(x);},[e]),g=react.useCallback((x,k)=>{e.updateCard(x,k);},[e]),y=react.useCallback(x=>{e.deleteCard(x);},[e]),b=react.useCallback((x,k,h)=>{e.moveCard(x,k,h);},[e]),v=react.useCallback(x=>e.getCard(x),[e]),f=react.useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:l,addCard:m,updateCard:g,deleteCard:y,moveCard:b,getCard:v,getCardsByColumn:f}}function x0(e){let{cards:t}=is();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 v0(e="position",t="asc"){let{cards:a}=is();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?d[o.priority]:0,i=s.priority?d[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 Ui=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Uc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},y5=new Ui;function w0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:u}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=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:l.map(y=>{let b=e[y.index];if(!b)return null;let v=u?u(b,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(b,y.index)},v)})})})}function C0(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 N0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:u,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=u?u(v,b.index):b.index,x={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:x,"data-index":b.index,children:o(v,b.index)},f)})})})}function D0(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 S0(e,t=10){return e>t}var oc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},nc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},sc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ic={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},lc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},dc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},cc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},uc={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)"},pc={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)"},mc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},gc={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}},fc={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}},Wi={spacing:oc,borderRadius:nc,fontSize:sc,fontWeight:ic,lineHeight:lc,zIndex:dc,duration:cc,easing:uc,shadows:pc,opacity:mc,kanban:gc,gantt:fc};function E0(e,t,a){return e[t]??a}function bc(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)?bc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function k5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function hc(e="asakaa"){let t=bc(Wi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=k5(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
409
414
|
${a.join(`
|
|
410
415
|
`)}
|
|
411
|
-
}`}function
|
|
416
|
+
}`}function ls(e,t="asakaa"){let a=[],r=bc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
412
417
|
${a.join(`
|
|
413
418
|
`)}
|
|
414
|
-
}`}var
|
|
419
|
+
}`}var Gi={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"}},yc={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"}},xc={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 vc(e=Gi,t="asakaa"){let a=hc(t),r=ls(e,t);return `${a}
|
|
415
420
|
|
|
416
|
-
${r}`}function
|
|
421
|
+
${r}`}function P0(){return `/**
|
|
417
422
|
* ASAKAA Design Tokens
|
|
418
423
|
* Auto-generated from design-tokens.ts
|
|
419
424
|
* Do not edit this file directly
|
|
420
425
|
*/
|
|
421
426
|
|
|
422
|
-
${
|
|
427
|
+
${vc(Gi)}
|
|
423
428
|
|
|
424
429
|
/* Light theme */
|
|
425
430
|
[data-theme="light"] {
|
|
426
|
-
${
|
|
431
|
+
${ls(yc,"asakaa").split(`
|
|
427
432
|
`).slice(1,-1).join(`
|
|
428
433
|
`)}
|
|
429
434
|
}
|
|
430
435
|
|
|
431
436
|
/* Neutral theme */
|
|
432
437
|
[data-theme="neutral"] {
|
|
433
|
-
${
|
|
438
|
+
${ls(xc,"asakaa").split(`
|
|
434
439
|
`).slice(1,-1).join(`
|
|
435
440
|
`)}
|
|
436
441
|
}
|
|
437
|
-
`}var
|
|
438
|
-
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 w5=({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 F0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=nn();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{let u=n,i=u===r;return jsxRuntime.jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${d.displayName} theme`,"aria-pressed":i,title:d.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(w5,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:d.displayName})]},u)})})}
|
|
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=e0;exports.AI_FEATURES=e5;exports.AI_MODELS=Jd;exports.AddCardButton=Dl;exports.AddColumnButton=kl;exports.AttachmentUploader=Or;exports.BoardProvider=h0;exports.BulkOperationsToolbar=Ws;exports.BurnDownChart=$l;exports.CUSTOM_FIELD_TYPES=Sg;exports.CalendarBoard=$g;exports.Card=Vr;exports.CardDetailModal=Al;exports.CardDetailModalV2=Bl;exports.CardHistoryReplay=_g;exports.CardHistoryTimeline=Gg;exports.CardRelationshipsGraph=Yg;exports.CardStack=_1;exports.CardTemplateSelector=_l;exports.CircuitBreaker=el;exports.Column=Qo;exports.ColumnManager=Js;exports.CommandPalette=Pl;exports.ConfigMenu=ql;exports.ContextMenu=un;exports.DEFAULT_SHORTCUTS=zn;exports.DEFAULT_TABLE_COLUMNS=Ng;exports.DEFAULT_TEMPLATES=Vl;exports.DateRangePicker=Dn;exports.DependenciesSelector=En;exports.DependencyLine=Vn;exports.DistributionCharts=Hl;exports.EditableColumnTitle=ll;exports.ErrorBoundary=tn;exports.ExportImportModal=Kl;exports.FilterBar=Yl;exports.GANTT_AI_SYSTEM_PROMPT=lm;exports.GanttAIAssistant=fi;exports.GanttBoard=rm;exports.GanttI18nContext=ln;exports.GanttMilestone=ci;exports.GanttToolbar=Xs;exports.GenerateGanttTasksDialog=r0;exports.GeneratePlanModal=Jg;exports.GroupBySelector=Wl;exports.HealthBar=gl;exports.KanbanBoard=io;exports.KanbanToolbar=xl;exports.KanbanViewAdapter=On;exports.KeyboardShortcutsHelp=Gl;exports.ListView=Tg;exports.MenuIcons=Vt;exports.PluginManager=Ui;exports.PrioritySelector=Co;exports.ProfitabilityReport=fl;exports.QuickTaskCreate=Eo;exports.RATE_LIMITS=Z1;exports.STANDARD_FIELDS=Dg;exports.SwimlaneBoardView=zl;exports.TagBadge=cl;exports.TagList=Tu;exports.TagPicker=oo;exports.TaskBar=ri;exports.TaskDetailModal=jr;exports.TaskFormModal=im;exports.TaskGrid=ei;exports.ThemeModal=Zl;exports.ThemeProvider=kp;exports.ThemeSwitcher=F0;exports.TimeInputPopover=Ir;exports.TimePill=ul;exports.TimePopover=pl;exports.Timeline=pi;exports.UserAssignmentSelector=No;exports.VelocityChart=Ol;exports.VirtualGrid=N0;exports.VirtualList=w0;exports.aiUsageTracker=$o;exports.borderRadius=nc;exports.calculatePosition=xs;exports.calendarDarkTheme=jd;exports.calendarEnTranslations=Ud;exports.calendarEsTranslations=Wd;exports.calendarLightTheme=Kd;exports.calendarNeutralTheme=Yd;exports.calendarThemes=Ri;exports.calendarTranslations=Ai;exports.cardToGanttTask=yi;exports.cardsToGanttTasks=fm;exports.cn=p;exports.createKanbanView=ep;exports.createRetryWrapper=cf;exports.darkTheme=Xl;exports.darkTokenTheme=Gi;exports.defaultTheme=Vs;exports.designTokens=Wi;exports.duration=cc;exports.easing=uc;exports.exportTokensToCSS=P0;exports.findTaskByName=Qr;exports.fontSize=sc;exports.fontWeight=ic;exports.formatCost=os;exports.ganttEnTranslations=js;exports.ganttEsTranslations=Cp;exports.ganttTaskToCardUpdate=gm;exports.ganttThemes=ot;exports.ganttTokens=fc;exports.ganttTranslations=ed;exports.ganttUtils=Me;exports.generateCSSVariables=hc;exports.generateCompleteCSS=vc;exports.generateInitialPositions=nf;exports.generateTasksContext=dm;exports.generateThemeVariables=ls;exports.getCalendarTheme=Hg;exports.getCalendarTranslations=Qn;exports.getListViewTheme=Eg;exports.getListViewTranslations=vd;exports.getMonthNames=Pg;exports.getToken=E0;exports.getTranslations=Tp;exports.getWeekdayNames=Fg;exports.kanbanTokens=gc;exports.lightTheme=Jl;exports.lightTokenTheme=yc;exports.lineHeight=lc;exports.listViewDarkTheme=$d;exports.listViewEnTranslations=yd;exports.listViewEsTranslations=xd;exports.listViewLightTheme=Hd;exports.listViewNeutralTheme=zd;exports.listViewThemes=Mi;exports.listViewTranslations=xi;exports.mergeCalendarTranslations=Li;exports.mergeListViewTranslations=vi;exports.mergeTranslations=td;exports.neutralTheme=Ql;exports.neutralTokenTheme=xc;exports.opacity=mc;exports.parseLocalCommand=pm;exports.parseNaturalDate=fd;exports.parseNaturalDuration=bd;exports.parseProgress=hd;exports.parseStatus=um;exports.pluginManager=y5;exports.retrySyncOperation=df;exports.retryWithBackoff=vs;exports.shadows=pc;exports.shouldVirtualizeGrid=S0;exports.spacing=oc;exports.themes=Mo;exports.useAI=p0;exports.useBoard=n0;exports.useBoardCore=is;exports.useBoardStore=zi;exports.useCardStacking=f0;exports.useDragState=hl;exports.useFilteredCards=x0;exports.useFilters=l0;exports.useGanttI18n=Tr;exports.useKanbanState=Hi;exports.useKeyboardShortcuts=yp;exports.useMultiSelect=m0;exports.useSelectionState=ec;exports.useSortedCards=v0;exports.useTheme=nn;exports.useVirtualGrid=D0;exports.useVirtualList=C0;exports.validateAIResponse=mm;exports.withErrorBoundary=Sl;exports.wouldCreateCircularDependency=ws;exports.zIndex=dc;//# sourceMappingURL=index.cjs.map
|
|
439
444
|
//# sourceMappingURL=index.cjs.map
|