@libxai/board 0.17.145 → 0.17.146
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 +20 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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=Ii(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=Ii(t[d]||"");if(c.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let l=o.get(m),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(c){s.push(`Line ${d+1}: ${c instanceof Error?c.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 Ii(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Li(e,t){switch(t){case "json":return Qc(e);case "csv":return ep(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Fi(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 Nn=react.createContext(null);function Bi(){return react.useContext(Nn)}var Ri=react.createContext(null);function Oi({children:e,themeName:t}){return jsxRuntime.jsx(Ri.Provider,{value:{themeName:t},children:e})}function kr(){return react.useContext(Ri)}function Ye({children:e,container:t}){let[a,r]=react.useState(false),o=Bi(),s=kr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:p}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:n,children:e}),d)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var Gi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},lp="#BDC3C7",dp=({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 ar({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null),n=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let k=v-u.bottom,D=u.top,h;k>=x+b?h=u.bottom+b:D>=x+b?h=u.top-x-b:h=k>=D?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};react.useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!p.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},l=e?Gi[e]:null,i=l?.color||lp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):n(),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?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}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:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Gi).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>m(u),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: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(dp,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),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:()=>m(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:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var cp=[{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 Wr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),i=(kr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),k=window.innerHeight,D=window.innerWidth,h=320,E=380,C=4,R=g.left;R+h>D-10&&(R=D-h-10),R<10&&(R=10);let T=k-g.bottom,U=g.top,W;T>=E+C?W=g.bottom+C:U>=E+C?W=g.top-E-C:W=T>=U?g.bottom+C:Math.max(10,g.top-E-C),c({top:W,left:R}),s(true);};react.useEffect(()=>{let g=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let k=new Date,D=R=>{let T=R.getFullYear(),U=String(R.getMonth()+1).padStart(2,"0"),W=String(R.getDate()).padStart(2,"0");return `${T}-${U}-${W}`},h=D(k),E=new Date(k);E.setDate(E.getDate()+g);let C=D(E);a(h,C),s(false);},f=()=>{if(!e||!t)return "Set date";let g=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=E.split("-").map(Number);if(C.length!==3||C.some(W=>isNaN(W)))return null;let R=C[0],T=C[1],U=C[2];return R===void 0||T===void 0||U===void 0?null:new Date(R,T-1,U)},k=g(e),D=g(t);if(!k||!D||isNaN(k.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[k.getMonth()]} ${k.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),g<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"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:i?"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:i?"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:cp.map(g=>jsxRuntime.jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"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:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function or({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=react.useState(false),[c,p]=react.useState(""),[n,m]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,k=window.innerWidth,D=300,h=380,E=4,C=b.right-D;C<10&&(C=b.left),C+D>k-10&&(C=k-D-10);let R=g-b.bottom,T=b.top,U;R>=h+E?U=b.bottom+E:T>=h+E?U=b.top-h-E:U=R>=T?b.bottom+E:Math.max(10,b.top-h-E),m({top:U,left:C}),d(true);};react.useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),p(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),p(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(k=>k.id===b.id);a(g?e.filter(k=>k.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?d(false):u(),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(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(Ye,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>p(b.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:f.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"}):f.map(b=>{let g=e.some(k=>k.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.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:b.color,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}),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:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(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 Co(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let n=p.dependencies.map(m=>{if(typeof m=="string")return m;let l=m;return l.taskId||l.targetId||""}).filter(Boolean);r.set(p.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,c=p=>{if(!s.has(p)){s.add(p),d.add(p);let n=r.get(p)||[];for(let m of n){if(!s.has(m)&&c(m))return true;if(d.has(m))return true}}return d.delete(p),false};return c(a)}function Hr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[l,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[f,y]=react.useState(null),x=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let C=b.current.getBoundingClientRect(),R=window.innerHeight,T=window.innerWidth,U=300,W=l?380:120,A=4,G=C.right-U;G<10&&(G=C.left),G+U>T-10&&(G=T-U-10);let re=R-C.bottom,be=C.top,_;re>=W+A?_=C.bottom+A:be>=W+A?_=C.top-W-A:_=re>=be?C.bottom+A:Math.max(10,C.top-W-A),v({top:_,left:G}),p(true);};react.useEffect(()=>{if(!c||!b.current)return;let C=b.current.getBoundingClientRect(),R=window.innerHeight,T=window.innerWidth,U=300,W=l?380:120,A=4,G=C.right-U;G<10&&(G=C.left),G+U>T-10&&(G=T-U-10);let re=R-C.bottom,be=C.top,_;re>=W+A?_=C.bottom+A:be>=W+A?_=C.top-W-A:_=re>=be?C.bottom+A:Math.max(10,C.top-W-A),v({top:_,left:G});},[l,c]),react.useEffect(()=>{let C=R=>{x.current&&!x.current.contains(R.target)&&!b.current?.contains(R.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=R=>{R.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);let k=C=>{let R=t.includes(C),T=a.find(U=>U.id===C);if(y(null),R){let U=t.filter(W=>W!==C);r(U),U.length===0&&i(false);}else {if(s&&Co(a,C,e)){let W=`Cannot add "${T?.title||C}" as dependency - would create circular reference`;y(W),d?.(C,T?.title||C),setTimeout(()=>y(null),3e3);return}r([...t,C]),i(true);}},D=()=>{let C=!l;i(C),C||r([]);},h=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),E=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?p(false):g(),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:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),c&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.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:[f&&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:f})]}),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:D,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:n,onChange:C=>m(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:h.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"}):h.map(C=>{let R=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>k(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children: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([]),i(false),p(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 Fa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:c=[],allCards:p=[]})=>{let{attributes:n,listeners:m,setNodeRef:l,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:vo.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:l,style:f,...n,...m,onClick:()=>a?.(e),children:t(e)});let y=c.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:b,className:w("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.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:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ar,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Wr,{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:(g,k)=>d?.(e.id,{startDate:g,endDate:k})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(or,{assignedUsers:y,availableUsers:c,onChange:g=>d?.(e.id,{assignedUserIds:g.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Hr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:p,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies));Fa.displayName="Card";var To={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"}},Zi=({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 Qi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),m=[...Object.entries(To).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(To).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=To[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...To.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,k=280,D=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let E=x-y.bottom,C=y.top,R;E>=k+D?R=y.bottom+D:C>=k+D?R=y.top-k-D:R=E>=C?y.bottom+D:Math.max(10,y.top-k-D),c({top:R,left:h}),s(true);};react.useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsxRuntime.jsx(Zi,{icon:v.icon,color:f})}),o&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.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:m.map(y=>jsxRuntime.jsxs("button",{onClick:()=>u(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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zi,{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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function el({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=react.useState(false),[c,p]=react.useState(false),[n,m]=react.useState(e),[l,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=k=>{u.current&&!u.current.contains(k.target)&&!v.current?.contains(k.target)&&(d(false),p(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&(d(false),p(false),m(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]);let y=()=>{p(true),m(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),p(false),d(false),m(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>d(!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(Ye,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.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:c?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:f,type:"text",value:n,onChange:g=>m(g.target.value),onKeyDown:b,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-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(),d(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 Tr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:c,availableUsers:p,allCards:n,enableVirtualization:m,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),D=m??Ni(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:x,children:a(e,t)});let C=(()=>{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}})(),R=C.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:w("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",x),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:w(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&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"})]}),C.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"})]}),C.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"})}),C.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||f)&&jsxRuntime.jsx(el,{columnTitle:e.title,onRename:U=>v?.(e.id,U),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:D?"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"})}):D?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map(U=>{let W=t[U.index];return W?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsxRuntime.jsx(Fa,{card:W,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n})},W.id):null})}):t.map(U=>jsxRuntime.jsx(Fa,{card:U,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n},U.id))})})]})});Tr.displayName="Column";function An({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=s.trim();m&&m!==e?t(m):d(e),o(false);},n=m=>{m.key==="Enter"?p():m.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:m=>d(m.target.value),onBlur:p,onKeyDown:n,className:w("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:w("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Ln(){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 ja({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:p,error:n,children:m}){let[l,i]=Ln(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=react.useCallback((T,U)=>{t.onCardUpdate?.(T,U);},[t]),x=react.useCallback((T,U)=>{t.onColumnUpdate?.(T,{title:U});},[t]),b=react.useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let T=new Map;return e.columns.forEach(U=>{let W=U.cardIds.map(A=>e.cards.find(G=>G.id===A)).filter(A=>A!==void 0).sort((A,G)=>A.position-G.position);T.set(U.id,W);}),T},[e.cards,e.columns]),h=react.useCallback(T=>{let{active:U}=T,W=e.cards.find(A=>A.id===U.id);W&&i({isDragging:true,draggedCardId:W.id,sourceColumnId:W.columnId,targetColumnId:W.columnId});},[e.cards,i]),E=react.useCallback(T=>{let{active:U,over:W}=T;if(!W||!e.cards.find(re=>re.id===U.id))return;let G=null;W.data.current?.type==="column"?G=W.id:W.data.current?.type==="card"&&(G=e.cards.find(be=>be.id===W.id)?.columnId||null),G&&G!==l.targetColumnId&&i({...l,targetColumnId:G});},[e.cards,l,i]),C=react.useCallback(async T=>{let{active:U,over:W}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!W)return;let A=e.cards.find(_=>_.id===U.id);if(!A)return;let G,re;if(W.data.current?.type==="column"){G=W.id;let _=D.get(G)||[];re=wn(_,0);}else {let _=e.cards.find(B=>B.id===W.id);if(!_)return;G=_.columnId;let Ae=D.get(G)||[],Fe=Ae.findIndex(B=>B.id===W.id);re=wn(Ae,Fe);}let be=e.columns.find(_=>_.id===G);if(be&&be.wipLimit&&be.wipLimitType==="hard"){let _=D.get(G)||[];if(A.columnId!==G&&_.length>=be.wipLimit){t.onWipLimitExceeded?.(be,A);return}}(A.columnId!==G||A.position!==re)&&await t.onCardMove?.(A.id,G,re);},[e.cards,e.columns,D,t,i]),R=react.useCallback(T=>{a?.(T);},[a]);return p?jsxRuntime.jsx("div",{className:w("asakaa-board",f,d),style:c,children:jsxRuntime.jsx(Fp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:w("asakaa-board",f,d),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Oi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:E,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:w("asakaa-board",f,d),style:c,"data-theme":u,children:[e.columns.sort((T,U)=>T.position-U.position).map(T=>{let U=D.get(T.id)||[],W=!g.includes(T.id);return jsxRuntime.jsx(Tr,{column:T,cards:U,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:R,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:W,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(Fa,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Fp({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 Up={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},zp={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Wp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Gp={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Hp({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=m=>{c.current&&!c.current.contains(m.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let p=n=>{t(n),d(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[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((n,m)=>n.position-m.position).map((n,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.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:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function _p({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=react.useState(false),[c,p]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[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(u=>u.handler),i=async(u,v)=>{if(v){p(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{p(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!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((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.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:c===u.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"})}):u.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:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function Vp({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, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Bn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:c,onExportExcel:p,translations:n}){let m=r==="dark"?Up:zp,l={...o==="es"?Wp:Gp,...n},i=d||c||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_p,{theme:m,t:l,onExportCSV:d,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(Hp,{columns:e,onSelect:t,theme:m,t:l,createTaskLabel:a}):jsxRuntime.jsx(Vp,{onClick:()=>t(),label:a||l.newTask}))]})})}function On({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=react.useState(false),[c,p]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),p(""),d(false));},[c,e]),m=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(p(""),d(false));},[n]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:w("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>p(i.target.value),onKeyDown:m,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{p(""),d(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:w("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>d(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 $n({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:c="dark",locale:p="es"}){let[n,m]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState([]),[x,b]=react.useState(""),[g,k]=react.useState(""),[D,h]=react.useState(""),[E,C]=react.useState(false),[R,T]=react.useState(false),[U,W]=react.useState(false),A=react.useRef(null),G=react.useRef(null),re={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},be=react.useCallback(()=>{v(""),y([]),b(""),k(""),h(""),C(false),T(false),W(false),m(false);},[]);react.useEffect(()=>{n&&A.current&&A.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let L=O=>{G.current&&!G.current.contains(O.target)&&(u.trim()||be());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[n,u,be]);let _=react.useCallback(async()=>{let L=u.trim();if(!(!L||l)){i(true);try{await t({name:L,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),v(""),y([]),b(""),k(""),h(""),C(!1),T(!1),W(!1),A.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{i(false);}}},[u,e,f,x,g,D,t,l]),Ae=react.useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),_()):L.key==="Escape"&&be();},[_,be]),Fe=react.useCallback(L=>{y(O=>O.includes(L)?O.filter(S=>S!==L):[...O,L]);},[]),B=c==="dark";return n?jsxRuntime.jsxs("div",{ref:G,className:w("rounded-lg overflow-hidden shadow-lg",B?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:A,type:"text",value:u,onChange:L=>v(L.target.value),onKeyDown:Ae,placeholder:re.placeholder,disabled:l,className:w("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",B?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!E),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",E||f.length>0?"bg-emerald-500/20 text-emerald-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:re.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>T(!R),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||x||g?"bg-blue-500/20 text-blue-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:re.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>W(!U),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",U||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:re.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:_,disabled:!u.trim()||l,className:w("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):re.save})]})]}),E&&a.length>0&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxRuntime.jsxs("button",{onClick:()=>Fe(L.id),className:w("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(L.id)?"bg-emerald-500 text-white":B?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsxRuntime.jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),R&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:re.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:L=>b(L.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:re.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:L=>k(L.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),U&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsxRuntime.jsx("button",{onClick:()=>h(D===L?"":L),className:w("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:B?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:re[L]},L))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:d,className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",B?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:re.buttonLabel})]})}var Yr=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(ja,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
-
`)}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(d=>{d?o(d):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ul(e={}){return new Yr(e)}var Dr=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(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:d}=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:d?`Error in ${d}`:"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 Un(e,t){let a=r=>jsxRuntime.jsx(Dr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Wn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState("home"),[x,b]=react.useState(""),[g,k]=react.useState("");react.useEffect(()=>{let C=R=>{(R.metaKey||R.ctrlKey)&&R.key===n&&(R.preventDefault(),i(T=>!T)),R.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{l||(y("home"),v(""),b(""),k(""));},[l]);let D=react.useCallback(()=>{i(false);},[]),h=react.useCallback(C=>{let[R,T]=C.split(":");switch(R){case "create-card":y("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(a?.(T),D()):y("navigate");break;case "search":r?.(u),D();break;case "priority":y("priority");break;case "set-priority":g&&T&&(o?.(g,T),D());break;case "assign":y("assign");break;case "assign-user":g&&T&&(s?.(g,T),D());break;case "ai":y("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":p?.(),D();break;case "back":y("home");break;}},[u,g,t,a,r,o,s,d,c,p,D]),E=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),D());},[x,u,t,D]);return l?jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,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:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&f==="create-card"&&x&&E();}}),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."}),f==="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:h,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:h,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:h,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:h,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:h,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"?"#3B82F6":"#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(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},C.id))})]}),f==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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))})]}),f==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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 R=e.columns.find(T=>T.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:h,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"?"#3B82F6":"#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:R?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.id)})})]}),f==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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:h,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:h,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 Zp(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 Qp(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 em(e){return e.startsWith("image/")}function Xr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[d,c]=react.useState(false),[p,n]=react.useState(false),[m,l]=react.useState(null),i=react.useRef(null),u=react.useCallback(h=>{let E=[],C=[];return e.length+h.length>s?(C.push(`Maximum ${s} files allowed`),{valid:E,errors:C}):(h.forEach(R=>{if(R.size/1048576>r){C.push(`${R.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>R.type.match(U))){C.push(`${R.name} has invalid file type`);return}E.push(R);}),{valid:E,errors:C})},[e.length,s,r,o]),v=react.useCallback(async h=>{let{valid:E,errors:C}=u(h);if(C.length>0){l(C.join(", ")),setTimeout(()=>l(null),5e3);return}if(E.length!==0){n(true),l(null);try{await t?.(E);}catch(R){l(R instanceof Error?R.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{n(false);}}},[u,t]),f=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),y=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),x=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let E=Array.from(h.dataTransfer.files);v(E);},[v]),g=react.useCallback(h=>{let E=h.target.files?Array.from(h.target.files):[];v(E),i.current&&(i.current.value="");},[v]),k=react.useCallback(()=>{i.current?.click();},[]),D=react.useCallback(h=>{confirm("Are you sure you want to delete this attachment?")&&a?.(h);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${p?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:k,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?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:d?"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"]})]})})]}),m&&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:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(h=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:em(h.type)&&h.url?jsxRuntime.jsx("img",{src:h.thumbnailUrl||h.url,alt:h.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Qp(h.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:h.name,children:h.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Zp(h.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(h.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(h.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"})})})]},h.id))})]})}function Hn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:l,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=react.useState("details"),[k,D]=react.useState(false),[h,E]=react.useState({}),[C,R]=react.useState(""),[T,U]=react.useState(false),[W,A]=react.useState({});if(!t||!e)return null;let G=react.useCallback(()=>{D(false),E({}),g("details"),R(""),A({}),a();},[a]),re=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),E({}),D(false));},[e.id,h,r]),be=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),G());},[e.id,o,G]),_=react.useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),R(""));},[e.id,C,m]),Ae=react.useCallback(async()=>{if(v){U(true);try{let S=await v(e);A(Y=>({...Y,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{U(false);}}},[e,v]),Fe=react.useCallback(async()=>{if(f){U(true);try{let S=await f(e);A(Y=>({...Y,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{U(false);}}},[e,f]),B=react.useCallback(async()=>{if(y){U(true);try{let S=await y(e);A(Y=>({...Y,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{U(false);}}},[e,y]),L={...e,...h},O=s.filter(S=>L.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:G,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:h.title??L.title,onChange:S=>E({...h,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:re,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(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:be,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:G,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:()=>g("details"),className:`card-detail-tab ${b==="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:()=>g("comments"),className:`card-detail-tab ${b==="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",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="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",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="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",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="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:[b==="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"}),k?jsxRuntime.jsx("textarea",{value:h.description??L.description??"",onChange:S=>E({...h,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??L.assignedUserIds??[],onChange:S=>{let Y=Array.from(S.target.selectedOptions,ne=>ne.value);E({...h,assignedUserIds:Y});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.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"}),k?jsxRuntime.jsxs("select",{value:h.priority??L.priority??"",onChange:S=>E({...h,priority:S.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:L.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:L.labels&&L.labels.length>0?L.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):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"}),k?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:S=>E({...h,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:S=>E({...h,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??L.estimatedTime??"",onChange:S=>E({...h,estimatedTime:S.target.value?parseFloat(S.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:L.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:L.dependencies&&L.dependencies.length>0?L.dependencies.map(S=>{let Y=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Y.slice(-4)]},Y)}):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:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:S=>R(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:_,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(S=>{let Y=s.find(ne=>ne.id===S.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:[Y&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Y.color},children:Y.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Y?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(S.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:S.content})]},S.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"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(S=>{let Y=s.find(ne=>ne.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.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:Y?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.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"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Xr,{cardId:e.id,attachments:n,onUpload:i?S=>i(e.id,S):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="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:Ae,disabled:T||!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:Fe,disabled:T||!f,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:B,disabled:T||!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"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((S,Y)=>{let ne=s.find(Z=>Z.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ne&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ne.color},children:ne.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ne?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},Y)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((S,Y)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},Y))]}),W.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:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&p.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 Jr({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:d=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,f=l.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let y=i-l.bottom,x=l.top,b;return y>=s+v?b=l.bottom+v:x>=s+v?b=l.top-s-v:y>=x?b=l.bottom+v:b=Math.max(10,l.top-s-v),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let l=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${d}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.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 lm=["LOW","MEDIUM","HIGH","URGENT"],dm=["todo","in-progress","review","done"];function jn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:l,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:f=[],onUploadCoverImage:y,unsplashAccessKey:x,theme:b,onSubtasksChange:g}){let k=kr(),D=b||k?.themeName||"dark",[h,E]=react.useState(e),[C,R]=react.useState(false),[T,U]=react.useState(e?.subtasks||[]),[W,A]=react.useState(false),[G,re]=react.useState(""),[be,_]=react.useState(""),[Ae,Fe]=react.useState("all"),[B,L]=react.useState(false),[O,S]=react.useState(false),[Y,ne]=react.useState(false),[Z,Te]=react.useState(false),[P,te]=react.useState(false),[X,Ee]=react.useState(false),Pe=react.useRef(null),Ve=react.useRef(null),ht=react.useRef(null),Se=react.useRef(null),pt=react.useRef(null),nt=react.useRef(null),at=react.useRef(null),$t=react.useRef(null),mt=react.useRef(null),ut=react.useRef(null),Lt=react.useRef(null),Kt=react.useRef(null);react.useEffect(()=>{e&&!h?(E({...e}),U(e.subtasks||[])):e&&h&&e.id!==h.id&&(E({...e}),U(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let I=K=>{let Ne=K.target;Se.current&&!Se.current.contains(Ne)&&L(false),pt.current&&!pt.current.contains(Ne)&&S(false),nt.current&&!nt.current.contains(Ne)&&ne(false),at.current&&!at.current.contains(Ne)&&Te(false);};if(B||O||Y||Z)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[B,O,Y,Z]),react.useEffect(()=>{if(!t)return;let I=K=>{let Ne=K.target,qe=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(K.key==="Escape"){K.preventDefault(),B||O||Y||Z||P||X?(L(false),S(false),ne(false),Te(false),te(false),Ee(false)):qe||a();return}if(qe&&K.key!=="Escape")return;let Pt=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),L(true);break;case "a":K.preventDefault(),ne(true);break;case "p":K.preventDefault(),S(true);break;case "l":K.preventDefault(),Te(true);break;case "d":Pt||(K.preventDefault(),te(true),setTimeout(()=>$t.current?.focus(),0));break;case "e":Pt||(K.preventDefault(),Ee(true));break;case "i":K.preventDefault(),R(true),setTimeout(()=>Ve.current?.focus(),0);break;case "t":K.preventDefault(),A(true);break;case "c":K.preventDefault(),ht.current?.focus();break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,a,B,O,Y,Z,P,X]);let we=react.useCallback(I=>{let K=I.currentTarget.textContent?.trim()||"";if(h&&K!==h.title){let Ne={...h,title:K};E(Ne),r?.(h.id,{title:K});}},[h,r]),$=react.useCallback(I=>{I.key==="Enter"&&(I.preventDefault(),I.currentTarget.blur()),I.key==="Escape"&&(I.preventDefault(),I.currentTarget.textContent=h?.title||"",I.currentTarget.blur());},[h]),De=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),R(false);},[h,e,r]),Ge=react.useCallback(I=>{if(h){let K={...h,columnId:I};E(K),r?.(h.id,{columnId:I}),L(false);}},[h,r]),We=react.useCallback(I=>{if(h){let K={...h,priority:I};E(K),r?.(h.id,{priority:I}),S(false);}},[h,r]),yt=react.useCallback(I=>{if(h){let K=h.assignedUserIds||[],Ne=K.includes(I)?K.filter(Pt=>Pt!==I):[...K,I],qe={...h,assignedUserIds:Ne};E(qe),r?.(h.id,{assignedUserIds:Ne});}},[h,r]),Q=react.useCallback(I=>{if(h){let K=h.labels||[],Ne=K.includes(I)?K.filter(Pt=>Pt!==I):[...K,I],qe={...h,labels:Ne};E(qe),r?.(h.id,{labels:Ne});}},[h,r]),ae=react.useCallback(I=>{if(h){let K=I.target.value,Ne={...h,endDate:K};E(Ne),r?.(h.id,{endDate:K}),te(false);}},[h,r]),xe=react.useCallback(I=>{if(h){let K={...h,estimatedTime:parseFloat(I)||0};E(K),r?.(h.id,{estimatedTime:parseFloat(I)||0});}},[h,r]),fe=react.useCallback(()=>{if(G.trim()&&h){let I={id:`subtask-${Date.now()}`,title:G.trim(),completed:false,createdAt:new Date},K=[...T,I];U(K),re(""),A(false),g?.(h.id,K);}},[G,T,h,g]),oe=react.useCallback(I=>{let K=T.map(Ne=>Ne.id===I?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);U(K),h&&g?.(h.id,K);},[T,h,g]),Ce=react.useCallback(I=>{let K=T.filter(Ne=>Ne.id!==I);U(K),h&&g?.(h.id,K);},[T,h,g]),he=react.useCallback(()=>{be.trim()&&h&&p&&(p(h.id,be.trim()),_(""));},[be,h,p]),ke=react.useCallback(I=>{(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&(I.preventDefault(),he());},[he]),F=I=>jsxRuntime.jsx(nm__default.default,{remarkPlugins:[sm__default.default],rehypePlugins:[im__default.default],components:{a:({node:K,...Ne})=>jsxRuntime.jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:I}),H=c.filter(I=>Ae==="comments"?I.type.includes("COMMENT"):Ae==="history"?!I.type.includes("COMMENT"):true);if(!t||!e)return null;let J=h||e,ce=s.filter(I=>J.assignedUserIds?.includes(I.id)),pe=T.filter(I=>I.completed).length;return jsxRuntime.jsx(Ye,{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":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Pe,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:we,onKeyDown:$,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:Se,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>L(!B),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(Jr,{triggerRef:mt,isOpen:B,onClose:()=>L(false),width:250,estimatedHeight:200,children:(v.length>0?v:dm.map(I=>({id:I,title:I}))).map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${J.columnId===I.id?"active":""}`,onClick:()=>Ge(I.id),children:I.title},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:nt,children:[jsxRuntime.jsxs("button",{ref:ut,className:"modal-v2-field",onClick:()=>ne(!Y),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:ce.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ce.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(Jr,{triggerRef:ut,isOpen:Y,onClose:()=>ne(false),width:280,estimatedHeight:300,children:s.map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.assignedUserIds?.includes(I.id)?"active":""}`,onClick:()=>yt(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:pt,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>S(!O),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(Jr,{triggerRef:Lt,isOpen:O,onClose:()=>S(false),width:180,estimatedHeight:220,children:[lm.map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${I.toLowerCase()} ${J.priority===I?"active":""}`,onClick:()=>We(I),children:I},I)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>We(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:at,children:[jsxRuntime.jsxs("button",{ref:Kt,className:"modal-v2-field",onClick:()=>Te(!Z),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(Jr,{triggerRef:Kt,isOpen:Z,onClose:()=>Te(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.labels?.includes(I)?"active":""}`,onClick:()=>Q(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:()=>{te(!P),setTimeout(()=>$t.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:$t,type:"date",value:typeof J.endDate=="string"?J.endDate.split("T")[0]:J.endDate?(()=>{let I=new Date(J.endDate),K=I.getUTCFullYear(),Ne=String(I.getUTCMonth()+1).padStart(2,"0"),qe=String(I.getUTCDate()).padStart(2,"0");return `${K}-${Ne}-${qe}`})():"",onChange:ae,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ee(!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("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"})]}),X&&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=>xe(I.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ee(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"})]}),C?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:J.description||"",onChange:I=>{if(h){let K={...h,description:I.target.value};E(K);}},onBlur:De,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>R(true),children:J.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:F(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"}),T.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[pe,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>A(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:[T.map(I=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${I.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>oe(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:()=>Ce(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)),W&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:G,onChange:I=>re(I.target.value),onKeyDown:I=>{I.key==="Enter"&&fe(),I.key==="Escape"&&(A(false),re(""));},onBlur:fe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${Ae==="all"?"active":""}`,onClick:()=>Fe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="comments"?"active":""}`,onClick:()=>Fe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="history"?"active":""}`,onClick:()=>Fe("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ht,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:be,onChange:I=>_(I.target.value),onKeyDown:ke,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:he,disabled:!be.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[H.map(I=>{let K=s.find(qe=>qe.id===I.userId);if(I.type.includes("COMMENT")){let qe=d.find(Pt=>Pt.id===I.metadata?.commentId);return qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:qe.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:K?.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)}),H.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 ym({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 Yn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(d=>({...d,average:d.average??e.reduce((c,p)=>c+p.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(ym,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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((d,c)=>d+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.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:"#3B82F6"},children:e.reduce((d,c)=>d+(c.planned||0),0)})]})]})]})}function Sm({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 qn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-d)/s*100:0,n=d<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height: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(Sm,{})}),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:n?"#10B981":"#EF4444",fill:n?"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:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#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:p>=50?"#10B981":"#F59E0B"},children:[p.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:n?"#10B981":"#EF4444"},children:d})]}),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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Rm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Cl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Om({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),p=t+d*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Tl({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 Xn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),d=e.map(p=>({...p,totalValue:s,color:p.color||Rm[p.name]||Cl[e.indexOf(p)%Cl.length]})),c=d.map(p=>p.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:d,cx:"50%",cy:"50%",labelLine:false,label:o?Om:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Tl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,l=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:d,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(Tl,{})}),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:d.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),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:"#3B82F6"},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((p,n)=>n.value>p.value?n:p).name})]})]})]})}var Ao=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[d,c]=react.useState(false),[p,n]=react.useState(false),[m,l]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(k=>k.id),f=k=>{r.onBulkUpdate?.(v,{priority:k}),c(false);},y=k=>{r.onBulkMove?.(v,k),n(false),a();},x=k=>{r.onBulkUpdate?.(v,{assignedUserIds:k}),l(false);},b=k=>{let D=new Set;e.forEach(E=>{E.labels?.forEach(C=>D.add(C));});let h=Array.from(new Set([...D,...k]));r.onBulkUpdate?.(v,{labels:h}),u(false);},g=()=>{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:()=>c(!d),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(k),children:[jsxRuntime.jsx("span",{className:w("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,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"})})]})]})})});Ao.displayName="BulkOperationsToolbar";function Gm(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,d,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let v=a?.find(f=>f.id===u);d=`assignee-${u}`,c=v?.name||`User ${u}`,p=v?.color,n=v?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(d).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",d=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:s,cardIds:[],color:p}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,p="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:p}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",p="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:p}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Jn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),c=react.useMemo(()=>Gm(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{d(m=>{let l=new Set(m);return l.has(n)?l.delete(n):l.add(n),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(ja,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:w("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),l=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...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&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(ja,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.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 Zn=[{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 Qn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),c=Zn.find(n=>n.value===e)||Zn[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:w("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:Zn.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:w("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.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:n.label}),e===n.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:n.description})]})]},n.value))})]})]})}var Zr=[{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 Vm(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&d&&c&&p}function Pl(e={}){let{shortcuts:t=Zr,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 d=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let l of o.current)if(Vm(n,l)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Km(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ym(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 qm(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ym(e),r=t?Km(t):"";return a?`${a} + ${r}`:r}function Xm(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 es({shortcuts:e=Zr,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=Xm(e);return jsxRuntime.jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.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(d).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:qm(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var ts=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
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'),xd=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),im=require('react-markdown'),lm=require('remark-gfm'),dm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var xd__default=/*#__PURE__*/_interopDefault(xd);var im__default=/*#__PURE__*/_interopDefault(im);var lm__default=/*#__PURE__*/_interopDefault(lm);var dm__default=/*#__PURE__*/_interopDefault(dm);var Do=(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 No=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 [No.Translate.toString(e),No.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function w(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function So(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 jc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Dn(e,t){return e.length===0?1e3:t===0?So(null,e[0].position):t>=e.length?So(e[e.length-1].position,null):So(e[t-1].position,e[t].position)}function Pi(e,t=100){return e>t}var Kc=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 Yc(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 Eo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:d=Kc,onRetry:c}=t,p,n=0;for(let m=1;m<=a;m++){n=m;try{return {data:await e(),attempts:n,success:!0}}catch(l){if(p=l,m===a||!d(p,m))return {error:p,attempts:n,success:false};let u=Yc(m,r,o,s);if(c)try{c(p,m,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:p||new Error("Unknown error"),attempts:n,success:false}}function qc(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 Xc(e,t={}){return async(...a)=>Eo(()=>e(...a),t)}var Nn=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 Mi=(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))(Mi||{}),ir=class ir{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...d}=t,c=`[${a}] [${r}] [${s}]`,p=Object.keys(d).length>0;switch(r){case "DEBUG":console.debug(c,o,p?d:"");break;case "INFO":console.info(c,o,p?d:"");break;case "WARN":console.warn(c,o,p?d:"");break;case "ERROR":console.error(c,o,p?d:""),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",...ir.globalOptions};}static configure(t){ir.globalOptions={...ir.globalOptions,...t};}child(t){return new ir({...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 Po((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Po(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Mi[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};ir.globalOptions={};var Sn=ir,Po=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}},Ai=new Sn;function Zc(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 Qc(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 d=e.columns.find(c=>c.id===s.columnId);return [s.id,En(s.title),En(s.description||""),En(d?.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 ep(e,t,a){let r=t;if(!r){let d=document.querySelector(".asakaa-board");d&&(r=d.parentElement||d);}if(r)try{let d=await xd__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=d.toDataURL("image/png"),p=297,n=210,m=d.width/d.height,l=p-20,i=l/m;i>n-20&&(i=n-20,l=i*m);let u=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});u.setFontSize(16),u.setTextColor(255,255,255),u.setFillColor(10,10,10),u.rect(0,0,p,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(p-l)/2;return u.addImage(c,"PNG",v,20,l,i),u}catch(d){console.error("Error capturing board:",d);}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(d=>{let c=e.cards.filter(p=>p.columnId===d.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(d.title,20,s),s+=8,c.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):c.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(p.description,160);o.text(m,25,s),s+=m.length*5;}let n=[];if(p.priority&&n.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&n.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&n.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let m=[];p.startDate&&m.push(`Start: ${p.startDate}`),p.endDate&&m.push(`End: ${p.endDate}`),n.push(m.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function En(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Li(e,t,a,r){switch(t){case "json":return Zc(e,r);case "csv":return Qc(e);case "pdf":return await ep(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Fi(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);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]}`,d={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:d[t]}),p=URL.createObjectURL(c),n=document.createElement("a");n.href=p,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(p);}function tp(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 ap(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=Bi(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=Bi(t[d]||"");if(c.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let l=o.get(m),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(c){s.push(`Line ${d+1}: ${c instanceof Error?c.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 Bi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Ri(e,t){switch(t){case "json":return tp(e);case "csv":return ap(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Oi(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 Pn=react.createContext(null);function $i(){return react.useContext(Pn)}var zi=react.createContext(null);function Ui({children:e,themeName:t}){return jsxRuntime.jsx(zi.Provider,{value:{themeName:t},children:e})}function Sr(){return react.useContext(zi)}function qe({children:e,container:t}){let[a,r]=react.useState(false),o=$i(),s=Sr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:p}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:n,children:e}),d)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var Vi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},cp="#BDC3C7",pp=({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 lr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null),n=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let k=v-u.bottom,D=u.top,h;k>=x+b?h=u.bottom+b:D>=x+b?h=u.top-x-b:h=k>=D?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};react.useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!p.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},l=e?Vi[e]:null,i=l?.color||cp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):n(),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?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}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:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(qe,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Vi).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>m(u),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: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(pp,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),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:()=>m(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:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var mp=[{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 jr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),i=(Sr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),k=window.innerHeight,D=window.innerWidth,h=320,P=380,C=4,B=g.left;B+h>D-10&&(B=D-h-10),B<10&&(B=10);let T=k-g.bottom,$=g.top,W;T>=P+C?W=g.bottom+C:$>=P+C?W=g.top-P-C:W=T>=$?g.bottom+C:Math.max(10,g.top-P-C),c({top:W,left:B}),s(true);};react.useEffect(()=>{let g=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let k=new Date,D=B=>{let T=B.getFullYear(),$=String(B.getMonth()+1).padStart(2,"0"),W=String(B.getDate()).padStart(2,"0");return `${T}-${$}-${W}`},h=D(k),P=new Date(k);P.setDate(P.getDate()+g);let C=D(P);a(h,C),s(false);},f=()=>{if(!e||!t)return "Set date";let g=P=>{if(P instanceof Date)return P;if(typeof P!="string"||!P.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=P.split("-").map(Number);if(C.length!==3||C.some(W=>isNaN(W)))return null;let B=C[0],T=C[1],$=C[2];return B===void 0||T===void 0||$===void 0?null:new Date(B,T-1,$)},k=g(e),D=g(t);if(!k||!D||isNaN(k.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[k.getMonth()]} ${k.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),g<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(qe,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"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:i?"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:i?"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:mp.map(g=>jsxRuntime.jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"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:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function cr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=react.useState(false),[c,p]=react.useState(""),[n,m]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,k=window.innerWidth,D=300,h=380,P=4,C=b.right-D;C<10&&(C=b.left),C+D>k-10&&(C=k-D-10);let B=g-b.bottom,T=b.top,$;B>=h+P?$=b.bottom+P:T>=h+P?$=b.top-h-P:$=B>=T?b.bottom+P:Math.max(10,b.top-h-P),m({top:$,left:C}),d(true);};react.useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),p(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),p(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(k=>k.id===b.id);a(g?e.filter(k=>k.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?d(false):u(),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(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(qe,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>p(b.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:f.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"}):f.map(b=>{let g=e.some(k=>k.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.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:b.color,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}),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:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(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 Mo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let n=p.dependencies.map(m=>{if(typeof m=="string")return m;let l=m;return l.taskId||l.targetId||""}).filter(Boolean);r.set(p.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,c=p=>{if(!s.has(p)){s.add(p),d.add(p);let n=r.get(p)||[];for(let m of n){if(!s.has(m)&&c(m))return true;if(d.has(m))return true}}return d.delete(p),false};return c(a)}function Yr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[l,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[f,y]=react.useState(null),x=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let C=b.current.getBoundingClientRect(),B=window.innerHeight,T=window.innerWidth,$=300,W=l?380:120,I=4,G=C.right-$;G<10&&(G=C.left),G+$>T-10&&(G=T-$-10);let ae=B-C.bottom,fe=C.top,H;ae>=W+I?H=C.bottom+I:fe>=W+I?H=C.top-W-I:H=ae>=fe?C.bottom+I:Math.max(10,C.top-W-I),v({top:H,left:G}),p(true);};react.useEffect(()=>{if(!c||!b.current)return;let C=b.current.getBoundingClientRect(),B=window.innerHeight,T=window.innerWidth,$=300,W=l?380:120,I=4,G=C.right-$;G<10&&(G=C.left),G+$>T-10&&(G=T-$-10);let ae=B-C.bottom,fe=C.top,H;ae>=W+I?H=C.bottom+I:fe>=W+I?H=C.top-W-I:H=ae>=fe?C.bottom+I:Math.max(10,C.top-W-I),v({top:H,left:G});},[l,c]),react.useEffect(()=>{let C=B=>{x.current&&!x.current.contains(B.target)&&!b.current?.contains(B.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=B=>{B.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);let k=C=>{let B=t.includes(C),T=a.find($=>$.id===C);if(y(null),B){let $=t.filter(W=>W!==C);r($),$.length===0&&i(false);}else {if(s&&Mo(a,C,e)){let W=`Cannot add "${T?.title||C}" as dependency - would create circular reference`;y(W),d?.(C,T?.title||C),setTimeout(()=>y(null),3e3);return}r([...t,C]),i(true);}},D=()=>{let C=!l;i(C),C||r([]);},h=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),P=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?p(false):g(),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:P,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:P},children:t.length})]}),c&&jsxRuntime.jsx(qe,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.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:[f&&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:f})]}),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:D,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:n,onChange:C=>m(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:h.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"}):h.map(C=>{let B=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>k(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.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([]),i(false),p(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 Oa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:c=[],allCards:p=[]})=>{let{attributes:n,listeners:m,setNodeRef:l,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:No.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:l,style:f,...n,...m,onClick:()=>a?.(e),children:t(e)});let y=c.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:b,className:w("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.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:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(lr,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(jr,{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:(g,k)=>d?.(e.id,{startDate:g,endDate:k})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(cr,{assignedUsers:y,availableUsers:c,onChange:g=>d?.(e.id,{assignedUserIds:g.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Yr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:p,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies));Oa.displayName="Card";var Ao={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"}},tl=({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 al({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[d,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),m=[...Object.entries(Ao).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(Ao).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=Ao[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Ao.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,k=280,D=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let P=x-y.bottom,C=y.top,B;P>=k+D?B=y.bottom+D:C>=k+D?B=y.top-k-D:B=P>=C?y.bottom+D:Math.max(10,y.top-k-D),c({top:B,left:h}),s(true);};react.useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsxRuntime.jsx(tl,{icon:v.icon,color:f})}),o&&jsxRuntime.jsx(qe,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.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:m.map(y=>jsxRuntime.jsxs("button",{onClick:()=>u(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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(tl,{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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function rl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=react.useState(false),[c,p]=react.useState(false),[n,m]=react.useState(e),[l,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=k=>{u.current&&!u.current.contains(k.target)&&!v.current?.contains(k.target)&&(d(false),p(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&(d(false),p(false),m(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]);let y=()=>{p(true),m(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),p(false),d(false),m(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>d(!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(qe,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.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:c?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:f,type:"text",value:n,onChange:g=>m(g.target.value),onKeyDown:b,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-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(),d(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 Mr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:c,availableUsers:p,allCards:n,enableVirtualization:m,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),D=m??Pi(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:x,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),B=C.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:w("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",x),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:w(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&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"})]}),C.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"})]}),C.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"})}),C.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||f)&&jsxRuntime.jsx(rl,{columnTitle:e.title,onRename:$=>v?.(e.id,$),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map($=>$.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map($=>{let W=t[$.index];return W?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsxRuntime.jsx(Oa,{card:W,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n})},W.id):null})}):t.map($=>jsxRuntime.jsx(Oa,{card:$,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n},$.id))})})]})});Mr.displayName="Column";function Fn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=s.trim();m&&m!==e?t(m):d(e),o(false);},n=m=>{m.key==="Enter"?p():m.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:m=>d(m.target.value),onBlur:p,onKeyDown:n,className:w("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:w("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Rn(){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 Xa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:p,error:n,children:m}){let[l,i]=Rn(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=react.useCallback((T,$)=>{t.onCardUpdate?.(T,$);},[t]),x=react.useCallback((T,$)=>{t.onColumnUpdate?.(T,{title:$});},[t]),b=react.useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let T=new Map;return e.columns.forEach($=>{let W=$.cardIds.map(I=>e.cards.find(G=>G.id===I)).filter(I=>I!==void 0).sort((I,G)=>I.position-G.position);T.set($.id,W);}),T},[e.cards,e.columns]),h=react.useCallback(T=>{let{active:$}=T,W=e.cards.find(I=>I.id===$.id);W&&i({isDragging:true,draggedCardId:W.id,sourceColumnId:W.columnId,targetColumnId:W.columnId});},[e.cards,i]),P=react.useCallback(T=>{let{active:$,over:W}=T;if(!W||!e.cards.find(ae=>ae.id===$.id))return;let G=null;W.data.current?.type==="column"?G=W.id:W.data.current?.type==="card"&&(G=e.cards.find(fe=>fe.id===W.id)?.columnId||null),G&&G!==l.targetColumnId&&i({...l,targetColumnId:G});},[e.cards,l,i]),C=react.useCallback(async T=>{let{active:$,over:W}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!W)return;let I=e.cards.find(H=>H.id===$.id);if(!I)return;let G,ae;if(W.data.current?.type==="column"){G=W.id;let H=D.get(G)||[];ae=Dn(H,0);}else {let H=e.cards.find(F=>F.id===W.id);if(!H)return;G=H.columnId;let Me=D.get(G)||[],Be=Me.findIndex(F=>F.id===W.id);ae=Dn(Me,Be);}let fe=e.columns.find(H=>H.id===G);if(fe&&fe.wipLimit&&fe.wipLimitType==="hard"){let H=D.get(G)||[];if(I.columnId!==G&&H.length>=fe.wipLimit){t.onWipLimitExceeded?.(fe,I);return}}(I.columnId!==G||I.position!==ae)&&await t.onCardMove?.(I.id,G,ae);},[e.cards,e.columns,D,t,i]),B=react.useCallback(T=>{a?.(T);},[a]);return p?jsxRuntime.jsx("div",{className:w("asakaa-board",f,d),style:c,children:jsxRuntime.jsx(Rp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:w("asakaa-board",f,d),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Ui,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:P,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:w("asakaa-board",f,d),style:c,"data-theme":u,children:[e.columns.sort((T,$)=>T.position-$.position).map(T=>{let $=D.get(T.id)||[],W=!g.includes(T.id);return jsxRuntime.jsx(Mr,{column:T,cards:$,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:B,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:W,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(Oa,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Rp({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 Wp={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},Gp={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Hp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},_p={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Vp({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=m=>{c.current&&!c.current.contains(m.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let p=n=>{t(n),d(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[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((n,m)=>n.position-m.position).map((n,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.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:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function jp({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=react.useState(false),[c,p]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[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(u=>u.handler),i=async(u,v)=>{if(v){p(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{p(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!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((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.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:c===u.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"})}):u.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:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function Kp({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, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function $n({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:c,onExportExcel:p,translations:n}){let m=r==="dark"?Wp:Gp,l={...o==="es"?Hp:_p,...n},i=d||c||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jp,{theme:m,t:l,onExportCSV:d,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(Vp,{columns:e,onSelect:t,theme:m,t:l,createTaskLabel:a}):jsxRuntime.jsx(Kp,{onClick:()=>t(),label:a||l.newTask}))]})})}function Un({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=react.useState(false),[c,p]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),p(""),d(false));},[c,e]),m=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(p(""),d(false));},[n]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:w("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>p(i.target.value),onKeyDown:m,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{p(""),d(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:w("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>d(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 Wn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:c="dark",locale:p="es"}){let[n,m]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState([]),[x,b]=react.useState(""),[g,k]=react.useState(""),[D,h]=react.useState(""),[P,C]=react.useState(false),[B,T]=react.useState(false),[$,W]=react.useState(false),I=react.useRef(null),G=react.useRef(null),ae={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},fe=react.useCallback(()=>{v(""),y([]),b(""),k(""),h(""),C(false),T(false),W(false),m(false);},[]);react.useEffect(()=>{n&&I.current&&I.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let L=R=>{G.current&&!G.current.contains(R.target)&&(u.trim()||fe());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[n,u,fe]);let H=react.useCallback(async()=>{let L=u.trim();if(!(!L||l)){i(true);try{await t({name:L,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),v(""),y([]),b(""),k(""),h(""),C(!1),T(!1),W(!1),I.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{i(false);}}},[u,e,f,x,g,D,t,l]),Me=react.useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),H()):L.key==="Escape"&&fe();},[H,fe]),Be=react.useCallback(L=>{y(R=>R.includes(L)?R.filter(E=>E!==L):[...R,L]);},[]),F=c==="dark";return n?jsxRuntime.jsxs("div",{ref:G,className:w("rounded-lg overflow-hidden shadow-lg",F?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:I,type:"text",value:u,onChange:L=>v(L.target.value),onKeyDown:Me,placeholder:ae.placeholder,disabled:l,className:w("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",F?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!P),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",P||f.length>0?"bg-emerald-500/20 text-emerald-400":F?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>T(!B),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||x||g?"bg-blue-500/20 text-blue-400":F?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>W(!$),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",$||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":F?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:H,disabled:!u.trim()||l,className:w("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):ae.save})]})]}),P&&a.length>0&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",F?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxRuntime.jsxs("button",{onClick:()=>Be(L.id),className:w("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(L.id)?"bg-emerald-500 text-white":F?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsxRuntime.jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),B&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",F?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",F?"text-gray-500":"text-gray-400"),children:ae.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:L=>b(L.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",F?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",F?"text-gray-500":"text-gray-400"),children:ae.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:L=>k(L.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",F?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),$&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",F?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsxRuntime.jsx("button",{onClick:()=>h(D===L?"":L),className:w("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:F?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ae[L]},L))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:d,className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",F?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:ae.buttonLabel})]})}var Qr=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(Xa,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
+
`)}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(d=>{d?o(d):s(new Error("Failed to create PNG blob"));},"image/png");})}};function bl(e={}){return new Qr(e)}var Ar=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(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:d}=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:d?`Error in ${d}`:"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 Gn(e,t){let a=r=>jsxRuntime.jsx(Ar,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function _n({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState("home"),[x,b]=react.useState(""),[g,k]=react.useState("");react.useEffect(()=>{let C=B=>{(B.metaKey||B.ctrlKey)&&B.key===n&&(B.preventDefault(),i(T=>!T)),B.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{l||(y("home"),v(""),b(""),k(""));},[l]);let D=react.useCallback(()=>{i(false);},[]),h=react.useCallback(C=>{let[B,T]=C.split(":");switch(B){case "create-card":y("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(a?.(T),D()):y("navigate");break;case "search":r?.(u),D();break;case "priority":y("priority");break;case "set-priority":g&&T&&(o?.(g,T),D());break;case "assign":y("assign");break;case "assign-user":g&&T&&(s?.(g,T),D());break;case "ai":y("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":p?.(),D();break;case "back":y("home");break;}},[u,g,t,a,r,o,s,d,c,p,D]),P=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),D());},[x,u,t,D]);return l?jsxRuntime.jsx(qe,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,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:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&f==="create-card"&&x&&P();}}),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."}),f==="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:h,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:h,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:h,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:h,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:h,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"?"#3B82F6":"#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))})]}),f==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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))})]}),f==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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(T=>T.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:h,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"?"#3B82F6":"#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(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.id)})})]}),f==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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:h,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:h,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 em(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 tm(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 am(e){return e.startsWith("image/")}function to({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[d,c]=react.useState(false),[p,n]=react.useState(false),[m,l]=react.useState(null),i=react.useRef(null),u=react.useCallback(h=>{let P=[],C=[];return e.length+h.length>s?(C.push(`Maximum ${s} files allowed`),{valid:P,errors:C}):(h.forEach(B=>{if(B.size/1048576>r){C.push(`${B.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>B.type.match($))){C.push(`${B.name} has invalid file type`);return}P.push(B);}),{valid:P,errors:C})},[e.length,s,r,o]),v=react.useCallback(async h=>{let{valid:P,errors:C}=u(h);if(C.length>0){l(C.join(", ")),setTimeout(()=>l(null),5e3);return}if(P.length!==0){n(true),l(null);try{await t?.(P);}catch(B){l(B instanceof Error?B.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{n(false);}}},[u,t]),f=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),y=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),x=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let P=Array.from(h.dataTransfer.files);v(P);},[v]),g=react.useCallback(h=>{let P=h.target.files?Array.from(h.target.files):[];v(P),i.current&&(i.current.value="");},[v]),k=react.useCallback(()=>{i.current?.click();},[]),D=react.useCallback(h=>{confirm("Are you sure you want to delete this attachment?")&&a?.(h);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${p?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:k,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?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:d?"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"]})]})})]}),m&&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:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(h=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:am(h.type)&&h.url?jsxRuntime.jsx("img",{src:h.thumbnailUrl||h.url,alt:h.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:tm(h.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:h.name,children:h.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:em(h.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(h.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(h.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"})})})]},h.id))})]})}function jn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:l,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=react.useState("details"),[k,D]=react.useState(false),[h,P]=react.useState({}),[C,B]=react.useState(""),[T,$]=react.useState(false),[W,I]=react.useState({});if(!t||!e)return null;let G=react.useCallback(()=>{D(false),P({}),g("details"),B(""),I({}),a();},[a]),ae=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),P({}),D(false));},[e.id,h,r]),fe=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),G());},[e.id,o,G]),H=react.useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),B(""));},[e.id,C,m]),Me=react.useCallback(async()=>{if(v){$(true);try{let E=await v(e);I(j=>({...j,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{$(false);}}},[e,v]),Be=react.useCallback(async()=>{if(f){$(true);try{let E=await f(e);I(j=>({...j,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{$(false);}}},[e,f]),F=react.useCallback(async()=>{if(y){$(true);try{let E=await y(e);I(j=>({...j,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{$(false);}}},[e,y]),L={...e,...h},R=s.filter(E=>L.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(qe,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:G,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:h.title??L.title,onChange:E=>P({...h,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:ae,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),P({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(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:fe,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:G,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:()=>g("details"),className:`card-detail-tab ${b==="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:()=>g("comments"),className:`card-detail-tab ${b==="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",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="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",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="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",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="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:[b==="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"}),k?jsxRuntime.jsx("textarea",{value:h.description??L.description??"",onChange:E=>P({...h,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??L.assignedUserIds??[],onChange:E=>{let j=Array.from(E.target.selectedOptions,oe=>oe.value);P({...h,assignedUserIds:j});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.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"}),k?jsxRuntime.jsxs("select",{value:h.priority??L.priority??"",onChange:E=>P({...h,priority:E.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:L.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:L.labels&&L.labels.length>0?L.labels.map(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):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"}),k?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:E=>P({...h,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:E=>P({...h,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??L.estimatedTime??"",onChange:E=>P({...h,estimatedTime:E.target.value?parseFloat(E.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:L.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:L.dependencies&&L.dependencies.length>0?L.dependencies.map(E=>{let j=typeof E=="string"?E:E.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:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:E=>B(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:H,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(E=>{let j=s.find(oe=>oe.id===E.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(E.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(E.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:E.content})]},E.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"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(E=>{let j=s.find(oe=>oe.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),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"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.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"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(to,{cardId:e.id,attachments:n,onUpload:i?E=>i(e.id,E):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="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:Me,disabled:T||!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:Be,disabled:T||!f,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:F,disabled:T||!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"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((E,j)=>{let oe=s.find(q=>q.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[oe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:oe?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},j)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((E,j)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},j))]}),W.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:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&p.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 ao({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:d=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,f=l.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let y=i-l.bottom,x=l.top,b;return y>=s+v?b=l.bottom+v:x>=s+v?b=l.top-s-v:y>=x?b=l.bottom+v:b=Math.max(10,l.top-s-v),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let l=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(qe,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${d}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.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 cm=["LOW","MEDIUM","HIGH","URGENT"],pm=["todo","in-progress","review","done"];function qn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:l,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:f=[],onUploadCoverImage:y,unsplashAccessKey:x,theme:b,onSubtasksChange:g}){let k=Sr(),D=b||k?.themeName||"dark",[h,P]=react.useState(e),[C,B]=react.useState(false),[T,$]=react.useState(e?.subtasks||[]),[W,I]=react.useState(false),[G,ae]=react.useState(""),[fe,H]=react.useState(""),[Me,Be]=react.useState("all"),[F,L]=react.useState(false),[R,E]=react.useState(false),[j,oe]=react.useState(false),[q,De]=react.useState(false),[M,te]=react.useState(false),[Y,Se]=react.useState(false),Ee=react.useRef(null),je=react.useRef(null),ht=react.useRef(null),Ne=react.useRef(null),nt=react.useRef(null),Nt=react.useRef(null),yt=react.useRef(null),Wt=react.useRef(null),st=react.useRef(null),tt=react.useRef(null),mt=react.useRef(null),Qt=react.useRef(null);react.useEffect(()=>{e&&!h?(P({...e}),$(e.subtasks||[])):e&&h&&e.id!==h.id&&(P({...e}),$(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let N=X=>{let me=X.target;Ne.current&&!Ne.current.contains(me)&&L(false),nt.current&&!nt.current.contains(me)&&E(false),Nt.current&&!Nt.current.contains(me)&&oe(false),yt.current&&!yt.current.contains(me)&&De(false);};if(F||R||j||q)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[F,R,j,q]),react.useEffect(()=>{if(!t)return;let N=X=>{let me=X.target,Te=me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.isContentEditable;if(X.key==="Escape"){X.preventDefault(),F||R||j||q||M||Y?(L(false),E(false),oe(false),De(false),te(false),Se(false)):Te||a();return}if(Te&&X.key!=="Escape")return;let Mt=X.metaKey||X.ctrlKey;switch(X.key.toLowerCase()){case "s":X.preventDefault(),L(true);break;case "a":X.preventDefault(),oe(true);break;case "p":X.preventDefault(),E(true);break;case "l":X.preventDefault(),De(true);break;case "d":Mt||(X.preventDefault(),te(true),setTimeout(()=>Wt.current?.focus(),0));break;case "e":Mt||(X.preventDefault(),Se(true));break;case "i":X.preventDefault(),B(true),setTimeout(()=>je.current?.focus(),0);break;case "t":X.preventDefault(),I(true);break;case "c":X.preventDefault(),ht.current?.focus();break}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[t,a,F,R,j,q,M,Y]);let xe=react.useCallback(N=>{let X=N.currentTarget.textContent?.trim()||"";if(h&&X!==h.title){let me={...h,title:X};P(me),r?.(h.id,{title:X});}},[h,r]),O=react.useCallback(N=>{N.key==="Enter"&&(N.preventDefault(),N.currentTarget.blur()),N.key==="Escape"&&(N.preventDefault(),N.currentTarget.textContent=h?.title||"",N.currentTarget.blur());},[h]),we=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),B(false);},[h,e,r]),He=react.useCallback(N=>{if(h){let X={...h,columnId:N};P(X),r?.(h.id,{columnId:N}),L(false);}},[h,r]),We=react.useCallback(N=>{if(h){let X={...h,priority:N};P(X),r?.(h.id,{priority:N}),E(false);}},[h,r]),vt=react.useCallback(N=>{if(h){let X=h.assignedUserIds||[],me=X.includes(N)?X.filter(Mt=>Mt!==N):[...X,N],Te={...h,assignedUserIds:me};P(Te),r?.(h.id,{assignedUserIds:me});}},[h,r]),J=react.useCallback(N=>{if(h){let X=h.labels||[],me=X.includes(N)?X.filter(Mt=>Mt!==N):[...X,N],Te={...h,labels:me};P(Te),r?.(h.id,{labels:me});}},[h,r]),Q=react.useCallback(N=>{if(h){let X=N.target.value,me={...h,endDate:X};P(me),r?.(h.id,{endDate:X}),te(false);}},[h,r]),ve=react.useCallback(N=>{if(h){let X={...h,estimatedTime:parseFloat(N)||0};P(X),r?.(h.id,{estimatedTime:parseFloat(N)||0});}},[h,r]),be=react.useCallback(()=>{if(G.trim()&&h){let N={id:`subtask-${Date.now()}`,title:G.trim(),completed:false,createdAt:new Date},X=[...T,N];$(X),ae(""),I(false),g?.(h.id,X);}},[G,T,h,g]),re=react.useCallback(N=>{let X=T.map(me=>me.id===N?{...me,completed:!me.completed,updatedAt:new Date}:me);$(X),h&&g?.(h.id,X);},[T,h,g]),Ce=react.useCallback(N=>{let X=T.filter(me=>me.id!==N);$(X),h&&g?.(h.id,X);},[T,h,g]),ue=react.useCallback(()=>{fe.trim()&&h&&p&&(p(h.id,fe.trim()),H(""));},[fe,h,p]),ke=react.useCallback(N=>{(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),ue());},[ue]),ge=N=>jsxRuntime.jsx(im__default.default,{remarkPlugins:[lm__default.default],rehypePlugins:[dm__default.default],components:{a:({node:X,...me})=>jsxRuntime.jsx("a",{...me,target:"_blank",rel:"noopener noreferrer"})},children:N}),Ae=c.filter(N=>Me==="comments"?N.type.includes("COMMENT"):Me==="history"?!N.type.includes("COMMENT"):true);if(!t||!e)return null;let pe=h||e,Ie=s.filter(N=>pe.assignedUserIds?.includes(N.id)),U=T.filter(N=>N.completed).length;return jsxRuntime.jsx(qe,{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:N=>N.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ee,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:xe,onKeyDown:O,children:pe.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:Ne,children:[jsxRuntime.jsxs("button",{ref:st,className:"modal-v2-field",onClick:()=>L(!F),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:pe.columnId||"No status"})]}),jsxRuntime.jsx(ao,{triggerRef:st,isOpen:F,onClose:()=>L(false),width:250,estimatedHeight:200,children:(v.length>0?v:pm.map(N=>({id:N,title:N}))).map(N=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${pe.columnId===N.id?"active":""}`,onClick:()=>He(N.id),children:N.title},N.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Nt,children:[jsxRuntime.jsxs("button",{ref:tt,className:"modal-v2-field",onClick:()=>oe(!j),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Ie.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ie.map(N=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:N.color},title:N.name,children:N.initials},N.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ao,{triggerRef:tt,isOpen:j,onClose:()=>oe(false),width:280,estimatedHeight:300,children:s.map(N=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pe.assignedUserIds?.includes(N.id)?"active":""}`,onClick:()=>vt(N.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:N.color},children:N.initials}),N.name,pe.assignedUserIds?.includes(N.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"})})]},N.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:nt,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>E(!R),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:pe.priority||"None"})]}),jsxRuntime.jsxs(ao,{triggerRef:mt,isOpen:R,onClose:()=>E(false),width:180,estimatedHeight:220,children:[cm.map(N=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${N.toLowerCase()} ${pe.priority===N?"active":""}`,onClick:()=>We(N),children:N},N)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>We(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:yt,children:[jsxRuntime.jsxs("button",{ref:Qt,className:"modal-v2-field",onClick:()=>De(!q),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:pe.labels&&pe.labels.length>0?jsxRuntime.jsx("span",{children:pe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(ao,{triggerRef:Qt,isOpen:q,onClose:()=>De(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(N=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pe.labels?.includes(N)?"active":""}`,onClick:()=>J(N),children:[N,pe.labels?.includes(N)&&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"})})]},N))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{te(!M),setTimeout(()=>Wt.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:pe.endDate?new Date(pe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Wt,type:"date",value:typeof pe.endDate=="string"?pe.endDate.split("T")[0]:pe.endDate?(()=>{let N=new Date(pe.endDate),X=N.getUTCFullYear(),me=String(N.getUTCMonth()+1).padStart(2,"0"),Te=String(N.getUTCDate()).padStart(2,"0");return `${X}-${me}-${Te}`})():"",onChange:Q,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Se(!Y),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:pe.estimatedTime?`${pe.estimatedTime}h`:"Not set"})]}),Y&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pe.estimatedTime||"",onChange:N=>ve(N.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Se(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"})]}),C?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:pe.description||"",onChange:N=>{if(h){let X={...h,description:N.target.value};P(X);}},onBlur:we,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>B(true),children:pe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:ge(pe.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"}),T.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[U,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>I(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:[T.map(N=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${N.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>re(N.id),children:N.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:N.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ce(N.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"})]})})]},N.id)),W&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:G,onChange:N=>ae(N.target.value),onKeyDown:N=>{N.key==="Enter"&&be(),N.key==="Escape"&&(I(false),ae(""));},onBlur:be,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${Me==="all"?"active":""}`,onClick:()=>Be("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Me==="comments"?"active":""}`,onClick:()=>Be("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Me==="history"?"active":""}`,onClick:()=>Be("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ht,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:fe,onChange:N=>H(N.target.value),onKeyDown:ke,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:ue,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Ae.map(N=>{let X=s.find(Te=>Te.id===N.userId);if(N.type.includes("COMMENT")){let Te=d.find(Mt=>Mt.id===N.metadata?.commentId);return Te?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[X&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:X.color},children:X.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:X?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(N.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Te.content})]})]},N.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[N.type.includes("CREATED")&&"\u2795",N.type.includes("UPDATED")&&"\u270F\uFE0F",N.type.includes("MOVED")&&"\u27A1\uFE0F",N.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",N.type.includes("ASSIGNED")&&"\u{1F464}",N.type.includes("PRIORITY")&&"\u{1F3AF}",N.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:X?.name||"Unknown"})," ",N.type.replace(/_/g," ").toLowerCase(),N.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:N.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(N.timestamp).toLocaleString()})]})]},N.id)}),Ae.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 xm({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 Jn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(d=>({...d,average:d.average??e.reduce((c,p)=>c+p.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(xm,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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((d,c)=>d+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.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:"#3B82F6"},children:e.reduce((d,c)=>d+(c.planned||0),0)})]})]})]})}function Pm({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 Zn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-d)/s*100:0,n=d<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height: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(Pm,{})}),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:n?"#10B981":"#EF4444",fill:n?"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:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#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:p>=50?"#10B981":"#F59E0B"},children:[p.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:n?"#10B981":"#EF4444"},children:d})]}),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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var $m={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Nl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function zm({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),p=t+d*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Sl({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 Qn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),d=e.map(p=>({...p,totalValue:s,color:p.color||$m[p.name]||Nl[e.indexOf(p)%Nl.length]})),c=d.map(p=>p.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:d,cx:"50%",cy:"50%",labelLine:false,label:o?zm:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Sl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,l=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:d,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(Sl,{})}),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:d.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),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:"#3B82F6"},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((p,n)=>n.value>p.value?n:p).name})]})]})]})}var $o=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[d,c]=react.useState(false),[p,n]=react.useState(false),[m,l]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(k=>k.id),f=k=>{r.onBulkUpdate?.(v,{priority:k}),c(false);},y=k=>{r.onBulkMove?.(v,k),n(false),a();},x=k=>{r.onBulkUpdate?.(v,{assignedUserIds:k}),l(false);},b=k=>{let D=new Set;e.forEach(P=>{P.labels?.forEach(C=>D.add(C));});let h=Array.from(new Set([...D,...k]));r.onBulkUpdate?.(v,{labels:h}),u(false);},g=()=>{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:()=>c(!d),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(k),children:[jsxRuntime.jsx("span",{className:w("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,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"})})]})]})})});$o.displayName="BulkOperationsToolbar";function _m(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,d,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let v=a?.find(f=>f.id===u);d=`assignee-${u}`,c=v?.name||`User ${u}`,p=v?.color,n=v?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(d).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",d=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:s,cardIds:[],color:p}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,p="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:p}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",p="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:p}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function es({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),c=react.useMemo(()=>_m(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{d(m=>{let l=new Set(m);return l.has(n)?l.delete(n):l.add(n),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Xa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:w("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),l=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...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&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Xa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.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 ts=[{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 as({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),c=ts.find(n=>n.value===e)||ts[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:w("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:ts.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:w("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.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:n.label}),e===n.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:n.description})]})]},n.value))})]})]})}var ro=[{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 Km(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&d&&c&&p}function Il(e={}){let{shortcuts:t=ro,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 d=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let l of o.current)if(Km(n,l)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function qm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Xm(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 Jm(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Xm(e),r=t?qm(t):"";return a?`${a} + ${r}`:r}function Zm(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 rs({shortcuts:e=ro,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=Zm(e);return jsxRuntime.jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.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(d).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Jm(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var os=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
6
6
|
1.
|
|
7
7
|
|
|
8
8
|
**Expected behavior:**
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function as({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let l=m.category||"Other";return n[l]||(n[l]=[]),n[l].push(m),n},{});return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:w("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(p).map(([n,m])=>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:n})}),jsxRuntime.jsx("div",{children:m.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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))})]},n)),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 os({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[p,n]=react.useState("json"),[m,l]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Mi(e,p,f);Ai(y,p);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Fi(y),b=y.name.endsWith(".json")?"json":"csv",g=Li(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:w("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:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:w("p-4 rounded-lg border-2 transition-all text-center",p===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:u,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"})]}),d==="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:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.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"})]})]}),m&&jsxRuntime.jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var tu=["URGENT","HIGH","MEDIUM","LOW"],au=[{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"}],ru=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ns({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=react.useState(true),x=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=react.useCallback(h=>{r({by:h.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=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 ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:f?"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"}),D&&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)"]})]}),!f&&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"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,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:h=>{let E=h.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),tu.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let E=h.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let E=h.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:au.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,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:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ru.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ss({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:w("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>p?.()),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 is={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ls={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ds={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"}},lr={dark:is,light:ls,neutral:ds},Lo="dark";var Fo=react.createContext(void 0),uu="asakaa-theme";function Il({children:e,defaultTheme:t=Lo,storageKey:a=uu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=lr[r];Object.entries(p.colors).forEach(([m,l])=>{l&&c.style.setProperty(`--theme-${gu(m)}`,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(([m,l])=>{let i=p.colors[m];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:lr};return jsxRuntime.jsx(Fo.Provider,{value:d,children:e})}function Pr(){let e=react.useContext(Fo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function cs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Pr();return e?jsxRuntime.jsxs("div",{className:w("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(lr).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:w("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:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.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}var Ue={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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"}};function Ll(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ue[e]||Ue.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Ue[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ue[e].bgSecondary),bgGrid:r("--theme-bg-card",Ue[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ue[e].bgWeekend),border:r("--theme-border-primary",Ue[e].border),borderLight:r("--theme-border-subtle",Ue[e].borderLight),textPrimary:r("--theme-text-primary",Ue[e].textPrimary),textSecondary:r("--theme-text-secondary",Ue[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ue[e].textTertiary),accent:r("--theme-accent-primary",Ue[e].accent),accentHover:r("--theme-accent-hover",Ue[e].accentHover),accentLight:r("--theme-accent-primary",Ue[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ue[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ue[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ue[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ue[e].dependency),dependencyHover:r("--theme-border-secondary",Ue[e].dependencyHover),criticalPath:r("--theme-error",Ue[e].criticalPath),criticalPathLight:r("--theme-error",Ue[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ue[e].today):e==="neutral"?r("--theme-text-primary",Ue[e].today):r("--theme-error",Ue[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ue[e].todayLight):e==="neutral"?r("--theme-text-primary",Ue[e].todayLight):r("--theme-error",Ue[e].todayLight),milestone:r("--theme-warning",Ue[e].milestone),milestoneLight:r("--theme-warning",Ue[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ue[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ue[e].statusInProgress),statusCompleted:r("--theme-success",Ue[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ue[e].hoverBg),focusRing:r("--theme-accent-primary",Ue[e].focusRing)}}var Bo={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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},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"}},Fl={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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},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"}},ps={en:Bo,es:Fl};function Bl(e){return ps[e]||ps.en}function ms(e,t){let a=Bl(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 Ar=react.createContext(Bo);function Qr(){return react.useContext(Ar)}function Au({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,p]=react.useState(false),[n,m]=react.useState(null),l=react.useRef(null),i=Qr();if(react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{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:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){m(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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: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:v.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.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:n===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Iu({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 d=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&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:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Lu({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-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[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 Fu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=Qr();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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 left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,m)=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ro({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=Qr(),k=u||v||f||y||x||b,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{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"})}];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(Lu,{options:D,value:t,onChange:E=>a(E),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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(Fu,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||g.toolbar.createTask})]}),(k||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Au,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Iu,{options:h,value:s,onChange:E=>d(E),theme:e})]})]})}function Oo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,d]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();d({x:m.left,y:m.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(Ye,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor: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"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.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:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Ir({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),p({x:f,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m: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: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,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(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(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:l=>{m.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var dt={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"}),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 Yl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:l,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),f=react.useCallback(g=>{let k=[],D=h=>{for(let E of h)k.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&D(E.subtasks);};return D(g),k},[]),y=react.useCallback(()=>{let g=f(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,f]),x=react.useCallback((g,k)=>{let D=f(e);if(D.length===0)return;let h=y();if(!h){a(D[0].id,false);return}let E=D.findIndex(T=>T.id===h.id);if(E===-1)return;let C=g==="up"?E-1:E+1;if(C<0||C>=D.length)return;let R=D[C];a(R.id,k);},[e,y,f,a]),b=react.useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){g.key==="Escape"&&(k.blur(),u.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),R=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(R&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!R.isExpanded||g.key==="ArrowLeft"&&R.isExpanded)&&m(R.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),d(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),p(C));return}if(g.key==="Enter"&&!g.shiftKey&&!E){R&&(g.preventDefault(),r(R.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!E){R&&(g.preventDefault(),r(R.id,"above"));return}if(g.key==="Enter"&&E){R&&(g.preventDefault(),l(R.id));return}if(g.key==="F2"){R&&(g.preventDefault(),n(R.id));return}if(g.key==="Delete"||g.key==="Backspace"&&E){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&E&&!g.shiftKey){C.length>0&&(g.preventDefault(),s(C));return}},[i,t,y,x,r,o,s,d,c,p,n,m,l]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Xl(){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(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=react.useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=react.useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),p=react.useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function Lr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Jl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Jl(a.subtasks,t);if(r)return r}}return null}function fs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=fs(a.subtasks,t);if(r)return r}return null}function bs(e,t){if(t.length===0)return e;let a=Lr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function hs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=fs(a,r);if(!o)continue;let s=fs(a,o.id),d=(n,m,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,m,l);if(v)return v}}return null},c=(n,m,l)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,m,l);return n},p=d(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function ys(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=d.length?false:([d[n],d[m]]=[d[m],d[n]],true)};return s(r,o,a),r}function vs(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 xs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(m=>m.id===r);if(c===-1){for(let m of d)if(m.subtasks&&o(m.subtasks))return true;return false}let p=d[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Zl(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(l=>l.id===t);if(n===-1){for(let l of p)if(l.subtasks&&c(l.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,d),true};return c(r),{tasks:r,newTask:d}}function ks(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ks(r.subtasks,t,a)}:r)}function ws(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ws(a.subtasks,t)}:a)}function Cs(e,t){let a=m=>{for(let l of m){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,p],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:p}}function Ql(e,t,a,r){if(t===a)return e;let o=Jl(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],l=r!==void 0?r:m.length,i=[...m];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function zo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:k,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:E,onTaskReparent:C}){let R=react.useContext(Ar),[T,U]=react.useState(null),[W,A]=react.useState(false),[G,re]=react.useState(null),[be,_]=react.useState(""),Ae=react.useRef(null),Fe=react.useRef(null),[B,L]=react.useState(null),[O,S]=react.useState(0),[Y,ne]=react.useState(0),[Z,Te]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[P,te]=react.useState(null),[X,Ee]=react.useState(null),[Pe,Ve]=react.useState(null),ht=react.useRef(0),Se=5,pt=react.useRef(false),[nt,at]=react.useState(null);react.useEffect(()=>{function F(H){Ae.current&&!Ae.current.contains(H.target)&&A(false);}if(W)return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[W]),react.useEffect(()=>{G&&Fe.current&&(Fe.current.focus(),Fe.current.select());},[G]),react.useEffect(()=>{if(!B)return;let F=J=>{let ce=J.clientX-O,pe=Y+ce;i?.(B,pe);},H=()=>{L(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",F),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[B,O,Y,i]);let{selectedTaskIds:$t,handleTaskClick:mt,isTaskSelected:ut}=Xl(),{setIsEditing:Lt}=Yl({tasks:e,selectedTaskIds:$t,onTaskSelect:(F,H)=>{let ce=Lr(e).map(pe=>pe.id);mt(F,ce,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:F=>{let H=Lr(e).find(J=>J.id===F);H&&Ge(H);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:F=>{let H=Lr(e).find(J=>J.id===F);H&&h&&h(H);},enableKeyboard:true}),Kt=(F,H=0)=>{let J=[];for(let ce of F)J.push({task:ce,level:H}),ce.subtasks&&ce.subtasks.length>0&&ce.isExpanded&&J.push(...Kt(ce.subtasks,H+1));return J},we=Kt(e),$=48,De=F=>!F.startDate||!F.endDate?"-":`${Math.ceil((F.endDate.getTime()-F.startDate.getTime())/(1e3*60*60*24))}d`,Ge=F=>{re(F.id),_(F.name),Lt(true);},We=F=>{be.trim()&&be!==e.find(H=>H.id===F)?.name&&k?.(F,be.trim()),re(null),_(""),Lt(false);},yt=()=>{re(null),_(""),Lt(false);},Q=(F,H)=>{H.stopPropagation(),D?.(F.id);},ae=(F,H)=>{H.preventDefault(),ht.current=H.clientY,te(F),pt.current=false;},xe=F=>{if(!P||(Math.abs(F.clientY-ht.current)>Se&&(pt.current=true),!pt.current))return;let J=document.querySelectorAll("[data-task-row]"),ce=null,pe=null;J.forEach(I=>{let K=I.getBoundingClientRect(),Ne=I.getAttribute("data-task-row");if(Ne&&Ne!==P&&F.clientY>=K.top&&F.clientY<=K.bottom){ce=Ne;let qe=F.clientY-K.top,Pt=K.height;qe<Pt*.25?pe="above":qe>Pt*.75?pe="below":pe="child";}}),Ee(ce),Ve(pe);},fe=()=>{if(pt.current&&P&&X&&Pe){if(Pe==="child")C?.(P,X);else if(Pe==="above"||Pe==="below"){let F=(ce,pe,I=null)=>{for(let K of ce){if(K.id===pe)return I;if(K.subtasks){let Ne=F(K.subtasks,pe,K.id);if(Ne!==void 0)return Ne}}},H=F(e,X,null),J=(ce,pe)=>{let I=ce.findIndex(K=>K.id===pe);return Pe==="below"?I+1:I};if(H===null){let ce=J(e,X);C?.(P,null,ce);}else {let ce=we.find(pe=>pe.task.id===H)?.task;if(ce?.subtasks){let pe=J(ce.subtasks,X);C?.(P,H,pe);}}}}te(null),Ee(null),Ve(null),pt.current=false;};react.useEffect(()=>{if(P)return document.addEventListener("mousemove",xe),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[P,X,Pe]);let oe=(F,H,J)=>{switch(F.id){case "name":let ce=G===H.id,pe=T===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${J*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:pe?1:.3},onMouseDown:me=>ae(H.id,me),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),p?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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"}),!(H.subtasks&&H.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),ce?jsxRuntime.jsx("input",{ref:Fe,type:"text",value:be,onChange:me=>_(me.target.value),onKeyDown:me=>{me.key==="Enter"?We(H.id):me.key==="Escape"&&yt();},onBlur:()=>We(H.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:me=>me.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:H.name}),pe&&!ce&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:me=>Q(H,me),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:me=>{me.stopPropagation(),Ge(H);},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 K=F.id==="startDate"?"startDate":"endDate",Ne=H[K],qe=nt?.taskId===H.id&&nt?.field===K,Pt=me=>me?(typeof me=="string"?new Date(me):me).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:me=>me.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},onClick:me=>{if(qe)at(null);else {let gt=me.currentTarget.getBoundingClientRect();at({taskId:H.id,field:K,month:Ne?typeof Ne=="string"?new Date(Ne):Ne:new Date,position:{top:gt.bottom+4,left:gt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Pt(Ne)})]}),qe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>at(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:nt?.position.top,left:nt?.position.left},onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let me=new Date,gt=new Date(me);gt.setDate(me.getDate()+1);let _t=new Date(me);_t.setDate(me.getDate()+7);let Ga=new Date(me);return Ga.setDate(me.getDate()+14),[{label:"Hoy",date:me},{label:"Ma\xF1ana",date:gt},{label:"Pr\xF3xima semana",date:_t},{label:"2 semanas",date:Ga}].map((vr,Aa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ia=>Ia.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ia=>Ia.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(H.id,{[K]:vr.date}),at(null);},children:vr.label},Aa))})(),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:me=>me.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(H.id,{[K]:void 0}),at(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:()=>at(me=>me?{...me,month:new Date(me.month.getFullYear(),me.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:nt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>at(me=>me?{...me,month:new Date(me.month.getFullYear(),me.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((me,gt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:me},gt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let me=nt?.month||new Date,gt=me.getFullYear(),_t=me.getMonth(),Ga=new Date(gt,_t,1).getDay(),ho=new Date(gt,_t+1,0).getDate(),vr=new Date,Aa=[];for(let Tt=Ga-1;Tt>=0;Tt--)Aa.push({day:new Date(gt,_t,-Tt).getDate(),date:new Date(gt,_t-1,new Date(gt,_t,-Tt).getDate()),isCurrentMonth:false});for(let Tt=1;Tt<=ho;Tt++)Aa.push({day:Tt,date:new Date(gt,_t,Tt),isCurrentMonth:true});let Ia=42-Aa.length;for(let Tt=1;Tt<=Ia;Tt++)Aa.push({day:Tt,date:new Date(gt,_t+1,Tt),isCurrentMonth:false});return Aa.map((Tt,vn)=>{let xn=Tt.date.toDateString()===vr.toDateString(),xr=(Ne?typeof Ne=="string"?new Date(Ne):Ne:null)?.toDateString()===Tt.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:Tt.isCurrentMonth?xr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:xr?"#3B82F6":"transparent",boxShadow:xn&&!xr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(H.id,{[K]:Tt.date}),at(null);},children:Tt.day},vn)})})()})]})]})]}),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:De(H)})});case "assignees":let Ur=r.filter(me=>H.assignees?.some(gt=>gt.name===me.name||gt.initials===me.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(or,{assignedUsers:Ur,availableUsers:r,onChange:me=>{let gt=me.map(_t=>({id:_t.id,name:_t.name,initials:_t.initials,color:_t.color}));u?.(H.id,{assignees:gt.length>0?gt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(Qi,{status:H.status||"todo",onChange:me=>{u?.(H.id,{status:me,progress:me==="completed"?100:H.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});case "priority":let zr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Wa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},yn=zr[H.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(ar,{priority:yn,onChange:me=>{me&&u?.(H.id,{priority:Wa[me]||"medium"});}})});default:return null}},Ce=F=>[{id:"hide",label:"Hide Column",icon:dt.Hide,onClick:()=>l(F),disabled:F==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:dt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:dt.SortDesc,onClick:()=>{}}],he=F=>F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:dt.Add,onClick:()=>{D?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:dt.Delete,onClick:()=>{E?E(F.id,F.name):x?.([F.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:dt.Pencil,onClick:()=>{d?.(F);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:dt.Add,onClick:()=>{D?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:dt.MarkIncomplete,onClick:()=>{u?.(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:dt.SetInProgress,onClick:()=>{u?.(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:dt.MarkComplete,onClick:()=>{u?.(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:dt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:dt.Delete,onClick:()=>{E?E(F.id,F.name):x?.([F.id]);}}],ke=m.filter(F=>F.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${$}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ke.map((F,H)=>{let J=H===ke.length-1,ce=F.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${ce?"":"justify-center"}`,style:{width:`${F.width}px`,minWidth:`${F.minWidth??(ce?200:60)}px`,maxWidth:`${F.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:J?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:pe=>{pe.preventDefault(),Te({isOpen:true,x:pe.clientX,y:pe.clientY,type:"header",columnId:F.id});},onMouseEnter:pe=>{pe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:pe=>{pe.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:ce?"70px":"0"},title:F.label,children:F.label}),ce&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Oo,{columns:m,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>A(!W),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),F.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===F.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:pe=>{pe.preventDefault(),pe.stopPropagation(),L(F.id),S(pe.clientX),ne(F.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"}})})]},F.id)}),W&&jsxRuntime.jsxs("div",{ref:Ae,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:F=>F.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:()=>A(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",children:we.map(({task:F,level:H},J)=>{let ce=ut(F.id),pe=X===F.id,I={};return pe&&Pe&&(Pe==="above"?(I.borderTopWidth="2px",I.borderTopStyle="solid",I.borderTopColor=t.accent):Pe==="below"?(I.borderBottomWidth="2px",I.borderBottomStyle="solid",I.borderBottomColor=t.accent):Pe==="child"&&(I.backgroundColor=t.accentLight,I.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":F.id,className:`flex items-center cursor-pointer group ${P===F.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:ce?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ce||pe&&Pe==="child"?t.accentLight:J%2===0?t.bgPrimary:t.bgGrid,...I},onMouseEnter:()=>U(F.id),onMouseLeave:()=>U(null),onClick:K=>{let qe=Lr(e).map(zr=>zr.id),Ur=navigator.platform.toUpperCase().indexOf("MAC")>=0?K.metaKey:K.ctrlKey;mt(F.id,qe,Ur,K.shiftKey),s?.(F);},onDoubleClick:K=>{K.stopPropagation(),d?.(F);},onContextMenu:K=>{K.preventDefault(),Te({isOpen:true,x:K.clientX,y:K.clientY,type:"task",task:F}),c?.(F,K);},whileHover:{backgroundColor:ce?t.accentLight:t.hoverBg},children:ke.map((K,Ne)=>{let qe=Ne===ke.length-1,Pt=K.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Pt?"justify-start":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.minWidth??(Pt?200:60)}px`,maxWidth:`${K.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:qe?"none":`1px solid ${T===F.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:oe(K,F,Pt?H:0)},`${F.id}-${K.id}`)})},F.id)})}),jsxRuntime.jsx(Ir,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?Ce(Z.columnId):Z.type==="task"&&Z.task?he(Z.task):[],onClose:()=>Te({...Z,isOpen:false}),theme:t})]})}function rd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[p,n]=react.useState(t),[m,l]=react.useState(null),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(0),[k,D]=react.useState(0),[h,E]=react.useState(null),[C,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:E,isHovered:C,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(G,re)=>{r("none"),l(null),u(null),c(G),n(re),D(0),x(null),g(0);}}}function Wo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=rd(t,r),x=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:k,setDragOffset:D,ghostX:h,setGhostX:E,ghostWidth:C,setGhostWidth:R,connectionLine:T,setConnectionLine:U,hoveredTaskId:W,setHoveredTaskId:A,activeZone:G,setActiveZone:re,draggedSegmentIndex:be,setDraggedSegmentIndex:_,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Fe,segmentDragOffsetX:B,setSegmentDragOffsetX:L,hoveredSegmentIndex:O,setHoveredSegmentIndex:S,isHovered:Y,setIsHovered:ne,isDragging:Z,isResizing:Te,isConnecting:P,resetDragState:te}=y,X=32,Ee=8,Pe=e.endDate&&e.endDate<new Date&&e.progress<100,Ve=e.isCriticalPath,ht=o.name==="neutral"||o.today==="#1C1917",Se=e.status==="completed"||e.progress===100,pt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},at=e.isCriticalPath||Pe?"#DC2626":e.color?e.color:e.priority&&pt[e.priority]?pt[e.priority]:o.taskBarPrimary,mt=(oe=>oe>=80?20:oe>=60?15:oe>=50?12:10)(r),ut=r<50,Lt=r<40;react.useEffect(()=>{if(f)if(Y&&!Z&&!e.segments){let oe=a<100;f({task:e,x:t,y:a,width:r,height:X,showBelow:oe});}else f(null);},[Y,Z,e,t,a,r,X,f]);let Kt=oe=>oe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),we=()=>{let oe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${oe} day${oe!==1?"s":""}`},$=oe=>Math.round(oe/s)*s,De=oe=>{let Ce=Math.round(oe/s),he=new Date(d);return he.setDate(he.getDate()+Ce),he},Ge=(oe,Ce)=>{for(let he of u){if(he.id===e.id)continue;let ke=5;if(oe>=he.x-ke&&oe<=he.x+he.width+ke&&Ce>=he.y-ke&&Ce<=he.y+he.height+ke)return he.id}return null},We=react.useCallback((oe,Ce,he)=>{oe.preventDefault(),oe.stopPropagation();let ke=x.current?.ownerSVGElement;if(!ke)return;let F=ke.createSVGPoint();F.x=oe.clientX,F.y=oe.clientY;let H=F.matrixTransform(ke.getScreenCTM()?.inverse()),J=he!==void 0?he:t,ce=Ce;if(!ce){let pe=H.x-J;oe.shiftKey?(ce="connect",U({x:t+r,y:a+X/2})):oe.ctrlKey||oe.metaKey?ce="move":oe.altKey?ce=pe<r/2?"resize-start":"resize-end":Lt?pe<r/2?ce="move":ce="resize-end":ut?pe<=mt/2?ce="resize-start":pe>=r-mt/2?ce="resize-end":ce="move":pe<=mt?ce="resize-start":pe>=r-mt?ce="resize-end":ce="move";}g(ce),ne(false),re(null),ce==="move"?D(H.x-J):ce==="connect"?U({x:t+r,y:a+X/2}):D(0),E(J),R(r);},[t,r,a,X]),yt=react.useCallback(oe=>{if(b==="none")return;let Ce=x.current?.ownerSVGElement;if(!Ce)return;let he=Ce.createSVGPoint();he.x=oe.clientX,he.y=oe.clientY;let ke=he.matrixTransform(Ce.getScreenCTM()?.inverse());if(b==="connect"){U({x:ke.x,y:ke.y});let F=Ge(ke.x,ke.y);A(F);}else if(b==="move"){let F=ke.x-k,H=$(F);E(H),R(r);let J=Math.round((H-t)/s);if(v?.(e.id,J,true),e.segments&&e.segments.length>0&&be!==null){let ce=H-Ae;L(ce);}}else if(b==="resize-start"){let F=ke.x,H=$(F),J=t+r-H;J>=s&&(E(H),R(J));}else if(b==="resize-end"){let F=ke.x,J=$(F)-t;J>=s&&R(J);}},[b,t,r,s,k,e,$,be,Ae,Ge,A,U,E,R,L,v]),Q=react.useCallback(()=>{if(b!=="none"){if(b==="connect")W&&i&&i(e,W),U(null),A(null);else {let oe=e.endDate.getTime()-e.startDate.getTime(),Ce,he,ke=true;if(b==="move"){if(Ce=De(h),he=new Date(Ce.getTime()+oe),e.segments&&e.segments.length>0&&be!==null){let F=Math.round(B/s),H=e.segments.map((I,K)=>{if(K===be){let Ne=new Date(I.startDate),qe=new Date(I.endDate);return Ne.setDate(Ne.getDate()+F),qe.setDate(qe.getDate()+F),{startDate:Ne,endDate:qe}}return I}),J=H.flatMap(I=>[I.startDate,I.endDate]),ce=new Date(Math.min(...J.map(I=>I.getTime()))),pe=new Date(Math.max(...J.map(I=>I.getTime())));l?.({...e,segments:H},ce,pe),te(t,r);return}}else b==="resize-start"?(Ce=De(h),he=e.endDate,Ce>=he&&(console.warn("Invalid date range: start date must be before end date"),ke=false)):b==="resize-end"?(Ce=e.startDate,he=De(h+C),he<=Ce&&(console.warn("Invalid date range: end date must be after start date"),ke=false)):ke=false;ke&&Ce&&he&&(he.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,Ce,he));}v?.(e.id,0,false),te(t,r);}},[b,h,C,e,l,W,i,t,r,s,De,B,be,te,v]);react.useEffect(()=>{if(b==="none")return;let oe=he=>{yt(he);},Ce=()=>{Q();};return window.addEventListener("mousemove",oe),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",Ce);}},[b,yt,Q]);let ae=Z&&!P?h:t,xe=Z&&!P?C:r,fe=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!Z&&ne(true),onMouseLeave:()=>{Z||(ne(false),re(null));},onClick:()=>!Z&&p?.(e),onDoubleClick:oe=>{Z||(oe.stopPropagation(),n?.(e));},onContextMenu:oe=>{oe.preventDefault(),m?.(e,oe);},children:[Y&&!Z&&!ut&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:mt,height:X,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:oe=>We(oe,"resize-start")}),jsxRuntime.jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:X,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:oe=>We(oe,"move")}),jsxRuntime.jsx("rect",{x:t+r-mt,y:a,width:mt,height:X,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:oe=>We(oe,"resize-end")})]}),Y&&!Z&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:X,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:oe=>We(oe,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:X,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:oe=>We(oe,"resize-end")}),Y&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+X-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Z&&!P&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:C,height:X,rx:Ee,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae,y:a,width:xe,height:X,rx:Ee,fill:at,"data-task-class":fe,initial:{opacity:0,scale:.95},animate:{opacity:Z&&!P?.15:e.parentId?.6:Y?.9:.8,scale:Y&&!Z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:oe=>We(oe),style:{cursor:Z?P?"crosshair":Te?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ae,y:a,width:xe*(e.progress/100),height:X,rx:Ee,fill:at,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((oe,Ce)=>{let he=(oe.startDate.getTime()-d.getTime())/864e5*s,F=(oe.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-he+s,H=Z&&b==="move"&&be===Ce,J=O===Ce,ce=H?he+B:he;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Z&&S(Ce),onMouseLeave:()=>!Z&&S(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ce,y:a,width:F,height:X,rx:Ee,fill:at,initial:{opacity:0,scale:.95},animate:{opacity:H||e.parentId?.6:J?.9:.8,scale:J&&!Z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),_(Ce),Fe(he),We(pe,void 0,he);},style:{cursor:Z?P?"crosshair":Te?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ce,y:a,width:F*(e.progress/100),height:X,rx:Ee,fill:at,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),ht&&(Pe||Ve)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ve&&!Pe&&jsxRuntime.jsx("rect",{x:ae,y:a,width:xe,height:X,rx:Ee,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Pe&&jsxRuntime.jsx("rect",{x:ae,y:a,width:xe,height:X,rx:Ee,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),xe>60&&!e.segments&&(()=>{let oe=c.taskLabel(e),Ce=typeof oe=="string"?oe:e.name,he=Ce.length>Math.floor(xe/8)?`${Ce.substring(0,Math.floor(xe/8))}...`:Ce;return jsxRuntime.jsx("text",{x:ae+12,y:a+X/2,dominantBaseline:"middle",fill:Se?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Se?"line-through":"none"},children:he})})(),xe>100&&e.progress>0&&e.progress<100&&!Z&&!e.segments&&jsxRuntime.jsxs("text",{x:ae+xe-12,y:a+X/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&xe>80&&!Z&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ae+xe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ae+xe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Y||Te)&&!P&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ut?ae-15:ae-10,y:a-5,width:ut?25:20,height:X+10,fill:"transparent",onMouseDown:oe=>We(oe,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ut?ae-8:ae-3,y:a+6,width:ut?8:6,height:ut?X-12:X-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ae+xe-10,y:a-5,width:ut?25:20,height:X+10,fill:"transparent",onMouseDown:oe=>We(oe,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ut?ae+xe:ae+xe-3,y:a+6,width:ut?8:6,height:ut?X-12:X-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&!Z&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+X/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:oe=>{oe.stopPropagation(),We(oe,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+X/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),P&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+X/2,x2:T.x,y2:T.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Y||Z)&&!P&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae-2,y:a-2,width:xe+4,height:X+4,rx:Ee+2,fill:"none",stroke:Z?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:Z?.6:.4,initial:{opacity:0},animate:{opacity:Z?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+C,y1:0,x2:h+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&!Z&&!e.segments&&!f&&(()=>{let he=a<100,ke=he?a+X+13:a-82-13,F=he?`M ${ae+xe/2-6} ${a+X+3} L ${ae+xe/2} ${a+X+13} L ${ae+xe/2+6} ${a+X+3}`:`M ${ae+xe/2-6} ${a-13} L ${ae+xe/2} ${a-3} L ${ae+xe/2+6} ${a-13}`,H=ke+22,J=ke+40,ce=ke+55,pe=ke+70,I=he?ke+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:he?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:he?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:F,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ae+xe/2-120,y:ke,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:ae+xe/2,y:H,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:ae+xe/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ae+xe/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Kt(e.startDate)}),jsxRuntime.jsx("text",{x:ae+xe/2-110,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ae+xe/2-70,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Kt(e.endDate)}),jsxRuntime.jsx("text",{x:ae+xe/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ae+xe/2+65,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:we()}),jsxRuntime.jsx("text",{x:ae+xe/2+10,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ae+xe/2+65,y:ce,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:ae+xe/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ae+xe/2-50,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(K=>K.name).join(", ").substring(0,30),e.assignees.map(K=>K.name).join(", ").length>30?"...":""]})]}),!he&&jsxRuntime.jsx("text",{x:ae+xe/2,y:I,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ut?"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 sd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,p=82,n=13,m=c?o+d+n:o-p-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,f=m+70,y=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};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:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/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:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function _o({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,p]=react.useState(false),n=a-e,m=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]);let k=!s&&!d;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeDasharray:"6 4",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?.9:.35,strokeWidth:c?2:1.5,strokeDasharray:c?"0 0":"6 4"},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2},strokeDasharray:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?.9:.35,scale:c?1.1:1,strokeWidth:c?2:1.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:2.5,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.4:1,opacity:c&&d?0:c?.9:.35},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function jo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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:p(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 le={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=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,p=n=>{if(!d.has(n)){d.add(n),c.add(n);let m=r.get(n)||[];for(let l of m){if(!d.has(l)&&p(l))return true;if(c.has(l))return true}}return c.delete(n),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=le.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=le.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=le.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=le.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(`
|
|
46
|
-
`)},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=
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ns({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let l=m.category||"Other";return n[l]||(n[l]=[]),n[l].push(m),n},{});return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:w("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(p).map(([n,m])=>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:n})}),jsxRuntime.jsx("div",{children:m.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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))})]},n)),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 is({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[p,n]=react.useState("json"),[m,l]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Li(e,p,f);Fi(y,p);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Oi(y),b=y.name.endsWith(".json")?"json":"csv",g=Ri(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:w("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:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:w("p-4 rounded-lg border-2 transition-all text-center",p===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:u,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"})]}),d==="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:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.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"})]})]}),m&&jsxRuntime.jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var ru=["URGENT","HIGH","MEDIUM","LOW"],ou=[{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"}],nu=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ls({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=react.useState(true),x=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=react.useCallback(h=>{r({by:h.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=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 ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:f?"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"}),D&&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)"]})]}),!f&&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"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,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:h=>{let P=h.target.value;a({priorities:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ru.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let P=h.target.value;a({assignees:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let P=h.target.value;a({labels:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:ou.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,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:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:nu.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ds({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:w("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>p?.()),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 cs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ps={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ms={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"}},gr={dark:cs,light:ps,neutral:ms},Uo="dark";var Wo=react.createContext(void 0),fu="asakaa-theme";function Bl({children:e,defaultTheme:t=Uo,storageKey:a=fu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=gr[r];Object.entries(p.colors).forEach(([m,l])=>{l&&c.style.setProperty(`--theme-${bu(m)}`,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(([m,l])=>{let i=p.colors[m];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:gr};return jsxRuntime.jsx(Wo.Provider,{value:d,children:e})}function Br(){let e=react.useContext(Wo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function bu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function us({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Br();return e?jsxRuntime.jsxs("div",{className:w("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(gr).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:w("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:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.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}var Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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"}};function Rl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ge[e]||Ge.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Ge[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ge[e].bgSecondary),bgGrid:r("--theme-bg-card",Ge[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ge[e].bgWeekend),border:r("--theme-border-primary",Ge[e].border),borderLight:r("--theme-border-subtle",Ge[e].borderLight),textPrimary:r("--theme-text-primary",Ge[e].textPrimary),textSecondary:r("--theme-text-secondary",Ge[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ge[e].textTertiary),accent:r("--theme-accent-primary",Ge[e].accent),accentHover:r("--theme-accent-hover",Ge[e].accentHover),accentLight:r("--theme-accent-primary",Ge[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ge[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ge[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ge[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ge[e].dependency),dependencyHover:r("--theme-border-secondary",Ge[e].dependencyHover),criticalPath:r("--theme-error",Ge[e].criticalPath),criticalPathLight:r("--theme-error",Ge[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ge[e].today):e==="neutral"?r("--theme-text-primary",Ge[e].today):r("--theme-error",Ge[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ge[e].todayLight):e==="neutral"?r("--theme-text-primary",Ge[e].todayLight):r("--theme-error",Ge[e].todayLight),milestone:r("--theme-warning",Ge[e].milestone),milestoneLight:r("--theme-warning",Ge[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ge[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ge[e].statusInProgress),statusCompleted:r("--theme-success",Ge[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ge[e].hoverBg),focusRing:r("--theme-accent-primary",Ge[e].focusRing)}}var Go={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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},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"}},Ol={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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},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"}},gs={en:Go,es:Ol};function $l(e){return gs[e]||gs.en}function fs(e,t){let a=$l(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 Or=react.createContext(Go);function oo(){return react.useContext(Or)}function Lu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,p]=react.useState(false),[n,m]=react.useState(null),l=react.useRef(null),i=oo();if(react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{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:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){m(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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: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:v.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.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:n===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Fu({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 d=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&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:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Bu({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-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[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 Ru({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=oo();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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 left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,m)=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ho({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=oo(),k=u||v||f||y||x||b,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{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"})}];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(Bu,{options:D,value:t,onChange:P=>a(P),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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(Ru,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||g.toolbar.createTask})]}),(k||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Fu,{options:h,value:s,onChange:P=>d(P),theme:e})]})]})}function _o({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,d]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();d({x:m.left,y:m.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(qe,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor: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"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.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:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function $r({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),p({x:f,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m: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: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,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(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(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:l=>{m.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var ct={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"}),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 Jl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:l,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),f=react.useCallback(g=>{let k=[],D=h=>{for(let P of h)k.push(P),P.subtasks&&P.subtasks.length>0&&P.isExpanded&&D(P.subtasks);};return D(g),k},[]),y=react.useCallback(()=>{let g=f(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,f]),x=react.useCallback((g,k)=>{let D=f(e);if(D.length===0)return;let h=y();if(!h){a(D[0].id,false);return}let P=D.findIndex(T=>T.id===h.id);if(P===-1)return;let C=g==="up"?P-1:P+1;if(C<0||C>=D.length)return;let B=D[C];a(B.id,k);},[e,y,f,a]),b=react.useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){g.key==="Escape"&&(k.blur(),u.current=false);return}let P=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),B=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(B&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!B.isExpanded||g.key==="ArrowLeft"&&B.isExpanded)&&m(B.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),d(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),p(C));return}if(g.key==="Enter"&&!g.shiftKey&&!P){B&&(g.preventDefault(),r(B.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!P){B&&(g.preventDefault(),r(B.id,"above"));return}if(g.key==="Enter"&&P){B&&(g.preventDefault(),l(B.id));return}if(g.key==="F2"){B&&(g.preventDefault(),n(B.id));return}if(g.key==="Delete"||g.key==="Backspace"&&P){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&P&&!g.shiftKey){C.length>0&&(g.preventDefault(),s(C));return}},[i,t,y,x,r,o,s,d,c,p,n,m,l]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Ql(){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(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=react.useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=react.useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),p=react.useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function zr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ed(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ed(a.subtasks,t);if(r)return r}}return null}function ys(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ys(a.subtasks,t);if(r)return r}return null}function vs(e,t){if(t.length===0)return e;let a=zr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function xs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ys(a,r);if(!o)continue;let s=ys(a,o.id),d=(n,m,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,m,l);if(v)return v}}return null},c=(n,m,l)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,m,l);return n},p=d(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function ks(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=d.length?false:([d[n],d[m]]=[d[m],d[n]],true)};return s(r,o,a),r}function ws(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 Cs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(m=>m.id===r);if(c===-1){for(let m of d)if(m.subtasks&&o(m.subtasks))return true;return false}let p=d[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function td(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(l=>l.id===t);if(n===-1){for(let l of p)if(l.subtasks&&c(l.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,d),true};return c(r),{tasks:r,newTask:d}}function Ts(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ts(r.subtasks,t,a)}:r)}function Ds(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ds(a.subtasks,t)}:a)}function Ns(e,t){let a=m=>{for(let l of m){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,p],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:p}}function ad(e,t,a,r){if(t===a)return e;let o=ed(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],l=r!==void 0?r:m.length,i=[...m];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function Ko({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:k,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:P,onTaskReparent:C}){let B=react.useContext(Or),[T,$]=react.useState(null),[W,I]=react.useState(false),[G,ae]=react.useState(null),[fe,H]=react.useState(""),Me=react.useRef(null),Be=react.useRef(null),[F,L]=react.useState(null),[R,E]=react.useState(0),[j,oe]=react.useState(0),[q,De]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[M,te]=react.useState(null),[Y,Se]=react.useState(null),[Ee,je]=react.useState(null),ht=react.useRef(0),Ne=5,nt=react.useRef(false),[Nt,yt]=react.useState(null),[Wt,st]=react.useState(false),[tt,mt]=react.useState(null);react.useEffect(()=>{function U(N){Me.current&&!Me.current.contains(N.target)&&I(false);}if(W)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[W]),react.useEffect(()=>{G&&Be.current&&(Be.current.focus(),Be.current.select());},[G]),react.useEffect(()=>{if(!F)return;let U=X=>{let me=X.clientX-R,Te=j+me;i?.(F,Te);},N=()=>{L(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",N),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",N),document.body.style.cursor="",document.body.style.userSelect="";}},[F,R,j,i]);let{selectedTaskIds:Qt,handleTaskClick:xe,isTaskSelected:O}=Ql(),{setIsEditing:we}=Jl({tasks:e,selectedTaskIds:Qt,onTaskSelect:(U,N)=>{let me=zr(e).map(Te=>Te.id);xe(U,me,N||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:U=>{let N=zr(e).find(X=>X.id===U);N&&Q(N);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:U=>{let N=zr(e).find(X=>X.id===U);N&&h&&h(N);},enableKeyboard:true}),He=(U,N=0)=>{let X=[];for(let me of U)X.push({task:me,level:N}),me.subtasks&&me.subtasks.length>0&&me.isExpanded&&X.push(...He(me.subtasks,N+1));return X},We=He(e),vt=48,J=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Q=U=>{ae(U.id),H(U.name),we(true);},ve=U=>{fe.trim()&&fe!==e.find(N=>N.id===U)?.name&&k?.(U,fe.trim()),ae(null),H(""),we(false);},be=()=>{ae(null),H(""),we(false);},re=(U,N)=>{N.stopPropagation(),D?.(U.id);},Ce=(U,N)=>{N.preventDefault(),ht.current=N.clientY,te(U),nt.current=false,st(false),yt({x:N.clientX,y:N.clientY});},ue=U=>{if(!M||(Math.abs(U.clientY-ht.current)>Ne&&!nt.current&&(nt.current=true,st(true)),yt({x:U.clientX,y:U.clientY}),!nt.current))return;let X=document.querySelectorAll("[data-task-row]"),me=null,Te=null;X.forEach(Mt=>{let St=Mt.getBoundingClientRect(),At=Mt.getAttribute("data-task-row");if(At&&At!==M&&U.clientY>=St.top&&U.clientY<=St.bottom){me=At;let Xt=U.clientY-St.top,ut=St.height;Xt<ut*.25?Te="above":Xt>ut*.75?Te="below":Te="child";}}),Se(me),je(Te);},ke=()=>{if(nt.current&&M&&Y&&Ee){if(Ee==="child")C?.(M,Y);else if(Ee==="above"||Ee==="below"){let U=(me,Te,Mt=null)=>{for(let St of me){if(St.id===Te)return Mt;if(St.subtasks){let At=U(St.subtasks,Te,St.id);if(At!==void 0)return At}}},N=U(e,Y,null),X=(me,Te)=>{let Mt=me.findIndex(St=>St.id===Te);return Ee==="below"?Mt+1:Mt};if(N===null){let me=X(e,Y);C?.(M,null,me);}else {let me=We.find(Te=>Te.task.id===N)?.task;if(me?.subtasks){let Te=X(me.subtasks,Y);C?.(M,N,Te);}}}}te(null),Se(null),je(null),yt(null),nt.current=false,st(false);};react.useEffect(()=>{if(M)return document.addEventListener("mousemove",ue),document.addEventListener("mouseup",ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",ke),document.body.style.cursor="",document.body.style.userSelect="";}},[M,Y,Ee]);let ge=(U,N,X)=>{switch(U.id){case "name":let me=G===N.id,Te=T===N.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${X*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:Te?1:.3},onMouseDown:le=>Ce(N.id,le),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),N.subtasks&&N.subtasks.length>0?jsxRuntime.jsx("button",{onClick:le=>{le.stopPropagation(),p?.(N.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:N.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"}),!(N.subtasks&&N.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:N.color||"#3B82F6",opacity:N.parentId?.6:1,borderColor:N.isMilestone?t.accent:"transparent",borderWidth:N.isMilestone?"2px":"0px"},title:N.isMilestone?"Milestone":N.parentId?"Subtask":"Task"}),me?jsxRuntime.jsx("input",{ref:Be,type:"text",value:fe,onChange:le=>H(le.target.value),onKeyDown:le=>{le.key==="Enter"?ve(N.id):le.key==="Escape"&&be();},onBlur:()=>ve(N.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:le=>le.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:N.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:N.parentId?"13px":"14px",fontWeight:N.isMilestone?600:N.parentId?400:600,letterSpacing:N.parentId?"0":"-0.01em"},title:N.name,children:N.name}),Te&&!me&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:le=>le.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:le=>re(N,le),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:le=>{le.stopPropagation(),Q(N);},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 St=U.id==="startDate"?"startDate":"endDate",At=N[St],Xt=tt?.taskId===N.id&&tt?.field===St,ut=le=>le?(typeof le=="string"?new Date(le):le).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:le=>le.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},onClick:le=>{if(Xt)mt(null);else {let gt=le.currentTarget.getBoundingClientRect();mt({taskId:N.id,field:St,month:At?typeof At=="string"?new Date(At):At:new Date,position:{top:gt.bottom+4,left:gt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ut(At)})]}),Xt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>mt(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:tt?.position.top,left:tt?.position.left},onClick:le=>le.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let le=new Date,gt=new Date(le);gt.setDate(le.getDate()+1);let Kt=new Date(le);Kt.setDate(le.getDate()+7);let Va=new Date(le);return Va.setDate(le.getDate()+14),[{label:"Hoy",date:le},{label:"Ma\xF1ana",date:gt},{label:"Pr\xF3xima semana",date:Kt},{label:"2 semanas",date:Va}].map((Nr,Ba)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ja=>ja.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ja=>ja.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(N.id,{[St]:Nr.date}),mt(null);},children:Nr.label},Ba))})(),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:le=>le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(N.id,{[St]:void 0}),mt(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:()=>mt(le=>le?{...le,month:new Date(le.month.getFullYear(),le.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:tt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>mt(le=>le?{...le,month:new Date(le.month.getFullYear(),le.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((le,gt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:le},gt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let le=tt?.month||new Date,gt=le.getFullYear(),Kt=le.getMonth(),Va=new Date(gt,Kt,1).getDay(),wo=new Date(gt,Kt+1,0).getDate(),Nr=new Date,Ba=[];for(let xt=Va-1;xt>=0;xt--)Ba.push({day:new Date(gt,Kt,-xt).getDate(),date:new Date(gt,Kt-1,new Date(gt,Kt,-xt).getDate()),isCurrentMonth:false});for(let xt=1;xt<=wo;xt++)Ba.push({day:xt,date:new Date(gt,Kt,xt),isCurrentMonth:true});let ja=42-Ba.length;for(let xt=1;xt<=ja;xt++)Ba.push({day:xt,date:new Date(gt,Kt+1,xt),isCurrentMonth:false});return Ba.map((xt,Co)=>{let To=xt.date.toDateString()===Nr.toDateString(),Vr=(At?typeof At=="string"?new Date(At):At: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?Vr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Vr?"#3B82F6":"transparent",boxShadow:To&&!Vr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(N.id,{[St]:xt.date}),mt(null);},children:xt.day},Co)})})()})]})]})]}),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:J(N)})});case "assignees":let Dr=r.filter(le=>N.assignees?.some(gt=>gt.name===le.name||gt.initials===le.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(cr,{assignedUsers:Dr,availableUsers:r,onChange:le=>{let gt=le.map(Kt=>({id:Kt.id,name:Kt.name,initials:Kt.initials,color:Kt.color}));u?.(N.id,{assignees:gt.length>0?gt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(al,{status:N.status||"todo",onChange:le=>{u?.(N.id,{status:le,progress:le==="completed"?100:N.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${N.progress}%`,backgroundColor:N.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:[N.progress,"%"]})]});case "priority":let or={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},_a={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},nr=or[N.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(lr,{priority:nr,onChange:le=>{le&&u?.(N.id,{priority:_a[le]||"medium"});}})});default:return null}},Ae=U=>[{id:"hide",label:"Hide Column",icon:ct.Hide,onClick:()=>l(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ct.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ct.SortDesc,onClick:()=>{}}],pe=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:ct.Add,onClick:()=>{D?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:ct.Delete,onClick:()=>{P?P(U.id,U.name):x?.([U.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:ct.Pencil,onClick:()=>{d?.(U);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:ct.Add,onClick:()=>{D?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ct.MarkIncomplete,onClick:()=>{u?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:ct.SetInProgress,onClick:()=>{u?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:ct.MarkComplete,onClick:()=>{u?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:ct.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:ct.Delete,onClick:()=>{P?P(U.id,U.name):x?.([U.id]);}}],Ie=m.filter(U=>U.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${vt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Ie.map((U,N)=>{let X=N===Ie.length-1,me=U.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${me?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(me?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:X?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Te=>{Te.preventDefault(),De({isOpen:true,x:Te.clientX,y:Te.clientY,type:"header",columnId:U.id});},onMouseEnter:Te=>{Te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Te=>{Te.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:me?"70px":"0"},title:U.label,children:U.label}),me&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(_o,{columns:m,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>I(!W),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),U.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:F===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Te=>{Te.preventDefault(),Te.stopPropagation(),L(U.id),E(Te.clientX),oe(U.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"}})})]},U.id)}),W&&jsxRuntime.jsxs("div",{ref:Me,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:U=>U.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:()=>I(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",children:We.map(({task:U,level:N},X)=>{let me=O(U.id),Te=Y===U.id,Mt=Te&&Ee==="above",St=Te&&Ee==="below",At=Te&&Ee==="child",Xt={};return At&&(Xt.backgroundColor=`${t.accent}15`,Xt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${M===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:me?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:me?t.accentLight:At?`${t.accent}15`:X%2===0?t.bgPrimary:t.bgGrid,...Xt},onMouseEnter:()=>$(U.id),onMouseLeave:()=>$(null),onClick:ut=>{let or=zr(e).map(le=>le.id),nr=navigator.platform.toUpperCase().indexOf("MAC")>=0?ut.metaKey:ut.ctrlKey;xe(U.id,or,nr,ut.shiftKey),s?.(U);},onDoubleClick:ut=>{ut.stopPropagation(),d?.(U);},onContextMenu:ut=>{ut.preventDefault(),De({isOpen:true,x:ut.clientX,y:ut.clientY,type:"task",task:U}),c?.(U,ut);},whileHover:{backgroundColor:me?t.accentLight:t.hoverBg},children:[Mt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:-1,left:0,right:0,height:"3px",backgroundColor:t.accent,zIndex:10,borderRadius:"2px",boxShadow:`0 0 8px ${t.accent}80`},children:jsxRuntime.jsx("div",{style:{position:"absolute",left:8,top:"50%",transform:"translateY(-50%)",width:8,height:8,borderRadius:"50%",backgroundColor:t.accent,border:`2px solid ${t.bgPrimary}`,boxShadow:`0 0 4px ${t.accent}`}})}),St&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:-1,left:0,right:0,height:"3px",backgroundColor:t.accent,zIndex:10,borderRadius:"2px",boxShadow:`0 0 8px ${t.accent}80`},children:jsxRuntime.jsx("div",{style:{position:"absolute",left:8,top:"50%",transform:"translateY(-50%)",width:8,height:8,borderRadius:"50%",backgroundColor:t.accent,border:`2px solid ${t.bgPrimary}`,boxShadow:`0 0 4px ${t.accent}`}})}),Ie.map((ut,Dr)=>{let or=Dr===Ie.length-1,_a=ut.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${_a?"justify-start":"justify-center"}`,style:{width:`${ut.width}px`,minWidth:`${ut.minWidth??(_a?200:60)}px`,maxWidth:`${ut.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:or?"none":`1px solid ${T===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ge(ut,U,_a?N:0)},`${U.id}-${ut.id}`)})]},U.id)})}),jsxRuntime.jsx($r,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ae(q.columnId):q.type==="task"&&q.task?pe(q.task):[],onClose:()=>De({...q,isOpen:false}),theme:t}),Wt&&Nt&&M&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Nt.x+15,top:Nt.y-a/2,zIndex:99999,pointerEvents:"none",opacity:.85,transform:"scale(0.98)",cursor:"grabbing"},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg shadow-2xl",style:{backgroundColor:t.bgPrimary,border:`2px solid ${t.accent}`,minWidth:"200px",maxWidth:"350px",height:`${a-8}px`,boxShadow:`0 10px 40px rgba(0,0,0,0.4), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4 flex-shrink-0",style:{color:t.accent}}),(()=>{let U=We.find(N=>N.task.id===M)?.task;return U?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:U.color||"#3B82F6"}}),jsxRuntime.jsx("span",{className:"text-sm font-medium truncate",style:{color:t.textPrimary},children:U.name})]}):null})()]})}),document.body)]})}function id(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[p,n]=react.useState(t),[m,l]=react.useState(null),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(0),[k,D]=react.useState(0),[h,P]=react.useState(null),[C,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:P,isHovered:C,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(G,ae)=>{r("none"),l(null),u(null),c(G),n(ae),D(0),x(null),g(0);}}}function Yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=id(t,r),x=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:k,setDragOffset:D,ghostX:h,setGhostX:P,ghostWidth:C,setGhostWidth:B,connectionLine:T,setConnectionLine:$,hoveredTaskId:W,setHoveredTaskId:I,activeZone:G,setActiveZone:ae,draggedSegmentIndex:fe,setDraggedSegmentIndex:H,draggedSegmentStartX:Me,setDraggedSegmentStartX:Be,segmentDragOffsetX:F,setSegmentDragOffsetX:L,hoveredSegmentIndex:R,setHoveredSegmentIndex:E,isHovered:j,setIsHovered:oe,isDragging:q,isResizing:De,isConnecting:M,resetDragState:te}=y,Y=32,Se=8,Ee=e.endDate&&e.endDate<new Date&&e.progress<100,je=e.isCriticalPath,ht=o.name==="neutral"||o.today==="#1C1917",Ne=e.status==="completed"||e.progress===100,nt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},yt=e.isCriticalPath||Ee?"#DC2626":e.color?e.color:e.priority&&nt[e.priority]?nt[e.priority]:o.taskBarPrimary,st=(re=>re>=80?20:re>=60?15:re>=50?12:10)(r),tt=r<50,mt=r<40;react.useEffect(()=>{if(f)if(j&&!q&&!e.segments){let re=a<100;f({task:e,x:t,y:a,width:r,height:Y,showBelow:re});}else f(null);},[j,q,e,t,a,r,Y,f]);let Qt=re=>re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),xe=()=>{let re=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${re} day${re!==1?"s":""}`},O=re=>Math.round(re/s)*s,we=re=>{let Ce=Math.round(re/s),ue=new Date(d);return ue.setDate(ue.getDate()+Ce),ue},He=(re,Ce)=>{for(let ue of u){if(ue.id===e.id)continue;let ke=5;if(re>=ue.x-ke&&re<=ue.x+ue.width+ke&&Ce>=ue.y-ke&&Ce<=ue.y+ue.height+ke)return ue.id}return null},We=react.useCallback((re,Ce,ue)=>{re.preventDefault(),re.stopPropagation();let ke=x.current?.ownerSVGElement;if(!ke)return;let ge=ke.createSVGPoint();ge.x=re.clientX,ge.y=re.clientY;let Ae=ge.matrixTransform(ke.getScreenCTM()?.inverse()),pe=ue!==void 0?ue:t,Ie=Ce;if(!Ie){let U=Ae.x-pe;re.shiftKey?(Ie="connect",$({x:t+r,y:a+Y/2})):re.ctrlKey||re.metaKey?Ie="move":re.altKey?Ie=U<r/2?"resize-start":"resize-end":mt?U<r/2?Ie="move":Ie="resize-end":tt?U<=st/2?Ie="resize-start":U>=r-st/2?Ie="resize-end":Ie="move":U<=st?Ie="resize-start":U>=r-st?Ie="resize-end":Ie="move";}g(Ie),oe(false),ae(null),Ie==="move"?D(Ae.x-pe):Ie==="connect"?$({x:t+r,y:a+Y/2}):D(0),P(pe),B(r);},[t,r,a,Y]),vt=react.useCallback(re=>{if(b==="none")return;let Ce=x.current?.ownerSVGElement;if(!Ce)return;let ue=Ce.createSVGPoint();ue.x=re.clientX,ue.y=re.clientY;let ke=ue.matrixTransform(Ce.getScreenCTM()?.inverse());if(b==="connect"){$({x:ke.x,y:ke.y});let ge=He(ke.x,ke.y);I(ge);}else if(b==="move"){let ge=ke.x-k,Ae=O(ge);P(Ae),B(r);let pe=Math.round((Ae-t)/s);if(v?.(e.id,pe,true),e.segments&&e.segments.length>0&&fe!==null){let Ie=Ae-Me;L(Ie);}}else if(b==="resize-start"){let ge=ke.x,Ae=O(ge),pe=t+r-Ae;pe>=s&&(P(Ae),B(pe));}else if(b==="resize-end"){let ge=ke.x,pe=O(ge)-t;pe>=s&&B(pe);}},[b,t,r,s,k,e,O,fe,Me,He,I,$,P,B,L,v]),J=react.useCallback(()=>{if(b!=="none"){if(b==="connect")W&&i&&i(e,W),$(null),I(null);else {let re=e.endDate.getTime()-e.startDate.getTime(),Ce,ue,ke=true;if(b==="move"){if(Ce=we(h),ue=new Date(Ce.getTime()+re),e.segments&&e.segments.length>0&&fe!==null){let ge=Math.round(F/s),Ae=e.segments.map((N,X)=>{if(X===fe){let me=new Date(N.startDate),Te=new Date(N.endDate);return me.setDate(me.getDate()+ge),Te.setDate(Te.getDate()+ge),{startDate:me,endDate:Te}}return N}),pe=Ae.flatMap(N=>[N.startDate,N.endDate]),Ie=new Date(Math.min(...pe.map(N=>N.getTime()))),U=new Date(Math.max(...pe.map(N=>N.getTime())));l?.({...e,segments:Ae},Ie,U),te(t,r);return}}else b==="resize-start"?(Ce=we(h),ue=e.endDate,Ce>=ue&&(console.warn("Invalid date range: start date must be before end date"),ke=false)):b==="resize-end"?(Ce=e.startDate,ue=we(h+C),ue<=Ce&&(console.warn("Invalid date range: end date must be after start date"),ke=false)):ke=false;ke&&Ce&&ue&&(ue.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,Ce,ue));}v?.(e.id,0,false),te(t,r);}},[b,h,C,e,l,W,i,t,r,s,we,F,fe,te,v]);react.useEffect(()=>{if(b==="none")return;let re=ue=>{vt(ue);},Ce=()=>{J();};return window.addEventListener("mousemove",re),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Ce);}},[b,vt,J]);let Q=q&&!M?h:t,ve=q&&!M?C:r,be=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!q&&oe(true),onMouseLeave:()=>{q||(oe(false),ae(null));},onClick:()=>!q&&p?.(e),onDoubleClick:re=>{q||(re.stopPropagation(),n?.(e));},onContextMenu:re=>{re.preventDefault(),m?.(e,re);},children:[j&&!q&&!tt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:st,height:Y,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ae("resize-start"),onMouseDown:re=>We(re,"resize-start")}),jsxRuntime.jsx("rect",{x:t+st,y:a,width:r-st*2,height:Y,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ae("move"),onMouseDown:re=>We(re,"move")}),jsxRuntime.jsx("rect",{x:t+r-st,y:a,width:st,height:Y,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ae("resize-end"),onMouseDown:re=>We(re,"resize-end")})]}),j&&!q&&mt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Y,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ae("move"),onMouseDown:re=>We(re,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Y,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ae("resize-end"),onMouseDown:re=>We(re,"resize-end")}),j&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Y-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),q&&!M&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:C,height:Y,rx:Se,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q,y:a,width:ve,height:Y,rx:Se,fill:yt,"data-task-class":be,initial:{opacity:0,scale:.95},animate:{opacity:q&&!M?.15:e.parentId?.6:j?.9:.8,scale:j&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>We(re),style:{cursor:q?M?"crosshair":De?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve*(e.progress/100),height:Y,rx:Se,fill:yt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((re,Ce)=>{let ue=(re.startDate.getTime()-d.getTime())/864e5*s,ge=(re.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-ue+s,Ae=q&&b==="move"&&fe===Ce,pe=R===Ce,Ie=Ae?ue+F:ue;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!q&&E(Ce),onMouseLeave:()=>!q&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie,y:a,width:ge,height:Y,rx:Se,fill:yt,initial:{opacity:0,scale:.95},animate:{opacity:Ae||e.parentId?.6:pe?.9:.8,scale:pe&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U=>{U.stopPropagation(),H(Ce),Be(ue),We(U,void 0,ue);},style:{cursor:q?M?"crosshair":De?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ie,y:a,width:ge*(e.progress/100),height:Y,rx:Se,fill:yt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),ht&&(Ee||je)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[je&&!Ee&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve,height:Y,rx:Se,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ee&&jsxRuntime.jsx("rect",{x:Q,y:a,width:ve,height:Y,rx:Se,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ve>60&&!e.segments&&(()=>{let re=c.taskLabel(e),Ce=typeof re=="string"?re:e.name,ue=Ce.length>Math.floor(ve/8)?`${Ce.substring(0,Math.floor(ve/8))}...`:Ce;return jsxRuntime.jsx("text",{x:Q+12,y:a+Y/2,dominantBaseline:"middle",fill:Ne?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ne?"line-through":"none"},children:ue})})(),ve>100&&e.progress>0&&e.progress<100&&!q&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+ve-12,y:a+Y/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ve>80&&!q&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+ve-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+ve-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(j||De)&&!M&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:tt?Q-15:Q-10,y:a-5,width:tt?25:20,height:Y+10,fill:"transparent",onMouseDown:re=>We(re,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?Q-8:Q-3,y:a+6,width:tt?8:6,height:tt?Y-12:Y-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Q+ve-10,y:a-5,width:tt?25:20,height:Y+10,fill:"transparent",onMouseDown:re=>We(re,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?Q+ve:Q+ve-3,y:a+6,width:tt?8:6,height:tt?Y-12:Y-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&!q&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+Y/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:re=>{re.stopPropagation(),We(re,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+Y/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),M&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Y/2,x2:T.x,y2:T.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(j||q)&&!M&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:ve+4,height:Y+4,rx:Se+2,fill:"none",stroke:q?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:q?.6:.4,initial:{opacity:0},animate:{opacity:q?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),De&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+C,y1:0,x2:h+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&!q&&!e.segments&&!f&&(()=>{let ue=a<100,ke=ue?a+Y+13:a-82-13,ge=ue?`M ${Q+ve/2-6} ${a+Y+3} L ${Q+ve/2} ${a+Y+13} L ${Q+ve/2+6} ${a+Y+3}`:`M ${Q+ve/2-6} ${a-13} L ${Q+ve/2} ${a-3} L ${Q+ve/2+6} ${a-13}`,Ae=ke+22,pe=ke+40,Ie=ke+55,U=ke+70,N=ue?ke+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ue?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ue?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ge,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+ve/2-120,y:ke,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:Q+ve/2,y:Ae,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:Q+ve/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+ve/2-70,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.startDate)}),jsxRuntime.jsx("text",{x:Q+ve/2-110,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+ve/2-70,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.endDate)}),jsxRuntime.jsx("text",{x:Q+ve/2+10,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+ve/2+65,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xe()}),jsxRuntime.jsx("text",{x:Q+ve/2+10,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+ve/2+65,y:Ie,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:Q+ve/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+ve/2-50,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(X=>X.name).join(", ").substring(0,30),e.assignees.map(X=>X.name).join(", ").length>30?"...":""]})]}),!ue&&jsxRuntime.jsx("text",{x:Q+ve/2,y:N,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:mt?"Left: move \u2022 Right: resize":tt?"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 cd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,p=82,n=13,m=c?o+d+n:o-p-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,f=m+70,y=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};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:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/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:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Jo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,p]=react.useState(false),n=a-e,m=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]);let k=!s&&!d;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeDasharray:"6 4",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?.9:.35,strokeWidth:c?2:1.5,strokeDasharray:c?"0 0":"6 4"},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2},strokeDasharray:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?.9:.35,scale:c?1.1:1,strokeWidth:c?2:1.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:2.5,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.4:1,opacity:c&&d?0:c?.9:.35},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Qo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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:p(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 se={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=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,p=n=>{if(!d.has(n)){d.add(n),c.add(n);let m=r.get(n)||[];for(let l of m){if(!d.has(l)&&p(l))return true;if(c.has(l))return true}}return c.delete(n),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=se.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=se.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(`
|
|
46
|
+
`)},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=se.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=se.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)=>se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=se.findTaskById(e,t);return !a||!a.dependencies?[]:se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>se.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=se.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=>se.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=se.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 d=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(p=>{let n=p.startDate&&p.endDate?se.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?se.formatDate(p.startDate):"N/A",p.endDate?se.formatDate(p.endDate):"N/A",n>0?`${n} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:d,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=se.flattenTasks(e).map(p=>{let n=p.startDate&&p.endDate?se.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?se.formatDate(p.startDate):"","End Date":p.endDate?se.formatDate(p.endDate):"","Duration (days)":n>0?n:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(m=>m.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),s=a.utils.json_to_sheet(o),d=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=d;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=se.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),d=se.getEarliestStartDate(e)||new Date,c=se.getLatestEndDate(e)||new Date,p=r.map((i,u)=>{let v=o.get(i.id),f=i.startDate&&i.endDate?se.calculateDuration(i.startDate,i.endDate):0,y=(i.dependencies||[]).filter(x=>o.has(x)).map(x=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${o.get(x)}</PredecessorUID>
|
|
49
49
|
<Type>1</Type>
|
|
@@ -273,9 +273,9 @@
|
|
|
273
273
|
</Calendars>
|
|
274
274
|
<Tasks>${p}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(m),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=le.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?le.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+m;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let m=n.startDate&&n.endDate?le.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-m;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),l=d.get(n.id);if(m&&l){let i=l.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=le.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(le.calculateCriticalPath(e).includes(t))return 0;let o=le.getDependentTasks(e,t);if(o.length===0){let c=le.getLatestEndDate(e);if(!c)return null;let p=le.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let d=le.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>le.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=le.findTaskById(e,t);if(!r||!r.endDate)return e;let o=le.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=le.calculateDuration(d.startDate,d.endDate),p;a!==void 0?(p=new Date(d.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=le.calculateEndDate(p,c),m=l=>l.map(i=>i.id===d.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=le.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,l=le.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=le.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex(U=>U.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/m,E=(g-n)/m*s,C=E+v*s,R=Math.max(D*s,s),T=c+b*d+12;p.push({taskId:x.id,taskName:x.name,originalX:E,previewX:C,width:R,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=le.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 d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=m=>m.map(l=>l.id===o.id?{...l,endDate:c,segments:p}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Yo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,k]=react.useState(null),D=react.useCallback(B=>{b(B);},[]),h=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),E=r==="day"?60:r==="week"?20:8,C=h*E*d,R=B=>{let L=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),O=L.getUTCDay()||7;L.setUTCDate(L.getUTCDate()+4-O);let S=new Date(Date.UTC(L.getUTCFullYear(),0,1));return Math.ceil(((L.getTime()-S.getTime())/864e5+1)/7)},T=B=>{let L=B.getDay();return L===0||L===6},U=react.useCallback(B=>{let L=Math.round(B/(E*d)),O=new Date(o);return O.setDate(O.getDate()+L),O},[o,E,d]),W=react.useCallback((B,L)=>{if(L.startDate&&L.endDate)return;let O=B.currentTarget.ownerSVGElement;if(!O)return;let S=O.createSVGPoint();S.x=B.clientX,S.y=B.clientY;let Y=S.matrixTransform(O.getScreenCTM()?.inverse()),ne=U(Y.x),Z=new Date(ne);Z.setDate(Z.getDate()+1),l?.(L,ne,Z);},[U,l]),A=react.useMemo(()=>{let B=Y=>Y.map(ne=>{if(ne.subtasks&&ne.subtasks.length>0){let Z=B(ne.subtasks),Te=Z.filter(P=>P.startDate&&P.endDate);if(Te.length>0){let P=Te.map(Pe=>Pe.startDate.getTime()),te=Te.map(Pe=>Pe.endDate.getTime()),X=new Date(Math.min(...P)),Ee=new Date(Math.max(...te));return {...ne,subtasks:Z,startDate:X,endDate:Ee}}return {...ne,subtasks:Z}}return ne}),L=(Y,ne=[])=>{for(let Z of Y)ne.push(Z),Z.subtasks&&Z.subtasks.length>0&&(Z.isExpanded===void 0||Z.isExpanded)&&L(Z.subtasks,ne);return ne},O=B(e);return L(O)},[e]),G=react.useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let L=B.startDate.getTime(),O=B.endDate.getTime(),S=o.getTime(),Y=(L-S)/(1e3*60*60*24),ne=(O-L)/(1e3*60*60*24),Z=Y*E*d,Te=Math.max(E*d,40),P=Math.max(ne*E*d,Te);return {x:Z,width:P}},[o,E,d]),re=react.useMemo(()=>A.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:L,width:O}=G(B),Y=A.findIndex(ne=>ne.id===B.id)*a+12;return {id:B.id,x:L,y:Y,width:O,height:32}}),[A,G]),be=react.useCallback((B,L,O)=>{if(!O||L===0){y([]);return}let S=le.calculateCascadePreview(e,B,L,A,o,E*d,a,48);y(S);},[e,A,o,E,d,a,48]),_=react.useMemo(()=>{let B=[],L=new Date(o);for(;L<=s;){let Y=(L.getTime()-o.getTime())/864e5*E*d;if(r==="day")B.push({date:new Date(L),label:L.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),L.setDate(L.getDate()+1);else if(r==="week"){let ne=R(L);B.push({date:new Date(L),label:`Week ${ne}`,x:Y}),L.setDate(L.getDate()+7);}else B.push({date:new Date(L),label:L.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),L.setMonth(L.getMonth()+1);}return B},[o,s,r,E,d]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*E*d,[o,E,d]),Fe=Math.max(A.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(C,1e3),height:48,fill:t.bgGrid}),_.map((B,L)=>jsxRuntime.jsxs("g",{children:[L>0&&jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:B.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${L}`)),Ae>=0&&Ae<=C&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:Fe,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(C,1e3),height:Fe,fill:t.bgPrimary}),_.map((B,L)=>{let O=_[L+1]?.x||C,S=T(B.date);return jsxRuntime.jsxs("g",{children:[S&&jsxRuntime.jsx("rect",{x:B.x,y:0,width:O-B.x,height:A.length*a,fill:t.bgWeekend,opacity:1}),L>0&&jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:A.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},L)}),Ae>=0&&Ae<=C&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:A.length*a,stroke:t.today,strokeWidth:2,opacity:1}),A.map((B,L)=>{let O=B.startDate&&B.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:C,height:a,fill:L%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${B.id}`),!O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:C,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:S=>W(S,B),onMouseEnter:S=>{S.currentTarget.setAttribute("fill",t.accentLight),S.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:S=>{S.currentTarget.setAttribute("fill","transparent"),S.currentTarget.setAttribute("opacity","1");}},`clickable-${B.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae:100,y:L*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${B.id}`)]})]},`row-group-${B.id}`)}),A.map((B,L)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(O=>{let S=A.find(Te=>Te.id===O);if(!S||!S.startDate||!S.endDate)return null;let Y=A.findIndex(Te=>Te.id===O),ne=G(S),Z=G(B);return jsxRuntime.jsx(_o,{x1:ne.x+ne.width,y1:Y*a+a/2,x2:Z.x,y2:L*a+a/2,theme:t},`dep-${O}-${B.id}`)})),A.map((B,L)=>{if(!B.startDate||!B.endDate)return null;let{x:O,width:S}=G(B),Y=L*a+12,ne=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;return B.isMilestone?jsxRuntime.jsx(jo,{task:B,x:O+S/2,y:Y+16,theme:t,onClick:p},B.id):ne?jsxRuntime.jsxs("g",{onClick:()=>p?.(B),onContextMenu:Z=>{Z.preventDefault(),Z.stopPropagation(),m?.(B,Z);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:O,y:Y,width:S,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:O,y1:Y,x2:O+S,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O,y1:Y,x2:O,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O+S,y1:Y,x2:O+S,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O,y1:Y+32,x2:O+S,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),S>60&&jsxRuntime.jsx("text",{x:O+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:B.name})]},B.id):jsxRuntime.jsx(Wo,{task:B,x:O,y:Y,width:S,theme:t,dayWidth:E*d,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:re,onDragMove:be,onHoverChange:D},B.id)}),A.map((B,L)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(O=>{let S=A.find(Se=>Se.id===O);if(!S||!S.startDate||!S.endDate)return null;let Y=A.findIndex(Se=>Se.id===O),ne=G(S),Z=G(B),Te=ne.x+ne.width,P=Y*a+a/2,te=Z.x,X=L*a+a/2,Ee=te-Te,Pe=Te+Ee/2,Ve=`M ${Te} ${P} C ${Pe} ${P}, ${Pe} ${X}, ${te} ${X}`;return g&&g.x1===Te&&g.y1===P&&g.x2===te&&g.y2===X?null:jsxRuntime.jsx("path",{d:Ve,fill:"none",stroke:"transparent",strokeWidth:24,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:Te,y1:P,x2:te,y2:X,onDelete:()=>u?.(B.id,O)});}},`dep-hover-${O}-${B.id}`)})),f.map(B=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:32,rx:8,fill:B.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(B.daysDelta)>0&&jsxRuntime.jsx("text",{x:B.previewX+B.width/2,y:B.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),g&&(()=>{let{x1:B,y1:L,x2:O,y2:S,onDelete:Y}=g,ne=O-B,Z=S-L,Te=B+ne/2,P=(L+S)/2,te=`M ${B} ${L} C ${Te} ${L}, ${Te} ${S}, ${O} ${S}`,X=6,Ee=Math.atan2(Z,ne),Pe=O-X*Math.cos(Ee-Math.PI/6),Ve=S-X*Math.sin(Ee-Math.PI/6),ht=O-X*Math.cos(Ee+Math.PI/6),Se=S-X*Math.sin(Ee+Math.PI/6),pt=t.dependency,nt="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:te,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Te,cy:P,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:te,fill:"none",stroke:pt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:te,fill:"none",stroke:pt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${O} ${S} L ${Pe} ${Ve} M ${O} ${S} L ${ht} ${Se}`,fill:"none",stroke:pt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:O,cy:S,r:4,fill:pt,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:$t=>{$t.stopPropagation(),k(null),Y();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Te,cy:P,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:nt,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Te-3,y1:P-3,x2:Te+3,y2:P+3,stroke:nt,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Te+3,y1:P-3,x2:Te-3,y2:P+3,stroke:nt,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(sd,{tooltipData:x,theme:t})]})]})}var qo=[{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"}];var Es=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ps=[{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 Xo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[]}){let m=[...Es,...n.filter(P=>!Es.some(te=>te.id===P.id))],l=Ue[p]||Ue.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[k,D]=react.useState(null),[h,E]=react.useState(new Date),[C,R]=react.useState({top:0,left:0}),[T,U]=react.useState(false),W=react.useRef(null),A=react.useRef(null),G=react.useRef(null),re=react.useRef(null),be=react.useRef(null),[_,Ae]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[Fe,B]=react.useState({});react.useEffect(()=>{a?(Ae({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&U(true)):(Ae({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),U(false));},[a,e]),react.useEffect(()=>{let P=te=>{W.current&&!W.current.contains(te.target)&&u(false),A.current&&!A.current.contains(te.target)&&f(false),G.current&&!G.current.contains(te.target)&&x(false),re.current&&!re.current.contains(te.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let L=()=>{let P={};return _.name.trim()||(P.name="El nombre es requerido"),_.startDate&&_.endDate&&_.startDate>_.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),B(P),Object.keys(P).length===0},O=async P=>{if(P.preventDefault(),!!L())try{await s(_),t();}catch(te){console.error("Error submitting task:",te);}},S=(P,te)=>{Ae(X=>{let Ee={...X,[P]:te};if(P==="status"){let Pe=te;Pe==="todo"?Ee.progress=0:Pe==="in-progress"?(X.progress===0||X.progress===100)&&(Ee.progress=50):Pe==="completed"||Pe==="closed"?Ee.progress=100:(Pe==="in-review"||Pe==="review")&&(Ee.progress=75);}if(P==="progress"){let Pe=typeof te=="number"?te:parseInt(te,10);Pe===100&&X.status!=="completed"?Ee.status="completed":Pe>0&&Pe<100&&X.status==="todo"?Ee.status="in-progress":Pe===0&&X.status!=="todo"&&(Ee.status="todo");}return Ee}),Fe[P]&&B(X=>{let Ee={...X};return delete Ee[P],Ee});},Y=m.find(P=>P.id===_.status)??Es[0],ne=Ps.find(P=>P.id===_.priority)??Ps[1],Z=qo.find(P=>P.value===_.color)??qo[0],Te={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Y.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:O,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:_.name,onChange:P=>S("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),Fe.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"}),Fe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:_.description||"",onChange:P=>S("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Te,borderColor:Y.color,backgroundColor:`${Y.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Y.color}}),jsxRuntime.jsx("span",{style:{color:Y.color},children:Y.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Y.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&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 shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:m.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:l.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{S("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,_.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:A,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Te,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ne.color}}),jsxRuntime.jsx("span",{children:ne.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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 shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Ps.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:l.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{S("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,_.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Te,disabled:d,children:[_.assignees&&_.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,3).map((P,te)=>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||l.accent,borderColor:l.bgSecondary},children:P.initials},te))}),_.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",_.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let te=_.assignees?.some(X=>X.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:l.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{let X=te?(_.assignees||[]).filter(Ee=>Ee.name!==P.name):[..._.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(Ee=>Ee[0]).join("").toUpperCase().slice(0,2),color:l.accent}];S("assignees",X);},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:l.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:te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:re,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Te,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:_.color}}),jsxRuntime.jsx("span",{children:Z.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:qo.slice(0,16).map(P=>{let te=_.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{S("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:te?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{ref:be,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!d&&!_.isMilestone)if(k==="start")D(null);else {if(be.current){let P=be.current.getBoundingClientRect(),te=window.innerHeight,X=320,Pe=te-P.bottom<X?P.top-X-8:P.bottom+8;R({top:Pe,left:P.left});}D("start"),E(_.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Te,opacity:_.isMilestone?.5:1,cursor:_.isMilestone?"not-allowed":"pointer"},disabled:d||_.isMilestone,children:_.startDate?_.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!d&&!_.isMilestone)if(k==="end")D(null);else {if(be.current){let P=be.current.getBoundingClientRect(),te=window.innerHeight,X=320,Pe=te-P.bottom<X?P.top-X-8:P.bottom+8;R({top:Pe,left:P.left});}D("end"),E(_.endDate||_.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Te,opacity:_.isMilestone?.5:1,cursor:_.isMilestone?"not-allowed":"pointer"},disabled:d||_.isMilestone,children:_.endDate?_.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(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:`${C.top}px`,left:`${C.left}px`,zIndex:99999,backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,te=new Date(P);te.setDate(P.getDate()+1);let X=new Date(P);X.setDate(P.getDate()+7);let Ee=new Date(P);return Ee.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:te},{label:"Pr\xF3xima semana",date:X},{label:"2 semanas",date:Ee}].map((Ve,ht)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:Se=>Se.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{k==="start"?(S("startDate",Ve.date),(!_.endDate||Ve.date>_.endDate)&&S("endDate",Ve.date),D("end")):(S("endDate",Ve.date),(!_.startDate||Ve.date<_.startDate)&&S("startDate",Ve.date),D(null));},children:Ve.label},ht))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.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=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{S("startDate",void 0),S("endDate",void 0),D(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:()=>E(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>E(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,te)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},te))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),te=h.getMonth(),X=new Date(P,te,1).getDay(),Ee=new Date(P,te+1,0).getDate(),Pe=new Date,Ve=[];for(let Se=X-1;Se>=0;Se--)Ve.push({day:new Date(P,te,-Se).getDate(),date:new Date(P,te-1,new Date(P,te,-Se).getDate()),isCurrentMonth:false});for(let Se=1;Se<=Ee;Se++)Ve.push({day:Se,date:new Date(P,te,Se),isCurrentMonth:true});let ht=42-Ve.length;for(let Se=1;Se<=ht;Se++)Ve.push({day:Se,date:new Date(P,te+1,Se),isCurrentMonth:false});return Ve.map((Se,pt)=>{let nt=Se.date.toDateString()===Pe.toDateString(),at=_.startDate?.toDateString()===Se.date.toDateString(),$t=_.endDate?.toDateString()===Se.date.toDateString(),mt=_.startDate&&_.endDate&&Se.date>=_.startDate&&Se.date<=_.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:Se.isCurrentMonth?at||$t?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:at?"#3B82F6":$t?"#7C3AED":mt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:nt&&!at&&!$t?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{k==="start"?(S("startDate",Se.date),_.endDate&&Se.date>_.endDate&&S("endDate",Se.date),D("end")):(S("endDate",Se.date),_.startDate&&Se.date<_.startDate&&S("startDate",Se.date),D(null));},children:Se.day},pt)})})()})]})]})]})})]}),Fe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Fe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.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:_.progress,onChange:P=>S("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:_.progress<30?"#EF4444":_.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${_.progress<30?"#EF4444":_.progress<70?"#F59E0B":"#10B981"}20`,color:_.progress<30?"#EF4444":_.progress<70?"#F59E0B":"#10B981"},children:[_.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>U(!T),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${T?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&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("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:_.isMilestone,onChange:P=>S("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let te=_.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let X=te?(_.dependencies||[]).filter(Ee=>Ee!==P.id):[..._.dependencies||[],P.id];S("dependencies",X);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:te?`${l.accent}30`:l.bgPrimary,color:te?l.accent:l.textSecondary,border:`1px solid ${te?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var $g=['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"'],pd=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),Ug=()=>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"})}),zg=()=>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"})}),Wg=()=>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"})}),Gg=()=>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 Jo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,k]=react.useState(true),D=react.useRef(null),h=react.useRef(null),E=react.useRef(null),{enabled:C=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:U,suggestions:W=$g,maxHistory:A=50,persistHistory:G}=a,re=G?.storageKey||"gantt-ai-history",be=G?.maxMessages??5;react.useEffect(()=>{if(G?.enabled)try{let O=localStorage.getItem(re);if(O){let Y=JSON.parse(O).map(ne=>({...ne,timestamp:new Date(ne.timestamp)}));v(Y.slice(-be));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[G?.enabled,re,be]),react.useEffect(()=>{if(G?.enabled&&u.length>0)try{let O=u.filter(S=>!S.isLoading).slice(-be);localStorage.setItem(re,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[u,G?.enabled,re,be]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let _=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&d?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&c?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&p?.(O.taskId,O.dependencyFrom);break}},[o,s,d,c,p]),Ae=react.useCallback(async O=>{if(!O.trim()||x)return;let S={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};v(ne=>[...ne.slice(-(A-1)),S]),y(""),k(false),b(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ne=>[...ne,Y]);try{if(U){let ne=await U(O,e);v(Z=>{let Te=Z.filter(te=>!te.isLoading),P={id:`assistant-${Date.now()}`,role:"assistant",content:ne.message,timestamp:new Date,command:ne};return [...Te,P]}),_(ne);}else v(ne=>[...ne.filter(Te=>!Te.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(ne){v(Z=>[...Z.filter(P=>!P.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ne instanceof Error?ne.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,A,U,e,_]),Fe=O=>{O.preventDefault(),Ae(f);},B=O=>{y(O),D.current?.focus();};if(react.useEffect(()=>{let O=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),m(Y=>!Y),n||i(false)),S.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[n]),react.useEffect(()=>{if(!n)return;let O=Y=>{let ne=Y.target;E.current&&!E.current.contains(ne)&&m(false);},S=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",O);}},[n]),!C)return null;let L={"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(Ye,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsxRuntime.jsx(pd,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:E,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 ${L[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(pd,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Wg,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(zg,{})})]})]}),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:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((O,S)=>jsxRuntime.jsx("button",{onClick:()=>B(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},S))})]}),u.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(Gg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Fe,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:f,onChange:O=>y(O.target.value),placeholder:R,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ug,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function md(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!m)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:l}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function ud({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?d.metaKey:d.ctrlKey;if(p&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&p&&d.key==="y"){d.preventDefault(),t();return}if(c&&p&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var jg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${le.formatDate(e.startDate)} - ${le.formatDate(e.endDate)}`);let a=le.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=>le.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function gd(e){return {...jg,...e}}var Qg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},hd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:k,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:E,onProgressChange:C,onTaskEdit:R,onTaskAddSubtask:T,onTaskMarkIncomplete:U,onTaskSetInProgress:W,onDependencyCreate:A,onDependencyDelete:G,onBeforeTaskAdd:re,onAfterTaskAdd:be,onBeforeTaskUpdate:_,onAfterTaskUpdate:Ae,onBeforeTaskDelete:Fe,onAfterTaskDelete:B}=a,O=react.useContext(Fo)?.theme,[S,Y]=react.useState(O||s||"dark"),[ne,Z]=react.useState(d),[Te,P]=react.useState(c),[te,X]=react.useState(1),[Ee,Pe]=react.useState(0),[Ve,ht]=react.useState(false),[Se,pt]=react.useState(null),[nt,at]=react.useState({isOpen:false,x:0,y:0,task:null}),[$t,mt]=react.useState(null),[ut,Lt]=react.useState(null);react.useEffect(()=>{O&&O!==S&&Y(O);},[O]),react.useEffect(()=>{s&&s!==S&&Y(s);},[s]);let Kt=react.useCallback(N=>{Y(N),g?.(N);},[g]),{state:we,setState:$,undo:De,redo:Ge,canUndo:We,canRedo:yt,clearHistory:Q}=md(t,50);react.useEffect(()=>{$(t);},[t,$]);let ae=react.useRef(t),xe=react.useRef(true);react.useEffect(()=>{if(xe.current){xe.current=false,ae.current=we;return}if(!r)return;let N=JSON.stringify(ae.current),z=JSON.stringify(we);N!==z&&(ae.current=we,r(we));},[we,r]);let fe=react.useMemo(()=>ms(v,f),[v,f]),oe=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ce,he]=react.useState(()=>oe(fe));react.useEffect(()=>{he(N=>N.map(z=>({...z,label:fe.columns[z.id==="name"?"taskName":z.id]||z.label})));},[fe]);let ke=react.useMemo(()=>{let N=Ce.filter(ie=>ie.visible),z=N.some(ie=>ie.id!=="name");return N.reduce((ie,ye)=>ie+ye.width,0)+(z?20:0)},[Ce]);react.useEffect(()=>{Se!==null&&Se>ke&&(Ce.filter(q=>q.visible).some(q=>q.id!=="name")||pt(null));},[Ce,ke,Se]);let F=react.useMemo(()=>Se!==null?Math.max(280,Se,ke):Math.max(280,ke),[Se,ke]),H=react.useRef(null),J=react.useRef(null),ce=react.useRef(null),pe=react.useMemo(()=>Ll(S),[S]),I=react.useMemo(()=>({theme:pe,themeName:S}),[pe,S]),K=react.useMemo(()=>gd(l),[l]),Ne=react.useMemo(()=>{if(!i)return we;let N=le.calculateCriticalPath(we),z=q=>q.map(ie=>({...ie,isCriticalPath:N.includes(ie.id),subtasks:ie.subtasks?z(ie.subtasks):void 0}));return z(we)},[we,i]),qe=Qg(Te);ud({undo:De,redo:Ge,canUndo:We,canRedo:yt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>le.findTaskById(we,N),addTask:(N,z)=>{$(q=>{if(!z)return [...q,{...N,level:0}];let ie=ye=>ye.map(Me=>Me.id===z?{...Me,subtasks:[...Me.subtasks||[],{...N,parentId:z,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:ie(Me.subtasks)}:Me);return ie(q)});},updateTask:(N,z)=>{$(q=>{let ie=ye=>ye.map(Me=>Me.id===N?{...Me,...z}:Me.subtasks?{...Me,subtasks:ie(Me.subtasks)}:Me);return ie(q)});},deleteTask:N=>{$(z=>{let q=ie=>ie.filter(ye=>ye.id===N?false:(ye.subtasks&&(ye.subtasks=q(ye.subtasks)),true));return q(z)});},deleteTasks:N=>{$(z=>vs(z,N));},duplicateTask:N=>{$(z=>xs(z,[N]));},splitTask:(N,z,q=3)=>{$(ie=>le.splitTask(ie,N,z,q));},calculateEndDate:le.calculateEndDate,calculateDuration:le.calculateDuration,validateDependency:(N,z)=>!le.validateDependencies(we,N,z),getAllTasks:()=>le.flattenTasks(we),getTasksByStatus:N=>le.flattenTasks(we).filter(z=>z.status===N),getTasksByParent:N=>N?le.findTaskById(we,N)?.subtasks||[]:we.filter(q=>!q.parentId),getCriticalPath:()=>le.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{$(z=>bs(z,[N]));},outdentTask:N=>{$(z=>hs(z,[N]));},moveTask:(N,z)=>{$(q=>ys(q,[N],z));},createSubtask:async N=>{let{tasks:z,newTask:q}=Cs(we,N);if(re){let ie=re({...q,parentId:N});if((ie instanceof Promise?await ie:ie)===false)return}$(z),be&&be({...q,parentId:N});},scrollToTask:N=>{let q=le.flattenTasks(we).findIndex(ie=>ie.id===N);if(q!==-1&&H.current){let ie=q*qe;H.current.scrollTo({top:ie,behavior:"smooth"}),J.current&&J.current.scrollTo({top:ie,behavior:"smooth"});}},highlightTask:(N,z=2e3)=>{},expandTask:N=>{$(z=>{let q=ie=>ie.map(ye=>ye.id===N?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:q(ye.subtasks)}:ye);return q(z)});},collapseTask:N=>{$(z=>{let q=ie=>ie.map(ye=>ye.id===N?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:q(ye.subtasks)}:ye);return q(z)});},expandAll:()=>{$(N=>{let z=q=>q.map(ie=>({...ie,isExpanded:true,subtasks:ie.subtasks?z(ie.subtasks):void 0}));return z(N)});},collapseAll:()=>{$(N=>{let z=q=>q.map(ie=>({...ie,isExpanded:false,subtasks:ie.subtasks?z(ie.subtasks):void 0}));return z(N)});},undo:De,redo:Ge,canUndo:()=>We,canRedo:()=>yt,clearHistory:Q,exportToPNG:async()=>{if(!ce.current)throw new Error("Gantt container not found");let N=await bd__default.default(ce.current,{backgroundColor:pe.bgPrimary,scale:2});return new Promise((z,q)=>{N.toBlob(ie=>{ie?z(ie):q(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await le.exportToPDF(we,N);},exportToExcel:async N=>{await le.exportToExcel(we,N);},exportToJSON:()=>le.exportToJSON(we),exportToCSV:()=>le.exportToCSV(we),importFromJSON:N=>{let z=le.importFromJSON(N);$(z);},getTasks:()=>we,refresh:()=>{$(N=>[...N]);},clearAll:()=>{$([]);}}),[we,De,Ge,We,yt,Q,pe,qe]);let Pt=react.useCallback(N=>{he(z=>z.map(q=>q.id===N?{...q,visible:!q.visible}:q));},[]),Ur=react.useCallback((N,z)=>{he(q=>q.map(ie=>{if(ie.id!==N)return ie;let ye=ie.minWidth??100,Me=ie.maxWidth??800,Ft=Math.max(ye,Math.min(Me,z));return {...ie,width:Ft}}));},[]),zr=react.useCallback(N=>{$(z=>ws(z,N)),a.onTaskToggleExpand?.(N);},[a]),Wa=react.useCallback((N,z)=>{if(_&&_(N,z)===false)return;let ie=le.findTaskById(we,N)?.progress,ye=Ft=>Ft.map(Bt=>Bt.id===N?{...Bt,...z}:Bt.subtasks?{...Bt,subtasks:ye(Bt.subtasks)}:Bt);$(ye(we));let Me=le.findTaskById(ye(we),N);Me&&(E?.(Me),Ae?.(Me),z.progress!==void 0&&ie!==void 0&&z.progress!==ie&&C?.(N,ie,z.progress));},[we,E,_,Ae,C]),yn=react.useCallback(N=>{N.length!==0&&($(z=>bs(z,N)),a.onTaskIndent?.(N[0]));},[a]),me=react.useCallback(N=>{N.length!==0&&($(z=>hs(z,N)),a.onTaskOutdent?.(N[0]));},[a]),gt=react.useCallback((N,z,q)=>{$(ie=>Ql(ie,N,z,q)),a.onTaskReparent?.(N,z,q);},[a]),_t=react.useCallback((N,z)=>{N.length!==0&&($(q=>ys(q,N,z)),a.onTaskMove?.(N[0],z));},[a]),Ga=react.useCallback(async N=>{let z=[];for(let q of N)Fe&&await Promise.resolve(Fe(q))===false||z.push(q);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):($(q=>vs(q,z)),z.forEach(q=>a.onTaskDelete?.(q))),B&&z.forEach(q=>B(q)));},[a,Fe,B]),ho=react.useCallback(N=>{$(z=>xs(z,N)),N.forEach(z=>a.onTaskDuplicate?.(z));},[a]),vr=react.useCallback((N,z)=>{$(q=>{let{tasks:ie,newTask:ye}=Zl(q,N,z);return re&&re(ye)===false?q:(a.onTaskCreate?.(ye.parentId,ye.position||0),be?.(ye),ie)});},[a,re,be]),Aa=react.useCallback((N,z)=>{$(q=>ks(q,N,z)),a.onTaskRename?.(N,z);},[a]),Ia=react.useCallback(N=>{$(z=>{let{tasks:q}=Cs(z,N);return a.onTaskCreate?.(N,0),q});},[a]),Tt=react.useCallback((N,z,q)=>{let ie=N.startDate?Math.round((z.getTime()-N.startDate.getTime())/864e5):0,ye=Bt=>Bt.map(Vt=>Vt.id===N.id?{...Vt,startDate:z,endDate:q,...N.segments&&{segments:N.segments}}:Vt.subtasks?{...Vt,subtasks:ye(Vt.subtasks)}:Vt),Me=ye(we);Me=le.autoScheduleDependents(Me,N.id,ie),$(Me);let Ft={...N,startDate:z,endDate:q};E?.(Ft);},[we,E]),vn=react.useCallback((N,z)=>{h?.(N,z),at({isOpen:true,x:z.clientX,y:z.clientY,task:N});},[h]),xn=react.useCallback((N,z)=>{let q=le.splitTask(we,N.id,z);$(q),at({isOpen:false,x:0,y:0,task:null});},[we]),kn=react.useCallback(N=>{D?.(N),R||mt(N);},[D,R]),xr=react.useCallback((N,z,q)=>{let ie=new Map,ye=fa=>{fa.forEach(La=>{La.dependencies&&ie.set(La.id,La.dependencies),La.subtasks&&ye(La.subtasks);});};ye(q);let Me=ie.get(z)||[];ie.set(z,[...Me,N]);let Ft=new Set,Bt=new Set,Vt=fa=>{if(!Ft.has(fa)){Ft.add(fa),Bt.add(fa);let La=ie.get(fa)||[];for(let er of La){if(!Ft.has(er)&&Vt(er))return true;if(Bt.has(er))return true}}return Bt.delete(fa),false};return Vt(z)},[]),Ti=react.useCallback((N,z)=>{if(xr(N.id,z,we)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(m),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=se.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?se.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+m;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let m=n.startDate&&n.endDate?se.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-m;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),l=d.get(n.id);if(m&&l){let i=l.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(se.calculateCriticalPath(e).includes(t))return 0;let o=se.getDependentTasks(e,t);if(o.length===0){let c=se.getLatestEndDate(e);if(!c)return null;let p=se.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let d=se.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=se.findTaskById(e,t);if(!r||!r.endDate)return e;let o=se.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=se.calculateDuration(d.startDate,d.endDate),p;a!==void 0?(p=new Date(d.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=se.calculateEndDate(p,c),m=l=>l.map(i=>i.id===d.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=se.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,l=se.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=se.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex($=>$.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/m,P=(g-n)/m*s,C=P+v*s,B=Math.max(D*s,s),T=c+b*d+12;p.push({taskId:x.id,taskName:x.name,originalX:P,previewX:C,width:B,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=se.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 d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=m=>m.map(l=>l.id===o.id?{...l,endDate:c,segments:p}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function tn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,k]=react.useState(null),D=react.useCallback(F=>{b(F);},[]),h=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),P=r==="day"?60:r==="week"?20:8,C=h*P*d,B=F=>{let L=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),R=L.getUTCDay()||7;L.setUTCDate(L.getUTCDate()+4-R);let E=new Date(Date.UTC(L.getUTCFullYear(),0,1));return Math.ceil(((L.getTime()-E.getTime())/864e5+1)/7)},T=F=>{let L=F.getDay();return L===0||L===6},$=react.useCallback(F=>{let L=Math.round(F/(P*d)),R=new Date(o);return R.setDate(R.getDate()+L),R},[o,P,d]),W=react.useCallback((F,L)=>{if(L.startDate&&L.endDate)return;let R=F.currentTarget.ownerSVGElement;if(!R)return;let E=R.createSVGPoint();E.x=F.clientX,E.y=F.clientY;let j=E.matrixTransform(R.getScreenCTM()?.inverse()),oe=$(j.x),q=new Date(oe);q.setDate(q.getDate()+1),l?.(L,oe,q);},[$,l]),I=react.useMemo(()=>{let F=j=>j.map(oe=>{if(oe.subtasks&&oe.subtasks.length>0){let q=F(oe.subtasks),De=q.filter(M=>M.startDate&&M.endDate);if(De.length>0){let M=De.map(Ee=>Ee.startDate.getTime()),te=De.map(Ee=>Ee.endDate.getTime()),Y=new Date(Math.min(...M)),Se=new Date(Math.max(...te));return {...oe,subtasks:q,startDate:Y,endDate:Se}}return {...oe,subtasks:q}}return oe}),L=(j,oe=[])=>{for(let q of j)oe.push(q),q.subtasks&&q.subtasks.length>0&&(q.isExpanded===void 0||q.isExpanded)&&L(q.subtasks,oe);return oe},R=F(e);return L(R)},[e]),G=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let L=F.startDate.getTime(),R=F.endDate.getTime(),E=o.getTime(),j=(L-E)/(1e3*60*60*24),oe=(R-L)/(1e3*60*60*24),q=j*P*d,De=Math.max(P*d,40),M=Math.max(oe*P*d,De);return {x:q,width:M}},[o,P,d]),ae=react.useMemo(()=>I.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:L,width:R}=G(F),j=I.findIndex(oe=>oe.id===F.id)*a+12;return {id:F.id,x:L,y:j,width:R,height:32}}),[I,G]),fe=react.useCallback((F,L,R)=>{if(!R||L===0){y([]);return}let E=se.calculateCascadePreview(e,F,L,I,o,P*d,a,48);y(E);},[e,I,o,P,d,a,48]),H=react.useMemo(()=>{let F=[],L=new Date(o);for(;L<=s;){let j=(L.getTime()-o.getTime())/864e5*P*d;if(r==="day")F.push({date:new Date(L),label:L.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:j}),L.setDate(L.getDate()+1);else if(r==="week"){let oe=B(L);F.push({date:new Date(L),label:`Week ${oe}`,x:j}),L.setDate(L.getDate()+7);}else F.push({date:new Date(L),label:L.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:j}),L.setMonth(L.getMonth()+1);}return F},[o,s,r,P,d]),Me=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*P*d,[o,P,d]),Be=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(C,1e3),height:48,fill:t.bgGrid}),H.map((F,L)=>jsxRuntime.jsxs("g",{children:[L>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${L}`)),Me>=0&&Me<=C&&jsxRuntime.jsx("circle",{cx:Me,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:Be,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(C,1e3),height:Be,fill:t.bgPrimary}),H.map((F,L)=>{let R=H[L+1]?.x||C,E=T(F.date);return jsxRuntime.jsxs("g",{children:[E&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:R-F.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),L>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},L)}),Me>=0&&Me<=C&&jsxRuntime.jsx("line",{x1:Me,y1:0,x2:Me,y2:I.length*a,stroke:t.today,strokeWidth:2,opacity:1}),I.map((F,L)=>{let R=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:C,height:a,fill:L%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:C,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>W(E,F),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:Me>0?Me:100,y:L*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),I.map((F,L)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(R=>{let E=I.find(De=>De.id===R);if(!E||!E.startDate||!E.endDate)return null;let j=I.findIndex(De=>De.id===R),oe=G(E),q=G(F);return jsxRuntime.jsx(Jo,{x1:oe.x+oe.width,y1:j*a+a/2,x2:q.x,y2:L*a+a/2,theme:t},`dep-${R}-${F.id}`)})),I.map((F,L)=>{if(!F.startDate||!F.endDate)return null;let{x:R,width:E}=G(F),j=L*a+12,oe=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(Qo,{task:F,x:R+E/2,y:j+16,theme:t,onClick:p},F.id):oe?jsxRuntime.jsxs("g",{onClick:()=>p?.(F),onContextMenu:q=>{q.preventDefault(),q.stopPropagation(),m?.(F,q);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:R,y:j,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:R,y1:j,x2:R+E,y2:j,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:j,x2:R,y2:j+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R+E,y1:j,x2:R+E,y2:j+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:j+32,x2:R+E,y2:j+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsxRuntime.jsx("text",{x:R+12,y:j+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(Yo,{task:F,x:R,y:j,width:E,theme:t,dayWidth:P*d,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:ae,onDragMove:fe,onHoverChange:D},F.id)}),I.map((F,L)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(R=>{let E=I.find(Ne=>Ne.id===R);if(!E||!E.startDate||!E.endDate)return null;let j=I.findIndex(Ne=>Ne.id===R),oe=G(E),q=G(F),De=oe.x+oe.width,M=j*a+a/2,te=q.x,Y=L*a+a/2,Se=te-De,Ee=De+Se/2,je=`M ${De} ${M} C ${Ee} ${M}, ${Ee} ${Y}, ${te} ${Y}`;return g&&g.x1===De&&g.y1===M&&g.x2===te&&g.y2===Y?null:jsxRuntime.jsx("path",{d:je,fill:"none",stroke:"transparent",strokeWidth:24,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:De,y1:M,x2:te,y2:Y,onDelete:()=>u?.(F.id,R)});}},`dep-hover-${R}-${F.id}`)})),f.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),g&&(()=>{let{x1:F,y1:L,x2:R,y2:E,onDelete:j}=g,oe=R-F,q=E-L,De=F+oe/2,M=(L+E)/2,te=`M ${F} ${L} C ${De} ${L}, ${De} ${E}, ${R} ${E}`,Y=6,Se=Math.atan2(q,oe),Ee=R-Y*Math.cos(Se-Math.PI/6),je=E-Y*Math.sin(Se-Math.PI/6),ht=R-Y*Math.cos(Se+Math.PI/6),Ne=E-Y*Math.sin(Se+Math.PI/6),nt=t.dependency,Nt="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:te,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:De,cy:M,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:te,fill:"none",stroke:nt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:te,fill:"none",stroke:nt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${R} ${E} L ${Ee} ${je} M ${R} ${E} L ${ht} ${Ne}`,fill:"none",stroke:nt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:R,cy:E,r:4,fill:nt,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Wt=>{Wt.stopPropagation(),k(null),j();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:De,cy:M,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:Nt,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:De-3,y1:M-3,x2:De+3,y2:M+3,stroke:Nt,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:De+3,y1:M-3,x2:De-3,y2:M+3,stroke:Nt,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(cd,{tooltipData:x,theme:t})]})]})}var an=[{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"}];var Is=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ls=[{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 rn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[]}){let m=[...Is,...n.filter(M=>!Is.some(te=>te.id===M.id))],l=Ge[p]||Ge.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[k,D]=react.useState(null),[h,P]=react.useState(new Date),[C,B]=react.useState({top:0,left:0}),[T,$]=react.useState(false),W=react.useRef(null),I=react.useRef(null),G=react.useRef(null),ae=react.useRef(null),fe=react.useRef(null),[H,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[Be,F]=react.useState({});react.useEffect(()=>{a?(Me({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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&$(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),$(false));},[a,e]),react.useEffect(()=>{let M=te=>{W.current&&!W.current.contains(te.target)&&u(false),I.current&&!I.current.contains(te.target)&&f(false),G.current&&!G.current.contains(te.target)&&x(false),ae.current&&!ae.current.contains(te.target)&&g(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);let L=()=>{let M={};return H.name.trim()||(M.name="El nombre es requerido"),H.startDate&&H.endDate&&H.startDate>H.endDate&&(M.endDate="La fecha de fin debe ser posterior a la de inicio"),F(M),Object.keys(M).length===0},R=async M=>{if(M.preventDefault(),!!L())try{await s(H),t();}catch(te){console.error("Error submitting task:",te);}},E=(M,te)=>{Me(Y=>{let Se={...Y,[M]:te};if(M==="status"){let Ee=te;Ee==="todo"?Se.progress=0:Ee==="in-progress"?(Y.progress===0||Y.progress===100)&&(Se.progress=50):Ee==="completed"||Ee==="closed"?Se.progress=100:(Ee==="in-review"||Ee==="review")&&(Se.progress=75);}if(M==="progress"){let Ee=typeof te=="number"?te:parseInt(te,10);Ee===100&&Y.status!=="completed"?Se.status="completed":Ee>0&&Ee<100&&Y.status==="todo"?Se.status="in-progress":Ee===0&&Y.status!=="todo"&&(Se.status="todo");}return Se}),Be[M]&&F(Y=>{let Se={...Y};return delete Se[M],Se});},j=m.find(M=>M.id===H.status)??Is[0],oe=Ls.find(M=>M.id===H.priority)??Ls[1],q=an.find(M=>M.value===H.color)??an[0],De={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:j.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=l.hoverBg,M.currentTarget.style.color=l.textPrimary;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent",M.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:R,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:H.name,onChange:M=>E("name",M.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,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:H.description||"",onChange:M=>E("description",M.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...De,borderColor:j.color,backgroundColor:`${j.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:j.color}}),jsxRuntime.jsx("span",{style:{color:j.color},children:j.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:j.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&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 shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:m.map(M=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{E("status",M.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:M.color}}),M.title,H.status===M.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},M.id))})})]}),jsxRuntime.jsxs("div",{ref:I,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:De,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:oe.color}}),jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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 shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Ls.map(M=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{E("priority",M.id),f(false);},children:[jsxRuntime.jsx("span",{children:M.icon}),M.label,H.priority===M.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},M.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:De,disabled:d,children:[H.assignees&&H.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,3).map((M,te)=>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:M.color||l.accent,borderColor:l.bgSecondary},children:M.initials},te))}),H.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",H.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(M=>{let te=H.assignees?.some(Y=>Y.name===M.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:l.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Y=te?(H.assignees||[]).filter(Se=>Se.name!==M.name):[...H.assignees||[],{name:M.name,avatar:M.avatar,initials:M.name.split(" ").map(Se=>Se[0]).join("").toUpperCase().slice(0,2),color:l.accent}];E("assignees",Y);},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:l.accent},children:M.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:M.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})})]},M.id)})})})]}),jsxRuntime.jsxs("div",{ref:ae,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:De,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsxRuntime.jsx("span",{children:q.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:an.slice(0,16).map(M=>{let te=H.color===M.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{E("color",M.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:M.value,outline:te?`2px solid ${M.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:M.name},M.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{ref:fe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!d&&!H.isMilestone)if(k==="start")D(null);else {if(fe.current){let M=fe.current.getBoundingClientRect(),te=window.innerHeight,Y=320,Ee=te-M.bottom<Y?M.top-Y-8:M.bottom+8;B({top:Ee,left:M.left});}D("start"),P(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...De,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:d||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!d&&!H.isMilestone)if(k==="end")D(null);else {if(fe.current){let M=fe.current.getBoundingClientRect(),te=window.innerHeight,Y=320,Ee=te-M.bottom<Y?M.top-Y-8:M.bottom+8;B({top:Ee,left:M.left});}D("end"),P(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...De,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:d||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(qe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(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:`${C.top}px`,left:`${C.left}px`,zIndex:99999,backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let M=new Date,te=new Date(M);te.setDate(M.getDate()+1);let Y=new Date(M);Y.setDate(M.getDate()+7);let Se=new Date(M);return Se.setDate(M.getDate()+14),[{label:"Hoy",date:M},{label:"Ma\xF1ana",date:te},{label:"Pr\xF3xima semana",date:Y},{label:"2 semanas",date:Se}].map((je,ht)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{k==="start"?(E("startDate",je.date),(!H.endDate||je.date>H.endDate)&&E("endDate",je.date),D("end")):(E("endDate",je.date),(!H.startDate||je.date<H.startDate)&&E("startDate",je.date),D(null));},children:je.label},ht))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.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:M=>M.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",onClick:()=>{E("startDate",void 0),E("endDate",void 0),D(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(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>P(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((M,te)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:M},te))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let M=h.getFullYear(),te=h.getMonth(),Y=new Date(M,te,1).getDay(),Se=new Date(M,te+1,0).getDate(),Ee=new Date,je=[];for(let Ne=Y-1;Ne>=0;Ne--)je.push({day:new Date(M,te,-Ne).getDate(),date:new Date(M,te-1,new Date(M,te,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Se;Ne++)je.push({day:Ne,date:new Date(M,te,Ne),isCurrentMonth:true});let ht=42-je.length;for(let Ne=1;Ne<=ht;Ne++)je.push({day:Ne,date:new Date(M,te+1,Ne),isCurrentMonth:false});return je.map((Ne,nt)=>{let Nt=Ne.date.toDateString()===Ee.toDateString(),yt=H.startDate?.toDateString()===Ne.date.toDateString(),Wt=H.endDate?.toDateString()===Ne.date.toDateString(),st=H.startDate&&H.endDate&&Ne.date>=H.startDate&&Ne.date<=H.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:Ne.isCurrentMonth?yt||Wt?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:yt?"#3B82F6":Wt?"#7C3AED":st?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Nt&&!yt&&!Wt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{k==="start"?(E("startDate",Ne.date),H.endDate&&Ne.date>H.endDate&&E("endDate",Ne.date),D("end")):(E("endDate",Ne.date),H.startDate&&Ne.date<H.startDate&&E("startDate",Ne.date),D(null));},children:Ne.day},nt)})})()})]})]})]})})]}),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:l.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:H.progress,onChange:M=>E("progress",parseInt(M.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"}20`,color:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},children:[H.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>$(!T),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${T?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&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("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:H.isMilestone,onChange:M=>E("isMilestone",M.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(M=>M.id!==a?.id).map(M=>{let te=H.dependencies?.includes(M.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Y=te?(H.dependencies||[]).filter(Se=>Se!==M.id):[...H.dependencies||[],M.id];E("dependencies",Y);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:te?`${l.accent}30`:l.bgPrimary,color:te?l.accent:l.textSecondary,border:`1px solid ${te?l.accent:l.borderLight}`},disabled:d,children:M.name},M.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:M=>M.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:M=>!d&&(M.currentTarget.style.opacity="0.9"),onMouseLeave:M=>!d&&(M.currentTarget.style.opacity="1"),children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var $g=['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"'],fd=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),zg=()=>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"})}),Ug=()=>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"})}),Wg=()=>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"})}),Gg=()=>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 on({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,k]=react.useState(true),D=react.useRef(null),h=react.useRef(null),P=react.useRef(null),{enabled:C=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:$,suggestions:W=$g,maxHistory:I=50,persistHistory:G}=a,ae=G?.storageKey||"gantt-ai-history",fe=G?.maxMessages??5;react.useEffect(()=>{if(G?.enabled)try{let R=localStorage.getItem(ae);if(R){let j=JSON.parse(R).map(oe=>({...oe,timestamp:new Date(oe.timestamp)}));v(j.slice(-fe));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[G?.enabled,ae,fe]),react.useEffect(()=>{if(G?.enabled&&u.length>0)try{let R=u.filter(E=>!E.isLoading).slice(-fe);localStorage.setItem(ae,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[u,G?.enabled,ae,fe]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let H=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&d?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&c?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&p?.(R.taskId,R.dependencyFrom);break}},[o,s,d,c,p]),Me=react.useCallback(async R=>{if(!R.trim()||x)return;let E={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};v(oe=>[...oe.slice(-(I-1)),E]),y(""),k(false),b(true);let j={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(oe=>[...oe,j]);try{if($){let oe=await $(R,e);v(q=>{let De=q.filter(te=>!te.isLoading),M={id:`assistant-${Date.now()}`,role:"assistant",content:oe.message,timestamp:new Date,command:oe};return [...De,M]}),H(oe);}else v(oe=>[...oe.filter(De=>!De.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(oe){v(q=>[...q.filter(M=>!M.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${oe instanceof Error?oe.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,I,$,e,H]),Be=R=>{R.preventDefault(),Me(f);},F=R=>{y(R),D.current?.focus();};if(react.useEffect(()=>{let R=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(j=>!j),n||i(false)),E.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[n]),react.useEffect(()=>{if(!n)return;let R=j=>{let oe=j.target;P.current&&!P.current.contains(oe)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",R);}},[n]),!C)return null;let L={"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(qe,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsxRuntime.jsx(fd,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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 ${L[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(fd,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Wg,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ug,{})})]})]}),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:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((R,E)=>jsxRuntime.jsx("button",{onClick:()=>F(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},E))})]}),u.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(Gg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Be,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:f,onChange:R=>y(R.target.value),placeholder:B,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(zg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!m)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:l}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function hd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?d.metaKey:d.ctrlKey;if(p&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&p&&d.key==="y"){d.preventDefault(),t();return}if(c&&p&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var jg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${se.formatDate(e.startDate)} - ${se.formatDate(e.endDate)}`);let a=se.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=>se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function yd(e){return {...jg,...e}}var Qg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},kd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:k,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:P,onProgressChange:C,onTaskEdit:B,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:W,onDependencyCreate:I,onDependencyDelete:G,onBeforeTaskAdd:ae,onAfterTaskAdd:fe,onBeforeTaskUpdate:H,onAfterTaskUpdate:Me,onBeforeTaskDelete:Be,onAfterTaskDelete:F}=a,R=react.useContext(Wo)?.theme,[E,j]=react.useState(R||s||"dark"),[oe,q]=react.useState(d),[De,M]=react.useState(c),[te,Y]=react.useState(1),[Se,Ee]=react.useState(0),[je,ht]=react.useState(false),[Ne,nt]=react.useState(null),[Nt,yt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Wt,st]=react.useState(null),[tt,mt]=react.useState(null);react.useEffect(()=>{R&&R!==E&&j(R);},[R]),react.useEffect(()=>{s&&s!==E&&j(s);},[s]);let Qt=react.useCallback(S=>{j(S),g?.(S);},[g]),{state:xe,setState:O,undo:we,redo:He,canUndo:We,canRedo:vt,clearHistory:J}=bd(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),ve=react.useRef(true);react.useEffect(()=>{if(ve.current){ve.current=false,Q.current=xe;return}if(!r)return;let S=JSON.stringify(Q.current),z=JSON.stringify(xe);S!==z&&(Q.current=xe,r(xe));},[xe,r]);let be=react.useMemo(()=>fs(v,f),[v,f]),re=react.useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ce,ue]=react.useState(()=>re(be));react.useEffect(()=>{ue(S=>S.map(z=>({...z,label:be.columns[z.id==="name"?"taskName":z.id]||z.label})));},[be]);let ke=react.useMemo(()=>{let S=Ce.filter(ne=>ne.visible),z=S.some(ne=>ne.id!=="name");return S.reduce((ne,he)=>ne+he.width,0)+(z?20:0)},[Ce]);react.useEffect(()=>{Ne!==null&&Ne>ke&&(Ce.filter(K=>K.visible).some(K=>K.id!=="name")||nt(null));},[Ce,ke,Ne]);let ge=react.useMemo(()=>Ne!==null?Math.max(280,Ne,ke):Math.max(280,ke),[Ne,ke]),Ae=react.useRef(null),pe=react.useRef(null),Ie=react.useRef(null),U=react.useMemo(()=>Rl(E),[E]),N=react.useMemo(()=>({theme:U,themeName:E}),[U,E]),X=react.useMemo(()=>yd(l),[l]),me=react.useMemo(()=>{if(!i)return xe;let S=se.calculateCriticalPath(xe),z=K=>K.map(ne=>({...ne,isCriticalPath:S.includes(ne.id),subtasks:ne.subtasks?z(ne.subtasks):void 0}));return z(xe)},[xe,i]),Te=Qg(De);hd({undo:we,redo:He,canUndo:We,canRedo:vt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>se.findTaskById(xe,S),addTask:(S,z)=>{O(K=>{if(!z)return [...K,{...S,level:0}];let ne=he=>he.map(Pe=>Pe.id===z?{...Pe,subtasks:[...Pe.subtasks||[],{...S,parentId:z,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:ne(Pe.subtasks)}:Pe);return ne(K)});},updateTask:(S,z)=>{O(K=>{let ne=he=>he.map(Pe=>Pe.id===S?{...Pe,...z}:Pe.subtasks?{...Pe,subtasks:ne(Pe.subtasks)}:Pe);return ne(K)});},deleteTask:S=>{O(z=>{let K=ne=>ne.filter(he=>he.id===S?false:(he.subtasks&&(he.subtasks=K(he.subtasks)),true));return K(z)});},deleteTasks:S=>{O(z=>ws(z,S));},duplicateTask:S=>{O(z=>Cs(z,[S]));},splitTask:(S,z,K=3)=>{O(ne=>se.splitTask(ne,S,z,K));},calculateEndDate:se.calculateEndDate,calculateDuration:se.calculateDuration,validateDependency:(S,z)=>!se.validateDependencies(xe,S,z),getAllTasks:()=>se.flattenTasks(xe),getTasksByStatus:S=>se.flattenTasks(xe).filter(z=>z.status===S),getTasksByParent:S=>S?se.findTaskById(xe,S)?.subtasks||[]:xe.filter(K=>!K.parentId),getCriticalPath:()=>se.flattenTasks(xe).filter(S=>S.isCriticalPath),indentTask:S=>{O(z=>vs(z,[S]));},outdentTask:S=>{O(z=>xs(z,[S]));},moveTask:(S,z)=>{O(K=>ks(K,[S],z));},createSubtask:async S=>{let{tasks:z,newTask:K}=Ns(xe,S);if(ae){let ne=ae({...K,parentId:S});if((ne instanceof Promise?await ne:ne)===false)return}O(z),fe&&fe({...K,parentId:S});},scrollToTask:S=>{let K=se.flattenTasks(xe).findIndex(ne=>ne.id===S);if(K!==-1&&Ae.current){let ne=K*Te;Ae.current.scrollTo({top:ne,behavior:"smooth"}),pe.current&&pe.current.scrollTo({top:ne,behavior:"smooth"});}},highlightTask:(S,z=2e3)=>{},expandTask:S=>{O(z=>{let K=ne=>ne.map(he=>he.id===S?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:K(he.subtasks)}:he);return K(z)});},collapseTask:S=>{O(z=>{let K=ne=>ne.map(he=>he.id===S?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:K(he.subtasks)}:he);return K(z)});},expandAll:()=>{O(S=>{let z=K=>K.map(ne=>({...ne,isExpanded:true,subtasks:ne.subtasks?z(ne.subtasks):void 0}));return z(S)});},collapseAll:()=>{O(S=>{let z=K=>K.map(ne=>({...ne,isExpanded:false,subtasks:ne.subtasks?z(ne.subtasks):void 0}));return z(S)});},undo:we,redo:He,canUndo:()=>We,canRedo:()=>vt,clearHistory:J,exportToPNG:async()=>{if(!Ie.current)throw new Error("Gantt container not found");let S=await xd__default.default(Ie.current,{backgroundColor:U.bgPrimary,scale:2});return new Promise((z,K)=>{S.toBlob(ne=>{ne?z(ne):K(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await se.exportToPDF(xe,S);},exportToExcel:async S=>{await se.exportToExcel(xe,S);},exportToJSON:()=>se.exportToJSON(xe),exportToCSV:()=>se.exportToCSV(xe),importFromJSON:S=>{let z=se.importFromJSON(S);O(z);},getTasks:()=>xe,refresh:()=>{O(S=>[...S]);},clearAll:()=>{O([]);}}),[xe,we,He,We,vt,J,U,Te]);let Mt=react.useCallback(S=>{ue(z=>z.map(K=>K.id===S?{...K,visible:!K.visible}:K));},[]),St=react.useCallback((S,z)=>{ue(K=>K.map(ne=>{if(ne.id!==S)return ne;let he=ne.minWidth??100,Pe=ne.maxWidth??800,Ot=Math.max(he,Math.min(Pe,z));return {...ne,width:Ot}}));},[]),At=react.useCallback(S=>{O(z=>Ds(z,S)),a.onTaskToggleExpand?.(S);},[a]),Xt=react.useCallback((S,z)=>{if(H&&H(S,z)===false)return;let ne=se.findTaskById(xe,S)?.progress,he=Ot=>Ot.map($t=>$t.id===S?{...$t,...z}:$t.subtasks?{...$t,subtasks:he($t.subtasks)}:$t);O(he(xe));let Pe=se.findTaskById(he(xe),S);Pe&&(P?.(Pe),Me?.(Pe),z.progress!==void 0&&ne!==void 0&&z.progress!==ne&&C?.(S,ne,z.progress));},[xe,P,H,Me,C]),ut=react.useCallback(S=>{S.length!==0&&(O(z=>vs(z,S)),a.onTaskIndent?.(S[0]));},[a]),Dr=react.useCallback(S=>{S.length!==0&&(O(z=>xs(z,S)),a.onTaskOutdent?.(S[0]));},[a]),or=react.useCallback((S,z,K)=>{O(ne=>ad(ne,S,z,K)),a.onTaskReparent?.(S,z,K);},[a]),_a=react.useCallback((S,z)=>{S.length!==0&&(O(K=>ks(K,S,z)),a.onTaskMove?.(S[0],z));},[a]),nr=react.useCallback(async S=>{let z=[];for(let K of S)Be&&await Promise.resolve(Be(K))===false||z.push(K);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):(O(K=>ws(K,z)),z.forEach(K=>a.onTaskDelete?.(K))),F&&z.forEach(K=>F(K)));},[a,Be,F]),le=react.useCallback(S=>{O(z=>Cs(z,S)),S.forEach(z=>a.onTaskDuplicate?.(z));},[a]),gt=react.useCallback((S,z)=>{O(K=>{let{tasks:ne,newTask:he}=td(K,S,z);return ae&&ae(he)===false?K:(a.onTaskCreate?.(he.parentId,he.position||0),fe?.(he),ne)});},[a,ae,fe]),Kt=react.useCallback((S,z)=>{O(K=>Ts(K,S,z)),a.onTaskRename?.(S,z);},[a]),Va=react.useCallback(S=>{O(z=>{let{tasks:K}=Ns(z,S);return a.onTaskCreate?.(S,0),K});},[a]),wo=react.useCallback((S,z,K)=>{let ne=S.startDate?Math.round((z.getTime()-S.startDate.getTime())/864e5):0,he=$t=>$t.map(Yt=>Yt.id===S.id?{...Yt,startDate:z,endDate:K,...S.segments&&{segments:S.segments}}:Yt.subtasks?{...Yt,subtasks:he(Yt.subtasks)}:Yt),Pe=he(xe);Pe=se.autoScheduleDependents(Pe,S.id,ne),O(Pe);let Ot={...S,startDate:z,endDate:K};P?.(Ot);},[xe,P]),Nr=react.useCallback((S,z)=>{h?.(S,z),yt({isOpen:true,x:z.clientX,y:z.clientY,task:S});},[h]),Ba=react.useCallback((S,z)=>{let K=se.splitTask(xe,S.id,z);O(K),yt({isOpen:false,x:0,y:0,task:null});},[xe]),ja=react.useCallback(S=>{D?.(S),B||st(S);},[D,B]),xt=react.useCallback((S,z,K)=>{let ne=new Map,he=va=>{va.forEach(Ra=>{Ra.dependencies&&ne.set(Ra.id,Ra.dependencies),Ra.subtasks&&he(Ra.subtasks);});};he(K);let Pe=ne.get(z)||[];ne.set(z,[...Pe,S]);let Ot=new Set,$t=new Set,Yt=va=>{if(!Ot.has(va)){Ot.add(va),$t.add(va);let Ra=ne.get(va)||[];for(let sr of Ra){if(!Ot.has(sr)&&Yt(sr))return true;if($t.has(sr))return true}}return $t.delete(va),false};return Yt(z)},[]),Co=react.useCallback((S,z)=>{if(xt(S.id,z,xe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
277
277
|
|
|
278
|
-
Task dependencies must flow in one direction only.`);return}let q=ie=>ie.map(ye=>{if(ye.id===z){let Me=ye.dependencies||[];if(!Me.includes(N.id))return {...ye,dependencies:[...Me,N.id]}}return ye.subtasks?{...ye,subtasks:q(ye.subtasks)}:ye});$(q(we)),A?.(N.id,z);},[we,A,xr]),Di=react.useCallback((N,z)=>{let q=ie=>ie.map(ye=>{if(ye.id===N&&ye.dependencies){let Me=ye.dependencies.filter(Ft=>Ft!==z);return {...ye,dependencies:Me}}return ye.subtasks?{...ye,subtasks:q(ye.subtasks)}:ye});$(q(we)),G?.(N,z);},[we,G]),{startDate:Ac,endDate:Ic}=react.useMemo(()=>{let N=we.filter(Me=>Me.startDate&&Me.endDate);if(N.length===0){let Me=new Date,Ft=new Date(Me);Ft.setDate(Ft.getDate()-30);let Bt=new Date(Me);return Bt.setDate(Bt.getDate()+60),{startDate:Ft,endDate:Bt}}let z=N.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),q=new Date(Math.min(...z.map(Me=>Me.getTime()))),ie=new Date(Math.max(...z.map(Me=>Me.getTime()))),ye=ne==="day"?7:ne==="week"?14:30;return q.setDate(q.getDate()-ye),ie.setDate(ie.getDate()+ye),{startDate:q,endDate:ie}},[we,ne]),Lc=react.useCallback(async()=>{if(!ce.current)return;let N=await bd__default.default(ce.current,{backgroundColor:pe.bgPrimary,scale:2}),z=document.createElement("a");z.download="gantt-chart.png",z.href=N.toDataURL("image/png"),z.click();},[pe]),Fc=react.useCallback(async()=>{await le.exportToPDF(we);},[we]),Bc=react.useCallback(async()=>{await le.exportToExcel(we);},[we]),Rc=react.useCallback(()=>{let N=le.exportToCSV(we),z=new Blob([N],{type:"text/csv;charset=utf-8;"}),q=document.createElement("a");q.href=URL.createObjectURL(z),q.download="gantt-chart.csv",q.click(),URL.revokeObjectURL(q.href);},[we]),Oc=react.useCallback(()=>{let N=le.exportToJSON(we),z=new Blob([N],{type:"application/json;charset=utf-8;"}),q=document.createElement("a");q.href=URL.createObjectURL(z),q.download="gantt-chart.json",q.click(),URL.revokeObjectURL(q.href);},[we]),$c=react.useCallback(()=>{le.exportToMSProject(we,"Gantt Project","project.xml");},[we]),Uc=N=>{N.preventDefault(),ht(true);};return react.useEffect(()=>{let N=J.current,z=H.current;if(!N||!z)return;let q=z.querySelector(".gantt-taskgrid-content"),ie=()=>{let Vt=N.scrollTop;Pe(Vt),q&&(q.style.transform=`translateY(-${Vt}px)`);},ye=Vt=>{if(Ve&&z){let La=z.parentElement?.getBoundingClientRect()?.left||0,er=Vt.clientX-La,zc=280,Wc=Math.min(window.innerWidth-300,800);er>=zc&&er<=Wc&&pt(er);}},Me=()=>{ht(false);},Ft=z.querySelector(".gantt-grid-scroll")||z,Bt=Vt=>{let fa=Vt;fa.deltaY!==0&&(N.scrollTop+=fa.deltaY,Vt.preventDefault());};return N.addEventListener("scroll",ie),Ft.addEventListener("wheel",Bt,{passive:false}),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Me),()=>{N.removeEventListener("scroll",ie),Ft.removeEventListener("wheel",Bt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Me);}},[Ve]),jsxRuntime.jsx(Ar.Provider,{value:fe,children:jsxRuntime.jsx(Nn.Provider,{value:I,children:jsxRuntime.jsxs("div",{ref:ce,className:"flex flex-col h-full w-full",style:{backgroundColor:pe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Ro,{theme:pe,timeScale:ne,onTimeScaleChange:Z,zoom:te,onZoomChange:X,currentTheme:S,onThemeChange:Kt,rowDensity:Te,onRowDensityChange:P,showThemeSelector:p,showCreateTaskButton:y,createTaskLabel:x,onCreateTask:b,onExportPNG:n?Lc:void 0,onExportPDF:n?Fc:void 0,onExportExcel:n?Bc:void 0,onExportCSV:n?Rc:void 0,onExportJSON:n?Oc:void 0,onExportMSProject:n?$c:void 0}),jsxRuntime.jsxs("div",{ref:H,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:F,overflow:"hidden"},children:jsxRuntime.jsx(zo,{tasks:Ne,theme:pe,rowHeight:qe,availableUsers:m,templates:K,onTaskClick:k,onTaskDblClick:kn,onTaskContextMenu:h,onTaskToggle:zr,scrollTop:Ee,columns:Ce,onToggleColumn:Pt,onColumnResize:Ur,onTaskUpdate:Wa,onTaskIndent:yn,onTaskOutdent:me,onTaskMove:_t,onMultiTaskDelete:Ga,onTaskDuplicate:ho,onTaskCreate:vr,onTaskRename:Aa,onCreateSubtask:Ia,onOpenTaskModal:k?N=>k(N):void 0,onDeleteRequest:(N,z)=>Lt({taskId:N,taskName:z}),onTaskReparent:gt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Uc}),jsxRuntime.jsx("div",{ref:J,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Yo,{tasks:Ne,theme:pe,rowHeight:qe,timeScale:ne,startDate:Ac,endDate:Ic,zoom:te,templates:K,onTaskClick:k,onTaskDblClick:kn,onTaskContextMenu:vn,onTaskDateChange:Tt,onDependencyCreate:Ti,onDependencyDelete:Di})})]}),nt.task&&jsxRuntime.jsx(Ir,{isOpen:nt.isOpen,x:nt.x,y:nt.y,theme:pe,onClose:()=>at({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=nt.task;return N?N.subtasks&&N.subtasks.length>0?[{id:"addSubtask",label:fe.contextMenu?.addSubtask||"Add Subtask",icon:dt.Add,onClick:()=>{T?T(N):Ia(N.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:fe.contextMenu?.deleteTask||"Delete Task",icon:dt.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[{id:"edit",label:fe.contextMenu?.editTask||"Edit Task",icon:dt.Pencil,onClick:()=>{R?R(N):mt(N);}},{id:"addSubtask",label:fe.contextMenu?.addSubtask||"Add Subtask",icon:dt.Add,onClick:()=>{T?T(N):Ia(N.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:fe.contextMenu?.markIncomplete||"Mark Incomplete",icon:dt.MarkIncomplete,onClick:()=>{U?U(N):Wa(N.id,{status:"todo",progress:0});},disabled:N.status==="todo"},{id:"setInProgress",label:fe.contextMenu?.setInProgress||"Set In Progress",icon:dt.SetInProgress,onClick:()=>{W?W(N):Wa(N.id,{status:"in-progress"});},disabled:N.status==="in-progress"},{id:"markComplete",label:fe.contextMenu?.markComplete||"Mark Complete",icon:dt.MarkComplete,onClick:()=>{Wa(N.id,{status:"completed",progress:100});},disabled:N.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:fe.contextMenu?.splitTask||"Split Task",icon:dt.Split,onClick:()=>{if(!N.startDate||!N.endDate){console.warn("Cannot split task without dates");return}let q=N.startDate.getTime(),ie=N.endDate.getTime(),ye=q+(ie-q)/2,Me=new Date(ye);xn(N,Me);},disabled:!N.startDate||!N.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:fe.contextMenu?.deleteTask||"Delete Task",icon:dt.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[]})()}),$t&&jsxRuntime.jsx(Xo,{isOpen:true,onClose:()=>mt(null),task:$t,onSubmit:N=>{Wa($t.id,N),mt(null);},mode:"edit",theme:S}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ut&&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:()=>Lt(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:N=>N.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:pe.bgSecondary,border:`1px solid ${pe.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${pe.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:pe.textPrimary,fontFamily:"Inter, sans-serif"},children:[fe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:pe.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="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:pe.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:pe.textPrimary},children:['"',ut.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:pe.bgPrimary,borderTop:`1px solid ${pe.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:pe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=pe.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ga([ut.taskId]),Lt(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:N=>{N.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Jo,{tasks:we,theme:pe,config:u,onTasksUpdate:$,onTaskUpdate:Wa,onTaskCreate:N=>{$(z=>[...z,N]);},onTaskDelete:N=>{Ga([N]);},onDependencyCreate:(N,z)=>{let q=le.findTaskById(we,N);q&&Ti(q,z);},onDependencyDelete:Di})]})})})});var yd=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let K=ne=>ne.map(he=>{if(he.id===z){let Pe=he.dependencies||[];if(!Pe.includes(S.id))return {...he,dependencies:[...Pe,S.id]}}return he.subtasks?{...he,subtasks:K(he.subtasks)}:he});O(K(xe)),I?.(S.id,z);},[xe,I,xt]),To=react.useCallback((S,z)=>{let K=ne=>ne.map(he=>{if(he.id===S&&he.dependencies){let Pe=he.dependencies.filter(Ot=>Ot!==z);return {...he,dependencies:Pe}}return he.subtasks?{...he,subtasks:K(he.subtasks)}:he});O(K(xe)),G?.(S,z);},[xe,G]),{startDate:Ei,endDate:Vr}=react.useMemo(()=>{let S=xe.filter(Pe=>Pe.startDate&&Pe.endDate);if(S.length===0){let Pe=new Date,Ot=new Date(Pe);Ot.setDate(Ot.getDate()-30);let $t=new Date(Pe);return $t.setDate($t.getDate()+60),{startDate:Ot,endDate:$t}}let z=S.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),K=new Date(Math.min(...z.map(Pe=>Pe.getTime()))),ne=new Date(Math.max(...z.map(Pe=>Pe.getTime()))),he=oe==="day"?7:oe==="week"?14:30;return K.setDate(K.getDate()-he),ne.setDate(ne.getDate()+he),{startDate:K,endDate:ne}},[xe,oe]),Bc=react.useCallback(async()=>{if(!Ie.current)return;let S=await xd__default.default(Ie.current,{backgroundColor:U.bgPrimary,scale:2}),z=document.createElement("a");z.download="gantt-chart.png",z.href=S.toDataURL("image/png"),z.click();},[U]),Rc=react.useCallback(async()=>{await se.exportToPDF(xe);},[xe]),Oc=react.useCallback(async()=>{await se.exportToExcel(xe);},[xe]),$c=react.useCallback(()=>{let S=se.exportToCSV(xe),z=new Blob([S],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(z),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[xe]),zc=react.useCallback(()=>{let S=se.exportToJSON(xe),z=new Blob([S],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(z),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[xe]),Uc=react.useCallback(()=>{se.exportToMSProject(xe,"Gantt Project","project.xml");},[xe]),Wc=S=>{S.preventDefault(),ht(true);};return react.useEffect(()=>{let S=pe.current,z=Ae.current;if(!S||!z)return;let K=z.querySelector(".gantt-taskgrid-content"),ne=()=>{let Yt=S.scrollTop;Ee(Yt),K&&(K.style.transform=`translateY(-${Yt}px)`);},he=Yt=>{if(je&&z){let Ra=z.parentElement?.getBoundingClientRect()?.left||0,sr=Yt.clientX-Ra,Gc=280,Hc=Math.min(window.innerWidth-300,800);sr>=Gc&&sr<=Hc&&nt(sr);}},Pe=()=>{ht(false);},Ot=z.querySelector(".gantt-grid-scroll")||z,$t=Yt=>{let va=Yt;va.deltaY!==0&&(S.scrollTop+=va.deltaY,Yt.preventDefault());};return S.addEventListener("scroll",ne),Ot.addEventListener("wheel",$t,{passive:false}),document.addEventListener("mousemove",he),document.addEventListener("mouseup",Pe),()=>{S.removeEventListener("scroll",ne),Ot.removeEventListener("wheel",$t),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Pe);}},[je]),jsxRuntime.jsx(Or.Provider,{value:be,children:jsxRuntime.jsx(Pn.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:Ie,className:"flex flex-col h-full w-full",style:{backgroundColor:U.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Ho,{theme:U,timeScale:oe,onTimeScaleChange:q,zoom:te,onZoomChange:Y,currentTheme:E,onThemeChange:Qt,rowDensity:De,onRowDensityChange:M,showThemeSelector:p,showCreateTaskButton:y,createTaskLabel:x,onCreateTask:b,onExportPNG:n?Bc:void 0,onExportPDF:n?Rc:void 0,onExportExcel:n?Oc:void 0,onExportCSV:n?$c:void 0,onExportJSON:n?zc:void 0,onExportMSProject:n?Uc:void 0}),jsxRuntime.jsxs("div",{ref:Ae,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ge,overflow:"hidden"},children:jsxRuntime.jsx(Ko,{tasks:me,theme:U,rowHeight:Te,availableUsers:m,templates:X,onTaskClick:k,onTaskDblClick:ja,onTaskContextMenu:h,onTaskToggle:At,scrollTop:Se,columns:Ce,onToggleColumn:Mt,onColumnResize:St,onTaskUpdate:Xt,onTaskIndent:ut,onTaskOutdent:Dr,onTaskMove:_a,onMultiTaskDelete:nr,onTaskDuplicate:le,onTaskCreate:gt,onTaskRename:Kt,onCreateSubtask:Va,onOpenTaskModal:k?S=>k(S):void 0,onDeleteRequest:(S,z)=>mt({taskId:S,taskName:z}),onTaskReparent:or})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Wc}),jsxRuntime.jsx("div",{ref:pe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(tn,{tasks:me,theme:U,rowHeight:Te,timeScale:oe,startDate:Ei,endDate:Vr,zoom:te,templates:X,onTaskClick:k,onTaskDblClick:ja,onTaskContextMenu:Nr,onTaskDateChange:wo,onDependencyCreate:Co,onDependencyDelete:To})})]}),Nt.task&&jsxRuntime.jsx($r,{isOpen:Nt.isOpen,x:Nt.x,y:Nt.y,theme:U,onClose:()=>yt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=Nt.task;return S?S.subtasks&&S.subtasks.length>0?[{id:"addSubtask",label:be.contextMenu?.addSubtask||"Add Subtask",icon:ct.Add,onClick:()=>{T?T(S):Va(S.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:be.contextMenu?.deleteTask||"Delete Task",icon:ct.Delete,onClick:()=>{mt({taskId:S.id,taskName:S.name});}}]:[{id:"edit",label:be.contextMenu?.editTask||"Edit Task",icon:ct.Pencil,onClick:()=>{B?B(S):st(S);}},{id:"addSubtask",label:be.contextMenu?.addSubtask||"Add Subtask",icon:ct.Add,onClick:()=>{T?T(S):Va(S.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:be.contextMenu?.markIncomplete||"Mark Incomplete",icon:ct.MarkIncomplete,onClick:()=>{$?$(S):Xt(S.id,{status:"todo",progress:0});},disabled:S.status==="todo"},{id:"setInProgress",label:be.contextMenu?.setInProgress||"Set In Progress",icon:ct.SetInProgress,onClick:()=>{W?W(S):Xt(S.id,{status:"in-progress"});},disabled:S.status==="in-progress"},{id:"markComplete",label:be.contextMenu?.markComplete||"Mark Complete",icon:ct.MarkComplete,onClick:()=>{Xt(S.id,{status:"completed",progress:100});},disabled:S.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:be.contextMenu?.splitTask||"Split Task",icon:ct.Split,onClick:()=>{if(!S.startDate||!S.endDate){console.warn("Cannot split task without dates");return}let K=S.startDate.getTime(),ne=S.endDate.getTime(),he=K+(ne-K)/2,Pe=new Date(he);Ba(S,Pe);},disabled:!S.startDate||!S.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:be.contextMenu?.deleteTask||"Delete Task",icon:ct.Delete,onClick:()=>{mt({taskId:S.id,taskName:S.name});}}]:[]})()}),Wt&&jsxRuntime.jsx(rn,{isOpen:true,onClose:()=>st(null),task:Wt,onSubmit:S=>{Xt(Wt.id,S),st(null);},mode:"edit",theme:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&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:()=>mt(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:S=>S.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:U.bgSecondary,border:`1px solid ${U.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${U.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:U.textPrimary,fontFamily:"Inter, sans-serif"},children:[be.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:U.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="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:U.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:U.textPrimary},children:['"',tt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:U.bgPrimary,borderTop:`1px solid ${U.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>mt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:U.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=U.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{nr([tt.taskId]),mt(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:S=>{S.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(on,{tasks:xe,theme:U,config:u,onTasksUpdate:O,onTaskUpdate:Xt,onTaskCreate:S=>{O(z=>[...z,S]);},onTaskDelete:S=>{nr([S]);},onDependencyCreate:(S,z)=>{let K=se.findTaskById(xe,S);K&&Co(K,z);},onDependencyDelete:To})]})})})});var wd=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
279
279
|
|
|
280
280
|
AVAILABLE COMMANDS:
|
|
281
281
|
1. move_task - Move a task to a different date
|
|
@@ -316,39 +316,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
316
316
|
|
|
317
317
|
Always try to match task names case-insensitively and handle partial matches.
|
|
318
318
|
If you can't find a task by name, search through the provided task list.
|
|
319
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
320
|
-
${
|
|
319
|
+
If ambiguous, ask for clarification in the message field.`;function Cd(e){return `CURRENT TASKS:
|
|
320
|
+
${Td(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",d=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${d}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function xd(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ua(e,t){let a=xd(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return d.every(n=>p.includes(n))})}function Is(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 i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}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 u={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(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;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 i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=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(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let m={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 i=m[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Ls(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 Fs(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 kd(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 wd(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 n=r[1].trim(),m=r[2].trim(),l=Ua(t,n),i=Is(m);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),l=Ua(t,n),i=Ls(m);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.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 n=s[1].trim(),m=s[2].trim(),l=Ua(t,n),i=Fs(m);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),m=d[2].trim(),l=Ua(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:m},message:`Renamed "${l.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),l=Ua(t,n),i=Ua(t,m);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ua(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Cd(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 ef(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 tf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qo(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let l=a.find(i=>i.id===m);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Qo(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let d=m=>{if(m)return typeof m=="string"?new Date(m):m},c=d(e.startDate),p=d(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:ef(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:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Td(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:tf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Dd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qo(r,e,t))}var Bs={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},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"}},Rs={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},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"}},en={en:Bs,es:Rs};function Os(e){return en[e]||en.en}function tn(e,t){let a=Os(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}function Pd(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(...Pd(r.subtasks,t+1));return a}function uf({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function Md({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:l=true}=t,i=tn(p,n),u=c==="dark",[v,f]=react.useState(new Set),[y,x]=react.useState("startDate"),[b,g]=react.useState("asc"),[k,D]=react.useState("");react.useMemo(()=>{let T=new Set;function U(W){for(let A of W)A.subtasks?.length&&(T.add(A.id),U(A.subtasks));}U(e),f(T);},[e]);let h=react.useCallback(T=>{f(U=>{let W=new Set(U);return W.has(T)?W.delete(T):W.add(T),W}),a.onTaskToggleExpand?.(T);},[a]),E=react.useCallback(T=>{y===T?g(U=>U==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),C=react.useMemo(()=>{let T=Pd(e);if(k.trim()){let W=k.toLowerCase();T=T.filter(A=>A.name.toLowerCase().includes(W));}let U=[];for(let W of T){let A=W.level===0;W.level>0&&(A=true),(A||k.trim())&&U.push(W);}return k.trim()&&U.sort((W,A)=>{let G,re;switch(y){case "name":G=W.name.toLowerCase(),re=A.name.toLowerCase();break;case "startDate":G=W.startDate?.getTime()||0,re=A.startDate?.getTime()||0;break;case "endDate":G=W.endDate?.getTime()||0,re=A.endDate?.getTime()||0;break;case "progress":G=W.progress||0,re=A.progress||0;break;case "status":G=W.status||"todo",re=A.status||"todo";break;default:return 0}return G<re?b==="asc"?-1:1:G>re?b==="asc"?1:-1:0}),U},[e,k,y,b]),R=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:w("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:w("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:w("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>E("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>E("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>E("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>E("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>E("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((T,U)=>{let W=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:U*.02},className:w("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:A=>{A.stopPropagation(),h(T.id);},className:w("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:W?jsxRuntime.jsx(lucideReact.ChevronDown,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:A=>{A.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(uf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:w("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:w("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),R(T.startDate)]}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),R(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:w("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:w("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:w(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var $s={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Us={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"},zs={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"},rn={dark:$s,light:Us,neutral:zs};function Ad(e){return rn[e]||rn.dark}var Ws={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gs={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},on={en:Ws,es:Gs};function lo(e){return on[e]||on.en}function nn(e,t){let a=lo(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 Id(e){let t=lo(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 Ld(e,t=0,a=true){let r=lo(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 Nf(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 Ks(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 Rd({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function $d({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,l=nn(n,m),i=p==="dark",[u,v]=react.useState(r||new Date),[f,y]=react.useState(null),[x,b]=react.useState(null),[g,k]=react.useState(null),[D,h]=react.useState(new Date),[E,C]=react.useState({}),R=4,T=3,[U,W]=react.useState(false),[A,G]=react.useState(false),[re,be]=react.useState(false),[_,Ae]=react.useState(null),[Fe,B]=react.useState(""),[L,O]=react.useState(void 0),[S,Y]=react.useState(null),[ne,Z]=react.useState(false),[Te,P]=react.useState(false),[te,X]=react.useState(null),[Ee,Pe]=react.useState(false),[Ve,ht]=react.useState(new Date),Se=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),pt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),nt=react.useCallback(()=>{v(new Date);},[]),at=react.useMemo(()=>{let $=u.getFullYear(),De=u.getMonth(),Ge=new Date($,De,1),We=new Date($,De+1,0),yt=Ge.getDay(),Q=We.getDate(),ae=Nf(e),xe=new Date;xe.setHours(0,0,0,0);let fe=[],oe=yt,Ce=new Date($,De,0).getDate();for(let ke=oe-1;ke>=0;ke--){let F=new Date($,De-1,Ce-ke);fe.push({date:F,isCurrentMonth:false,isToday:false,isWeekend:F.getDay()===0||F.getDay()===6,events:ae.filter(H=>Ks(F,H)).map(H=>({id:H.id,title:H.name,start:H.startDate,end:H.endDate,task:H}))});}for(let ke=1;ke<=Q;ke++){let F=new Date($,De,ke),H=F.getTime()===xe.getTime();fe.push({date:F,isCurrentMonth:true,isToday:H,isWeekend:F.getDay()===0||F.getDay()===6,events:ae.filter(J=>Ks(F,J)).map(J=>({id:J.id,title:J.name,start:J.startDate,end:J.endDate,task:J}))});}let he=42-fe.length;for(let ke=1;ke<=he;ke++){let F=new Date($,De+1,ke);fe.push({date:F,isCurrentMonth:false,isToday:false,isWeekend:F.getDay()===0||F.getDay()===6,events:ae.filter(H=>Ks(F,H)).map(H=>({id:H.id,title:H.name,start:H.startDate,end:H.endDate,task:H}))});}return fe},[u,e]),$t=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],mt=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ut=react.useCallback(($,De)=>{if(!f)return;let Ge={...f,[$]:De};y(Ge),a.onTaskUpdate?.(Ge);},[f,a]),Lt=react.useCallback($=>{if(!f)return;let De=f.progress||0;$==="completed"?De=100:$==="todo"&&(De=0);let Ge={...f,status:$,progress:De};y(Ge),a.onTaskUpdate?.(Ge),W(false);},[f,a]),Kt=react.useCallback(($,De)=>{if(!f)return;let Ge={...f,startDate:$,endDate:De};y(Ge),a.onTaskUpdate?.(Ge);},[f,a]),we=react.useCallback(()=>{W(false),G(false),k(null);},[]);return o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:w("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:mt}),jsxRuntime.jsx("button",{onClick:nt,className:w("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Se,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:pt,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:$t.map($=>jsxRuntime.jsx("div",{className:w("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:$},$))}),jsxRuntime.jsx("div",{className:w("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:at.map(($,De)=>{let Ge=$.date.getDay()===0||$.date.getDay()===6;return jsxRuntime.jsxs("div",{className:w("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?Ge?"bg-[#1C1F26]":$.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ge?"bg-gray-100":$.isCurrentMonth?"bg-white":"bg-gray-50",$.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let We=E[De]||R,yt=$.events.slice(0,We),Q=$.events.length-We;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[yt.map(ae=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(ae.task),a.onEventClick?.(ae);},whileHover:{scale:1.02},className:w("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ae.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Rd,{task:ae.task}),jsxRuntime.jsx("span",{className:"truncate",children:ae.title})]})},ae.id)),Q>0&&jsxRuntime.jsxs("button",{onClick:ae=>{ae.stopPropagation(),C(xe=>({...xe,[De]:We+T}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Q," ",n==="es"?"M\xC1S":"MORE"]}),We>R&&$.events.length>R&&jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),C(xe=>({...xe,[De]:R}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let We=De>=28,yt=De%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),_===De?Ae(null):(Ae(De),B(""),O(void 0),Y(null),X(null),Z(false),P(false),Pe(false),ht($.date));},className:w("w-5 h-5 rounded flex items-center justify-center transition-all",_===De?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:w("w-3.5 h-3.5 transition-transform",_===De&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_===De&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(null),B(""),O(void 0),Y(null),X(null),Z(false),P(false),Pe(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:w("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",yt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Q=>{Q.stopPropagation(),Z(false),P(false),Pe(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Fe,onChange:Q=>B(Q.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:w("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Q=>{if(Q.key==="Enter"&&Fe.trim()){let ae=t.availableUsers?.find(fe=>fe.id===S),xe=te||$.date;a.onTaskCreate?.({name:Fe.trim(),startDate:xe,endDate:xe,priority:L,assignees:ae?[ae]:void 0}),B(""),O(void 0),Y(null),X(null),Ae(null);}Q.key==="Escape"&&(Ae(null),B(""),O(void 0),Y(null),X(null));}})}),jsxRuntime.jsxs("div",{className:w("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"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(),Z(!ne),P(false);},className:w("p-1 rounded transition-colors",L?L==="urgent"||L==="high"?"text-red-400 bg-red-500/20":L==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Q=>Q.stopPropagation(),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(Q=>jsxRuntime.jsxs("button",{onClick:()=>{O(Q.id),Z(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",L===Q.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",Q.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Q.label})]},Q.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),Pe(!Ee),Z(false),P(false),ht(te||$.date);},className:w("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",te?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(te||$.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Q=>Q.stopPropagation(),children:[jsxRuntime.jsx("div",{className:w("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let Q=new Date,ae=new Date(Q);ae.setDate(Q.getDate()+1);let xe=new Date(Q);xe.setDate(Q.getDate()+((6-Q.getDay()+7)%7||7));let fe=new Date(Q);fe.setDate(Q.getDate()+((1-Q.getDay()+7)%7||7));let oe=new Date(Q);oe.setDate(Q.getDate()+14);let Ce=new Date(Q);return Ce.setDate(Q.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:fe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:oe,display:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ke,F)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{X(ke.date),Pe(false);},children:[jsxRuntime.jsx("span",{children:ke.label}),jsxRuntime.jsx("span",{className:w("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:ke.display})]},F))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:w("text-xs font-medium",i?"text-white":"text-gray-900"),children:Ve.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>ht(new Date),className:w("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(Ve.getFullYear(),Ve.getMonth()-1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(Ve.getFullYear(),Ve.getMonth()+1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Q=>jsxRuntime.jsx("div",{className:w("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Q},Q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Q=Ve.getFullYear(),ae=Ve.getMonth(),xe=new Date(Q,ae,1).getDay(),fe=new Date(Q,ae+1,0).getDate(),oe=new Date(Q,ae,0).getDate(),Ce=new Date,he=[];for(let F=xe-1;F>=0;F--)he.push({dayNum:oe-F,isCurrentMonth:false,date:new Date(Q,ae-1,oe-F)});for(let F=1;F<=fe;F++)he.push({dayNum:F,isCurrentMonth:true,date:new Date(Q,ae,F)});let ke=42-he.length;for(let F=1;F<=ke;F++)he.push({dayNum:F,isCurrentMonth:false,date:new Date(Q,ae+1,F)});return he.map((F,H)=>{let J=F.date.toDateString()===Ce.toDateString(),ce=(te||$.date).toDateString()===F.date.toDateString();return jsxRuntime.jsx("button",{className:w("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!F.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(i?"text-white":"text-gray-900"),J&&"ring-1 ring-[#3B82F6]",ce&&"bg-[#7C3AED] text-white",!ce&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{X(F.date),Pe(false);},children:F.dayNum},H)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),P(!Te),Z(false);},className:w("p-1 rounded transition-colors",S?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:S?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(Q=>Q.id===S)?.color||"#7C3AED"},children:t.availableUsers?.find(Q=>Q.id===S)?.initials||t.availableUsers?.find(Q=>Q.id===S)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Te&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Q=>Q.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{Y(null),P(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!S&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:w("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Q=>jsxRuntime.jsxs("button",{onClick:()=>{Y(Q.id),P(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===Q.id&&(i?"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-medium",style:{backgroundColor:Q.color||"#7C3AED"},children:Q.initials||Q.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Q.name})]},Q.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:w("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Fe.trim()){let Q=t.availableUsers?.find(xe=>xe.id===S),ae=te||$.date;a.onTaskCreate?.({name:Fe.trim(),startDate:ae,endDate:ae,priority:L,assignees:Q?[Q]:void 0}),B(""),O(void 0),Y(null),X(null),Ae(null);}},disabled:!Fe.trim(),className:w("px-2.5 py-1 rounded text-xs font-medium transition-colors",Fe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:w("text-sm font-medium",$.isToday?"text-[#3B82F6]":$.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:$.date.getDate()})]})]},De)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),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:w("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:w("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:w("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:w("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:w("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>y(null),className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let $=f.progress===100?0:100,Ge={...f,progress:$,status:$===100?"completed":"todo"};y(Ge),a.onTaskUpdate?.(Ge);},className:w("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"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("h2",{className:w("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),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:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{we(),W(!U);},className:w("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":i?"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:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map($=>jsxRuntime.jsxs("button",{onClick:()=>Lt($.id),className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===$.id||$.id==="completed"&&f.progress===100||$.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||$.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",$.id==="completed"?"bg-green-500":$.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:$.label})]},$.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map(($,De)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:$.color||"#8B5CF6"},title:$.name,children:$.initials||$.name.slice(0,2).toUpperCase()},De)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(g?null:"start"),h(f.startDate||new Date);},className:w("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:w("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:$=>{$.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:w("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:w("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let $=new Date,De=new Date($);De.setDate($.getDate()+1);let Ge=new Date($);Ge.setDate($.getDate()+((6-$.getDay()+7)%7||7));let We=new Date($);We.setDate($.getDate()+((1-$.getDay()+7)%7||7));let yt=new Date($);yt.setDate($.getDate()+(6-$.getDay()+7)%7+7);let Q=new Date($);Q.setDate($.getDate()+14);let ae=new Date($);return ae.setDate($.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:$,display:$.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:Ge,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:We,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:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((fe,oe)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Ce=f.endDate&&fe.date>f.endDate?fe.date:f.endDate;Kt(fe.date,Ce),k("end");}else {let Ce=f.startDate&&fe.date<f.startDate?fe.date:f.startDate;Kt(Ce,fe.date),k(null);}},children:[jsxRuntime.jsx("span",{children:fe.label}),jsxRuntime.jsx("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:fe.display})]},oe))})(),jsxRuntime.jsx("div",{className:w("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Kt(void 0,void 0),k(null);},className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:w("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="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:w("font-medium",i?"text-white":"text-gray-900"),children:D.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:()=>h(new Date),className:w("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()+1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),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($=>jsxRuntime.jsx("div",{className:w("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:$},$))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=D.getFullYear(),De=D.getMonth(),Ge=new Date($,De,1).getDay(),We=new Date($,De+1,0).getDate(),yt=new Date($,De,0).getDate(),Q=new Date,ae=[];for(let fe=Ge-1;fe>=0;fe--)ae.push({day:yt-fe,isCurrentMonth:false,date:new Date($,De-1,yt-fe)});for(let fe=1;fe<=We;fe++)ae.push({day:fe,isCurrentMonth:true,date:new Date($,De,fe)});let xe=42-ae.length;for(let fe=1;fe<=xe;fe++)ae.push({day:fe,isCurrentMonth:false,date:new Date($,De+1,fe)});return ae.map((fe,oe)=>{let Ce=fe.date.toDateString()===Q.toDateString(),he=f.startDate?.toDateString()===fe.date.toDateString(),ke=f.endDate?.toDateString()===fe.date.toDateString(),F=he||ke,H=f.startDate&&f.endDate&&fe.date>=f.startDate&&fe.date<=f.endDate;return jsxRuntime.jsx("button",{className:w("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!fe.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),fe.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#3B82F6]",he&&"bg-[#3B82F6] text-white",ke&&!he&&"bg-[#7C3AED] text-white",H&&!F&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!F&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let J=new Date(fe.date);if(g==="start"){let ce=f.endDate&&J>f.endDate?J:f.endDate;Kt(J,ce),k("end");}else {let ce=f.startDate&&J<f.startDate?J:f.startDate;Kt(ce,J),k(null);}},children:fe.day},oe)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{we(),G(!A);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer 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":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map($=>jsxRuntime.jsxs("button",{onClick:()=>{ut("priority",$.id),G(false);},className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===$.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",$.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:$.label})]},$.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"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:w("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"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:$=>{let De=parseInt($.target.value),Ge=f.status;De===100?Ge="completed":De>0?Ge="in-progress":Ge="todo";let We={...f,progress:De,status:Ge};y(We),a.onTaskUpdate?.(We);},onBlur:()=>be(false),className:w("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>be(true),className:w("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map($=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",$.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:$.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:w("text-sm",$.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:$.name})]},$.id))}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:w("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:w("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:w("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:w("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:w("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:w("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:w("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:w("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:w("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 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:w("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",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:w("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map($=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),y($.task);},className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Rd,{task:$.task}),jsxRuntime.jsx("span",{className:w("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:$.title}),$.task.priority==="high"||$.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},$.id))})]})]})})]})}var Ys={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},qs={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"},Xs={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"},cn={dark:Ys,light:qs,neutral:Xs};function Ud(e){return cn[e]||cn.dark}function Ef({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=react.useMemo(()=>{let u=m.length,v=new Set(m.flatMap(x=>x.assignedUserIds||[])).size,f=m.map(x=>x.priority).filter(Boolean),y=new Set(m.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:w("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,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:w("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"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(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:m.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:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.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"})]})})]},u.id))})})]})}var Wd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function co(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 po(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 Gd(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 Hd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let p=react.useMemo(()=>({...Wd,...d}),[d]),[n,m]=react.useState(new Set),l=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let k=g.timestamp.toISOString().split("T")[0],D=b.get(k);D?D.push(g):b.set(k,[g]);}),Array.from(b.entries()).sort((g,k)=>k[0].localeCompare(g[0])).map(([g,k])=>({date:new Date(g),events:k.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(k=>{b.add(k.userId),g.add(k.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{m(g=>{let k=new Set(g);return k.has(b)?k.delete(b):k.add(b),k});},y=b=>{let k=new Date().getTime()-b.getTime(),D=Math.floor(k/6e4),h=Math.floor(k/36e5),E=Math.floor(k/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:E<7?`${E}d ago`:b.toLocaleDateString()},x=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:w("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:w("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[po(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,k)=>{let D=n.has(g.id),h=s===g.id,E=Gd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:w("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:po(g.type)})}),k<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),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:[p.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:co(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),f(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([C,R])=>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(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},C)),g.metadata&&Object.keys(g.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(g.metadata).map(([C,R])=>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(R)})]},C))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function Vd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:w("history-replay-empty",n),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:w("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&po(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&co(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:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:w("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:co(u)},u.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:d,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:m.map(u=>jsxRuntime.jsxs("button",{className:w("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),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(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:w("history-replay-start",n),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 Js(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 Zs(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 jd(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 Kd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ff(e,t,a,r,o,s=100){let d=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;d.forEach(m=>{let l=a/2,i=r/2;m.vx+=(l-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,d.forEach(u=>{if(m.id===u.id)return;let v=m.x-u.x,f=m.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);m.vx+=v/y*x,m.vy+=f/y*x;});}),t.forEach(m=>{let l=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return d}function Yd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:p}){let n=react.useRef(null),[m,l]=react.useState([]),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(1),[k,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let A=Ff(e,t,a.width,a.height,a,150);l(A);},[e,t,a]);let h=react.useCallback((A,G)=>{a.enableDragging&&(G.stopPropagation(),u(A));},[a.enableDragging]),E=react.useCallback(A=>{if(!i||!n.current)return;let re=n.current.getBoundingClientRect(),be=(A.clientX-re.left-k.x)/b,_=(A.clientY-re.top-k.y)/b;l(Ae=>Ae.map(Fe=>Fe.id===i?{...Fe,x:be,y:_,fx:be,fy:_}:Fe));},[i,b,k]),C=react.useCallback(()=>{u(null);},[]),R=react.useCallback((A,G)=>{G.stopPropagation(),c?.({type:"node-click",node:A,position:{x:G.clientX,y:G.clientY}});},[c]),T=react.useCallback((A,G)=>{G.stopPropagation(),c?.({type:"edge-click",edge:A,position:{x:G.clientX,y:G.clientY}});},[c]),U=react.useCallback(A=>{let G=m.find(re=>re.id===A);return G?{x:G.x,y:G.y}:{x:0,y:0}},[m]),W=react.useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let G=A.card.priority;return G==="URGENT"?"#ef4444":G==="HIGH"?"#f59e0b":G==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:w("relationships-graph-empty",p),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:w("relationships-graph",p),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:d.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:d.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:()=>g(A=>Math.min(A+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(A=>A.type))).map(A=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Js(A)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[jd(A)," ",Zs(A)]})]},A))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let G=U(typeof A.source=="string"?A.source:A.source.id),re=U(typeof A.target=="string"?A.target:A.target.id),be=Kd(A.type),_=y===A.id,Ae=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-edge",_&&"hovered",Ae&&"critical"),onMouseEnter:()=>x(A.id),onMouseLeave:()=>x(null),onClick:Fe=>T(A,Fe),children:[jsxRuntime.jsx("line",{x1:G.x,y1:G.y,x2:re.x,y2:re.y,stroke:Js(A.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:_?1:.6,markerEnd:be?"url(#arrowhead)":void 0}),a.showEdgeLabels&&_&&jsxRuntime.jsx("text",{x:(G.x+re.x)/2,y:(G.y+re.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Zs(A.type)})]},A.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(A=>{let G=v===A.id,re=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-node",G&&"hovered",re&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:be=>h(A.id,be),onMouseEnter:()=>f(A.id),onMouseLeave:()=>f(null),onClick:be=>R(A,be),children:[jsxRuntime.jsx("circle",{r:re?a.nodeSize*1.2:a.nodeSize,fill:W(A),stroke:re?"#fbbf24":"#ffffff",strokeWidth:re?3:2,opacity:G?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:A.card.title.length>20?A.card.title.substring(0,20)+"...":A.card.title})]},A.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 Jd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[l,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),m(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){p(true),m(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{p(false);}}},x=()=>{l&&(a(l),f());};return e?jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),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:b=>b.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:f,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: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((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),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((b,g)=>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:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),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:u,value:s,onChange:b=>d(b.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."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),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((b,g)=>jsxRuntime.jsx("button",{onClick:()=>d(b),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:b},g))})]})]})}),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:f,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"}),l?jsxRuntime.jsx("button",{onClick:x,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, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qs={"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 Rf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Of={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 $f(e,t,a){let r=Qs[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function mo(e){return `$${e.toFixed(4)}`}var ei=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=$f(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,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),p=a.reduce((l,i)=>l+i.duration,0),n={},m={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,m[l.feature]=(m[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.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,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=d).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=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)}},fr=new ei;function ec({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(fr.getStats()),[s,d]=react.useState(fr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(fr.getStats()),d(fr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=fr.getRecentOperations(5);return jsxRuntime.jsxs(Ye,{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:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:mo(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(([p,n])=>{let m=r.costsByFeature[p]||0,l=r.totalOperations>0?n/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:p.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:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mo(m)})]})]}),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}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 rc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[p,n]=react.useState(""),[m,l]=react.useState(""),[i,u]=react.useState(false),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(null),k=react.useRef(null),D=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let T=U=>{U.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let h=()=>{D||(c(""),n(""),l(""),f(null),x(null),g(null),t());},E=async()=>{if(!(!d.trim()||D)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{y&&(a(y),h());};if(!e)return null;let R=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:T=>T.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:h,disabled:D,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:[b?.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"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.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:[b.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((T,U)=>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:["#",U+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.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"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.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:k,value:d,onChange:T=>c(T.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:D}),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:p,onChange:T=>n(T.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:D})]}),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:m,onChange:T=>l(T.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:D})]})]}),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((T,U)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,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:T},U))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:D,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:E,disabled:!d.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function un({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&ko(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(y,x,b)=>{r(g=>{let k=g.cards.find(T=>T.id===y);if(!k)return g;let D=k.columnId,h={...k,columnId:x,position:b},E=g.cards.map(T=>T.id===y?h:T),C=g.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter(U=>U!==y)};if(T.id===x){let U=E.filter(W=>W.columnId===x).sort((W,A)=>W.position-A.position);return {...T,cardIds:U.map(W=>W.id)}}return T}),R={...g,cards:E,columns:C};return o(R),R});},[o]),d=react.useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(D=>D.id===y?{...D,...x}:D),k={...b,cards:g};return o(k),k});},[o]),c=react.useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},k=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),D={...b,cards:[...b.cards,g],columns:k};return o(D),D});},[o]),p=react.useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),k=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(E=>E!==y)}:h),D={...x,cards:g,columns:k};return o(D),D});},[o]),n=react.useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},k={...b,columns:[...b.columns,g]};return o(k),k});},[o]),m=react.useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(D=>D.id===y?{...D,...x}:D),k={...b,columns:g};return o(k),k});},[o]),l=react.useCallback(async y=>{r(x=>{let b=x.cards.filter(D=>D.columnId!==y),g=x.columns.filter(D=>D.id!==y),k={...x,cards:b,columns:g};return o(k),k});},[o]),i=react.useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=react.useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=react.useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:l,clearBoard:v}}}function nc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=un({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(l=>l.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:p,position:n??m+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:d}}var uo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ic={by:"none",order:"asc"};function lc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...uo,...e}),[s,d]=react.useState({...ic,...t}),c=react.useCallback(f=>{o(y=>({...y,...f}));},[]),p=react.useCallback(f=>{d(y=>({...y,...f}));},[]),n=react.useCallback(()=>{o(uo),d(ic);},[]),m=react.useCallback(()=>{a&&o({...uo,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...uo,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...uo,priorities:["HIGH","URGENT"]});},[]),u=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(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),k=String(x.getDate()).padStart(2,"0"),D=`${b}-${g}-${k}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let E=h.endDate||h.dueDate;if(!E)return false;let C;if(typeof E=="string")C=E.split("T")[0]||E;else {let R=E.getUTCFullYear(),T=String(E.getUTCMonth()+1).padStart(2,"0"),U=String(E.getUTCDate()).padStart(2,"0");C=`${R}-${T}-${U}`;}switch(r.dateFilter){case "overdue":return C<D;case "today":return C===D;case "this-week":let R=new Date(D+"T00:00:00"),T=new Date(C+"T00:00:00"),U=new Date(R);return U.setDate(U.getDate()+7),T>=R&&T<=U;case "custom":if(r.dateRange){let W=typeof E=="string"?new Date(E):E;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let k=x.createdAt?new Date(x.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;g=k-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=h[x.priority||"LOW"],C=h[b.priority||"LOW"];g=E-C;break;case "dueDate":let R=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!R)return 1;if(!T)return -1;let U=typeof R=="string"?new Date(R).getTime():R.getTime(),W=typeof T=="string"?new Date(T).getTime():T.getTime();g=U-W;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let A=x.estimatedTime||0,G=b.estimatedTime||0;g=A-G;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var cc,pc;if(typeof window<"u")try{let e=yo("ai");cc=e.generateObject,pc=e.generateText;}catch{}function mc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(cc&&pc&&e.apiKey),d=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(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}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("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=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(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=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(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=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(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function ai(){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 uc(e){let{cards:t}=e,[a,r]=ai(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(C=>C.columnId===f.columnId).sort((C,R)=>C.position-R.position),b=x.findIndex(C=>C.id===a.lastSelectedCardId),g=x.findIndex(C=>C.id===l),[k,D]=b<g?[b,g]:[g,b],h=x.slice(k,D+1).map(C=>C.id),E=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:E,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),m=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:d,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var gc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function fc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...gc,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(D=>D.columnId===x).length,createdAt:new Date};d(D=>[...D,k]);},[o.minCardsPerStack,s]),p=react.useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=react.useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),m=react.useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=react.useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(k=>k!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=react.useCallback(async f=>{let y=t.filter(D=>D.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(D);});}),b.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(E=>E.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(D);});}),g.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(E=>E.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(y.forEach(D=>{D.priority&&(k.has(D.priority)||k.set(D.priority,[]),k.get(D.priority).push(D));}),k.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${E} ${h} Priority`,cardIds:D.map(C=>C.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of y){let E=(await r.findSimilar(D,y)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let C=[D.id,...E.map(T=>T.card.id)],R=E.reduce((T,U)=>T+U.similarity,0)/E.length;x.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:C,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:R});}}return x.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var bc=react.createContext(null);function hc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(p=>{let{Column:n}=yo("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=yo("@libxai/core");d.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=yo("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(bc.Provider,{value:{store:o},children:e})}function gn(){let e=react.useContext(bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function fo(){let e=gn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(b=>{e.updateBoard(b);},[e]),p=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,k)=>{e.moveCard(b,g,k);},[e]),y=react.useCallback(b=>e.getCard(b),[e]),x=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function vc(e){let{cards:t}=fo();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 xc(e="position",t="asc"){let{cards:a}=fo();return react.useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=p-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var fn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ei.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 d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{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(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},tb=new fn;function wc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=p?p(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function Cc(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 Dc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=p?p(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function Nc(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 Sc(e,t=10){return e>t}var si={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ii={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},li={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},di={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ci={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},pi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},mi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ui={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)"},gi={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)"},fi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bi={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}},hi={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}},bn={spacing:si,borderRadius:ii,fontSize:li,fontWeight:di,lineHeight:ci,zIndex:pi,duration:mi,easing:ui,shadows:gi,opacity:fi,kanban:bi,gantt:hi};function Ec(e,t,a){return e[t]??a}function yi(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)?yi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function ob(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vi(e="asakaa"){let t=yi(bn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=ob(o);a.push(` ${s}: ${d};`);}return `:root {
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Td(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ga(e,t){let a=Td(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return d.every(n=>p.includes(n))})}function Rs(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 i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}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 u={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(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;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 i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=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(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let m={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 i=m[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Os(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 $s(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 Dd(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 Nd(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 n=r[1].trim(),m=r[2].trim(),l=Ga(t,n),i=Rs(m);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),l=Ga(t,n),i=Os(m);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.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 n=s[1].trim(),m=s[2].trim(),l=Ga(t,n),i=$s(m);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),m=d[2].trim(),l=Ga(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:m},message:`Renamed "${l.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),l=Ga(t,n),i=Ga(t,m);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ga(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Sd(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 ef(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 tf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function sn(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let l=a.find(i=>i.id===m);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>sn(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let d=m=>{if(m)return typeof m=="string"?new Date(m):m},c=d(e.startDate),p=d(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:ef(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:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Ed(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:tf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Pd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>sn(r,e,t))}var zs={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},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"}},Us={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},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"}},ln={en:zs,es:Us};function Ws(e){return ln[e]||ln.en}function dn(e,t){let a=Ws(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}function Ld(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(...Ld(r.subtasks,t+1));return a}function uf({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function Fd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:l=true}=t,i=dn(p,n),u=c==="dark",[v,f]=react.useState(new Set),[y,x]=react.useState("startDate"),[b,g]=react.useState("asc"),[k,D]=react.useState("");react.useMemo(()=>{let T=new Set;function $(W){for(let I of W)I.subtasks?.length&&(T.add(I.id),$(I.subtasks));}$(e),f(T);},[e]);let h=react.useCallback(T=>{f($=>{let W=new Set($);return W.has(T)?W.delete(T):W.add(T),W}),a.onTaskToggleExpand?.(T);},[a]),P=react.useCallback(T=>{y===T?g($=>$==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),C=react.useMemo(()=>{let T=Ld(e);if(k.trim()){let W=k.toLowerCase();T=T.filter(I=>I.name.toLowerCase().includes(W));}let $=[];for(let W of T){let I=W.level===0;W.level>0&&(I=true),(I||k.trim())&&$.push(W);}return k.trim()&&$.sort((W,I)=>{let G,ae;switch(y){case "name":G=W.name.toLowerCase(),ae=I.name.toLowerCase();break;case "startDate":G=W.startDate?.getTime()||0,ae=I.startDate?.getTime()||0;break;case "endDate":G=W.endDate?.getTime()||0,ae=I.endDate?.getTime()||0;break;case "progress":G=W.progress||0,ae=I.progress||0;break;case "status":G=W.status||"todo",ae=I.status||"todo";break;default:return 0}return G<ae?b==="asc"?-1:1:G>ae?b==="asc"?1:-1:0}),$},[e,k,y,b]),B=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:w("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:w("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:w("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>P("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((T,$)=>{let W=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:w("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),h(T.id);},className:w("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:W?jsxRuntime.jsx(lucideReact.ChevronDown,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(uf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:w("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:w("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(T.startDate)]}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),B(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:w("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:w("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:w(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Gs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Hs={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"},_s={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"},pn={dark:Gs,light:Hs,neutral:_s};function Bd(e){return pn[e]||pn.dark}var Vs={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},js={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},mn={en:Vs,es:js};function go(e){return mn[e]||mn.en}function un(e,t){let a=go(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 Rd(e){let t=go(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 Od(e,t=0,a=true){let r=go(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 Nf(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 Js(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 Ud({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Gd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,l=un(n,m),i=p==="dark",[u,v]=react.useState(r||new Date),[f,y]=react.useState(null),[x,b]=react.useState(null),[g,k]=react.useState(null),[D,h]=react.useState(new Date),[P,C]=react.useState({}),B=4,T=3,[$,W]=react.useState(false),[I,G]=react.useState(false),[ae,fe]=react.useState(false),[H,Me]=react.useState(null),[Be,F]=react.useState(""),[L,R]=react.useState(void 0),[E,j]=react.useState(null),[oe,q]=react.useState(false),[De,M]=react.useState(false),[te,Y]=react.useState(null),[Se,Ee]=react.useState(false),[je,ht]=react.useState(new Date),Ne=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),nt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Nt=react.useCallback(()=>{v(new Date);},[]),yt=react.useMemo(()=>{let O=u.getFullYear(),we=u.getMonth(),He=new Date(O,we,1),We=new Date(O,we+1,0),vt=He.getDay(),J=We.getDate(),Q=Nf(e),ve=new Date;ve.setHours(0,0,0,0);let be=[],re=vt,Ce=new Date(O,we,0).getDate();for(let ke=re-1;ke>=0;ke--){let ge=new Date(O,we-1,Ce-ke);be.push({date:ge,isCurrentMonth:false,isToday:false,isWeekend:ge.getDay()===0||ge.getDay()===6,events:Q.filter(Ae=>Js(ge,Ae)).map(Ae=>({id:Ae.id,title:Ae.name,start:Ae.startDate,end:Ae.endDate,task:Ae}))});}for(let ke=1;ke<=J;ke++){let ge=new Date(O,we,ke),Ae=ge.getTime()===ve.getTime();be.push({date:ge,isCurrentMonth:true,isToday:Ae,isWeekend:ge.getDay()===0||ge.getDay()===6,events:Q.filter(pe=>Js(ge,pe)).map(pe=>({id:pe.id,title:pe.name,start:pe.startDate,end:pe.endDate,task:pe}))});}let ue=42-be.length;for(let ke=1;ke<=ue;ke++){let ge=new Date(O,we+1,ke);be.push({date:ge,isCurrentMonth:false,isToday:false,isWeekend:ge.getDay()===0||ge.getDay()===6,events:Q.filter(Ae=>Js(ge,Ae)).map(Ae=>({id:Ae.id,title:Ae.name,start:Ae.startDate,end:Ae.endDate,task:Ae}))});}return be},[u,e]),Wt=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],st=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),tt=react.useCallback((O,we)=>{if(!f)return;let He={...f,[O]:we};y(He),a.onTaskUpdate?.(He);},[f,a]),mt=react.useCallback(O=>{if(!f)return;let we=f.progress||0;O==="completed"?we=100:O==="todo"&&(we=0);let He={...f,status:O,progress:we};y(He),a.onTaskUpdate?.(He),W(false);},[f,a]),Qt=react.useCallback((O,we)=>{if(!f)return;let He={...f,startDate:O,endDate:we};y(He),a.onTaskUpdate?.(He);},[f,a]),xe=react.useCallback(()=>{W(false),G(false),k(null);},[]);return o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:w("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:st}),jsxRuntime.jsx("button",{onClick:Nt,className:w("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ne,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:nt,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:Wt.map(O=>jsxRuntime.jsx("div",{className:w("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:w("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:yt.map((O,we)=>{let He=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:w("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?He?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":He?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let We=P[we]||B,vt=O.events.slice(0,We),J=O.events.length-We;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[vt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:w("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Ud,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),C(ve=>({...ve,[we]:We+T}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),We>B&&O.events.length>B&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),C(ve=>({...ve,[we]:B}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let We=we>=28,vt=we%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),H===we?Me(null):(Me(we),F(""),R(void 0),j(null),Y(null),q(false),M(false),Ee(false),ht(O.date));},className:w("w-5 h-5 rounded flex items-center justify-center transition-all",H===we?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:w("w-3.5 h-3.5 transition-transform",H===we&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H===we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),F(""),R(void 0),j(null),Y(null),q(false),M(false),Ee(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:w("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",vt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),q(false),M(false),Ee(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Be,onChange:J=>F(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:w("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&Be.trim()){let Q=t.availableUsers?.find(be=>be.id===E),ve=te||O.date;a.onTaskCreate?.({name:Be.trim(),startDate:ve,endDate:ve,priority:L,assignees:Q?[Q]:void 0}),F(""),R(void 0),j(null),Y(null),Me(null);}J.key==="Escape"&&(Me(null),F(""),R(void 0),j(null),Y(null));}})}),jsxRuntime.jsxs("div",{className:w("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),q(!oe),M(false);},className:w("p-1 rounded transition-colors",L?L==="urgent"||L==="high"?"text-red-400 bg-red-500/20":L==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:oe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),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(J=>jsxRuntime.jsxs("button",{onClick:()=>{R(J.id),q(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",L===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),Ee(!Se),q(false),M(false),ht(te||O.date);},className:w("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",te?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(te||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:w("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let ve=new Date(J);ve.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let be=new Date(J);be.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let re=new Date(J);re.setDate(J.getDate()+14);let Ce=new Date(J);return Ce.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:be,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ke,ge)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Y(ke.date),Ee(false);},children:[jsxRuntime.jsx("span",{children:ke.label}),jsxRuntime.jsx("span",{className:w("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:ke.display})]},ge))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:w("text-xs font-medium",i?"text-white":"text-gray-900"),children:je.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>ht(new Date),className:w("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(je.getFullYear(),je.getMonth()-1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(je.getFullYear(),je.getMonth()+1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:w("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=je.getFullYear(),Q=je.getMonth(),ve=new Date(J,Q,1).getDay(),be=new Date(J,Q+1,0).getDate(),re=new Date(J,Q,0).getDate(),Ce=new Date,ue=[];for(let ge=ve-1;ge>=0;ge--)ue.push({dayNum:re-ge,isCurrentMonth:false,date:new Date(J,Q-1,re-ge)});for(let ge=1;ge<=be;ge++)ue.push({dayNum:ge,isCurrentMonth:true,date:new Date(J,Q,ge)});let ke=42-ue.length;for(let ge=1;ge<=ke;ge++)ue.push({dayNum:ge,isCurrentMonth:false,date:new Date(J,Q+1,ge)});return ue.map((ge,Ae)=>{let pe=ge.date.toDateString()===Ce.toDateString(),Ie=(te||O.date).toDateString()===ge.date.toDateString();return jsxRuntime.jsx("button",{className:w("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ge.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ge.isCurrentMonth&&(i?"text-white":"text-gray-900"),pe&&"ring-1 ring-[#3B82F6]",Ie&&"bg-[#7C3AED] text-white",!Ie&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Y(ge.date),Ee(false);},children:ge.dayNum},Ae)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),M(!De),q(false);},className:w("p-1 rounded transition-colors",E?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:E?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(J=>J.id===E)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===E)?.initials||t.availableUsers?.find(J=>J.id===E)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:De&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{j(null),M(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!E&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:w("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxRuntime.jsxs("button",{onClick:()=>{j(J.id),M(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",E===J.id&&(i?"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-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:w("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Be.trim()){let J=t.availableUsers?.find(ve=>ve.id===E),Q=te||O.date;a.onTaskCreate?.({name:Be.trim(),startDate:Q,endDate:Q,priority:L,assignees:J?[J]:void 0}),F(""),R(void 0),j(null),Y(null),Me(null);}},disabled:!Be.trim(),className:w("px-2.5 py-1 rounded text-xs font-medium transition-colors",Be.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:w("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},we)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),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:w("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:w("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:w("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:w("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:w("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>y(null),className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let O=f.progress===100?0:100,He={...f,progress:O,status:O===100?"completed":"todo"};y(He),a.onTaskUpdate?.(He);},className:w("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"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("h2",{className:w("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),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:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{xe(),W(!$);},className:w("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":i?"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:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>mt(O.id),className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,we)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},we)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(g?null:"start"),h(f.startDate||new Date);},className:w("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:w("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:w("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:w("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,we=new Date(O);we.setDate(O.getDate()+1);let He=new Date(O);He.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let We=new Date(O);We.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let vt=new Date(O);vt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let J=new Date(O);J.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:we,display:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:He,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:We,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:vt,display:vt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((be,re)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Ce=f.endDate&&be.date>f.endDate?be.date:f.endDate;Qt(be.date,Ce),k("end");}else {let Ce=f.startDate&&be.date<f.startDate?be.date:f.startDate;Qt(Ce,be.date),k(null);}},children:[jsxRuntime.jsx("span",{children:be.label}),jsxRuntime.jsx("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:be.display})]},re))})(),jsxRuntime.jsx("div",{className:w("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Qt(void 0,void 0),k(null);},className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:w("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="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:w("font-medium",i?"text-white":"text-gray-900"),children:D.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:()=>h(new Date),className:w("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()+1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),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(O=>jsxRuntime.jsx("div",{className:w("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=D.getFullYear(),we=D.getMonth(),He=new Date(O,we,1).getDay(),We=new Date(O,we+1,0).getDate(),vt=new Date(O,we,0).getDate(),J=new Date,Q=[];for(let be=He-1;be>=0;be--)Q.push({day:vt-be,isCurrentMonth:false,date:new Date(O,we-1,vt-be)});for(let be=1;be<=We;be++)Q.push({day:be,isCurrentMonth:true,date:new Date(O,we,be)});let ve=42-Q.length;for(let be=1;be<=ve;be++)Q.push({day:be,isCurrentMonth:false,date:new Date(O,we+1,be)});return Q.map((be,re)=>{let Ce=be.date.toDateString()===J.toDateString(),ue=f.startDate?.toDateString()===be.date.toDateString(),ke=f.endDate?.toDateString()===be.date.toDateString(),ge=ue||ke,Ae=f.startDate&&f.endDate&&be.date>=f.startDate&&be.date<=f.endDate;return jsxRuntime.jsx("button",{className:w("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!be.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),be.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#3B82F6]",ue&&"bg-[#3B82F6] text-white",ke&&!ue&&"bg-[#7C3AED] text-white",Ae&&!ge&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!ge&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let pe=new Date(be.date);if(g==="start"){let Ie=f.endDate&&pe>f.endDate?pe:f.endDate;Qt(pe,Ie),k("end");}else {let Ie=f.startDate&&pe<f.startDate?pe:f.startDate;Qt(Ie,pe),k(null);}},children:be.day},re)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{xe(),G(!I);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer 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":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>{tt("priority",O.id),G(false);},className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"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:w("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ae?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let we=parseInt(O.target.value),He=f.status;we===100?He="completed":we>0?He="in-progress":He="todo";let We={...f,progress:we,status:He};y(We),a.onTaskUpdate?.(We);},onBlur:()=>fe(false),className:w("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>fe(true),className:w("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:w("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:w("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:w("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:w("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:w("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:w("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:w("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:w("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:w("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:w("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 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:w("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",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:w("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),y(O.task);},className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Ud,{task:O.task}),jsxRuntime.jsx("span",{className:w("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Zs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},Qs={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"},ei={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"},hn={dark:Zs,light:Qs,neutral:ei};function Hd(e){return hn[e]||hn.dark}function Ef({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=react.useMemo(()=>{let u=m.length,v=new Set(m.flatMap(x=>x.assignedUserIds||[])).size,f=m.map(x=>x.priority).filter(Boolean),y=new Set(m.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:w("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,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:w("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"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(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:m.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:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.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"})]})})]},u.id))})})]})}var Vd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function fo(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 bo(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 jd(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 Kd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let p=react.useMemo(()=>({...Vd,...d}),[d]),[n,m]=react.useState(new Set),l=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let k=g.timestamp.toISOString().split("T")[0],D=b.get(k);D?D.push(g):b.set(k,[g]);}),Array.from(b.entries()).sort((g,k)=>k[0].localeCompare(g[0])).map(([g,k])=>({date:new Date(g),events:k.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(k=>{b.add(k.userId),g.add(k.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{m(g=>{let k=new Set(g);return k.has(b)?k.delete(b):k.add(b),k});},y=b=>{let k=new Date().getTime()-b.getTime(),D=Math.floor(k/6e4),h=Math.floor(k/36e5),P=Math.floor(k/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:P<7?`${P}d ago`:b.toLocaleDateString()},x=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:w("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:w("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[bo(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,k)=>{let D=n.has(g.id),h=s===g.id,P=jd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:w("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:P},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:bo(g.type)})}),k<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:P}})]}),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:[p.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:fo(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),f(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.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)),g.metadata&&Object.keys(g.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(g.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))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function qd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:w("history-replay-empty",n),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:w("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&bo(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&fo(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:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:w("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:fo(u)},u.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:d,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:m.map(u=>jsxRuntime.jsxs("button",{className:w("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),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(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:w("history-replay-start",n),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 ti(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 ai(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 Xd(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 Jd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ff(e,t,a,r,o,s=100){let d=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;d.forEach(m=>{let l=a/2,i=r/2;m.vx+=(l-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,d.forEach(u=>{if(m.id===u.id)return;let v=m.x-u.x,f=m.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);m.vx+=v/y*x,m.vy+=f/y*x;});}),t.forEach(m=>{let l=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return d}function Zd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:p}){let n=react.useRef(null),[m,l]=react.useState([]),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(1),[k,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=Ff(e,t,a.width,a.height,a,150);l(I);},[e,t,a]);let h=react.useCallback((I,G)=>{a.enableDragging&&(G.stopPropagation(),u(I));},[a.enableDragging]),P=react.useCallback(I=>{if(!i||!n.current)return;let ae=n.current.getBoundingClientRect(),fe=(I.clientX-ae.left-k.x)/b,H=(I.clientY-ae.top-k.y)/b;l(Me=>Me.map(Be=>Be.id===i?{...Be,x:fe,y:H,fx:fe,fy:H}:Be));},[i,b,k]),C=react.useCallback(()=>{u(null);},[]),B=react.useCallback((I,G)=>{G.stopPropagation(),c?.({type:"node-click",node:I,position:{x:G.clientX,y:G.clientY}});},[c]),T=react.useCallback((I,G)=>{G.stopPropagation(),c?.({type:"edge-click",edge:I,position:{x:G.clientX,y:G.clientY}});},[c]),$=react.useCallback(I=>{let G=m.find(ae=>ae.id===I);return G?{x:G.x,y:G.y}:{x:0,y:0}},[m]),W=react.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let G=I.card.priority;return G==="URGENT"?"#ef4444":G==="HIGH"?"#f59e0b":G==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:w("relationships-graph-empty",p),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:w("relationships-graph",p),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:d.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:d.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:()=>g(I=>Math.min(I+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(I=>I.type))).map(I=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:ti(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Xd(I)," ",ai(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:P,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let G=$(typeof I.source=="string"?I.source:I.source.id),ae=$(typeof I.target=="string"?I.target:I.target.id),fe=Jd(I.type),H=y===I.id,Me=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-edge",H&&"hovered",Me&&"critical"),onMouseEnter:()=>x(I.id),onMouseLeave:()=>x(null),onClick:Be=>T(I,Be),children:[jsxRuntime.jsx("line",{x1:G.x,y1:G.y,x2:ae.x,y2:ae.y,stroke:ti(I.type),strokeWidth:Me?a.edgeWidth*2:a.edgeWidth,strokeOpacity:H?1:.6,markerEnd:fe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&H&&jsxRuntime.jsx("text",{x:(G.x+ae.x)/2,y:(G.y+ae.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ai(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(I=>{let G=v===I.id,ae=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-node",G&&"hovered",ae&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:fe=>h(I.id,fe),onMouseEnter:()=>f(I.id),onMouseLeave:()=>f(null),onClick:fe=>B(I,fe),children:[jsxRuntime.jsx("circle",{r:ae?a.nodeSize*1.2:a.nodeSize,fill:W(I),stroke:ae?"#fbbf24":"#ffffff",strokeWidth:ae?3:2,opacity:G?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:I.card.title.length>20?I.card.title.substring(0,20)+"...":I.card.title})]},I.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 tc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[l,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),m(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){p(true),m(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{p(false);}}},x=()=>{l&&(a(l),f());};return e?jsxRuntime.jsxs(qe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),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:b=>b.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:f,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: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((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),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((b,g)=>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:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),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:u,value:s,onChange:b=>d(b.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."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),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((b,g)=>jsxRuntime.jsx("button",{onClick:()=>d(b),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:b},g))})]})]})}),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:f,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"}),l?jsxRuntime.jsx("button",{onClick:x,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, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ri={"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 Rf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Of={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 $f(e,t,a){let r=ri[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ho(e){return `$${e.toFixed(4)}`}var oi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=$f(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,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),p=a.reduce((l,i)=>l+i.duration,0),n={},m={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,m[l.feature]=(m[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.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,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=d).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=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)}},kr=new oi;function oc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(kr.getStats()),[s,d]=react.useState(kr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(kr.getStats()),d(kr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=kr.getRecentOperations(5);return jsxRuntime.jsxs(qe,{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:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:ho(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(([p,n])=>{let m=r.costsByFeature[p]||0,l=r.totalOperations>0?n/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:p.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:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ho(m)})]})]}),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}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ho(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 ic({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[p,n]=react.useState(""),[m,l]=react.useState(""),[i,u]=react.useState(false),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(null),k=react.useRef(null),D=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let T=$=>{$.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let h=()=>{D||(c(""),n(""),l(""),f(null),x(null),g(null),t());},P=async()=>{if(!(!d.trim()||D)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{y&&(a(y),h());};if(!e)return null;let B=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(qe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:T=>T.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:h,disabled:D,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:[b?.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"}),b?.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:[b?.tokens_used||0," tokens"]}),b?.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:[b.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((T,$)=>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:["#",$+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.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"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.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:k,value:d,onChange:T=>c(T.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:D}),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:p,onChange:T=>n(T.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:D})]}),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:m,onChange:T=>l(T.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:D})]})]}),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((T,$)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,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:T},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:D,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:P,disabled:!d.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function xn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&Eo(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(y,x,b)=>{r(g=>{let k=g.cards.find(T=>T.id===y);if(!k)return g;let D=k.columnId,h={...k,columnId:x,position:b},P=g.cards.map(T=>T.id===y?h:T),C=g.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter($=>$!==y)};if(T.id===x){let $=P.filter(W=>W.columnId===x).sort((W,I)=>W.position-I.position);return {...T,cardIds:$.map(W=>W.id)}}return T}),B={...g,cards:P,columns:C};return o(B),B});},[o]),d=react.useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(D=>D.id===y?{...D,...x}:D),k={...b,cards:g};return o(k),k});},[o]),c=react.useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},k=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),D={...b,cards:[...b.cards,g],columns:k};return o(D),D});},[o]),p=react.useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),k=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(P=>P!==y)}:h),D={...x,cards:g,columns:k};return o(D),D});},[o]),n=react.useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},k={...b,columns:[...b.columns,g]};return o(k),k});},[o]),m=react.useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(D=>D.id===y?{...D,...x}:D),k={...b,columns:g};return o(k),k});},[o]),l=react.useCallback(async y=>{r(x=>{let b=x.cards.filter(D=>D.columnId!==y),g=x.columns.filter(D=>D.id!==y),k={...x,cards:b,columns:g};return o(k),k});},[o]),i=react.useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=react.useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=react.useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:l,clearBoard:v}}}function dc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=xn({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(l=>l.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:p,position:n??m+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:d}}var yo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},pc={by:"none",order:"asc"};function mc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...yo,...e}),[s,d]=react.useState({...pc,...t}),c=react.useCallback(f=>{o(y=>({...y,...f}));},[]),p=react.useCallback(f=>{d(y=>({...y,...f}));},[]),n=react.useCallback(()=>{o(yo),d(pc);},[]),m=react.useCallback(()=>{a&&o({...yo,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...yo,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...yo,priorities:["HIGH","URGENT"]});},[]),u=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(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),k=String(x.getDate()).padStart(2,"0"),D=`${b}-${g}-${k}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let P=h.endDate||h.dueDate;if(!P)return false;let C;if(typeof P=="string")C=P.split("T")[0]||P;else {let B=P.getUTCFullYear(),T=String(P.getUTCMonth()+1).padStart(2,"0"),$=String(P.getUTCDate()).padStart(2,"0");C=`${B}-${T}-${$}`;}switch(r.dateFilter){case "overdue":return C<D;case "today":return C===D;case "this-week":let B=new Date(D+"T00:00:00"),T=new Date(C+"T00:00:00"),$=new Date(B);return $.setDate($.getDate()+7),T>=B&&T<=$;case "custom":if(r.dateRange){let W=typeof P=="string"?new Date(P):P;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let k=x.createdAt?new Date(x.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;g=k-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},P=h[x.priority||"LOW"],C=h[b.priority||"LOW"];g=P-C;break;case "dueDate":let B=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!B)return 1;if(!T)return -1;let $=typeof B=="string"?new Date(B).getTime():B.getTime(),W=typeof T=="string"?new Date(T).getTime():T.getTime();g=$-W;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let I=x.estimatedTime||0,G=b.estimatedTime||0;g=I-G;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var gc,fc;if(typeof window<"u")try{let e=Do("ai");gc=e.generateObject,fc=e.generateText;}catch{}function bc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(gc&&fc&&e.apiKey),d=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(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}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("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=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(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=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(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=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(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function si(){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 hc(e){let{cards:t}=e,[a,r]=si(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(C=>C.columnId===f.columnId).sort((C,B)=>C.position-B.position),b=x.findIndex(C=>C.id===a.lastSelectedCardId),g=x.findIndex(C=>C.id===l),[k,D]=b<g?[b,g]:[g,b],h=x.slice(k,D+1).map(C=>C.id),P=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:P,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),m=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:d,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var yc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function vc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...yc,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(D=>D.columnId===x).length,createdAt:new Date};d(D=>[...D,k]);},[o.minCardsPerStack,s]),p=react.useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=react.useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),m=react.useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=react.useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(k=>k!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=react.useCallback(async f=>{let y=t.filter(D=>D.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(D);});}),b.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(P=>P.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(D);});}),g.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(P=>P.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(y.forEach(D=>{D.priority&&(k.has(D.priority)||k.set(D.priority,[]),k.get(D.priority).push(D));}),k.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let P={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${P} ${h} Priority`,cardIds:D.map(C=>C.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of y){let P=(await r.findSimilar(D,y)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(P.length>=o.minCardsPerStack-1){let C=[D.id,...P.map(T=>T.card.id)],B=P.reduce((T,$)=>T+$.similarity,0)/P.length;x.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:C,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${P.length+1} similar tasks`,confidence:B});}}return x.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var xc=react.createContext(null);function kc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(p=>{let{Column:n}=Do("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=Do("@libxai/core");d.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=Do("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(xc.Provider,{value:{store:o},children:e})}function kn(){let e=react.useContext(xc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function xo(){let e=kn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(b=>{e.updateBoard(b);},[e]),p=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,k)=>{e.moveCard(b,g,k);},[e]),y=react.useCallback(b=>e.getCard(b),[e]),x=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function Cc(e){let{cards:t}=xo();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 Tc(e="position",t="asc"){let{cards:a}=xo();return react.useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=p-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var wn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ai.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 d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{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(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},tb=new wn;function Nc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=p?p(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function Sc(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 Pc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=p?p(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function Mc(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 Ac(e,t=10){return e>t}var ci={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},pi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},mi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ui={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},gi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},fi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},bi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},hi={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)"},yi={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)"},vi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},xi={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}},ki={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}},Cn={spacing:ci,borderRadius:pi,fontSize:mi,fontWeight:ui,lineHeight:gi,zIndex:fi,duration:bi,easing:hi,shadows:yi,opacity:vi,kanban:xi,gantt:ki};function Ic(e,t,a){return e[t]??a}function wi(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)?wi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function ob(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ci(e="asakaa"){let t=wi(Cn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=ob(o);a.push(` ${s}: ${d};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function
|
|
326
|
+
}`}function ko(e,t="asakaa"){let a=[],r=wi(e);for(let[o,s]of Object.entries(r)){let d=`--${t}-color-${o}`;a.push(` ${d}: ${s};`);}return `:root {
|
|
327
327
|
${a.join(`
|
|
328
328
|
`)}
|
|
329
|
-
}`}var
|
|
329
|
+
}`}var Tn={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"}},Ti={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"}},Di={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 Ni(e=Tn,t="asakaa"){let a=Ci(t),r=ko(e,t);return `${a}
|
|
330
330
|
|
|
331
|
-
${r}`}function
|
|
331
|
+
${r}`}function Lc(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|
|
333
333
|
* Auto-generated from design-tokens.ts
|
|
334
334
|
* Do not edit this file directly
|
|
335
335
|
*/
|
|
336
336
|
|
|
337
|
-
${
|
|
337
|
+
${Ni(Tn)}
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${
|
|
341
|
+
${ko(Ti,"asakaa").split(`
|
|
342
342
|
`).slice(1,-1).join(`
|
|
343
343
|
`)}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/* Neutral theme */
|
|
347
347
|
[data-theme="neutral"] {
|
|
348
|
-
${
|
|
348
|
+
${ko(Di,"asakaa").split(`
|
|
349
349
|
`).slice(1,-1).join(`
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
|
-
`}var nb=({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
|
|
353
|
-
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=
|
|
352
|
+
`}var nb=({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 Fc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Br();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([d,c])=>{let p=d,n=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(nb,{theme:p})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},p)})})}
|
|
353
|
+
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=oc;exports.AI_FEATURES=Of;exports.AI_MODELS=ri;exports.AddCardButton=Wn;exports.AddColumnButton=Un;exports.AttachmentUploader=to;exports.BoardProvider=kc;exports.BulkOperationsToolbar=$o;exports.BurnDownChart=Zn;exports.CalendarBoard=Gd;exports.Card=Oa;exports.CardDetailModal=jn;exports.CardDetailModalV2=qn;exports.CardHistoryReplay=qd;exports.CardHistoryTimeline=Kd;exports.CardRelationshipsGraph=Zd;exports.CardStack=Ef;exports.CardTemplateSelector=ns;exports.CircuitBreaker=Nn;exports.Column=Mr;exports.ColumnManager=_o;exports.CommandPalette=_n;exports.ConfigMenu=ds;exports.ContextMenu=$r;exports.DEFAULT_SHORTCUTS=ro;exports.DEFAULT_TEMPLATES=os;exports.DateRangePicker=jr;exports.DependenciesSelector=Yr;exports.DependencyLine=Jo;exports.DistributionCharts=Qn;exports.EditableColumnTitle=Fn;exports.ErrorBoundary=Ar;exports.ExportImportModal=is;exports.FilterBar=ls;exports.GANTT_AI_SYSTEM_PROMPT=wd;exports.GanttAIAssistant=on;exports.GanttBoard=kd;exports.GanttI18nContext=Or;exports.GanttMilestone=Qo;exports.GanttToolbar=Ho;exports.GenerateGanttTasksDialog=ic;exports.GeneratePlanModal=tc;exports.GroupBySelector=as;exports.KanbanBoard=Xa;exports.KanbanToolbar=$n;exports.KanbanViewAdapter=Qr;exports.KeyboardShortcutsHelp=rs;exports.ListView=Fd;exports.MenuIcons=ct;exports.PluginManager=wn;exports.PrioritySelector=lr;exports.RATE_LIMITS=Rf;exports.SwimlaneBoardView=es;exports.TaskBar=Yo;exports.TaskFormModal=rn;exports.TaskGrid=Ko;exports.ThemeModal=us;exports.ThemeProvider=Bl;exports.ThemeSwitcher=Fc;exports.Timeline=tn;exports.UserAssignmentSelector=cr;exports.VelocityChart=Jn;exports.VirtualGrid=Pc;exports.VirtualList=Nc;exports.aiUsageTracker=kr;exports.borderRadius=pi;exports.calculatePosition=So;exports.calendarDarkTheme=Zs;exports.calendarEnTranslations=Vs;exports.calendarEsTranslations=js;exports.calendarLightTheme=Qs;exports.calendarNeutralTheme=ei;exports.calendarThemes=hn;exports.calendarTranslations=mn;exports.cardToGanttTask=sn;exports.cardsToGanttTasks=Pd;exports.cn=w;exports.createKanbanView=bl;exports.createRetryWrapper=Xc;exports.darkTheme=cs;exports.darkTokenTheme=Tn;exports.defaultTheme=Uo;exports.designTokens=Cn;exports.duration=bi;exports.easing=hi;exports.exportTokensToCSS=Lc;exports.findTaskByName=Ga;exports.fontSize=mi;exports.fontWeight=ui;exports.formatCost=ho;exports.ganttEnTranslations=Go;exports.ganttEsTranslations=Ol;exports.ganttTaskToCardUpdate=Ed;exports.ganttThemes=Ge;exports.ganttTokens=ki;exports.ganttTranslations=gs;exports.ganttUtils=se;exports.generateCSSVariables=Ci;exports.generateCompleteCSS=Ni;exports.generateInitialPositions=jc;exports.generateTasksContext=Cd;exports.generateThemeVariables=ko;exports.getCalendarTheme=Hd;exports.getCalendarTranslations=go;exports.getListViewTheme=Bd;exports.getListViewTranslations=Ws;exports.getMonthNames=Rd;exports.getToken=Ic;exports.getTranslations=$l;exports.getWeekdayNames=Od;exports.kanbanTokens=xi;exports.lightTheme=ps;exports.lightTokenTheme=Ti;exports.lineHeight=gi;exports.listViewDarkTheme=Gs;exports.listViewEnTranslations=zs;exports.listViewEsTranslations=Us;exports.listViewLightTheme=Hs;exports.listViewNeutralTheme=_s;exports.listViewThemes=pn;exports.listViewTranslations=ln;exports.mergeCalendarTranslations=un;exports.mergeListViewTranslations=dn;exports.mergeTranslations=fs;exports.neutralTheme=ms;exports.neutralTokenTheme=Di;exports.opacity=vi;exports.parseLocalCommand=Nd;exports.parseNaturalDate=Rs;exports.parseNaturalDuration=Os;exports.parseProgress=$s;exports.parseStatus=Dd;exports.pluginManager=tb;exports.retrySyncOperation=qc;exports.retryWithBackoff=Eo;exports.shadows=yi;exports.shouldVirtualizeGrid=Ac;exports.spacing=ci;exports.themes=gr;exports.useAI=bc;exports.useBoard=dc;exports.useBoardCore=xo;exports.useBoardStore=kn;exports.useCardStacking=vc;exports.useDragState=Rn;exports.useFilteredCards=Cc;exports.useFilters=mc;exports.useGanttI18n=oo;exports.useKanbanState=xn;exports.useKeyboardShortcuts=Il;exports.useMultiSelect=hc;exports.useSelectionState=si;exports.useSortedCards=Tc;exports.useTheme=Br;exports.useVirtualGrid=Mc;exports.useVirtualList=Sc;exports.validateAIResponse=Sd;exports.withErrorBoundary=Gn;exports.wouldCreateCircularDependency=Mo;exports.zIndex=fi;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|