@libxai/board 0.17.92 → 0.17.94
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 +17 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -6
- 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 Wc(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
|
|
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=ci(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=ci(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,y)=>{n[u]=c[y]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let i=o.get(m),l={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:i.id,position:i.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(l),i.cardIds.push(l.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 ci(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 pi(e,t){switch(t){case "json":return Gc(e);case "csv":return Hc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function mi(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 ui(){return react.useContext(nn)}var gi=react.createContext(null);function fi({children:e,themeName:t}){return jsxRuntime.jsx(gi.Provider,{value:{themeName:t},children:e})}function lr(){return react.useContext(gi)}function Ke({children:e,container:t}){let[a,r]=react.useState(false),o=ui(),s=lr();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 xi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Jc="#BDC3C7",Zc=({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 ja({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(),y=window.innerHeight,g=window.innerWidth,v=160,k=220,b=4,f=u.right-v;f<10&&(f=u.left),f+v>g-10&&(f=g-v-10);let T=y-u.bottom,D=u.top,h;T>=k+b?h=u.bottom+b:D>=k+b?h=u.top-k-b:h=T>=D?u.bottom+b:Math.max(10,u.top-k-b),d({top:h,left:f}),o(true);};react.useEffect(()=>{let u=y=>{c.current&&!c.current.contains(y.target)&&!p.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},i=e?xi[e]:null,l=i?.color||Jc;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?`${l}10`:"transparent",boxShadow:e?`0 0 0 2px ${l}30 inset`:"none"},title:i?.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:l,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:l,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ke,{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(xi).map(([u,y])=>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:y.color,background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zc,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.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 Qc=[{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 Er({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),l=(lr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let f=n.current.getBoundingClientRect(),T=window.innerHeight,D=window.innerWidth,h=320,x=380,w=4,M=f.left;M+h>D-10&&(M=D-h-10),M<10&&(M=10);let C=T-f.bottom,B=f.top,z;C>=x+w?z=f.bottom+w:B>=x+w?z=f.top-x-w:z=C>=B?f.bottom+w:Math.max(10,f.top-x-w),c({top:z,left:M}),s(true);};react.useEffect(()=>{let f=T=>{p.current&&!p.current.contains(T.target)&&!n.current?.contains(T.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let y=f=>{let T=new Date,D=M=>{let C=M.getFullYear(),B=String(M.getMonth()+1).padStart(2,"0"),z=String(M.getDate()).padStart(2,"0");return `${C}-${B}-${z}`},h=D(T),x=new Date(T);x.setDate(x.getDate()+f);let w=D(x);a(h,w),s(false);},g=()=>{if(!e||!t)return "Set date";let f=x=>{if(x instanceof Date)return x;if(typeof x!="string"||!x.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=x.split("-").map(Number);if(w.length!==3||w.some(z=>isNaN(z)))return null;let M=w[0],C=w[1],B=w[2];return M===void 0||C===void 0||B===void 0?null:new Date(M,C-1,B)},T=f(e),D=f(t);if(!T||!D||isNaN(T.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[T.getMonth()]} ${T.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},v=e&&t,b=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),f<T})();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:v?`${g()}`:"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:g()})]}),o&&jsxRuntime.jsx(Ke,{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:l?"#1A1D25":"#FFFFFF",border:`1px solid ${l?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:l?"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:l?"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:l?"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:Qc.map(f=>jsxRuntime.jsx("button",{onClick:()=>y(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:l?"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:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"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:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Ya({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}),i=react.useRef(null),l=react.useRef(null),u=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),f=window.innerHeight,T=window.innerWidth,D=300,h=380,x=4,w=b.right-D;w<10&&(w=b.left),w+D>T-10&&(w=T-D-10);let M=f-b.bottom,C=b.top,B;M>=h+x?B=b.bottom+x:C>=h+x?B=b.top-h-x:B=M>=C?b.bottom+x:Math.max(10,b.top-h-x),m({top:B,left:w}),d(true);};react.useEffect(()=>{let b=f=>{i.current&&!i.current.contains(f.target)&&!l.current?.contains(f.target)&&(d(false),p(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=f=>{f.key==="Escape"&&(d(false),p(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let f=e.some(T=>T.id===b.id);a(f?e.filter(T=>T.id!==b.id):[...e,b]);},g=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),v=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,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:[v.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)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):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(Ke,{children:jsxRuntime.jsxs("div",{ref:i,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:g.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"}):g.map(b=>{let f=e.some(T=>T.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(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:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.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",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\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 so(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 i=m;return i.taskId||i.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 Mr({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(""),[i,l]=react.useState(t.length>0),[u,y]=react.useState({top:0,left:0}),[g,v]=react.useState(null),k=react.useRef(null),b=react.useRef(null),f=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),M=window.innerHeight,C=window.innerWidth,B=300,z=i?380:120,R=4,$=w.right-B;$<10&&($=w.left),$+B>C-10&&($=C-B-10);let K=M-w.bottom,le=w.top,be;K>=z+R?be=w.bottom+R:le>=z+R?be=w.top-z-R:be=K>=le?w.bottom+R:Math.max(10,w.top-z-R),y({top:be,left:$}),p(true);};react.useEffect(()=>{if(!c||!b.current)return;let w=b.current.getBoundingClientRect(),M=window.innerHeight,C=window.innerWidth,B=300,z=i?380:120,R=4,$=w.right-B;$<10&&($=w.left),$+B>C-10&&($=C-B-10);let K=M-w.bottom,le=w.top,be;K>=z+R?be=w.bottom+R:le>=z+R?be=w.top-z-R:be=K>=le?w.bottom+R:Math.max(10,w.top-z-R),y({top:be,left:$});},[i,c]),react.useEffect(()=>{let w=M=>{k.current&&!k.current.contains(M.target)&&!b.current?.contains(M.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=M=>{M.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let T=w=>{let M=t.includes(w),C=a.find(B=>B.id===w);if(v(null),M){let B=t.filter(z=>z!==w);r(B),B.length===0&&l(false);}else {if(s&&so(a,w,e)){let z=`Cannot add "${C?.title||w}" as dependency - would create circular reference`;v(z),d?.(w,C?.title||w),setTimeout(()=>v(null),3e3);return}r([...t,w]),l(true);}},D=()=>{let w=!i;l(w),w||r([]);},h=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(n.toLowerCase())||w.id.toLowerCase().includes(n.toLowerCase())),x=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?p(false):f(),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:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:x},children:t.length})]}),c&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:k,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:[g&&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:g})]}),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:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&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"})]})}),i&&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:w=>m(w.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(w=>{let M=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>T(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:C=>{C.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:M?"#3b82f6":"transparent",borderColor:M?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:M&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.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:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),l(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 Da=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:i,transform:l,transition:u,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),g={transform:ao.Transform.toString(l),transition:u};if(t)return jsxRuntime.jsx("div",{ref:i,style:g,...n,...m,onClick:()=>a?.(e),children:t(e)});let v=c.filter(f=>e.assignedUserIds?.includes(f.id)),k=e.progress===100,b={...g,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:i,style:b,className:S("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:f=>{f.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:f=>{f.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:k?"line-through":"none",opacity:k?.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:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ja,{priority:e.priority,onChange:f=>d?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Er,{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:(f,T)=>d?.(e.id,{startDate:f,endDate:T})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ya,{assignedUsers:v,availableUsers:c,onChange:f=>d?.(e.id,{assignedUserIds:f.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Mr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>d?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))}),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));Da.displayName="Card";var io={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"}},Mi=({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 Ii({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(io).map(([v,k])=>({id:v,label:k.label,color:k.color,icon:k.icon})),...r.filter(v=>!Object.keys(io).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let v=io[e];if(v)return {...v,id:e};let k=r.find(b=>b.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...io.todo,id:"todo"}},l=()=>{if(!n.current)return;let v=n.current.getBoundingClientRect(),k=window.innerHeight,b=window.innerWidth,f=180,T=280,D=4,h=v.right-f;h<10&&(h=v.left),h+f>b-10&&(h=b-f-10);let x=k-v.bottom,w=v.top,M;x>=T+D?M=v.bottom+D:w>=T+D?M=v.top-T-D:M=x>=w?v.bottom+D:Math.max(10,v.top-T-D),c({top:M,left:h}),s(true);};react.useEffect(()=>{let v=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let u=v=>{t(v),s(false);},y=i(),g=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${g}10`,boxShadow:`0 0 0 2px ${g}30 inset`},title:y.label,children:jsxRuntime.jsx(Mi,{icon:y.icon,color:g})}),o&&jsxRuntime.jsx(Ke,{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(v=>jsxRuntime.jsxs("button",{onClick:()=>u(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Mi,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}function Ai({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),[i,l]=react.useState({top:0,left:0}),u=react.useRef(null),y=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let f=y.current.getBoundingClientRect();l({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=T=>{u.current&&!u.current.contains(T.target)&&!y.current?.contains(T.target)&&(d(false),p(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&(d(false),p(false),m(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{c&&g.current&&(g.current.focus(),g.current.select());},[c]);let v=()=>{p(true),m(e);},k=()=>{let f=n.trim();f&&f!==e&&t(f),p(false),d(false),m(e);},b=f=>{f.key==="Enter"?k():f.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,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(Ke,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.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:g,type:"text",value:n,onChange:f=>m(f.target.value),onKeyDown:b,onBlur:k,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:v,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 pr=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:i=120,isCollapsed:l,onToggleCollapse:u,onColumnRename:y,onColumnDelete:g,isDeletable:v=false,className:k})=>{let{setNodeRef:b,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),D=m??oi(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>i,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:k,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let B=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:B}:B>=80?{state:"warning",percentage:B}:B>=60?{state:"approaching",percentage:B}:{state:"ok",percentage:B}})(),M=w.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:S("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",k),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:S(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||g)&&jsxRuntime.jsx(Ai,{columnTitle:e.title,onRename:B=>y?.(e.id,B),onDelete:g?()=>g(e.id):void 0,isDeletable:v}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(B=>B.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(B=>{let z=t[B.index];return z?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${B.start}px)`},children:jsxRuntime.jsx(Da,{card:z,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n})},z.id):null})}):t.map(B=>jsxRuntime.jsx(Da,{card:B,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n},B.id))})})]})});pr.displayName="Column";function pn({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:S("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:S("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function un(){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 Fa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:p,error:n,children:m}){let[i,l]=un(),u=o?.theme||"dark",g=u==="dark"||u==="neutral"?"dark":"",v=react.useCallback((C,B)=>{t.onCardUpdate?.(C,B);},[t]),k=react.useCallback((C,B)=>{t.onColumnUpdate?.(C,{title:B});},[t]),b=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),f=["todo","in-progress","completed"],T=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 C=new Map;return e.columns.forEach(B=>{let z=B.cardIds.map(R=>e.cards.find($=>$.id===R)).filter(R=>R!==void 0).sort((R,$)=>R.position-$.position);C.set(B.id,z);}),C},[e.cards,e.columns]),h=react.useCallback(C=>{let{active:B}=C,z=e.cards.find(R=>R.id===B.id);z&&l({isDragging:true,draggedCardId:z.id,sourceColumnId:z.columnId,targetColumnId:z.columnId});},[e.cards,l]),x=react.useCallback(C=>{let{active:B,over:z}=C;if(!z||!e.cards.find(K=>K.id===B.id))return;let $=null;z.data.current?.type==="column"?$=z.id:z.data.current?.type==="card"&&($=e.cards.find(le=>le.id===z.id)?.columnId||null),$&&$!==i.targetColumnId&&l({...i,targetColumnId:$});},[e.cards,i,l]),w=react.useCallback(async C=>{let{active:B,over:z}=C;if(l({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!z)return;let R=e.cards.find(be=>be.id===B.id);if(!R)return;let $,K;if(z.data.current?.type==="column"){$=z.id;let be=D.get($)||[];K=tn(be,0);}else {let be=e.cards.find(xe=>xe.id===z.id);if(!be)return;$=be.columnId;let Ge=D.get($)||[],Le=Ge.findIndex(xe=>xe.id===z.id);K=tn(Ge,Le);}let le=e.columns.find(be=>be.id===$);if(le&&le.wipLimit&&le.wipLimitType==="hard"){let be=D.get($)||[];if(R.columnId!==$&&be.length>=le.wipLimit){t.onWipLimitExceeded?.(le,R);return}}(R.columnId!==$||R.position!==K)&&await t.onCardMove?.(R.id,$,K);},[e.cards,e.columns,D,t,l]),M=react.useCallback(C=>{a?.(C);},[a]);return p?jsxRuntime.jsx("div",{className:S("asakaa-board",g,d),style:c,children:jsxRuntime.jsx(Cp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:S("asakaa-board",g,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(fi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:x,onDragEnd:w,children:[jsxRuntime.jsxs("div",{className:S("asakaa-board",g,d),style:c,"data-theme":u,children:[e.columns.sort((C,B)=>C.position-B.position).map(C=>{let B=D.get(C.id)||[],z=!f.includes(C.id);return jsxRuntime.jsx(pr,{column:C,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:M,onCardUpdate:v,onColumnRename:k,onColumnDelete:b,isDeletable:z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(Da,{card:e.cards.find(C=>C.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Cp({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 Ep={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)"},Pp={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)"},Mp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ip={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ap({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 Lp({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=y=>{n.current&&!n.current.contains(y.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let i=[{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),l=async(u,y)=>{if(y){p(u);try{await y();}catch(g){console.error(`Export ${u} failed:`,g);}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:i.map((u,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(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:y<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children: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 Fp({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 fn({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"?Ep:Pp,i={...o==="es"?Mp:Ip,...n},l=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:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lp,{theme:m,t:i,onExportCSV:d,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(Ap,{columns:e,onSelect:t,theme:m,t:i,createTaskLabel:a}):jsxRuntime.jsx(Fp,{onClick:()=>t(),label:a||i.newTask}))]})})}function hn({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 l=c.trim();l&&(e(l),p(""),d(false));},[c,e]),m=react.useCallback(l=>{l.key==="Enter"?(l.preventDefault(),n()):l.key==="Escape"&&(p(""),d(false));},[n]),i=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:S("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:l=>p(l.target.value),onKeyDown:m,onBlur:i,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:S("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 vn({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),[i,l]=react.useState(false),[u,y]=react.useState(""),[g,v]=react.useState([]),[k,b]=react.useState(""),[f,T]=react.useState(""),[D,h]=react.useState(""),[x,w]=react.useState(false),[M,C]=react.useState(false),[B,z]=react.useState(false),R=react.useRef(null),$=react.useRef(null),K={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"},le=react.useCallback(()=>{y(""),v([]),b(""),T(""),h(""),w(false),C(false),z(false),m(false);},[]);react.useEffect(()=>{n&&R.current&&R.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let E=I=>{$.current&&!$.current.contains(I.target)&&(u.trim()||le());};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[n,u,le]);let be=react.useCallback(async()=>{let E=u.trim();if(!(!E||i)){l(true);try{await t({name:E,columnId:e,assigneeIds:g.length>0?g:void 0,startDate:k?new Date(k):void 0,endDate:f?new Date(f):void 0,priority:D||void 0}),y(""),v([]),b(""),T(""),h(""),w(!1),C(!1),z(!1),R.current?.focus();}catch(I){console.error("Error creating card:",I);}finally{l(false);}}},[u,e,g,k,f,D,t,i]),Ge=react.useCallback(E=>{E.key==="Enter"&&!E.shiftKey?(E.preventDefault(),be()):E.key==="Escape"&&le();},[be,le]),Le=react.useCallback(E=>{v(I=>I.includes(E)?I.filter(P=>P!==E):[...I,E]);},[]),xe=c==="dark";return n?jsxRuntime.jsxs("div",{ref:$,className:S("rounded-lg overflow-hidden shadow-lg",xe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:u,onChange:E=>y(E.target.value),onKeyDown:Ge,placeholder:K.placeholder,disabled:i,className:S("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",xe?"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:()=>w(!x),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||g.length>0?"bg-emerald-500/20 text-emerald-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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"})]}),g.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:g.length})]}),jsxRuntime.jsx("button",{onClick:()=>C(!M),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||k||f?"bg-blue-500/20 text-blue-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:()=>z(!B),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||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":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:be,disabled:!u.trim()||i,className:S("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:i?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):K.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(E=>jsxRuntime.jsxs("button",{onClick:()=>Le(E.id),className:S("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",g.includes(E.id)?"bg-emerald-500 text-white":xe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[E.avatar?jsxRuntime.jsx("img",{src:E.avatar,alt:E.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",g.includes(E.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:E.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:E.name.split(" ")[0]})]},E.id))})}),M&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",xe?"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:S("block text-[10px] uppercase tracking-wide mb-1",xe?"text-gray-500":"text-gray-400"),children:K.startDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:E=>b(E.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",xe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:S("block text-[10px] uppercase tracking-wide mb-1",xe?"text-gray-500":"text-gray-400"),children:K.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:E=>T(E.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",xe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),B&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(E=>jsxRuntime.jsx("button",{onClick:()=>h(D===E?"":E),className:S("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===E?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[E]} text-white`:xe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:K[E]},E))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:d,className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",xe?"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:K.buttonLabel})]})}var Br=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(Fa,{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 Vi(e={}){return new Br(e)}var mr=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 yn(e,t){let a=r=>jsxRuntime.jsx(mr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function kn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[i,l]=react.useState(false),[u,y]=react.useState(""),[g,v]=react.useState("home"),[k,b]=react.useState(""),[f,T]=react.useState("");react.useEffect(()=>{let w=M=>{(M.metaKey||M.ctrlKey)&&M.key===n&&(M.preventDefault(),l(C=>!C)),M.key==="Escape"&&(l(false),v("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),react.useEffect(()=>{i||(v("home"),y(""),b(""),T(""));},[i]);let D=react.useCallback(()=>{l(false);},[]),h=react.useCallback(w=>{let[M,C]=w.split(":");switch(M){case "create-card":v("create-card");break;case "create-card-in":b(C||"");break;case "navigate":C?(a?.(C),D()):v("navigate");break;case "search":r?.(u),D();break;case "priority":v("priority");break;case "set-priority":f&&C&&(o?.(f,C),D());break;case "assign":v("assign");break;case "assign-user":f&&C&&(s?.(f,C),D());break;case "ai":v("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":p?.(),D();break;case "back":v("home");break;}},[u,f,t,a,r,o,s,d,c,p,D]),x=react.useCallback(()=>{k&&u.trim()&&(t?.(k,u.trim()),D());},[k,u,t,D]);return i?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:g==="create-card"&&k?"Type card title and press Enter...":g==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&g==="create-card"&&k&&x();}}),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."}),g==="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(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:h,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id))})]}),g==="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(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.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:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),g==="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(w=>{let M=e.columns.find(C=>C.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:h,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:M?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},w.id)})})]}),g==="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 Wp(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 Gp(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 Hp(e){return e.startsWith("image/")}function Or({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,i]=react.useState(null),l=react.useRef(null),u=react.useCallback(h=>{let x=[],w=[];return e.length+h.length>s?(w.push(`Maximum ${s} files allowed`),{valid:x,errors:w}):(h.forEach(M=>{if(M.size/1048576>r){w.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>M.type.match(B))){w.push(`${M.name} has invalid file type`);return}x.push(M);}),{valid:x,errors:w})},[e.length,s,r,o]),y=react.useCallback(async h=>{let{valid:x,errors:w}=u(h);if(w.length>0){i(w.join(", ")),setTimeout(()=>i(null),5e3);return}if(x.length!==0){n(true),i(null);try{await t?.(x);}catch(M){i(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{n(false);}}},[u,t]),g=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),v=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),k=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let x=Array.from(h.dataTransfer.files);y(x);},[y]),f=react.useCallback(h=>{let x=h.target.files?Array.from(h.target.files):[];y(x),l.current&&(l.current.value="");},[y]),T=react.useCallback(()=>{l.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:g,onDragLeave:v,onDragOver:k,onDrop:b,onClick:T,children:[jsxRuntime.jsx("input",{ref:l,type:"file",multiple:true,onChange:f,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:Hp(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:Gp(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:Wp(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 Cn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:i,onUploadAttachments:l,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:g,onEstimateEffort:v,currentUserId:k="user-1"}){let[b,f]=react.useState("details"),[T,D]=react.useState(false),[h,x]=react.useState({}),[w,M]=react.useState(""),[C,B]=react.useState(false),[z,R]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{D(false),x({}),f("details"),M(""),R({}),a();},[a]),K=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),x({}),D(false));},[e.id,h,r]),le=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),be=react.useCallback(()=>{m&&w.trim()&&(m(e.id,w.trim()),M(""));},[e.id,w,m]),Ge=react.useCallback(async()=>{if(y){B(true);try{let P=await y(e);R(_=>({..._,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{B(false);}}},[e,y]),Le=react.useCallback(async()=>{if(g){B(true);try{let P=await g(e);R(_=>({..._,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{B(false);}}},[e,g]),xe=react.useCallback(async()=>{if(v){B(true);try{let P=await v(e);R(_=>({..._,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{B(false);}}},[e,v]),E={...e,...h},I=s.filter(P=>E.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.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:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:h.title??E.title,onChange:P=>x({...h,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:E.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:K,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),x({});},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:le,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:$,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:()=>f("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:()=>f("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:()=>f("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:()=>f("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:()=>f("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"}),T?jsxRuntime.jsx("textarea",{value:h.description??E.description??"",onChange:P=>x({...h,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:E.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??E.assignedUserIds??[],onChange:P=>{let _=Array.from(P.target.selectedOptions,Y=>Y.value);x({...h,assignedUserIds:_});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:I.length>0?I.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.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"}),T?jsxRuntime.jsxs("select",{value:h.priority??E.priority??"",onChange:P=>x({...h,priority:P.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:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:E.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:E.labels&&E.labels.length>0?E.labels.map(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):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"}),T?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:E.startDate?new Date(E.startDate).toISOString().split("T")[0]:"",onChange:P=>x({...h,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:E.startDate?new Date(E.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:E.endDate?new Date(E.endDate).toISOString().split("T")[0]:"",onChange:P=>x({...h,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:E.endDate?new Date(E.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??E.estimatedTime??"",onChange:P=>x({...h,estimatedTime:P.target.value?parseFloat(P.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:E.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:E.dependencies&&E.dependencies.length>0?E.dependencies.map(P=>{let _=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",_.slice(-4)]},_)}):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:E.createdAt?new Date(E.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:w,onChange:P=>M(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:be,disabled:!w.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(P=>{let _=s.find(Y=>Y.id===P.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:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:_?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(P.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:P.content})]},P.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(P=>{let _=s.find(Y=>Y.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.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:_?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.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(Or,{cardId:e.id,attachments:n,onUpload:l?P=>l(e.id,P):void 0,onDelete:u,currentUserId:k,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:Ge,disabled:C||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Le,disabled:C||!g,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:xe,disabled:C||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((P,_)=>{let Y=s.find(j=>j.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",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-ai-suggestion-name",children:Y?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},_)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((P,_)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},_))]}),z.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:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.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(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!z.assignees&&!z.subtasks&&!z.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 $r({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 i=e.current.getBoundingClientRect(),l=window.innerHeight,u=window.innerWidth,y=4,g=i.left;g+o>u-10&&(g=u-o-10),g<10&&(g=10);let v=l-i.bottom,k=i.top,b;return v>=s+y?b=i.bottom+y:k>=s+y?b=i.top-s-y:v>=k?b=i.bottom+y:b=Math.max(10,i.top-s-y),{top:b,left:g}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let i=u=>{let y=u.target;n.current&&!n.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},l=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(l),document.removeEventListener("mousedown",i);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let i=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsxRuntime.jsx(Ke,{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 Jp=["LOW","MEDIUM","HIGH","URGENT"],Zp=["todo","in-progress","review","done"];function Nn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:i,onAICreateSubtasks:l,onAIFindSimilar:u,availableColumns:y=[],availableLabels:g=[],onUploadCoverImage:v,unsplashAccessKey:k,theme:b,onSubtasksChange:f}){let T=lr(),D=b||T?.themeName||"dark",[h,x]=react.useState(e),[w,M]=react.useState(false),[C,B]=react.useState(e?.subtasks||[]),[z,R]=react.useState(false),[$,K]=react.useState(""),[le,be]=react.useState(""),[Ge,Le]=react.useState("all"),[xe,E]=react.useState(false),[I,P]=react.useState(false),[_,Y]=react.useState(false),[j,ye]=react.useState(false),[F,oe]=react.useState(false),[q,Fe]=react.useState(false),Re=react.useRef(null),tt=react.useRef(null),Oe=react.useRef(null),dt=react.useRef(null),ce=react.useRef(null),vt=react.useRef(null),rt=react.useRef(null),Ot=react.useRef(null),ze=react.useRef(null),Pe=react.useRef(null),Ue=react.useRef(null),ct=react.useRef(null);react.useEffect(()=>{e&&!h?(x({...e}),B(e.subtasks||[])):e&&h&&e.id!==h.id&&(x({...e}),B(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let A=Q=>{let Se=Q.target;dt.current&&!dt.current.contains(Se)&&E(false),ce.current&&!ce.current.contains(Se)&&P(false),vt.current&&!vt.current.contains(Se)&&Y(false),rt.current&&!rt.current.contains(Se)&&ye(false);};if(xe||I||_||j)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[xe,I,_,j]),react.useEffect(()=>{if(!t)return;let A=Q=>{let Se=Q.target,at=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(Q.key==="Escape"){Q.preventDefault(),xe||I||_||j||F||q?(E(false),P(false),Y(false),ye(false),oe(false),Fe(false)):at||a();return}if(at&&Q.key!=="Escape")return;let ue=Q.metaKey||Q.ctrlKey;switch(Q.key.toLowerCase()){case "s":Q.preventDefault(),E(true);break;case "a":Q.preventDefault(),Y(true);break;case "p":Q.preventDefault(),P(true);break;case "l":Q.preventDefault(),ye(true);break;case "d":ue||(Q.preventDefault(),oe(true),setTimeout(()=>Ot.current?.focus(),0));break;case "e":ue||(Q.preventDefault(),Fe(true));break;case "i":Q.preventDefault(),M(true),setTimeout(()=>tt.current?.focus(),0);break;case "t":Q.preventDefault(),R(true);break;case "c":Q.preventDefault(),Oe.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,xe,I,_,j,F,q]);let de=react.useCallback(A=>{let Q=A.currentTarget.textContent?.trim()||"";if(h&&Q!==h.title){let Se={...h,title:Q};x(Se),r?.(h.id,{title:Q});}},[h,r]),we=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=h?.title||"",A.currentTarget.blur());},[h]),Kt=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),M(false);},[h,e,r]),ha=react.useCallback(A=>{if(h){let Q={...h,columnId:A};x(Q),r?.(h.id,{columnId:A}),E(false);}},[h,r]),Et=react.useCallback(A=>{if(h){let Q={...h,priority:A};x(Q),r?.(h.id,{priority:A}),P(false);}},[h,r]),va=react.useCallback(A=>{if(h){let Q=h.assignedUserIds||[],Se=Q.includes(A)?Q.filter(ue=>ue!==A):[...Q,A],at={...h,assignedUserIds:Se};x(at),r?.(h.id,{assignedUserIds:Se});}},[h,r]),ya=react.useCallback(A=>{if(h){let Q=h.labels||[],Se=Q.includes(A)?Q.filter(ue=>ue!==A):[...Q,A],at={...h,labels:Se};x(at),r?.(h.id,{labels:Se});}},[h,r]),De=react.useCallback(A=>{if(h){let Q=A.target.value,Se={...h,endDate:Q};x(Se),r?.(h.id,{endDate:Q}),oe(false);}},[h,r]),Ne=react.useCallback(A=>{if(h){let Q={...h,estimatedTime:parseFloat(A)||0};x(Q),r?.(h.id,{estimatedTime:parseFloat(A)||0});}},[h,r]),kt=react.useCallback(()=>{if($.trim()&&h){let A={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},Q=[...C,A];B(Q),K(""),R(false),f?.(h.id,Q);}},[$,C,h,f]),re=react.useCallback(A=>{let Q=C.map(Se=>Se.id===A?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);B(Q),h&&f?.(h.id,Q);},[C,h,f]),Ce=react.useCallback(A=>{let Q=C.filter(Se=>Se.id!==A);B(Q),h&&f?.(h.id,Q);},[C,h,f]),L=react.useCallback(()=>{le.trim()&&h&&p&&(p(h.id,le.trim()),be(""));},[le,h,p]),G=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),L());},[L]),pe=A=>jsxRuntime.jsx(Yp__default.default,{remarkPlugins:[qp__default.default],rehypePlugins:[Xp__default.default],components:{a:({node:Q,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:A}),fe=c.filter(A=>Ge==="comments"?A.type.includes("COMMENT"):Ge==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let J=h||e,me=s.filter(A=>J.assignedUserIds?.includes(A.id)),Z=C.filter(A=>A.completed).length;return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Re,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:de,onKeyDown:we,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:dt,children:[jsxRuntime.jsxs("button",{ref:ze,className:"modal-v2-field",onClick:()=>E(!xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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($r,{triggerRef:ze,isOpen:xe,onClose:()=>E(false),width:250,estimatedHeight:200,children:(y.length>0?y:Zp.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${J.columnId===A.id?"active":""}`,onClick:()=>ha(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:vt,children:[jsxRuntime.jsxs("button",{ref:Pe,className:"modal-v2-field",onClick:()=>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:me.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:me.map(A=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx($r,{triggerRef:Pe,isOpen:_,onClose:()=>Y(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>va(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,J.assignedUserIds?.includes(A.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>P(!I),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($r,{triggerRef:Ue,isOpen:I,onClose:()=>P(false),width:180,estimatedHeight:220,children:[Jp.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${J.priority===A?"active":""}`,onClick:()=>Et(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Et(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxRuntime.jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>ye(!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.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($r,{triggerRef:ct,isOpen:j,onClose:()=>ye(false),width:220,estimatedHeight:200,children:(g.length>0?g:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.labels?.includes(A)?"active":""}`,onClick:()=>ya(A),children:[A,J.labels?.includes(A)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{oe(!F),setTimeout(()=>Ot.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:Ot,type:"date",value:typeof J.endDate=="string"?J.endDate.split("T")[0]:J.endDate?(()=>{let A=new Date(J.endDate),Q=A.getUTCFullYear(),Se=String(A.getUTCMonth()+1).padStart(2,"0"),at=String(A.getUTCDate()).padStart(2,"0");return `${Q}-${Se}-${at}`})():"",onChange:De,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Fe(!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("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"})]}),q&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:J.estimatedTime||"",onChange:A=>Ne(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Fe(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"})]}),w?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:J.description||"",onChange:A=>{if(h){let Q={...h,description:A.target.value};x(Q);}},onBlur:Kt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>M(true),children:J.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:pe(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"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Z,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>R(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:[C.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>re(A.id),children:A.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:A.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ce(A.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},A.id)),z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:A=>K(A.target.value),onKeyDown:A=>{A.key==="Enter"&&kt(),A.key==="Escape"&&(R(false),K(""));},onBlur:kt,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 ${Ge==="all"?"active":""}`,onClick:()=>Le("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ge==="comments"?"active":""}`,onClick:()=>Le("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ge==="history"?"active":""}`,onClick:()=>Le("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:Oe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:le,onChange:A=>be(A.target.value),onKeyDown:G,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:L,disabled:!le.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[fe.map(A=>{let Q=s.find(at=>at.id===A.userId);if(A.type.includes("COMMENT")){let at=d.find(ue=>ue.id===A.metadata?.commentId);return at?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Q&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Q.color},children:Q.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:Q?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:at.content})]})]},A.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:Q?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),fe.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 im({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 En({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(im,{})}),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 bm({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 Pn({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(bm,{})}),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 Dm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},tl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Nm({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 al({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 Mn({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||Dm[p.name]||tl[e.indexOf(p)%tl.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?Nm: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(al,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,i=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${i}%)`}})]}):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(al,{})}),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 fo=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,i]=react.useState(false),[l,u]=react.useState(false);if(e.length===0)return null;let y=e.map(T=>T.id),g=T=>{r.onBulkUpdate?.(y,{priority:T}),c(false);},v=T=>{r.onBulkMove?.(y,T),n(false),a();},k=T=>{r.onBulkUpdate?.(y,{assignedUserIds:T}),i(false);},b=T=>{let D=new Set;e.forEach(x=>{x.labels?.forEach(w=>D.add(w));});let h=Array.from(new Set([...D,...T]));r.onBulkUpdate?.(y,{labels:h}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(T),children:[jsxRuntime.jsx("span",{className:S("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),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(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(T.id),children:T.title},T.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([T.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!l),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([T]),children:T},T))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,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"})})]})]})})});fo.displayName="BulkOperationsToolbar";function Im(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 y=a?.find(g=>g.id===u);d=`assignee-${u}`,c=y?.name||`User ${u}`,p=y?.color,n=y?.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 l={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=l.title,p=l.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 In({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),c=react.useMemo(()=>Im(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{d(m=>{let i=new Set(m);return i.has(n)?i.delete(n):i.add(n),i});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Fa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:S("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),i=e.cards.filter(u=>n.cardIds.includes(u.id)),l={...e,cards:i};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(Fa,{board:l,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 An=[{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 Ln({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),c=An.find(n=>n.value===e)||An[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:S("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:S("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:An.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:S("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 Fm(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=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 i of o.current)if(Fm(n,i)){r&&n.preventDefault();let l=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Rm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Om(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 $m(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Om(e),r=t?Rm(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 Fn({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=zm(e);return jsxRuntime.jsxs("div",{className:S("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:$m(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 Bn=[{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'),Jl=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Yp=require('react-markdown'),qp=require('remark-gfm'),Xp=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Jl__default=/*#__PURE__*/_interopDefault(Jl);var Yp__default=/*#__PURE__*/_interopDefault(Yp);var qp__default=/*#__PURE__*/_interopDefault(qp);var Xp__default=/*#__PURE__*/_interopDefault(Xp);var to=(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 ao=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 [ao.Translate.toString(e),ao.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function S(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function ro(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 Lc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function tn(e,t){return e.length===0?1e3:t===0?ro(null,e[0].position):t>=e.length?ro(e[e.length-1].position,null):ro(e[t-1].position,e[t].position)}function ni(e,t=100){return e>t}var Fc=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 Bc(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 oo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:d=Fc,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(i){if(p=i,m===a||!d(p,m))return {error:p,attempts:n,success:false};let u=Bc(m,r,o,s);if(c)try{c(p,m,u);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,u));}}return {error:p||new Error("Unknown error"),attempts:n,success:false}}function Rc(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 Oc(e,t={}){return async(...a)=>oo(()=>e(...a),t)}var an=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 si=(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))(si||{}),Va=class Va{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",...Va.globalOptions};}static configure(t){Va.globalOptions={...Va.globalOptions,...t};}child(t){return new Va({...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 no((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new no(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:si[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Va.globalOptions={};var rn=Va,no=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}},ii=new rn;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 Uc(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,on(s.title),on(s.description||""),on(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 Wc(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 Jl__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,i=p-20,l=i/m;l>n-20&&(l=n-20,i=l*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 y=(p-i)/2;return u.addImage(c,"PNG",y,20,i,l),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 on(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function di(e,t,a,r){switch(t){case "json":return zc(e,r);case "csv":return Uc(e);case "pdf":return await Wc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ci(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 Gc(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 Hc(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=pi(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=pi(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,y)=>{n[u]=c[y]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let i=o.get(m),l={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:i.id,position:i.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(l),i.cardIds.push(l.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 pi(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 mi(e,t){switch(t){case "json":return Gc(e);case "csv":return Hc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ui(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 gi(){return react.useContext(nn)}var fi=react.createContext(null);function bi({children:e,themeName:t}){return jsxRuntime.jsx(fi.Provider,{value:{themeName:t},children:e})}function lr(){return react.useContext(fi)}function Ke({children:e,container:t}){let[a,r]=react.useState(false),o=gi(),s=lr();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 ki={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Jc="#BDC3C7",Zc=({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 ja({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(),y=window.innerHeight,g=window.innerWidth,v=160,k=220,b=4,f=u.right-v;f<10&&(f=u.left),f+v>g-10&&(f=g-v-10);let T=y-u.bottom,D=u.top,h;T>=k+b?h=u.bottom+b:D>=k+b?h=u.top-k-b:h=T>=D?u.bottom+b:Math.max(10,u.top-k-b),d({top:h,left:f}),o(true);};react.useEffect(()=>{let u=y=>{c.current&&!c.current.contains(y.target)&&!p.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},i=e?ki[e]:null,l=i?.color||Jc;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?`${l}10`:"transparent",boxShadow:e?`0 0 0 2px ${l}30 inset`:"none"},title:i?.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:l,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:l,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ke,{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(ki).map(([u,y])=>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:y.color,background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zc,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.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 Qc=[{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 Er({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),l=(lr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let f=n.current.getBoundingClientRect(),T=window.innerHeight,D=window.innerWidth,h=320,x=380,w=4,M=f.left;M+h>D-10&&(M=D-h-10),M<10&&(M=10);let C=T-f.bottom,B=f.top,z;C>=x+w?z=f.bottom+w:B>=x+w?z=f.top-x-w:z=C>=B?f.bottom+w:Math.max(10,f.top-x-w),c({top:z,left:M}),s(true);};react.useEffect(()=>{let f=T=>{p.current&&!p.current.contains(T.target)&&!n.current?.contains(T.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let y=f=>{let T=new Date,D=M=>{let C=M.getFullYear(),B=String(M.getMonth()+1).padStart(2,"0"),z=String(M.getDate()).padStart(2,"0");return `${C}-${B}-${z}`},h=D(T),x=new Date(T);x.setDate(x.getDate()+f);let w=D(x);a(h,w),s(false);},g=()=>{if(!e||!t)return "Set date";let f=x=>{if(x instanceof Date)return x;if(typeof x!="string"||!x.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=x.split("-").map(Number);if(w.length!==3||w.some(z=>isNaN(z)))return null;let M=w[0],C=w[1],B=w[2];return M===void 0||C===void 0||B===void 0?null:new Date(M,C-1,B)},T=f(e),D=f(t);if(!T||!D||isNaN(T.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[T.getMonth()]} ${T.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},v=e&&t,b=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),f<T})();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:v?`${g()}`:"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:g()})]}),o&&jsxRuntime.jsx(Ke,{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:l?"#1A1D25":"#FFFFFF",border:`1px solid ${l?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:l?"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:l?"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:l?"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:Qc.map(f=>jsxRuntime.jsx("button",{onClick:()=>y(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:l?"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:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"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:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Ya({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}),i=react.useRef(null),l=react.useRef(null),u=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),f=window.innerHeight,T=window.innerWidth,D=300,h=380,x=4,w=b.right-D;w<10&&(w=b.left),w+D>T-10&&(w=T-D-10);let M=f-b.bottom,C=b.top,B;M>=h+x?B=b.bottom+x:C>=h+x?B=b.top-h-x:B=M>=C?b.bottom+x:Math.max(10,b.top-h-x),m({top:B,left:w}),d(true);};react.useEffect(()=>{let b=f=>{i.current&&!i.current.contains(f.target)&&!l.current?.contains(f.target)&&(d(false),p(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=f=>{f.key==="Escape"&&(d(false),p(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let f=e.some(T=>T.id===b.id);a(f?e.filter(T=>T.id!==b.id):[...e,b]);},g=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),v=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,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:[v.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)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):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(Ke,{children:jsxRuntime.jsxs("div",{ref:i,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:g.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"}):g.map(b=>{let f=e.some(T=>T.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(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:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.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",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\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 so(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 i=m;return i.taskId||i.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 Mr({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(""),[i,l]=react.useState(t.length>0),[u,y]=react.useState({top:0,left:0}),[g,v]=react.useState(null),k=react.useRef(null),b=react.useRef(null),f=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),M=window.innerHeight,C=window.innerWidth,B=300,z=i?380:120,R=4,$=w.right-B;$<10&&($=w.left),$+B>C-10&&($=C-B-10);let K=M-w.bottom,le=w.top,be;K>=z+R?be=w.bottom+R:le>=z+R?be=w.top-z-R:be=K>=le?w.bottom+R:Math.max(10,w.top-z-R),y({top:be,left:$}),p(true);};react.useEffect(()=>{if(!c||!b.current)return;let w=b.current.getBoundingClientRect(),M=window.innerHeight,C=window.innerWidth,B=300,z=i?380:120,R=4,$=w.right-B;$<10&&($=w.left),$+B>C-10&&($=C-B-10);let K=M-w.bottom,le=w.top,be;K>=z+R?be=w.bottom+R:le>=z+R?be=w.top-z-R:be=K>=le?w.bottom+R:Math.max(10,w.top-z-R),y({top:be,left:$});},[i,c]),react.useEffect(()=>{let w=M=>{k.current&&!k.current.contains(M.target)&&!b.current?.contains(M.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=M=>{M.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let T=w=>{let M=t.includes(w),C=a.find(B=>B.id===w);if(v(null),M){let B=t.filter(z=>z!==w);r(B),B.length===0&&l(false);}else {if(s&&so(a,w,e)){let z=`Cannot add "${C?.title||w}" as dependency - would create circular reference`;v(z),d?.(w,C?.title||w),setTimeout(()=>v(null),3e3);return}r([...t,w]),l(true);}},D=()=>{let w=!i;l(w),w||r([]);},h=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(n.toLowerCase())||w.id.toLowerCase().includes(n.toLowerCase())),x=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c?p(false):f(),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:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:x},children:t.length})]}),c&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:k,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:[g&&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:g})]}),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:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&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"})]})}),i&&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:w=>m(w.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(w=>{let M=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>T(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:C=>{C.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:M?"#3b82f6":"transparent",borderColor:M?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:M&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.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:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),l(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 Da=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:i,transform:l,transition:u,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),g={transform:ao.Transform.toString(l),transition:u};if(t)return jsxRuntime.jsx("div",{ref:i,style:g,...n,...m,onClick:()=>a?.(e),children:t(e)});let v=c.filter(f=>e.assignedUserIds?.includes(f.id)),k=e.progress===100,b={...g,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:i,style:b,className:S("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:f=>{f.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:f=>{f.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:k?"line-through":"none",opacity:k?.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:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ja,{priority:e.priority,onChange:f=>d?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Er,{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:(f,T)=>d?.(e.id,{startDate:f,endDate:T})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ya,{assignedUsers:v,availableUsers:c,onChange:f=>d?.(e.id,{assignedUserIds:f.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Mr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>d?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))}),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));Da.displayName="Card";var io={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"}},Ii=({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 Ai({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(io).map(([v,k])=>({id:v,label:k.label,color:k.color,icon:k.icon})),...r.filter(v=>!Object.keys(io).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let v=io[e];if(v)return {...v,id:e};let k=r.find(b=>b.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...io.todo,id:"todo"}},l=()=>{if(!n.current)return;let v=n.current.getBoundingClientRect(),k=window.innerHeight,b=window.innerWidth,f=180,T=280,D=4,h=v.right-f;h<10&&(h=v.left),h+f>b-10&&(h=b-f-10);let x=k-v.bottom,w=v.top,M;x>=T+D?M=v.bottom+D:w>=T+D?M=v.top-T-D:M=x>=w?v.bottom+D:Math.max(10,v.top-T-D),c({top:M,left:h}),s(true);};react.useEffect(()=>{let v=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let u=v=>{t(v),s(false);},y=i(),g=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${g}10`,boxShadow:`0 0 0 2px ${g}30 inset`},title:y.label,children:jsxRuntime.jsx(Ii,{icon:y.icon,color:g})}),o&&jsxRuntime.jsx(Ke,{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(v=>jsxRuntime.jsxs("button",{onClick:()=>u(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ii,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}function Li({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),[i,l]=react.useState({top:0,left:0}),u=react.useRef(null),y=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let f=y.current.getBoundingClientRect();l({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=T=>{u.current&&!u.current.contains(T.target)&&!y.current?.contains(T.target)&&(d(false),p(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&(d(false),p(false),m(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{c&&g.current&&(g.current.focus(),g.current.select());},[c]);let v=()=>{p(true),m(e);},k=()=>{let f=n.trim();f&&f!==e&&t(f),p(false),d(false),m(e);},b=f=>{f.key==="Enter"?k():f.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,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(Ke,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.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:g,type:"text",value:n,onChange:f=>m(f.target.value),onKeyDown:b,onBlur:k,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:v,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 pr=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:i=120,isCollapsed:l,onToggleCollapse:u,onColumnRename:y,onColumnDelete:g,isDeletable:v=false,className:k})=>{let{setNodeRef:b,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),D=m??ni(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>i,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:k,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let B=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:B}:B>=80?{state:"warning",percentage:B}:B>=60?{state:"approaching",percentage:B}:{state:"ok",percentage:B}})(),M=w.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:S("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",k),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:S(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||g)&&jsxRuntime.jsx(Li,{columnTitle:e.title,onRename:B=>y?.(e.id,B),onDelete:g?()=>g(e.id):void 0,isDeletable:v}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(B=>B.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(B=>{let z=t[B.index];return z?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${B.start}px)`},children:jsxRuntime.jsx(Da,{card:z,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n})},z.id):null})}):t.map(B=>jsxRuntime.jsx(Da,{card:B,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n},B.id))})})]})});pr.displayName="Column";function pn({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:S("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:S("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function un(){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 Fa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:p,error:n,children:m}){let[i,l]=un(),u=o?.theme||"dark",g=u==="dark"||u==="neutral"?"dark":"",v=react.useCallback((C,B)=>{t.onCardUpdate?.(C,B);},[t]),k=react.useCallback((C,B)=>{t.onColumnUpdate?.(C,{title:B});},[t]),b=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),f=["todo","in-progress","completed"],T=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 C=new Map;return e.columns.forEach(B=>{let z=B.cardIds.map(R=>e.cards.find($=>$.id===R)).filter(R=>R!==void 0).sort((R,$)=>R.position-$.position);C.set(B.id,z);}),C},[e.cards,e.columns]),h=react.useCallback(C=>{let{active:B}=C,z=e.cards.find(R=>R.id===B.id);z&&l({isDragging:true,draggedCardId:z.id,sourceColumnId:z.columnId,targetColumnId:z.columnId});},[e.cards,l]),x=react.useCallback(C=>{let{active:B,over:z}=C;if(!z||!e.cards.find(K=>K.id===B.id))return;let $=null;z.data.current?.type==="column"?$=z.id:z.data.current?.type==="card"&&($=e.cards.find(le=>le.id===z.id)?.columnId||null),$&&$!==i.targetColumnId&&l({...i,targetColumnId:$});},[e.cards,i,l]),w=react.useCallback(async C=>{let{active:B,over:z}=C;if(l({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!z)return;let R=e.cards.find(be=>be.id===B.id);if(!R)return;let $,K;if(z.data.current?.type==="column"){$=z.id;let be=D.get($)||[];K=tn(be,0);}else {let be=e.cards.find(xe=>xe.id===z.id);if(!be)return;$=be.columnId;let Ge=D.get($)||[],Le=Ge.findIndex(xe=>xe.id===z.id);K=tn(Ge,Le);}let le=e.columns.find(be=>be.id===$);if(le&&le.wipLimit&&le.wipLimitType==="hard"){let be=D.get($)||[];if(R.columnId!==$&&be.length>=le.wipLimit){t.onWipLimitExceeded?.(le,R);return}}(R.columnId!==$||R.position!==K)&&await t.onCardMove?.(R.id,$,K);},[e.cards,e.columns,D,t,l]),M=react.useCallback(C=>{a?.(C);},[a]);return p?jsxRuntime.jsx("div",{className:S("asakaa-board",g,d),style:c,children:jsxRuntime.jsx(Cp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:S("asakaa-board",g,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(bi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:x,onDragEnd:w,children:[jsxRuntime.jsxs("div",{className:S("asakaa-board",g,d),style:c,"data-theme":u,children:[e.columns.sort((C,B)=>C.position-B.position).map(C=>{let B=D.get(C.id)||[],z=!f.includes(C.id);return jsxRuntime.jsx(pr,{column:C,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:M,onCardUpdate:v,onColumnRename:k,onColumnDelete:b,isDeletable:z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(Da,{card:e.cards.find(C=>C.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Cp({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 Ep={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)"},Pp={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)"},Mp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ip={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ap({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 Lp({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=y=>{n.current&&!n.current.contains(y.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let i=[{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),l=async(u,y)=>{if(y){p(u);try{await y();}catch(g){console.error(`Export ${u} failed:`,g);}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:i.map((u,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(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:y<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children: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 Fp({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 fn({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"?Ep:Pp,i={...o==="es"?Mp:Ip,...n},l=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:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lp,{theme:m,t:i,onExportCSV:d,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(Ap,{columns:e,onSelect:t,theme:m,t:i,createTaskLabel:a}):jsxRuntime.jsx(Fp,{onClick:()=>t(),label:a||i.newTask}))]})})}function hn({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 l=c.trim();l&&(e(l),p(""),d(false));},[c,e]),m=react.useCallback(l=>{l.key==="Enter"?(l.preventDefault(),n()):l.key==="Escape"&&(p(""),d(false));},[n]),i=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:S("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:l=>p(l.target.value),onKeyDown:m,onBlur:i,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:S("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 vn({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),[i,l]=react.useState(false),[u,y]=react.useState(""),[g,v]=react.useState([]),[k,b]=react.useState(""),[f,T]=react.useState(""),[D,h]=react.useState(""),[x,w]=react.useState(false),[M,C]=react.useState(false),[B,z]=react.useState(false),R=react.useRef(null),$=react.useRef(null),K={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"},le=react.useCallback(()=>{y(""),v([]),b(""),T(""),h(""),w(false),C(false),z(false),m(false);},[]);react.useEffect(()=>{n&&R.current&&R.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let E=I=>{$.current&&!$.current.contains(I.target)&&(u.trim()||le());};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[n,u,le]);let be=react.useCallback(async()=>{let E=u.trim();if(!(!E||i)){l(true);try{await t({name:E,columnId:e,assigneeIds:g.length>0?g:void 0,startDate:k?new Date(k):void 0,endDate:f?new Date(f):void 0,priority:D||void 0}),y(""),v([]),b(""),T(""),h(""),w(!1),C(!1),z(!1),R.current?.focus();}catch(I){console.error("Error creating card:",I);}finally{l(false);}}},[u,e,g,k,f,D,t,i]),Ge=react.useCallback(E=>{E.key==="Enter"&&!E.shiftKey?(E.preventDefault(),be()):E.key==="Escape"&&le();},[be,le]),Le=react.useCallback(E=>{v(I=>I.includes(E)?I.filter(P=>P!==E):[...I,E]);},[]),xe=c==="dark";return n?jsxRuntime.jsxs("div",{ref:$,className:S("rounded-lg overflow-hidden shadow-lg",xe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:u,onChange:E=>y(E.target.value),onKeyDown:Ge,placeholder:K.placeholder,disabled:i,className:S("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",xe?"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:()=>w(!x),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||g.length>0?"bg-emerald-500/20 text-emerald-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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"})]}),g.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:g.length})]}),jsxRuntime.jsx("button",{onClick:()=>C(!M),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||k||f?"bg-blue-500/20 text-blue-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:()=>z(!B),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||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":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:be,disabled:!u.trim()||i,className:S("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:i?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):K.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(E=>jsxRuntime.jsxs("button",{onClick:()=>Le(E.id),className:S("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",g.includes(E.id)?"bg-emerald-500 text-white":xe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[E.avatar?jsxRuntime.jsx("img",{src:E.avatar,alt:E.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",g.includes(E.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:E.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:E.name.split(" ")[0]})]},E.id))})}),M&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",xe?"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:S("block text-[10px] uppercase tracking-wide mb-1",xe?"text-gray-500":"text-gray-400"),children:K.startDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:E=>b(E.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",xe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:S("block text-[10px] uppercase tracking-wide mb-1",xe?"text-gray-500":"text-gray-400"),children:K.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:E=>T(E.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",xe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),B&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(E=>jsxRuntime.jsx("button",{onClick:()=>h(D===E?"":E),className:S("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===E?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[E]} text-white`:xe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:K[E]},E))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:d,className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",xe?"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:K.buttonLabel})]})}var Br=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(Fa,{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 ji(e={}){return new Br(e)}var mr=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 yn(e,t){let a=r=>jsxRuntime.jsx(mr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function kn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[i,l]=react.useState(false),[u,y]=react.useState(""),[g,v]=react.useState("home"),[k,b]=react.useState(""),[f,T]=react.useState("");react.useEffect(()=>{let w=M=>{(M.metaKey||M.ctrlKey)&&M.key===n&&(M.preventDefault(),l(C=>!C)),M.key==="Escape"&&(l(false),v("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),react.useEffect(()=>{i||(v("home"),y(""),b(""),T(""));},[i]);let D=react.useCallback(()=>{l(false);},[]),h=react.useCallback(w=>{let[M,C]=w.split(":");switch(M){case "create-card":v("create-card");break;case "create-card-in":b(C||"");break;case "navigate":C?(a?.(C),D()):v("navigate");break;case "search":r?.(u),D();break;case "priority":v("priority");break;case "set-priority":f&&C&&(o?.(f,C),D());break;case "assign":v("assign");break;case "assign-user":f&&C&&(s?.(f,C),D());break;case "ai":v("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":p?.(),D();break;case "back":v("home");break;}},[u,f,t,a,r,o,s,d,c,p,D]),x=react.useCallback(()=>{k&&u.trim()&&(t?.(k,u.trim()),D());},[k,u,t,D]);return i?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:g==="create-card"&&k?"Type card title and press Enter...":g==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&g==="create-card"&&k&&x();}}),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."}),g==="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(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:h,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id))})]}),g==="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(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.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:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),g==="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(w=>{let M=e.columns.find(C=>C.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:h,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:M?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},w.id)})})]}),g==="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 Wp(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 Gp(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 Hp(e){return e.startsWith("image/")}function Or({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,i]=react.useState(null),l=react.useRef(null),u=react.useCallback(h=>{let x=[],w=[];return e.length+h.length>s?(w.push(`Maximum ${s} files allowed`),{valid:x,errors:w}):(h.forEach(M=>{if(M.size/1048576>r){w.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>M.type.match(B))){w.push(`${M.name} has invalid file type`);return}x.push(M);}),{valid:x,errors:w})},[e.length,s,r,o]),y=react.useCallback(async h=>{let{valid:x,errors:w}=u(h);if(w.length>0){i(w.join(", ")),setTimeout(()=>i(null),5e3);return}if(x.length!==0){n(true),i(null);try{await t?.(x);}catch(M){i(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{n(false);}}},[u,t]),g=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),v=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),k=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let x=Array.from(h.dataTransfer.files);y(x);},[y]),f=react.useCallback(h=>{let x=h.target.files?Array.from(h.target.files):[];y(x),l.current&&(l.current.value="");},[y]),T=react.useCallback(()=>{l.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:g,onDragLeave:v,onDragOver:k,onDrop:b,onClick:T,children:[jsxRuntime.jsx("input",{ref:l,type:"file",multiple:true,onChange:f,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:Hp(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:Gp(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:Wp(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 Cn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:i,onUploadAttachments:l,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:g,onEstimateEffort:v,currentUserId:k="user-1"}){let[b,f]=react.useState("details"),[T,D]=react.useState(false),[h,x]=react.useState({}),[w,M]=react.useState(""),[C,B]=react.useState(false),[z,R]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{D(false),x({}),f("details"),M(""),R({}),a();},[a]),K=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),x({}),D(false));},[e.id,h,r]),le=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),be=react.useCallback(()=>{m&&w.trim()&&(m(e.id,w.trim()),M(""));},[e.id,w,m]),Ge=react.useCallback(async()=>{if(y){B(true);try{let P=await y(e);R(_=>({..._,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{B(false);}}},[e,y]),Le=react.useCallback(async()=>{if(g){B(true);try{let P=await g(e);R(_=>({..._,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{B(false);}}},[e,g]),xe=react.useCallback(async()=>{if(v){B(true);try{let P=await v(e);R(_=>({..._,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{B(false);}}},[e,v]),E={...e,...h},I=s.filter(P=>E.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.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:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:h.title??E.title,onChange:P=>x({...h,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:E.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:K,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),x({});},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:le,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:$,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:()=>f("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:()=>f("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:()=>f("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:()=>f("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:()=>f("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"}),T?jsxRuntime.jsx("textarea",{value:h.description??E.description??"",onChange:P=>x({...h,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:E.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??E.assignedUserIds??[],onChange:P=>{let _=Array.from(P.target.selectedOptions,Y=>Y.value);x({...h,assignedUserIds:_});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:I.length>0?I.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.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"}),T?jsxRuntime.jsxs("select",{value:h.priority??E.priority??"",onChange:P=>x({...h,priority:P.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:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:E.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:E.labels&&E.labels.length>0?E.labels.map(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):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"}),T?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:E.startDate?new Date(E.startDate).toISOString().split("T")[0]:"",onChange:P=>x({...h,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:E.startDate?new Date(E.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:E.endDate?new Date(E.endDate).toISOString().split("T")[0]:"",onChange:P=>x({...h,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:E.endDate?new Date(E.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??E.estimatedTime??"",onChange:P=>x({...h,estimatedTime:P.target.value?parseFloat(P.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:E.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:E.dependencies&&E.dependencies.length>0?E.dependencies.map(P=>{let _=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",_.slice(-4)]},_)}):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:E.createdAt?new Date(E.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:w,onChange:P=>M(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:be,disabled:!w.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(P=>{let _=s.find(Y=>Y.id===P.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:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:_?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(P.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:P.content})]},P.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(P=>{let _=s.find(Y=>Y.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.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:_?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.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(Or,{cardId:e.id,attachments:n,onUpload:l?P=>l(e.id,P):void 0,onDelete:u,currentUserId:k,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:Ge,disabled:C||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Le,disabled:C||!g,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:xe,disabled:C||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((P,_)=>{let Y=s.find(j=>j.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",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-ai-suggestion-name",children:Y?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},_)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((P,_)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},_))]}),z.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:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.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(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!z.assignees&&!z.subtasks&&!z.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 $r({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 i=e.current.getBoundingClientRect(),l=window.innerHeight,u=window.innerWidth,y=4,g=i.left;g+o>u-10&&(g=u-o-10),g<10&&(g=10);let v=l-i.bottom,k=i.top,b;return v>=s+y?b=i.bottom+y:k>=s+y?b=i.top-s-y:v>=k?b=i.bottom+y:b=Math.max(10,i.top-s-y),{top:b,left:g}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let i=u=>{let y=u.target;n.current&&!n.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},l=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(l),document.removeEventListener("mousedown",i);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let i=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsxRuntime.jsx(Ke,{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 Jp=["LOW","MEDIUM","HIGH","URGENT"],Zp=["todo","in-progress","review","done"];function Nn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:i,onAICreateSubtasks:l,onAIFindSimilar:u,availableColumns:y=[],availableLabels:g=[],onUploadCoverImage:v,unsplashAccessKey:k,theme:b,onSubtasksChange:f}){let T=lr(),D=b||T?.themeName||"dark",[h,x]=react.useState(e),[w,M]=react.useState(false),[C,B]=react.useState(e?.subtasks||[]),[z,R]=react.useState(false),[$,K]=react.useState(""),[le,be]=react.useState(""),[Ge,Le]=react.useState("all"),[xe,E]=react.useState(false),[I,P]=react.useState(false),[_,Y]=react.useState(false),[j,ye]=react.useState(false),[F,oe]=react.useState(false),[q,Fe]=react.useState(false),Re=react.useRef(null),tt=react.useRef(null),Oe=react.useRef(null),dt=react.useRef(null),pe=react.useRef(null),vt=react.useRef(null),rt=react.useRef(null),Ot=react.useRef(null),ze=react.useRef(null),Pe=react.useRef(null),Ue=react.useRef(null),ct=react.useRef(null);react.useEffect(()=>{e&&!h?(x({...e}),B(e.subtasks||[])):e&&h&&e.id!==h.id&&(x({...e}),B(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let A=Q=>{let Se=Q.target;dt.current&&!dt.current.contains(Se)&&E(false),pe.current&&!pe.current.contains(Se)&&P(false),vt.current&&!vt.current.contains(Se)&&Y(false),rt.current&&!rt.current.contains(Se)&&ye(false);};if(xe||I||_||j)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[xe,I,_,j]),react.useEffect(()=>{if(!t)return;let A=Q=>{let Se=Q.target,at=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(Q.key==="Escape"){Q.preventDefault(),xe||I||_||j||F||q?(E(false),P(false),Y(false),ye(false),oe(false),Fe(false)):at||a();return}if(at&&Q.key!=="Escape")return;let ge=Q.metaKey||Q.ctrlKey;switch(Q.key.toLowerCase()){case "s":Q.preventDefault(),E(true);break;case "a":Q.preventDefault(),Y(true);break;case "p":Q.preventDefault(),P(true);break;case "l":Q.preventDefault(),ye(true);break;case "d":ge||(Q.preventDefault(),oe(true),setTimeout(()=>Ot.current?.focus(),0));break;case "e":ge||(Q.preventDefault(),Fe(true));break;case "i":Q.preventDefault(),M(true),setTimeout(()=>tt.current?.focus(),0);break;case "t":Q.preventDefault(),R(true);break;case "c":Q.preventDefault(),Oe.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,xe,I,_,j,F,q]);let de=react.useCallback(A=>{let Q=A.currentTarget.textContent?.trim()||"";if(h&&Q!==h.title){let Se={...h,title:Q};x(Se),r?.(h.id,{title:Q});}},[h,r]),we=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=h?.title||"",A.currentTarget.blur());},[h]),Kt=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),M(false);},[h,e,r]),ha=react.useCallback(A=>{if(h){let Q={...h,columnId:A};x(Q),r?.(h.id,{columnId:A}),E(false);}},[h,r]),Et=react.useCallback(A=>{if(h){let Q={...h,priority:A};x(Q),r?.(h.id,{priority:A}),P(false);}},[h,r]),va=react.useCallback(A=>{if(h){let Q=h.assignedUserIds||[],Se=Q.includes(A)?Q.filter(ge=>ge!==A):[...Q,A],at={...h,assignedUserIds:Se};x(at),r?.(h.id,{assignedUserIds:Se});}},[h,r]),ya=react.useCallback(A=>{if(h){let Q=h.labels||[],Se=Q.includes(A)?Q.filter(ge=>ge!==A):[...Q,A],at={...h,labels:Se};x(at),r?.(h.id,{labels:Se});}},[h,r]),De=react.useCallback(A=>{if(h){let Q=A.target.value,Se={...h,endDate:Q};x(Se),r?.(h.id,{endDate:Q}),oe(false);}},[h,r]),Ne=react.useCallback(A=>{if(h){let Q={...h,estimatedTime:parseFloat(A)||0};x(Q),r?.(h.id,{estimatedTime:parseFloat(A)||0});}},[h,r]),kt=react.useCallback(()=>{if($.trim()&&h){let A={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},Q=[...C,A];B(Q),K(""),R(false),f?.(h.id,Q);}},[$,C,h,f]),re=react.useCallback(A=>{let Q=C.map(Se=>Se.id===A?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);B(Q),h&&f?.(h.id,Q);},[C,h,f]),Ce=react.useCallback(A=>{let Q=C.filter(Se=>Se.id!==A);B(Q),h&&f?.(h.id,Q);},[C,h,f]),L=react.useCallback(()=>{le.trim()&&h&&p&&(p(h.id,le.trim()),be(""));},[le,h,p]),G=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),L());},[L]),me=A=>jsxRuntime.jsx(Yp__default.default,{remarkPlugins:[qp__default.default],rehypePlugins:[Xp__default.default],components:{a:({node:Q,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:A}),fe=c.filter(A=>Ge==="comments"?A.type.includes("COMMENT"):Ge==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let J=h||e,ue=s.filter(A=>J.assignedUserIds?.includes(A.id)),Z=C.filter(A=>A.completed).length;return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Re,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:de,onKeyDown:we,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:dt,children:[jsxRuntime.jsxs("button",{ref:ze,className:"modal-v2-field",onClick:()=>E(!xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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($r,{triggerRef:ze,isOpen:xe,onClose:()=>E(false),width:250,estimatedHeight:200,children:(y.length>0?y:Zp.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${J.columnId===A.id?"active":""}`,onClick:()=>ha(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:vt,children:[jsxRuntime.jsxs("button",{ref:Pe,className:"modal-v2-field",onClick:()=>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:ue.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ue.map(A=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx($r,{triggerRef:Pe,isOpen:_,onClose:()=>Y(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>va(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,J.assignedUserIds?.includes(A.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:pe,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>P(!I),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($r,{triggerRef:Ue,isOpen:I,onClose:()=>P(false),width:180,estimatedHeight:220,children:[Jp.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${J.priority===A?"active":""}`,onClick:()=>Et(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Et(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxRuntime.jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>ye(!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.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($r,{triggerRef:ct,isOpen:j,onClose:()=>ye(false),width:220,estimatedHeight:200,children:(g.length>0?g:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.labels?.includes(A)?"active":""}`,onClick:()=>ya(A),children:[A,J.labels?.includes(A)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{oe(!F),setTimeout(()=>Ot.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:Ot,type:"date",value:typeof J.endDate=="string"?J.endDate.split("T")[0]:J.endDate?(()=>{let A=new Date(J.endDate),Q=A.getUTCFullYear(),Se=String(A.getUTCMonth()+1).padStart(2,"0"),at=String(A.getUTCDate()).padStart(2,"0");return `${Q}-${Se}-${at}`})():"",onChange:De,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Fe(!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("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"})]}),q&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:J.estimatedTime||"",onChange:A=>Ne(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Fe(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"})]}),w?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:J.description||"",onChange:A=>{if(h){let Q={...h,description:A.target.value};x(Q);}},onBlur:Kt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>M(true),children:J.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:me(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"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Z,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>R(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:[C.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>re(A.id),children:A.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:A.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ce(A.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},A.id)),z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:A=>K(A.target.value),onKeyDown:A=>{A.key==="Enter"&&kt(),A.key==="Escape"&&(R(false),K(""));},onBlur:kt,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 ${Ge==="all"?"active":""}`,onClick:()=>Le("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ge==="comments"?"active":""}`,onClick:()=>Le("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ge==="history"?"active":""}`,onClick:()=>Le("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:Oe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:le,onChange:A=>be(A.target.value),onKeyDown:G,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:L,disabled:!le.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[fe.map(A=>{let Q=s.find(at=>at.id===A.userId);if(A.type.includes("COMMENT")){let at=d.find(ge=>ge.id===A.metadata?.commentId);return at?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Q&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Q.color},children:Q.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:Q?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:at.content})]})]},A.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:Q?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),fe.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 im({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 En({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(im,{})}),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 bm({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 Pn({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(bm,{})}),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 Dm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},al=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Nm({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 rl({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 Mn({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||Dm[p.name]||al[e.indexOf(p)%al.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?Nm: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(rl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,i=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${i}%)`}})]}):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(rl,{})}),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 fo=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,i]=react.useState(false),[l,u]=react.useState(false);if(e.length===0)return null;let y=e.map(T=>T.id),g=T=>{r.onBulkUpdate?.(y,{priority:T}),c(false);},v=T=>{r.onBulkMove?.(y,T),n(false),a();},k=T=>{r.onBulkUpdate?.(y,{assignedUserIds:T}),i(false);},b=T=>{let D=new Set;e.forEach(x=>{x.labels?.forEach(w=>D.add(w));});let h=Array.from(new Set([...D,...T]));r.onBulkUpdate?.(y,{labels:h}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(T),children:[jsxRuntime.jsx("span",{className:S("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),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(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(T.id),children:T.title},T.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([T.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!l),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([T]),children:T},T))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,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"})})]})]})})});fo.displayName="BulkOperationsToolbar";function Im(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 y=a?.find(g=>g.id===u);d=`assignee-${u}`,c=y?.name||`User ${u}`,p=y?.color,n=y?.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 l={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=l.title,p=l.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 In({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),c=react.useMemo(()=>Im(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{d(m=>{let i=new Set(m);return i.has(n)?i.delete(n):i.add(n),i});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Fa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:S("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),i=e.cards.filter(u=>n.cardIds.includes(u.id)),l={...e,cards:i};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(Fa,{board:l,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 An=[{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 Ln({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),c=An.find(n=>n.value===e)||An[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:S("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:S("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:An.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:S("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 Fm(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 ll(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 i of o.current)if(Fm(n,i)){r&&n.preventDefault();let l=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Rm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Om(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 $m(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Om(e),r=t?Rm(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 Fn({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=zm(e);return jsxRuntime.jsxs("div",{className:S("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:$m(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 Bn=[{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,7 +42,7 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Rn({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 i=m.category||"Other";return n[i]||(n[i]=[]),n[i].push(m),n},{});return jsxRuntime.jsxs("div",{className:S("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:S("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(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i),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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.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:i.name}),i.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.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 $n({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[p,n]=react.useState("json"),[m,i]=react.useState(null),l=react.useRef(null);if(!t)return null;let u=async()=>{let g=o?.current||void 0,v=await li(e,p,g);di(v,p);},y=async g=>{let v=g.target.files?.[0];if(v){try{let k=await mi(v),b=v.name.endsWith(".json")?"json":"csv",f=pi(k,b);i(f),f.success&&r&&r(f,k);}catch(k){i({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxRuntime.jsxs("div",{className:S("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:S("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:S("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(g=>jsxRuntime.jsxs("button",{onClick:()=>n(g),className:S("p-4 rounded-lg border-2 transition-all text-center",p===g?"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:[g==="json"&&"\u{1F4C4}",g==="csv"&&"\u{1F4CA}",g==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:g})]},g))})]}),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:l,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>l.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:S("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:S("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((g,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",g]},v))})]})]})]})]})]})}var _m=["URGENT","HIGH","MEDIUM","LOW"],Vm=[{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"}],jm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function zn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:i=true,compact:l=false,groupBy:u="none",onGroupByChange:y}){let[g,v]=react.useState(true),k=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),f=react.useCallback(h=>{r({by:h.target.value});},[r]),T=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 ${l?"filter-bar--compact":""} ${g?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!g),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:g?"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:g?"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)"]})]}),!g&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[i&&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:k,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 x=h.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),_m.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 x=h.target.value;a({assignees:x==="all"?[]:[x]});},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 x=h.target.value;a({labels:x==="all"?[]:[x]});},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:f,className:"filter-bar__select filter-bar__select--sm",children:Vm.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:h=>y(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jm.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 Un({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),i=react.useRef(null);react.useEffect(()=>{let u=y=>{i.current&&!i.current.contains(y.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let l=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:S("relative",r),ref:i,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:()=>l(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:()=>l(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:()=>l(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:()=>l(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:()=>l(()=>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:()=>l(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:()=>l(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 Wn={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"}},Gn={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"}},Hn={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"}},Za={dark:Wn,light:Gn,neutral:Hn},ho="dark";var vo=react.createContext(void 0),au="asakaa-theme";function cl({children:e,defaultTheme:t=ho,storageKey:a=au}){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=Za[r];Object.entries(p.colors).forEach(([m,i])=>{i&&c.style.setProperty(`--theme-${ru(m)}`,i);}),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,i])=>{let l=p.colors[m];l&&c.style.setProperty(i,l);}),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:Za};return jsxRuntime.jsx(vo.Provider,{value:d,children:e})}function br(){let e=react.useContext(vo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ru(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function _n({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=br();return e?jsxRuntime.jsxs("div",{className:S("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(Za).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:S("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 Be={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 pl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Be[e]||Be.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Be[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Be[e].bgSecondary),bgGrid:r("--theme-bg-card",Be[e].bgGrid),bgWeekend:r("--theme-bg-hover",Be[e].bgWeekend),border:r("--theme-border-primary",Be[e].border),borderLight:r("--theme-border-subtle",Be[e].borderLight),textPrimary:r("--theme-text-primary",Be[e].textPrimary),textSecondary:r("--theme-text-secondary",Be[e].textSecondary),textTertiary:r("--theme-text-tertiary",Be[e].textTertiary),accent:r("--theme-accent-primary",Be[e].accent),accentHover:r("--theme-accent-hover",Be[e].accentHover),accentLight:r("--theme-accent-primary",Be[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Be[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Be[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Be[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Be[e].dependency),dependencyHover:r("--theme-border-secondary",Be[e].dependencyHover),criticalPath:r("--theme-error",Be[e].criticalPath),criticalPathLight:r("--theme-error",Be[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Be[e].today):e==="neutral"?r("--theme-text-primary",Be[e].today):r("--theme-error",Be[e].today),todayLight:e==="light"?r("--theme-accent-primary",Be[e].todayLight):e==="neutral"?r("--theme-text-primary",Be[e].todayLight):r("--theme-error",Be[e].todayLight),milestone:r("--theme-warning",Be[e].milestone),milestoneLight:r("--theme-warning",Be[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Be[e].statusTodo),statusInProgress:r("--theme-accent-primary",Be[e].statusInProgress),statusCompleted:r("--theme-success",Be[e].statusCompleted),hoverBg:r("--theme-bg-hover",Be[e].hoverBg),focusRing:r("--theme-accent-primary",Be[e].focusRing)}}var yo={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"}},ml={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"}},Vn={en:yo,es:ml};function ul(e){return Vn[e]||Vn.en}function jn(e,t){let a=ul(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 vr=react.createContext(yo);function Ur(){return react.useContext(vr)}function xu({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),i=react.useRef(null),l=Ur();if(react.useEffect(()=>{let v=k=>{i.current&&!i.current.contains(k.target)&&p(false);};return c&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]),!(t||a||r||o||s||d))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(v=>v.handler),g=async(v,k)=>{if(k){m(v);try{await k();}catch(b){console.error(`Export ${v} failed:`,b);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:i,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:l.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:y.map((v,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(v.id,v.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:k<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===v.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"})}):v.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:v.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:v.description})]})]},v.id))})})})]})}function ku({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 wu({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 Cu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=Ur();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 i=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:i?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:i?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:i?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500},children:n.label}),i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function xo({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:i,onCreateTask:l,onExportPNG:u,onExportPDF:y,onExportExcel:g,onExportCSV:v,onExportJSON:k,onExportMSProject:b}){let f=Ur(),T=u||y||g||v||k||b,D=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.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(wu,{options:D,value:t,onChange:x=>a(x),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(Cu,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:l,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:i||f.toolbar.createTask})]}),(T||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xu,{theme:e,onExportPNG:u,onExportPDF:y,onExportExcel:g,onExportCSV:v,onExportJSON:k,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(ku,{options:h,value:s,onChange:x=>d(x),theme:e})]})]})}function ko({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=i=>{c.current&&!c.current.contains(i.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(Ke,{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:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.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 yr({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,i=r.length*36+8,l=8,u=window.innerWidth,y=window.innerHeight,g=t,v=a;t+m+l>u&&(g=t-m,g<l&&(g=l)),a+i+l>y&&(v=y-i-l,v<l&&(v=l)),p({x:g,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=l=>{d.current&&!d.current.contains(l.target)&&o();},i=l=>{l.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",i);}},[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:i=>{m.disabled||(i.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:i=>{i.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 it={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 Nl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:i,enableKeyboard:l=true}){let u=react.useRef(false),y=react.useCallback(f=>{u.current=f;},[]),g=react.useCallback(f=>{let T=[],D=h=>{for(let x of h)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&D(x.subtasks);};return D(f),T},[]),v=react.useCallback(()=>{let f=g(e);for(let T of f)if(t.has(T.id))return T;return null},[e,t,g]),k=react.useCallback((f,T)=>{let D=g(e);if(D.length===0)return;let h=v();if(!h){a(D[0].id,false);return}let x=D.findIndex(C=>C.id===h.id);if(x===-1)return;let w=f==="up"?x-1:x+1;if(w<0||w>=D.length)return;let M=D[w];a(M.id,T);},[e,v,g,a]),b=react.useCallback(f=>{if(!l)return;let T=f.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){f.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,w=Array.from(t),M=v();if(f.key==="ArrowUp"){f.preventDefault(),k("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),k("down",f.shiftKey);return}if(M&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){M.subtasks&&M.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!M.isExpanded||f.key==="ArrowLeft"&&M.isExpanded)&&m(M.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){w.length>0&&(f.preventDefault(),d(w,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){w.length>0&&(f.preventDefault(),c(w));return}if(f.key==="Tab"&&f.shiftKey){w.length>0&&(f.preventDefault(),p(w));return}if(f.key==="Enter"&&!f.shiftKey&&!x){M&&(f.preventDefault(),r(M.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!x){M&&(f.preventDefault(),r(M.id,"above"));return}if(f.key==="Enter"&&x){M&&(f.preventDefault(),i(M.id));return}if(f.key==="F2"){M&&(f.preventDefault(),n(M.id));return}if(f.key==="Delete"||f.key==="Backspace"&&x){w.length>0&&(f.preventDefault(),o(w));return}if(f.key==="d"&&x&&!f.shiftKey){w.length>0&&(f.preventDefault(),s(w));return}},[l,t,v,k,r,o,s,d,c,p,n,m,i]);return react.useEffect(()=>{if(l)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[l,b]),{setIsEditing:y}}function El(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(i=>{t(new Set([i])),r(i);},[]),s=react.useCallback(i=>{t(l=>{let u=new Set(l);return u.has(i)?u.delete(i):u.add(i),u}),r(i);},[]),d=react.useCallback((i,l)=>{if(!a){o(i);return}let u=l.indexOf(a),y=l.indexOf(i);if(u===-1||y===-1){o(i);return}let g=Math.min(u,y),v=Math.max(u,y),k=l.slice(g,v+1);t(new Set(k)),r(i);},[a,o]),c=react.useCallback((i,l,u,y)=>{y?d(i,l):u?s(i):o(i);},[o,s,d]),p=react.useCallback((i,l)=>{l?t(u=>{let y=new Set(u);return y.add(i),y}):o(i);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function xr(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 Pl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Pl(a.subtasks,t);if(r)return r}}return null}function qn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=qn(a.subtasks,t);if(r)return r}return null}function Xn(e,t){if(t.length===0)return e;let a=xr(e),r=t[0],o=a.findIndex(i=>i.id===r);if(o<=0)return e;let s=a[o-1],d=(i,l)=>{let u=[];return {tasks:i.filter(g=>{if(l.has(g.id))return u.push(g),false;if(g.subtasks){let v=d(g.subtasks,l);g.subtasks=v.tasks,u.push(...v.removed);}return true}),removed:u}},c=(i,l,u)=>i.map(y=>y.id===l?{...y,subtasks:[...y.subtasks||[],...u],isExpanded:true}:y.subtasks?{...y,subtasks:c(y.subtasks,l,u)}:y),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function Jn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=qn(a,r);if(!o)continue;let s=qn(a,o.id),d=(n,m,i)=>{for(let l=0;l<n.length;l++){let u=n[l];if(u.id===m&&u.subtasks){let y=u.subtasks.findIndex(g=>g.id===i);if(y!==-1){let[g]=u.subtasks.splice(y,1);return g}}if(u.subtasks){let y=d(u.subtasks,m,i);if(y)return y}}return null},c=(n,m,i)=>{let l=n.findIndex(u=>u.id===m);if(l!==-1)return n.splice(l+1,0,i),n;for(let u of n)u.subtasks&&c(u.subtasks,m,i);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 Zn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(i=>i.id===c);if(n===-1){for(let i of d)if(i.subtasks&&s(i.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 Qn(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 es(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 Ml(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(i=>i.id===t);if(n===-1){for(let i of p)if(i.subtasks&&c(i.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 as(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:as(a.subtasks,t)}:a)}function rs(e,t){let a=m=>{for(let i of m){if(i.id===t)return i;if(i.subtasks){let l=a(i.subtasks);if(l)return l}}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(i=>{if(i.id===t){let l=i.subtasks||[];return {...i,subtasks:[...l,p],isExpanded:true}}return i.subtasks?{...i,subtasks:n(i.subtasks)}:i});return {tasks:n(e),newTask:p}}function Il(e,t,a,r){if(t===a)return e;let o=Pl(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||[],i=r!==void 0?r:m.length,l=[...m];return l.splice(i,0,{...o,parentId:a}),{...n,subtasks:l,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function To({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:i,onColumnResize:l,onTaskUpdate:u,onTaskIndent:y,onTaskOutdent:g,onTaskMove:v,onMultiTaskDelete:k,onTaskDuplicate:b,onTaskCreate:f,onTaskRename:T,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:x,onTaskReparent:w}){let M=react.useContext(vr),[C,B]=react.useState(null),[z,R]=react.useState(false),[$,K]=react.useState(null),[le,be]=react.useState(""),Ge=react.useRef(null),Le=react.useRef(null),[xe,E]=react.useState(null),[I,P]=react.useState(0),[_,Y]=react.useState(0),[j,ye]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[F,oe]=react.useState(null),[q,Fe]=react.useState(null),[Re,tt]=react.useState(null),Oe=react.useRef(0),dt=5,ce=react.useRef(false);react.useEffect(()=>{function L(G){Ge.current&&!Ge.current.contains(G.target)&&R(false);}if(z)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[z]),react.useEffect(()=>{$&&Le.current&&(Le.current.focus(),Le.current.select());},[$]),react.useEffect(()=>{if(!xe)return;let L=pe=>{let fe=pe.clientX-I,J=_+fe;l?.(xe,J);},G=()=>{E(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",L),document.addEventListener("mouseup",G),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",G),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,I,_,l]);let{selectedTaskIds:vt,handleTaskClick:rt,isTaskSelected:Ot}=El(),{setIsEditing:ze}=Nl({tasks:e,selectedTaskIds:vt,onTaskSelect:(L,G)=>{let fe=xr(e).map(J=>J.id);rt(L,fe,G||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:g||(()=>{}),onTaskRename:L=>{let G=xr(e).find(pe=>pe.id===L);G&&we(G);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:L=>{let G=xr(e).find(pe=>pe.id===L);G&&h&&h(G);},enableKeyboard:true}),Pe=(L,G=0)=>{let pe=[];for(let fe of L)pe.push({task:fe,level:G}),fe.subtasks&&fe.subtasks.length>0&&fe.isExpanded&&pe.push(...Pe(fe.subtasks,G+1));return pe},Ue=Pe(e),ct=48,de=L=>!L.startDate||!L.endDate?"-":`${Math.ceil((L.endDate.getTime()-L.startDate.getTime())/(1e3*60*60*24))}d`,we=L=>{K(L.id),be(L.name),ze(true);},Kt=L=>{le.trim()&&le!==e.find(G=>G.id===L)?.name&&T?.(L,le.trim()),K(null),be(""),ze(false);},ha=()=>{K(null),be(""),ze(false);},Et=(L,G)=>{G.stopPropagation(),D?.(L.id);},va=(L,G)=>{G.preventDefault(),Oe.current=G.clientY,oe(L),ce.current=false;},ya=L=>{if(!F||(Math.abs(L.clientY-Oe.current)>dt&&(ce.current=true),!ce.current))return;let pe=document.querySelectorAll("[data-task-row]"),fe=null,J=null;pe.forEach(me=>{let Z=me.getBoundingClientRect(),A=me.getAttribute("data-task-row");if(A&&A!==F&&L.clientY>=Z.top&&L.clientY<=Z.bottom){fe=A;let Q=L.clientY-Z.top,Se=Z.height;Q<Se*.25?J="above":Q>Se*.75?J="below":J="child";}}),Fe(fe),tt(J);},De=()=>{if(ce.current&&F&&q&&Re){if(Re==="child")w?.(F,q);else if(Re==="above"||Re==="below"){let L=(fe,J,me=null)=>{for(let Z of fe){if(Z.id===J)return me;if(Z.subtasks){let A=L(Z.subtasks,J,Z.id);if(A!==void 0)return A}}},G=L(e,q,null),pe=(fe,J)=>{let me=fe.findIndex(Z=>Z.id===J);return Re==="below"?me+1:me};if(G===null){let fe=pe(e,q);w?.(F,null,fe);}else {let fe=Ue.find(J=>J.task.id===G)?.task;if(fe?.subtasks){let J=pe(fe.subtasks,q);w?.(F,G,J);}}}}oe(null),Fe(null),tt(null),ce.current=false;};react.useEffect(()=>{if(F)return document.addEventListener("mousemove",ya),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ya),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[F,q,Re]);let Ne=(L,G,pe)=>{switch(L.id){case "name":let fe=$===G.id,J=C===G.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pe*20}px`},children:[w&&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:J?1:.3},onMouseDown:ue=>va(G.id,ue),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),G.subtasks&&G.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ue=>{ue.stopPropagation(),p?.(G.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:G.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"}),!(G.subtasks&&G.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:G.color||"#3B82F6",opacity:G.parentId?.6:1,borderColor:G.isMilestone?t.accent:"transparent",borderWidth:G.isMilestone?"2px":"0px"},title:G.isMilestone?"Milestone":G.parentId?"Subtask":"Task"}),fe?jsxRuntime.jsx("input",{ref:Le,type:"text",value:le,onChange:ue=>be(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?Kt(G.id):ue.key==="Escape"&&ha();},onBlur:()=>Kt(G.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:ue=>ue.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:G.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:G.parentId?"13px":"14px",fontWeight:G.isMilestone?600:G.parentId?400:600,letterSpacing:G.parentId?"0":"-0.01em"},title:G.name,children:G.name}),J&&!fe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ue=>ue.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ue=>Et(G,ue),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:ue=>{ue.stopPropagation(),we(G);},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":let me=G.startDate?typeof G.startDate=="string"?G.startDate:G.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:me||"",onChange:ue=>{u?.(G.id,{startDate:ue.target.value?new Date(ue.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let Z=G.endDate?typeof G.endDate=="string"?G.endDate:G.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Z||"",onChange:ue=>{u?.(G.id,{endDate:ue.target.value?new Date(ue.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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(G)})});case "assignees":let A=r.filter(ue=>G.assignees?.some(_a=>_a.name===ue.name||_a.initials===ue.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Ya,{assignedUsers:A,availableUsers:r,onChange:ue=>{let _a=ue.map(sr=>({id:sr.id,name:sr.name,initials:sr.initials,color:sr.color}));u?.(G.id,{assignees:_a.length>0?_a:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Ii,{status:G.status||"todo",onChange:ue=>{u?.(G.id,{status:ue,progress:ue==="completed"?100:G.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:`${G.progress}%`,backgroundColor:G.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:[G.progress,"%"]})]});case "priority":let Q={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Se={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},at=Q[G.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(ja,{priority:at,onChange:ue=>{ue&&u?.(G.id,{priority:Se[ue]||"medium"});}})});default:return null}},kt=L=>[{id:"hide",label:"Hide Column",icon:it.Hide,onClick:()=>i(L),disabled:L==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:it.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:it.SortDesc,onClick:()=>{}}],re=L=>L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(L.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{x?x(L.id,L.name):k?.([L.id]);}}]:[{id:"edit",label:M?.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{d?.(L);}},{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(L.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:M?.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{u?.(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:M?.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{u?.(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:M?.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{u?.(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:M?.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{x?x(L.id,L.name):k?.([L.id]);}}],Ce=m.filter(L=>L.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:`${ct}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Ce.map((L,G)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${L.id==="name"?"justify-between":"justify-center"}`,style:{...L.id==="name"?{flex:"1 1 auto",minWidth:`${L.minWidth??150}px`}:{width:`${L.width}px`,minWidth:`${L.minWidth??60}px`,maxWidth:`${L.maxWidth??2e3}px`,flexShrink:0},borderRight:G<Ce.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:pe=>{pe.preventDefault(),ye({isOpen:true,x:pe.clientX,y:pe.clientY,type:"header",columnId:L.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",flex:L.id==="name"?"1 1 auto":"none",minWidth:0},title:L.label,children:L.label}),L.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(ko,{columns:m,onToggleColumn:i,theme:t}),jsxRuntime.jsx("button",{onClick:()=>R(!z),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"})})]}),L.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:xe===L.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:pe=>{pe.preventDefault(),pe.stopPropagation(),E(L.id),P(pe.clientX),Y(L.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"}})})]},L.id)),z&&jsxRuntime.jsxs("div",{ref:Ge,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:L=>L.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:()=>R(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:Ue.map(({task:L,level:G},pe)=>{let fe=Ot(L.id),J=q===L.id,me={};return J&&Re&&(Re==="above"?(me.borderTopWidth="2px",me.borderTopStyle="solid",me.borderTopColor=t.accent):Re==="below"?(me.borderBottomWidth="2px",me.borderBottomStyle="solid",me.borderBottomColor=t.accent):Re==="child"&&(me.backgroundColor=t.accentLight,me.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":L.id,className:`flex items-center cursor-pointer group ${F===L.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:fe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:fe||J&&Re==="child"?t.accentLight:pe%2===0?t.bgPrimary:t.bgGrid,...me},onMouseEnter:()=>B(L.id),onMouseLeave:()=>B(null),onClick:Z=>{let Q=xr(e).map(ue=>ue.id),at=navigator.platform.toUpperCase().indexOf("MAC")>=0?Z.metaKey:Z.ctrlKey;rt(L.id,Q,at,Z.shiftKey),s?.(L);},onDoubleClick:Z=>{Z.stopPropagation(),d?.(L);},onContextMenu:Z=>{Z.preventDefault(),ye({isOpen:true,x:Z.clientX,y:Z.clientY,type:"task",task:L}),c?.(L,Z);},whileHover:{backgroundColor:fe?t.accentLight:t.hoverBg},children:Ce.map((Z,A)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Z.id==="name"?"justify-start":"justify-center"} ${A<Ce.length-1?"border-r":""}`,style:{...Z.id==="name"?{flex:"1 1 auto",minWidth:`${Z.minWidth??150}px`}:{width:`${Z.width}px`,minWidth:`${Z.minWidth??60}px`,maxWidth:`${Z.maxWidth??2e3}px`,flexShrink:0},borderColor:C===L.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ne(Z,L,Z.id==="name"?G:0)},`${L.id}-${Z.id}`))},L.id)})}),jsxRuntime.jsx(yr,{isOpen:j.isOpen,x:j.x,y:j.y,items:j.type==="header"&&j.columnId?kt(j.columnId):j.type==="task"&&j.task?re(j.task):[],onClose:()=>ye({...j,isOpen:false}),theme:t})]})}function Al(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[p,n]=react.useState(t),[m,i]=react.useState(null),[l,u]=react.useState(null),[y,g]=react.useState(null),[v,k]=react.useState(null),[b,f]=react.useState(0),[T,D]=react.useState(0),[h,x]=react.useState(null),[w,M]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:i,hoveredTaskId:l,setHoveredTaskId:u,activeZone:y,setActiveZone:g,draggedSegmentIndex:v,setDraggedSegmentIndex:k,draggedSegmentStartX:b,setDraggedSegmentStartX:f,segmentDragOffsetX:T,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:x,isHovered:w,setIsHovered:M,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,K)=>{r("none"),i(null),u(null),c($),n(K),D(0),k(null),f(0);}}}function Do({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:i,onDependencyCreate:l,allTaskPositions:u=[],onDragMove:y,onHoverChange:g}){let v=Al(t,r),k=react.useRef(null),{dragMode:b,setDragMode:f,dragOffset:T,setDragOffset:D,ghostX:h,setGhostX:x,ghostWidth:w,setGhostWidth:M,connectionLine:C,setConnectionLine:B,hoveredTaskId:z,setHoveredTaskId:R,activeZone:$,setActiveZone:K,draggedSegmentIndex:le,setDraggedSegmentIndex:be,draggedSegmentStartX:Ge,setDraggedSegmentStartX:Le,segmentDragOffsetX:xe,setSegmentDragOffsetX:E,hoveredSegmentIndex:I,setHoveredSegmentIndex:P,isHovered:_,setIsHovered:Y,isDragging:j,isResizing:ye,isConnecting:F,resetDragState:oe}=v,q=32,Fe=8,Re=e.endDate&&e.endDate<new Date&&e.progress<100,tt=e.isCriticalPath,Oe=o.name==="neutral"||o.today==="#1C1917",dt=e.status==="completed"||e.progress===100,ce={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},rt=e.isCriticalPath||Re?"#DC2626":e.color?e.color:e.priority&&ce[e.priority]?ce[e.priority]:o.taskBarPrimary,ze=(re=>re>=80?20:re>=60?15:re>=50?12:10)(r),Pe=r<50,Ue=r<40;react.useEffect(()=>{if(g)if(_&&!j&&!e.segments){let re=a<100;g({task:e,x:t,y:a,width:r,height:q,showBelow:re});}else g(null);},[_,j,e,t,a,r,q,g]);let ct=re=>re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),de=()=>{let re=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${re} day${re!==1?"s":""}`},we=re=>Math.round(re/s)*s,Kt=re=>{let Ce=Math.round(re/s),L=new Date(d);return L.setDate(L.getDate()+Ce),L},ha=(re,Ce)=>{for(let L of u){if(L.id===e.id)continue;let G=5;if(re>=L.x-G&&re<=L.x+L.width+G&&Ce>=L.y-G&&Ce<=L.y+L.height+G)return L.id}return null},Et=react.useCallback((re,Ce,L)=>{re.preventDefault(),re.stopPropagation();let G=k.current?.ownerSVGElement;if(!G)return;let pe=G.createSVGPoint();pe.x=re.clientX,pe.y=re.clientY;let fe=pe.matrixTransform(G.getScreenCTM()?.inverse()),J=L!==void 0?L:t,me=Ce;if(!me){let Z=fe.x-J;re.shiftKey?(me="connect",B({x:t+r,y:a+q/2})):re.ctrlKey||re.metaKey?me="move":re.altKey?me=Z<r/2?"resize-start":"resize-end":Ue?Z<r/2?me="move":me="resize-end":Pe?Z<=ze/2?me="resize-start":Z>=r-ze/2?me="resize-end":me="move":Z<=ze?me="resize-start":Z>=r-ze?me="resize-end":me="move";}f(me),Y(false),K(null),me==="move"?D(fe.x-J):me==="connect"?B({x:t+r,y:a+q/2}):D(0),x(J),M(r);},[t,r,a,q]),va=react.useCallback(re=>{if(b==="none")return;let Ce=k.current?.ownerSVGElement;if(!Ce)return;let L=Ce.createSVGPoint();L.x=re.clientX,L.y=re.clientY;let G=L.matrixTransform(Ce.getScreenCTM()?.inverse());if(b==="connect"){B({x:G.x,y:G.y});let pe=ha(G.x,G.y);R(pe);}else if(b==="move"){let pe=G.x-T,fe=we(pe);x(fe),M(r);let J=Math.round((fe-t)/s);if(y?.(e.id,J,true),e.segments&&e.segments.length>0&&le!==null){let me=fe-Ge;E(me);}}else if(b==="resize-start"){let pe=G.x,fe=we(pe),J=t+r-fe;J>=s&&(x(fe),M(J));}else if(b==="resize-end"){let pe=G.x,J=we(pe)-t;J>=s&&M(J);}},[b,t,r,s,T,e,we,le,Ge,ha,R,B,x,M,E,y]),ya=react.useCallback(()=>{if(b!=="none"){if(b==="connect")z&&l&&l(e,z),B(null),R(null);else {let re=e.endDate.getTime()-e.startDate.getTime(),Ce,L,G=true;if(b==="move"){if(Ce=Kt(h),L=new Date(Ce.getTime()+re),e.segments&&e.segments.length>0&&le!==null){let pe=Math.round(xe/s),fe=e.segments.map((A,Q)=>{if(Q===le){let Se=new Date(A.startDate),at=new Date(A.endDate);return Se.setDate(Se.getDate()+pe),at.setDate(at.getDate()+pe),{startDate:Se,endDate:at}}return A}),J=fe.flatMap(A=>[A.startDate,A.endDate]),me=new Date(Math.min(...J.map(A=>A.getTime()))),Z=new Date(Math.max(...J.map(A=>A.getTime())));i?.({...e,segments:fe},me,Z),oe(t,r);return}}else b==="resize-start"?(Ce=Kt(h),L=e.endDate,Ce>=L&&(console.warn("Invalid date range: start date must be before end date"),G=false)):b==="resize-end"?(Ce=e.startDate,L=Kt(h+w),L<=Ce&&(console.warn("Invalid date range: end date must be after start date"),G=false)):G=false;G&&Ce&&L&&(L.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):i?.(e,Ce,L));}y?.(e.id,0,false),oe(t,r);}},[b,h,w,e,i,z,l,t,r,s,Kt,xe,le,oe,y]);react.useEffect(()=>{if(b==="none")return;let re=L=>{va(L);},Ce=()=>{ya();};return window.addEventListener("mousemove",re),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Ce);}},[b,va,ya]);let De=j&&!F?h:t,Ne=j&&!F?w:r,kt=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!j&&Y(true),onMouseLeave:()=>{j||(Y(false),K(null));},onClick:()=>!j&&p?.(e),onDoubleClick:re=>{j||(re.stopPropagation(),n?.(e));},onContextMenu:re=>{re.preventDefault(),m?.(e,re);},children:[_&&!j&&!Pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ze,height:q,fill:$==="resize-start"?o.accent:"transparent",opacity:$==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-start"),onMouseDown:re=>Et(re,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ze,y:a,width:r-ze*2,height:q,fill:$==="move"?o.accent:"transparent",opacity:$==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:re=>Et(re,"move")}),jsxRuntime.jsx("rect",{x:t+r-ze,y:a,width:ze,height:q,fill:$==="resize-end"?o.accent:"transparent",opacity:$==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:re=>Et(re,"resize-end")})]}),_&&!j&&Ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:q,fill:$==="move"?o.accent:"transparent",opacity:$==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:re=>Et(re,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:q,fill:$==="resize-end"?o.accent:"transparent",opacity:$==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:re=>Et(re,"resize-end")}),_&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+q-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),j&&!F&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:w,height:q,rx:Fe,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:De,y:a,width:Ne,height:q,rx:Fe,fill:rt,"data-task-class":kt,initial:{opacity:0,scale:.95},animate:{opacity:j&&!F?.15:e.parentId?.6:_?.9:.8,scale:_&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>Et(re),style:{cursor:j?F?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:De,y:a,width:Ne*(e.progress/100),height:q,rx:Fe,fill:rt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((re,Ce)=>{let L=(re.startDate.getTime()-d.getTime())/864e5*s,pe=(re.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-L+s,fe=j&&b==="move"&&le===Ce,J=I===Ce,me=fe?L+xe:L;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&P(Ce),onMouseLeave:()=>!j&&P(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:me,y:a,width:pe,height:q,rx:Fe,fill:rt,initial:{opacity:0,scale:.95},animate:{opacity:fe||e.parentId?.6:J?.9:.8,scale:J&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>{Z.stopPropagation(),be(Ce),Le(L),Et(Z,void 0,L);},style:{cursor:j?F?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:me,y:a,width:pe*(e.progress/100),height:q,rx:Fe,fill:rt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Oe&&(Re||tt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[tt&&!Re&&jsxRuntime.jsx("rect",{x:De,y:a,width:Ne,height:q,rx:Fe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Re&&jsxRuntime.jsx("rect",{x:De,y:a,width:Ne,height:q,rx:Fe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ne>60&&!e.segments&&(()=>{let re=c.taskLabel(e),Ce=typeof re=="string"?re:e.name,L=Ce.length>Math.floor(Ne/8)?`${Ce.substring(0,Math.floor(Ne/8))}...`:Ce;return jsxRuntime.jsx("text",{x:De+12,y:a+q/2,dominantBaseline:"middle",fill:dt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:dt?"line-through":"none"},children:L})})(),Ne>100&&e.progress>0&&e.progress<100&&!j&&!e.segments&&jsxRuntime.jsxs("text",{x:De+Ne-12,y:a+q/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&&Ne>80&&!j&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:De+Ne-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:De+Ne-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(_||ye)&&!F&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Pe?De-15:De-10,y:a-5,width:Pe?25:20,height:q+10,fill:"transparent",onMouseDown:re=>Et(re,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Pe?De-8:De-3,y:a+6,width:Pe?8:6,height:Pe?q-12:q-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:De+Ne-10,y:a-5,width:Pe?25:20,height:q+10,fill:"transparent",onMouseDown:re=>Et(re,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Pe?De+Ne:De+Ne-3,y:a+6,width:Pe?8:6,height:Pe?q-12:q-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&&!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+q/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(),Et(re,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+q/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),F&&C&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+q/2,x2:C.x,y2:C.y,stroke:z?o.statusCompleted:o.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:C.x,cy:C.y,r:z?8:6,fill:z?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsxRuntime.jsx(framerMotion.motion.text,{x:C.x+15,y:C.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:C.x+10},animate:{opacity:1,x:C.x+15},transition:{duration:.2},children:"Connect"})]}),(_||j)&&!F&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:De-2,y:a-2,width:Ne+4,height:q+4,rx:Fe+2,fill:"none",stroke:j?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:j?.6:.4,initial:{opacity:0},animate:{opacity:j?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ye&&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+w,y1:0,x2:h+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&!j&&!e.segments&&!g&&(()=>{let L=a<100,G=L?a+q+13:a-82-13,pe=L?`M ${De+Ne/2-6} ${a+q+3} L ${De+Ne/2} ${a+q+13} L ${De+Ne/2+6} ${a+q+3}`:`M ${De+Ne/2-6} ${a-13} L ${De+Ne/2} ${a-3} L ${De+Ne/2+6} ${a-13}`,fe=G+22,J=G+40,me=G+55,Z=G+70,A=L?G+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:L?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:L?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:pe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:De+Ne/2-120,y:G,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:De+Ne/2,y:fe,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:De+Ne/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:De+Ne/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.startDate)}),jsxRuntime.jsx("text",{x:De+Ne/2-110,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:De+Ne/2-70,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.endDate)}),jsxRuntime.jsx("text",{x:De+Ne/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:De+Ne/2+65,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:de()}),jsxRuntime.jsx("text",{x:De+Ne/2+10,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:De+Ne/2+65,y:me,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:De+Ne/2-110,y:Z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:De+Ne/2-50,y:Z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Q=>Q.name).join(", ").substring(0,30),e.assignees.map(Q=>Q.name).join(", ").length>30?"...":""]})]}),!L&&jsxRuntime.jsx("text",{x:De+Ne/2,y:A,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ue?"Left: move \u2022 Right: resize":Pe?"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 Bl({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,i=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}`,l=m+22,u=m+40,y=m+55,g=m+70,v=c?m+p-5:o-18,k=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let D=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${D} day${D!==1?"s":""}`},f=s<50,T=s<40;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:i,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:l,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?k(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?k(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:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,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:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(D=>D.name).join(", ").substring(0,30),a.assignees.map(D=>D.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+s/2,y:v,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:T?"Left: move \u2022 Right: resize":f?"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 Eo({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,i=e+n/2,l=`M ${e} ${t} C ${i} ${t}, ${i} ${r}, ${a} ${r}`,u=6,y=Math.atan2(m,n),g=a-u*Math.cos(y-Math.PI/6),v=r-u*Math.sin(y-Math.PI/6),k=a-u*Math.cos(y+Math.PI/6),b=r-u*Math.sin(y+Math.PI/6),f=o.dependency;return react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${g} ${v} M ${a} ${r} L ${k} ${b}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:i,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:i-4,y1:(t+r)/2-4,x2:i+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:i+4,y1:(t+r)/2-4,x2:i-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Mo({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 X={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 i of m){if(!d.has(i)&&p(i))return true;if(c.has(i))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=X.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=X.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=X.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=X.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(`
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Rn({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 i=m.category||"Other";return n[i]||(n[i]=[]),n[i].push(m),n},{});return jsxRuntime.jsxs("div",{className:S("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:S("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(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i),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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.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:i.name}),i.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.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 $n({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[p,n]=react.useState("json"),[m,i]=react.useState(null),l=react.useRef(null);if(!t)return null;let u=async()=>{let g=o?.current||void 0,v=await di(e,p,g);ci(v,p);},y=async g=>{let v=g.target.files?.[0];if(v){try{let k=await ui(v),b=v.name.endsWith(".json")?"json":"csv",f=mi(k,b);i(f),f.success&&r&&r(f,k);}catch(k){i({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxRuntime.jsxs("div",{className:S("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:S("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:S("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(g=>jsxRuntime.jsxs("button",{onClick:()=>n(g),className:S("p-4 rounded-lg border-2 transition-all text-center",p===g?"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:[g==="json"&&"\u{1F4C4}",g==="csv"&&"\u{1F4CA}",g==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:g})]},g))})]}),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:l,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>l.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:S("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:S("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((g,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",g]},v))})]})]})]})]})]})}var _m=["URGENT","HIGH","MEDIUM","LOW"],Vm=[{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"}],jm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function zn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:i=true,compact:l=false,groupBy:u="none",onGroupByChange:y}){let[g,v]=react.useState(true),k=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),f=react.useCallback(h=>{r({by:h.target.value});},[r]),T=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 ${l?"filter-bar--compact":""} ${g?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!g),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:g?"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:g?"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)"]})]}),!g&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[i&&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:k,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 x=h.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),_m.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 x=h.target.value;a({assignees:x==="all"?[]:[x]});},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 x=h.target.value;a({labels:x==="all"?[]:[x]});},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:f,className:"filter-bar__select filter-bar__select--sm",children:Vm.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:h=>y(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jm.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 Un({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),i=react.useRef(null);react.useEffect(()=>{let u=y=>{i.current&&!i.current.contains(y.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let l=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:S("relative",r),ref:i,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:()=>l(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:()=>l(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:()=>l(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:()=>l(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:()=>l(()=>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:()=>l(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:()=>l(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 Wn={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"}},Gn={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"}},Hn={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"}},Za={dark:Wn,light:Gn,neutral:Hn},ho="dark";var vo=react.createContext(void 0),au="asakaa-theme";function pl({children:e,defaultTheme:t=ho,storageKey:a=au}){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=Za[r];Object.entries(p.colors).forEach(([m,i])=>{i&&c.style.setProperty(`--theme-${ru(m)}`,i);}),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,i])=>{let l=p.colors[m];l&&c.style.setProperty(i,l);}),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:Za};return jsxRuntime.jsx(vo.Provider,{value:d,children:e})}function br(){let e=react.useContext(vo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ru(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function _n({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=br();return e?jsxRuntime.jsxs("div",{className:S("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(Za).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:S("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 Be={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 ml(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Be[e]||Be.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Be[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Be[e].bgSecondary),bgGrid:r("--theme-bg-card",Be[e].bgGrid),bgWeekend:r("--theme-bg-hover",Be[e].bgWeekend),border:r("--theme-border-primary",Be[e].border),borderLight:r("--theme-border-subtle",Be[e].borderLight),textPrimary:r("--theme-text-primary",Be[e].textPrimary),textSecondary:r("--theme-text-secondary",Be[e].textSecondary),textTertiary:r("--theme-text-tertiary",Be[e].textTertiary),accent:r("--theme-accent-primary",Be[e].accent),accentHover:r("--theme-accent-hover",Be[e].accentHover),accentLight:r("--theme-accent-primary",Be[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Be[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Be[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Be[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Be[e].dependency),dependencyHover:r("--theme-border-secondary",Be[e].dependencyHover),criticalPath:r("--theme-error",Be[e].criticalPath),criticalPathLight:r("--theme-error",Be[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Be[e].today):e==="neutral"?r("--theme-text-primary",Be[e].today):r("--theme-error",Be[e].today),todayLight:e==="light"?r("--theme-accent-primary",Be[e].todayLight):e==="neutral"?r("--theme-text-primary",Be[e].todayLight):r("--theme-error",Be[e].todayLight),milestone:r("--theme-warning",Be[e].milestone),milestoneLight:r("--theme-warning",Be[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Be[e].statusTodo),statusInProgress:r("--theme-accent-primary",Be[e].statusInProgress),statusCompleted:r("--theme-success",Be[e].statusCompleted),hoverBg:r("--theme-bg-hover",Be[e].hoverBg),focusRing:r("--theme-accent-primary",Be[e].focusRing)}}var yo={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"}},ul={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"}},Vn={en:yo,es:ul};function gl(e){return Vn[e]||Vn.en}function jn(e,t){let a=gl(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 vr=react.createContext(yo);function Ur(){return react.useContext(vr)}function xu({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),i=react.useRef(null),l=Ur();if(react.useEffect(()=>{let v=k=>{i.current&&!i.current.contains(k.target)&&p(false);};return c&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]),!(t||a||r||o||s||d))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(v=>v.handler),g=async(v,k)=>{if(k){m(v);try{await k();}catch(b){console.error(`Export ${v} failed:`,b);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:i,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:l.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:y.map((v,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(v.id,v.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:k<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===v.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"})}):v.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:v.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:v.description})]})]},v.id))})})})]})}function ku({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 wu({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 Cu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=Ur();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 i=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:i?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:i?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:i?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500},children:n.label}),i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function xo({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:i,onCreateTask:l,onExportPNG:u,onExportPDF:y,onExportExcel:g,onExportCSV:v,onExportJSON:k,onExportMSProject:b}){let f=Ur(),T=u||y||g||v||k||b,D=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.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(wu,{options:D,value:t,onChange:x=>a(x),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(Cu,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:l,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:i||f.toolbar.createTask})]}),(T||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xu,{theme:e,onExportPNG:u,onExportPDF:y,onExportExcel:g,onExportCSV:v,onExportJSON:k,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(ku,{options:h,value:s,onChange:x=>d(x),theme:e})]})]})}function ko({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=i=>{c.current&&!c.current.contains(i.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(Ke,{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:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.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 yr({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,i=r.length*36+8,l=8,u=window.innerWidth,y=window.innerHeight,g=t,v=a;t+m+l>u&&(g=t-m,g<l&&(g=l)),a+i+l>y&&(v=y-i-l,v<l&&(v=l)),p({x:g,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=l=>{d.current&&!d.current.contains(l.target)&&o();},i=l=>{l.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",i);}},[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:i=>{m.disabled||(i.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:i=>{i.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 it={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 Sl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:i,enableKeyboard:l=true}){let u=react.useRef(false),y=react.useCallback(f=>{u.current=f;},[]),g=react.useCallback(f=>{let T=[],D=h=>{for(let x of h)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&D(x.subtasks);};return D(f),T},[]),v=react.useCallback(()=>{let f=g(e);for(let T of f)if(t.has(T.id))return T;return null},[e,t,g]),k=react.useCallback((f,T)=>{let D=g(e);if(D.length===0)return;let h=v();if(!h){a(D[0].id,false);return}let x=D.findIndex(C=>C.id===h.id);if(x===-1)return;let w=f==="up"?x-1:x+1;if(w<0||w>=D.length)return;let M=D[w];a(M.id,T);},[e,v,g,a]),b=react.useCallback(f=>{if(!l)return;let T=f.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){f.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,w=Array.from(t),M=v();if(f.key==="ArrowUp"){f.preventDefault(),k("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),k("down",f.shiftKey);return}if(M&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){M.subtasks&&M.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!M.isExpanded||f.key==="ArrowLeft"&&M.isExpanded)&&m(M.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){w.length>0&&(f.preventDefault(),d(w,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){w.length>0&&(f.preventDefault(),c(w));return}if(f.key==="Tab"&&f.shiftKey){w.length>0&&(f.preventDefault(),p(w));return}if(f.key==="Enter"&&!f.shiftKey&&!x){M&&(f.preventDefault(),r(M.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!x){M&&(f.preventDefault(),r(M.id,"above"));return}if(f.key==="Enter"&&x){M&&(f.preventDefault(),i(M.id));return}if(f.key==="F2"){M&&(f.preventDefault(),n(M.id));return}if(f.key==="Delete"||f.key==="Backspace"&&x){w.length>0&&(f.preventDefault(),o(w));return}if(f.key==="d"&&x&&!f.shiftKey){w.length>0&&(f.preventDefault(),s(w));return}},[l,t,v,k,r,o,s,d,c,p,n,m,i]);return react.useEffect(()=>{if(l)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[l,b]),{setIsEditing:y}}function Pl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(i=>{t(new Set([i])),r(i);},[]),s=react.useCallback(i=>{t(l=>{let u=new Set(l);return u.has(i)?u.delete(i):u.add(i),u}),r(i);},[]),d=react.useCallback((i,l)=>{if(!a){o(i);return}let u=l.indexOf(a),y=l.indexOf(i);if(u===-1||y===-1){o(i);return}let g=Math.min(u,y),v=Math.max(u,y),k=l.slice(g,v+1);t(new Set(k)),r(i);},[a,o]),c=react.useCallback((i,l,u,y)=>{y?d(i,l):u?s(i):o(i);},[o,s,d]),p=react.useCallback((i,l)=>{l?t(u=>{let y=new Set(u);return y.add(i),y}):o(i);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function xr(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 Ml(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ml(a.subtasks,t);if(r)return r}}return null}function qn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=qn(a.subtasks,t);if(r)return r}return null}function Xn(e,t){if(t.length===0)return e;let a=xr(e),r=t[0],o=a.findIndex(i=>i.id===r);if(o<=0)return e;let s=a[o-1],d=(i,l)=>{let u=[];return {tasks:i.filter(g=>{if(l.has(g.id))return u.push(g),false;if(g.subtasks){let v=d(g.subtasks,l);g.subtasks=v.tasks,u.push(...v.removed);}return true}),removed:u}},c=(i,l,u)=>i.map(y=>y.id===l?{...y,subtasks:[...y.subtasks||[],...u],isExpanded:true}:y.subtasks?{...y,subtasks:c(y.subtasks,l,u)}:y),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function Jn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=qn(a,r);if(!o)continue;let s=qn(a,o.id),d=(n,m,i)=>{for(let l=0;l<n.length;l++){let u=n[l];if(u.id===m&&u.subtasks){let y=u.subtasks.findIndex(g=>g.id===i);if(y!==-1){let[g]=u.subtasks.splice(y,1);return g}}if(u.subtasks){let y=d(u.subtasks,m,i);if(y)return y}}return null},c=(n,m,i)=>{let l=n.findIndex(u=>u.id===m);if(l!==-1)return n.splice(l+1,0,i),n;for(let u of n)u.subtasks&&c(u.subtasks,m,i);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 Zn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(i=>i.id===c);if(n===-1){for(let i of d)if(i.subtasks&&s(i.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 Qn(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 es(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 Il(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(i=>i.id===t);if(n===-1){for(let i of p)if(i.subtasks&&c(i.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 as(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:as(a.subtasks,t)}:a)}function rs(e,t){let a=m=>{for(let i of m){if(i.id===t)return i;if(i.subtasks){let l=a(i.subtasks);if(l)return l}}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(i=>{if(i.id===t){let l=i.subtasks||[];return {...i,subtasks:[...l,p],isExpanded:true}}return i.subtasks?{...i,subtasks:n(i.subtasks)}:i});return {tasks:n(e),newTask:p}}function Al(e,t,a,r){if(t===a)return e;let o=Ml(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||[],i=r!==void 0?r:m.length,l=[...m];return l.splice(i,0,{...o,parentId:a}),{...n,subtasks:l,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function To({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:i,onColumnResize:l,onTaskUpdate:u,onTaskIndent:y,onTaskOutdent:g,onTaskMove:v,onMultiTaskDelete:k,onTaskDuplicate:b,onTaskCreate:f,onTaskRename:T,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:x,onTaskReparent:w}){let M=react.useContext(vr),[C,B]=react.useState(null),[z,R]=react.useState(false),[$,K]=react.useState(null),[le,be]=react.useState(""),Ge=react.useRef(null),Le=react.useRef(null),[xe,E]=react.useState(null),[I,P]=react.useState(0),[_,Y]=react.useState(0),[j,ye]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[F,oe]=react.useState(null),[q,Fe]=react.useState(null),[Re,tt]=react.useState(null),Oe=react.useRef(0),dt=5,pe=react.useRef(false);react.useEffect(()=>{function L(G){Ge.current&&!Ge.current.contains(G.target)&&R(false);}if(z)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[z]),react.useEffect(()=>{$&&Le.current&&(Le.current.focus(),Le.current.select());},[$]),react.useEffect(()=>{if(!xe)return;let L=me=>{let fe=me.clientX-I,J=_+fe;l?.(xe,J);},G=()=>{E(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",L),document.addEventListener("mouseup",G),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",G),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,I,_,l]);let{selectedTaskIds:vt,handleTaskClick:rt,isTaskSelected:Ot}=Pl(),{setIsEditing:ze}=Sl({tasks:e,selectedTaskIds:vt,onTaskSelect:(L,G)=>{let fe=xr(e).map(J=>J.id);rt(L,fe,G||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:g||(()=>{}),onTaskRename:L=>{let G=xr(e).find(me=>me.id===L);G&&we(G);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:L=>{let G=xr(e).find(me=>me.id===L);G&&h&&h(G);},enableKeyboard:true}),Pe=(L,G=0)=>{let me=[];for(let fe of L)me.push({task:fe,level:G}),fe.subtasks&&fe.subtasks.length>0&&fe.isExpanded&&me.push(...Pe(fe.subtasks,G+1));return me},Ue=Pe(e),ct=48,de=L=>!L.startDate||!L.endDate?"-":`${Math.ceil((L.endDate.getTime()-L.startDate.getTime())/(1e3*60*60*24))}d`,we=L=>{K(L.id),be(L.name),ze(true);},Kt=L=>{le.trim()&&le!==e.find(G=>G.id===L)?.name&&T?.(L,le.trim()),K(null),be(""),ze(false);},ha=()=>{K(null),be(""),ze(false);},Et=(L,G)=>{G.stopPropagation(),D?.(L.id);},va=(L,G)=>{G.preventDefault(),Oe.current=G.clientY,oe(L),pe.current=false;},ya=L=>{if(!F||(Math.abs(L.clientY-Oe.current)>dt&&(pe.current=true),!pe.current))return;let me=document.querySelectorAll("[data-task-row]"),fe=null,J=null;me.forEach(ue=>{let Z=ue.getBoundingClientRect(),A=ue.getAttribute("data-task-row");if(A&&A!==F&&L.clientY>=Z.top&&L.clientY<=Z.bottom){fe=A;let Q=L.clientY-Z.top,Se=Z.height;Q<Se*.25?J="above":Q>Se*.75?J="below":J="child";}}),Fe(fe),tt(J);},De=()=>{if(pe.current&&F&&q&&Re){if(Re==="child")w?.(F,q);else if(Re==="above"||Re==="below"){let L=(fe,J,ue=null)=>{for(let Z of fe){if(Z.id===J)return ue;if(Z.subtasks){let A=L(Z.subtasks,J,Z.id);if(A!==void 0)return A}}},G=L(e,q,null),me=(fe,J)=>{let ue=fe.findIndex(Z=>Z.id===J);return Re==="below"?ue+1:ue};if(G===null){let fe=me(e,q);w?.(F,null,fe);}else {let fe=Ue.find(J=>J.task.id===G)?.task;if(fe?.subtasks){let J=me(fe.subtasks,q);w?.(F,G,J);}}}}oe(null),Fe(null),tt(null),pe.current=false;};react.useEffect(()=>{if(F)return document.addEventListener("mousemove",ya),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ya),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[F,q,Re]);let Ne=(L,G,me)=>{switch(L.id){case "name":let fe=$===G.id,J=C===G.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*20}px`},children:[w&&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:J?1:.3},onMouseDown:ge=>va(G.id,ge),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),G.subtasks&&G.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),p?.(G.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:G.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"}),!(G.subtasks&&G.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:G.color||"#3B82F6",opacity:G.parentId?.6:1,borderColor:G.isMilestone?t.accent:"transparent",borderWidth:G.isMilestone?"2px":"0px"},title:G.isMilestone?"Milestone":G.parentId?"Subtask":"Task"}),fe?jsxRuntime.jsx("input",{ref:Le,type:"text",value:le,onChange:ge=>be(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"?Kt(G.id):ge.key==="Escape"&&ha();},onBlur:()=>Kt(G.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:ge=>ge.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:G.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:G.parentId?"13px":"14px",fontWeight:G.isMilestone?600:G.parentId?400:600,letterSpacing:G.parentId?"0":"-0.01em"},title:G.name,children:G.name}),J&&!fe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ge=>ge.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ge=>Et(G,ge),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:ge=>{ge.stopPropagation(),we(G);},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":let ue=G.startDate?typeof G.startDate=="string"?G.startDate:G.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ue||"",onChange:ge=>{u?.(G.id,{startDate:ge.target.value?new Date(ge.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let Z=G.endDate?typeof G.endDate=="string"?G.endDate:G.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Z||"",onChange:ge=>{u?.(G.id,{endDate:ge.target.value?new Date(ge.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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(G)})});case "assignees":let A=r.filter(ge=>G.assignees?.some(_a=>_a.name===ge.name||_a.initials===ge.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(Ya,{assignedUsers:A,availableUsers:r,onChange:ge=>{let _a=ge.map(sr=>({id:sr.id,name:sr.name,initials:sr.initials,color:sr.color}));u?.(G.id,{assignees:_a.length>0?_a:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(Ai,{status:G.status||"todo",onChange:ge=>{u?.(G.id,{status:ge,progress:ge==="completed"?100:G.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:`${G.progress}%`,backgroundColor:G.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:[G.progress,"%"]})]});case "priority":let Q={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Se={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},at=Q[G.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(ja,{priority:at,onChange:ge=>{ge&&u?.(G.id,{priority:Se[ge]||"medium"});}})});default:return null}},kt=L=>[{id:"hide",label:"Hide Column",icon:it.Hide,onClick:()=>i(L),disabled:L==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:it.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:it.SortDesc,onClick:()=>{}}],re=L=>L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(L.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{x?x(L.id,L.name):k?.([L.id]);}}]:[{id:"edit",label:M?.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{d?.(L);}},{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{D?.(L.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:M?.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{u?.(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:M?.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{u?.(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:M?.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{u?.(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:M?.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{x?x(L.id,L.name):k?.([L.id]);}}],Ce=m.filter(L=>L.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:`${ct}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Ce.map((L,G)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${L.id==="name"?"justify-between":"justify-center"}`,style:{...L.id==="name"?{flex:"1 1 auto",minWidth:`${L.minWidth??150}px`}:{width:`${L.width}px`,minWidth:`${L.minWidth??60}px`,maxWidth:`${L.maxWidth??2e3}px`,flexShrink:0},borderRight:G<Ce.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:me=>{me.preventDefault(),ye({isOpen:true,x:me.clientX,y:me.clientY,type:"header",columnId:L.id});},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:me=>{me.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",flex:L.id==="name"?"1 1 auto":"none",minWidth:0},title:L.label,children:L.label}),L.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(ko,{columns:m,onToggleColumn:i,theme:t}),jsxRuntime.jsx("button",{onClick:()=>R(!z),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"})})]}),L.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:xe===L.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:me=>{me.preventDefault(),me.stopPropagation(),E(L.id),P(me.clientX),Y(L.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"}})})]},L.id)),z&&jsxRuntime.jsxs("div",{ref:Ge,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:L=>L.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:()=>R(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:Ue.map(({task:L,level:G},me)=>{let fe=Ot(L.id),J=q===L.id,ue={};return J&&Re&&(Re==="above"?(ue.borderTopWidth="2px",ue.borderTopStyle="solid",ue.borderTopColor=t.accent):Re==="below"?(ue.borderBottomWidth="2px",ue.borderBottomStyle="solid",ue.borderBottomColor=t.accent):Re==="child"&&(ue.backgroundColor=t.accentLight,ue.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":L.id,className:`flex items-center cursor-pointer group ${F===L.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:fe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:fe||J&&Re==="child"?t.accentLight:me%2===0?t.bgPrimary:t.bgGrid,...ue},onMouseEnter:()=>B(L.id),onMouseLeave:()=>B(null),onClick:Z=>{let Q=xr(e).map(ge=>ge.id),at=navigator.platform.toUpperCase().indexOf("MAC")>=0?Z.metaKey:Z.ctrlKey;rt(L.id,Q,at,Z.shiftKey),s?.(L);},onDoubleClick:Z=>{Z.stopPropagation(),d?.(L);},onContextMenu:Z=>{Z.preventDefault(),ye({isOpen:true,x:Z.clientX,y:Z.clientY,type:"task",task:L}),c?.(L,Z);},whileHover:{backgroundColor:fe?t.accentLight:t.hoverBg},children:Ce.map((Z,A)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Z.id==="name"?"justify-start":"justify-center"} ${A<Ce.length-1?"border-r":""}`,style:{...Z.id==="name"?{flex:"1 1 auto",minWidth:`${Z.minWidth??150}px`}:{width:`${Z.width}px`,minWidth:`${Z.minWidth??60}px`,maxWidth:`${Z.maxWidth??2e3}px`,flexShrink:0},borderColor:C===L.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ne(Z,L,Z.id==="name"?G:0)},`${L.id}-${Z.id}`))},L.id)})}),jsxRuntime.jsx(yr,{isOpen:j.isOpen,x:j.x,y:j.y,items:j.type==="header"&&j.columnId?kt(j.columnId):j.type==="task"&&j.task?re(j.task):[],onClose:()=>ye({...j,isOpen:false}),theme:t})]})}function Ll(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[p,n]=react.useState(t),[m,i]=react.useState(null),[l,u]=react.useState(null),[y,g]=react.useState(null),[v,k]=react.useState(null),[b,f]=react.useState(0),[T,D]=react.useState(0),[h,x]=react.useState(null),[w,M]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:i,hoveredTaskId:l,setHoveredTaskId:u,activeZone:y,setActiveZone:g,draggedSegmentIndex:v,setDraggedSegmentIndex:k,draggedSegmentStartX:b,setDraggedSegmentStartX:f,segmentDragOffsetX:T,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:x,isHovered:w,setIsHovered:M,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,K)=>{r("none"),i(null),u(null),c($),n(K),D(0),k(null),f(0);}}}function Do({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:i,onDependencyCreate:l,allTaskPositions:u=[],onDragMove:y,onHoverChange:g}){let v=Ll(t,r),k=react.useRef(null),{dragMode:b,setDragMode:f,dragOffset:T,setDragOffset:D,ghostX:h,setGhostX:x,ghostWidth:w,setGhostWidth:M,connectionLine:C,setConnectionLine:B,hoveredTaskId:z,setHoveredTaskId:R,activeZone:$,setActiveZone:K,draggedSegmentIndex:le,setDraggedSegmentIndex:be,draggedSegmentStartX:Ge,setDraggedSegmentStartX:Le,segmentDragOffsetX:xe,setSegmentDragOffsetX:E,hoveredSegmentIndex:I,setHoveredSegmentIndex:P,isHovered:_,setIsHovered:Y,isDragging:j,isResizing:ye,isConnecting:F,resetDragState:oe}=v,q=32,Fe=8,Re=e.endDate&&e.endDate<new Date&&e.progress<100,tt=e.isCriticalPath,Oe=o.name==="neutral"||o.today==="#1C1917",dt=e.status==="completed"||e.progress===100,pe={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},rt=e.isCriticalPath||Re?"#DC2626":e.color?e.color:e.priority&&pe[e.priority]?pe[e.priority]:o.taskBarPrimary,ze=(re=>re>=80?20:re>=60?15:re>=50?12:10)(r),Pe=r<50,Ue=r<40;react.useEffect(()=>{if(g)if(_&&!j&&!e.segments){let re=a<100;g({task:e,x:t,y:a,width:r,height:q,showBelow:re});}else g(null);},[_,j,e,t,a,r,q,g]);let ct=re=>re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),de=()=>{let re=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${re} day${re!==1?"s":""}`},we=re=>Math.round(re/s)*s,Kt=re=>{let Ce=Math.round(re/s),L=new Date(d);return L.setDate(L.getDate()+Ce),L},ha=(re,Ce)=>{for(let L of u){if(L.id===e.id)continue;let G=5;if(re>=L.x-G&&re<=L.x+L.width+G&&Ce>=L.y-G&&Ce<=L.y+L.height+G)return L.id}return null},Et=react.useCallback((re,Ce,L)=>{re.preventDefault(),re.stopPropagation();let G=k.current?.ownerSVGElement;if(!G)return;let me=G.createSVGPoint();me.x=re.clientX,me.y=re.clientY;let fe=me.matrixTransform(G.getScreenCTM()?.inverse()),J=L!==void 0?L:t,ue=Ce;if(!ue){let Z=fe.x-J;re.shiftKey?(ue="connect",B({x:t+r,y:a+q/2})):re.ctrlKey||re.metaKey?ue="move":re.altKey?ue=Z<r/2?"resize-start":"resize-end":Ue?Z<r/2?ue="move":ue="resize-end":Pe?Z<=ze/2?ue="resize-start":Z>=r-ze/2?ue="resize-end":ue="move":Z<=ze?ue="resize-start":Z>=r-ze?ue="resize-end":ue="move";}f(ue),Y(false),K(null),ue==="move"?D(fe.x-J):ue==="connect"?B({x:t+r,y:a+q/2}):D(0),x(J),M(r);},[t,r,a,q]),va=react.useCallback(re=>{if(b==="none")return;let Ce=k.current?.ownerSVGElement;if(!Ce)return;let L=Ce.createSVGPoint();L.x=re.clientX,L.y=re.clientY;let G=L.matrixTransform(Ce.getScreenCTM()?.inverse());if(b==="connect"){B({x:G.x,y:G.y});let me=ha(G.x,G.y);R(me);}else if(b==="move"){let me=G.x-T,fe=we(me);x(fe),M(r);let J=Math.round((fe-t)/s);if(y?.(e.id,J,true),e.segments&&e.segments.length>0&&le!==null){let ue=fe-Ge;E(ue);}}else if(b==="resize-start"){let me=G.x,fe=we(me),J=t+r-fe;J>=s&&(x(fe),M(J));}else if(b==="resize-end"){let me=G.x,J=we(me)-t;J>=s&&M(J);}},[b,t,r,s,T,e,we,le,Ge,ha,R,B,x,M,E,y]),ya=react.useCallback(()=>{if(b!=="none"){if(b==="connect")z&&l&&l(e,z),B(null),R(null);else {let re=e.endDate.getTime()-e.startDate.getTime(),Ce,L,G=true;if(b==="move"){if(Ce=Kt(h),L=new Date(Ce.getTime()+re),e.segments&&e.segments.length>0&&le!==null){let me=Math.round(xe/s),fe=e.segments.map((A,Q)=>{if(Q===le){let Se=new Date(A.startDate),at=new Date(A.endDate);return Se.setDate(Se.getDate()+me),at.setDate(at.getDate()+me),{startDate:Se,endDate:at}}return A}),J=fe.flatMap(A=>[A.startDate,A.endDate]),ue=new Date(Math.min(...J.map(A=>A.getTime()))),Z=new Date(Math.max(...J.map(A=>A.getTime())));i?.({...e,segments:fe},ue,Z),oe(t,r);return}}else b==="resize-start"?(Ce=Kt(h),L=e.endDate,Ce>=L&&(console.warn("Invalid date range: start date must be before end date"),G=false)):b==="resize-end"?(Ce=e.startDate,L=Kt(h+w),L<=Ce&&(console.warn("Invalid date range: end date must be after start date"),G=false)):G=false;G&&Ce&&L&&(L.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):i?.(e,Ce,L));}y?.(e.id,0,false),oe(t,r);}},[b,h,w,e,i,z,l,t,r,s,Kt,xe,le,oe,y]);react.useEffect(()=>{if(b==="none")return;let re=L=>{va(L);},Ce=()=>{ya();};return window.addEventListener("mousemove",re),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Ce);}},[b,va,ya]);let De=j&&!F?h:t,Ne=j&&!F?w:r,kt=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!j&&Y(true),onMouseLeave:()=>{j||(Y(false),K(null));},onClick:()=>!j&&p?.(e),onDoubleClick:re=>{j||(re.stopPropagation(),n?.(e));},onContextMenu:re=>{re.preventDefault(),m?.(e,re);},children:[_&&!j&&!Pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ze,height:q,fill:$==="resize-start"?o.accent:"transparent",opacity:$==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-start"),onMouseDown:re=>Et(re,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ze,y:a,width:r-ze*2,height:q,fill:$==="move"?o.accent:"transparent",opacity:$==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:re=>Et(re,"move")}),jsxRuntime.jsx("rect",{x:t+r-ze,y:a,width:ze,height:q,fill:$==="resize-end"?o.accent:"transparent",opacity:$==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:re=>Et(re,"resize-end")})]}),_&&!j&&Ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:q,fill:$==="move"?o.accent:"transparent",opacity:$==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:re=>Et(re,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:q,fill:$==="resize-end"?o.accent:"transparent",opacity:$==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:re=>Et(re,"resize-end")}),_&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+q-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),j&&!F&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:w,height:q,rx:Fe,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:De,y:a,width:Ne,height:q,rx:Fe,fill:rt,"data-task-class":kt,initial:{opacity:0,scale:.95},animate:{opacity:j&&!F?.15:e.parentId?.6:_?.9:.8,scale:_&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>Et(re),style:{cursor:j?F?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:De,y:a,width:Ne*(e.progress/100),height:q,rx:Fe,fill:rt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((re,Ce)=>{let L=(re.startDate.getTime()-d.getTime())/864e5*s,me=(re.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-L+s,fe=j&&b==="move"&&le===Ce,J=I===Ce,ue=fe?L+xe:L;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&P(Ce),onMouseLeave:()=>!j&&P(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ue,y:a,width:me,height:q,rx:Fe,fill:rt,initial:{opacity:0,scale:.95},animate:{opacity:fe||e.parentId?.6:J?.9:.8,scale:J&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>{Z.stopPropagation(),be(Ce),Le(L),Et(Z,void 0,L);},style:{cursor:j?F?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ue,y:a,width:me*(e.progress/100),height:q,rx:Fe,fill:rt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Oe&&(Re||tt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[tt&&!Re&&jsxRuntime.jsx("rect",{x:De,y:a,width:Ne,height:q,rx:Fe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Re&&jsxRuntime.jsx("rect",{x:De,y:a,width:Ne,height:q,rx:Fe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ne>60&&!e.segments&&(()=>{let re=c.taskLabel(e),Ce=typeof re=="string"?re:e.name,L=Ce.length>Math.floor(Ne/8)?`${Ce.substring(0,Math.floor(Ne/8))}...`:Ce;return jsxRuntime.jsx("text",{x:De+12,y:a+q/2,dominantBaseline:"middle",fill:dt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:dt?"line-through":"none"},children:L})})(),Ne>100&&e.progress>0&&e.progress<100&&!j&&!e.segments&&jsxRuntime.jsxs("text",{x:De+Ne-12,y:a+q/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&&Ne>80&&!j&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:De+Ne-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:De+Ne-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(_||ye)&&!F&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Pe?De-15:De-10,y:a-5,width:Pe?25:20,height:q+10,fill:"transparent",onMouseDown:re=>Et(re,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Pe?De-8:De-3,y:a+6,width:Pe?8:6,height:Pe?q-12:q-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:De+Ne-10,y:a-5,width:Pe?25:20,height:q+10,fill:"transparent",onMouseDown:re=>Et(re,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Pe?De+Ne:De+Ne-3,y:a+6,width:Pe?8:6,height:Pe?q-12:q-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&&!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+q/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(),Et(re,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+q/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),F&&C&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+q/2,x2:C.x,y2:C.y,stroke:z?o.statusCompleted:o.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:C.x,cy:C.y,r:z?8:6,fill:z?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsxRuntime.jsx(framerMotion.motion.text,{x:C.x+15,y:C.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:C.x+10},animate:{opacity:1,x:C.x+15},transition:{duration:.2},children:"Connect"})]}),(_||j)&&!F&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:De-2,y:a-2,width:Ne+4,height:q+4,rx:Fe+2,fill:"none",stroke:j?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:j?.6:.4,initial:{opacity:0},animate:{opacity:j?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ye&&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+w,y1:0,x2:h+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&!j&&!e.segments&&!g&&(()=>{let L=a<100,G=L?a+q+13:a-82-13,me=L?`M ${De+Ne/2-6} ${a+q+3} L ${De+Ne/2} ${a+q+13} L ${De+Ne/2+6} ${a+q+3}`:`M ${De+Ne/2-6} ${a-13} L ${De+Ne/2} ${a-3} L ${De+Ne/2+6} ${a-13}`,fe=G+22,J=G+40,ue=G+55,Z=G+70,A=L?G+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:L?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:L?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:De+Ne/2-120,y:G,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:De+Ne/2,y:fe,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:De+Ne/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:De+Ne/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.startDate)}),jsxRuntime.jsx("text",{x:De+Ne/2-110,y:ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:De+Ne/2-70,y:ue,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.endDate)}),jsxRuntime.jsx("text",{x:De+Ne/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:De+Ne/2+65,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:de()}),jsxRuntime.jsx("text",{x:De+Ne/2+10,y:ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:De+Ne/2+65,y:ue,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:De+Ne/2-110,y:Z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:De+Ne/2-50,y:Z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Q=>Q.name).join(", ").substring(0,30),e.assignees.map(Q=>Q.name).join(", ").length>30?"...":""]})]}),!L&&jsxRuntime.jsx("text",{x:De+Ne/2,y:A,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ue?"Left: move \u2022 Right: resize":Pe?"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 Rl({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,i=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}`,l=m+22,u=m+40,y=m+55,g=m+70,v=c?m+p-5:o-18,k=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let D=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${D} day${D!==1?"s":""}`},f=s<50,T=s<40;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:i,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:l,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?k(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?k(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:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,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:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(D=>D.name).join(", ").substring(0,30),a.assignees.map(D=>D.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+s/2,y:v,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:T?"Left: move \u2022 Right: resize":f?"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 Eo({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,i=e+n/2,l=`M ${e} ${t} C ${i} ${t}, ${i} ${r}, ${a} ${r}`,u=6,y=Math.atan2(m,n),g=a-u*Math.cos(y-Math.PI/6),v=r-u*Math.sin(y-Math.PI/6),k=a-u*Math.cos(y+Math.PI/6),b=r-u*Math.sin(y+Math.PI/6),f=o.dependency;return react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${g} ${v} M ${a} ${r} L ${k} ${b}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:i,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:i-4,y1:(t+r)/2-4,x2:i+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:i+4,y1:(t+r)/2-4,x2:i-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Mo({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 X={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 i of m){if(!d.has(i)&&p(i))return true;if(c.has(i))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=X.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=X.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=X.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=X.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
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=X.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=X.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)=>X.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=X.findTaskById(e,t);return !a||!a.dependencies?[]:X.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>X.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>X.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=X.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=>X.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=X.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?X.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?X.formatDate(p.startDate):"N/A",p.endDate?X.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=X.flattenTasks(e).map(p=>{let n=p.startDate&&p.endDate?X.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?X.formatDate(p.startDate):"","End Date":p.endDate?X.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=X.flattenTasks(e),o=new Map;r.forEach((l,u)=>{o.set(l.id,u+1);});let s=l=>l.toISOString().replace("Z",""),d=X.getEarliestStartDate(e)||new Date,c=X.getLatestEndDate(e)||new Date,p=r.map((l,u)=>{let y=o.get(l.id),g=l.startDate&&l.endDate?X.calculateDuration(l.startDate,l.endDate):0,v=(l.dependencies||[]).filter(k=>o.has(k)).map(k=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${o.get(k)}</PredecessorUID>
|
|
@@ -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;"}),i=document.createElement("a");i.href=URL.createObjectURL(m),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=X.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?X.calculateDuration(n.startDate,n.endDate):0,i=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let y=t.find(g=>g.id===u);if(y){o(y);let g=r.get(u)?.ef||0;i=Math.max(i,g);}}let l=i+m;r.set(n.id,{es:i,ef:l});};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?X.calculateDuration(n.startDate,n.endDate):0,i=t.filter(y=>y.dependencies&&y.dependencies.includes(n.id)),l=s;if(i.length>0)for(let y of i){c(y);let g=d.get(y.id)?.ls||0;l=Math.min(l,g);}let u=l-m;d.set(n.id,{ls:u,lf:l});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),i=d.get(n.id);if(m&&i){let l=i.ls-m.es;Math.abs(l)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=X.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(X.calculateCriticalPath(e).includes(t))return 0;let o=X.getDependentTasks(e,t);if(o.length===0){let c=X.getLatestEndDate(e);if(!c)return null;let p=X.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=X.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>X.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=X.findTaskById(e,t);if(!r||!r.endDate)return e;let o=X.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=X.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=X.calculateEndDate(p,c),m=i=>i.map(l=>l.id===d.id?{...l,startDate:p,endDate:n}:l.subtasks?{...l,subtasks:m(l.subtasks)}:l);s=m(s),s=X.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,i=X.findTaskById(e,t);if(!i||!i.endDate)return [];let l=(u,y,g=new Set)=>{if(g.has(u))return;g.add(u);let v=X.getDependentTasks(e,u);for(let k of v){if(!k.startDate||!k.endDate)continue;let b=r.findIndex(B=>B.id===k.id);if(b===-1)continue;let f=k.startDate.getTime(),D=(k.endDate.getTime()-f)/m,x=(f-n)/m*s,w=x+y*s,M=Math.max(D*s,s),C=c+b*d+12;p.push({taskId:k.id,taskName:k.name,originalX:x,previewX:w,width:M,y:C,rowIndex:b,daysDelta:y,color:k.color}),l(k.id,y,g);}};return l(t,a),p},splitTask:(e,t,a,r=3)=>{let o=X.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(i=>i.id===o.id?{...i,endDate:c,segments:p}:i.subtasks?{...i,subtasks:n(i.subtasks)}:i);return n(e)}};function Ao({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:i,onDependencyCreate:l,onDependencyDelete:u}){let[g,v]=react.useState([]),[k,b]=react.useState(null),[f,T]=react.useState(null),D=react.useCallback(E=>{b(E);},[]),h=react.useCallback(E=>{T(E);},[]),x=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,M=x*w*d,C=E=>{let I=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),P=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-P);let _=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-_.getTime())/864e5+1)/7)},B=E=>{let I=E.getDay();return I===0||I===6},z=react.useCallback(E=>{let I=Math.round(E/(w*d)),P=new Date(o);return P.setDate(P.getDate()+I),P},[o,w,d]),R=react.useCallback((E,I)=>{if(I.startDate&&I.endDate)return;let P=E.currentTarget.ownerSVGElement;if(!P)return;let _=P.createSVGPoint();_.x=E.clientX,_.y=E.clientY;let Y=_.matrixTransform(P.getScreenCTM()?.inverse()),j=z(Y.x),ye=new Date(j);ye.setDate(ye.getDate()+1),i?.(I,j,ye);},[z,i]),$=react.useMemo(()=>{let E=Y=>Y.map(j=>{if(j.subtasks&&j.subtasks.length>0){let ye=E(j.subtasks),F=ye.filter(oe=>oe.startDate&&oe.endDate);if(F.length>0){let oe=F.map(tt=>tt.startDate.getTime()),q=F.map(tt=>tt.endDate.getTime()),Fe=new Date(Math.min(...oe)),Re=new Date(Math.max(...q));return {...j,subtasks:ye,startDate:Fe,endDate:Re}}return {...j,subtasks:ye}}return j}),I=(Y,j=[])=>{for(let ye of Y)j.push(ye),ye.subtasks&&ye.subtasks.length>0&&(ye.isExpanded===void 0||ye.isExpanded)&&I(ye.subtasks,j);return j},P=E(e);return I(P)},[e]),K=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let I=E.startDate.getTime(),P=E.endDate.getTime(),_=o.getTime(),Y=(I-_)/(1e3*60*60*24),j=(P-I)/(1e3*60*60*24),ye=Y*w*d,F=Math.max(w*d,40),oe=Math.max(j*w*d,F);return {x:ye,width:oe}},[o,w,d]),le=react.useMemo(()=>$.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:I,width:P}=K(E),Y=$.findIndex(j=>j.id===E.id)*a+12;return {id:E.id,x:I,y:Y,width:P,height:32}}),[$,K]),be=react.useCallback((E,I,P)=>{if(!P||I===0){v([]);return}let _=X.calculateCascadePreview(e,E,I,$,o,w*d,a,48);v(_);},[e,$,o,w,d,a,48]),Ge=react.useMemo(()=>{let E=[],I=new Date(o);for(;I<=s;){let Y=(I.getTime()-o.getTime())/864e5*w*d;if(r==="day")E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),I.setDate(I.getDate()+1);else if(r==="week"){let j=C(I);E.push({date:new Date(I),label:`Week ${j}`,x:Y}),I.setDate(I.getDate()+7);}else E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),I.setMonth(I.getMonth()+1);}return E},[o,s,r,w,d]),Le=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),xe=Math.max($.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(M,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(M,1e3),height:48,fill:t.bgGrid}),Ge.map((E,I)=>jsxRuntime.jsxs("g",{children:[I>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${I}`)),Le>=0&&Le<=M&&jsxRuntime.jsx("circle",{cx:Le,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(M,1e3),height:xe,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(M,1e3),height:xe,fill:t.bgPrimary}),Ge.map((E,I)=>{let P=Ge[I+1]?.x||M,_=B(E.date);return jsxRuntime.jsxs("g",{children:[_&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:P-E.x,height:$.length*a,fill:t.bgWeekend,opacity:1}),I>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:$.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},I)}),Le>=0&&Le<=M&&jsxRuntime.jsx("line",{x1:Le,y1:0,x2:Le,y2:$.length*a,stroke:t.today,strokeWidth:2,opacity:1}),$.map((E,I)=>{let P=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:I*a,width:M,height:a,fill:I%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:I*a,width:M,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:_=>R(_,E),onMouseEnter:_=>{_.currentTarget.setAttribute("fill",t.accentLight),_.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:_=>{_.currentTarget.setAttribute("fill","transparent"),_.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:Le>0?Le:100,y:I*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-${E.id}`)]})]},`row-group-${E.id}`)}),$.map((E,I)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(P=>{let _=$.find(F=>F.id===P);if(!_||!_.startDate||!_.endDate)return null;let Y=$.findIndex(F=>F.id===P),j=K(_),ye=K(E);return jsxRuntime.jsx(Eo,{x1:j.x+j.width,y1:Y*a+a/2,x2:ye.x,y2:I*a+a/2,theme:t,onDelete:()=>u?.(E.id,P),onHoverChange:h},`dep-${P}-${E.id}`)})),$.map((E,I)=>{if(!E.startDate||!E.endDate)return null;let{x:P,width:_}=K(E),Y=I*a+12,j=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Mo,{task:E,x:P+_/2,y:Y+16,theme:t,onClick:p},E.id):j?jsxRuntime.jsxs("g",{onClick:()=>p?.(E),onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),m?.(E,ye);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:P,y:Y,width:_,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:P,y1:Y,x2:P+_,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:P,y1:Y,x2:P,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:P+_,y1:Y,x2:P+_,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:P,y1:Y+32,x2:P+_,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),_>60&&jsxRuntime.jsx("text",{x:P+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(Do,{task:E,x:P,y:Y,width:_,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:i,onDependencyCreate:l,allTaskPositions:le,onDragMove:be,onHoverChange:D},E.id)}),g.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`)),f&&(()=>{let{x1:E,y1:I,x2:P,y2:_,onDelete:Y}=f,j=P-E,ye=_-I,F=E+j/2,oe=(I+_)/2,q=`M ${E} ${I} C ${F} ${I}, ${F} ${_}, ${P} ${_}`,Fe=6,Re=Math.atan2(ye,j),tt=P-Fe*Math.cos(Re-Math.PI/6),Oe=_-Fe*Math.sin(Re-Math.PI/6),dt=P-Fe*Math.cos(Re+Math.PI/6),ce=_-Fe*Math.sin(Re+Math.PI/6),vt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:q,fill:"none",stroke:vt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${P} ${_} L ${tt} ${Oe} M ${P} ${_} L ${dt} ${ce}`,fill:"none",stroke:vt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:P,cy:_,r:5,fill:vt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:rt=>{rt.stopPropagation(),Y();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:F,cy:oe,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:F-4,y1:oe-4,x2:F+4,y2:oe+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:F+4,y1:oe-4,x2:F-4,y2:oe+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),k&&jsxRuntime.jsx(Bl,{tooltipData:k,theme:t})]})]})}var $l=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function zl({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:$l.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:$l.find(r=>r.value===e)?.name||"Personalizado"})]})}var Hl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function Lo({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=[...Hl,...n.filter(x=>!Hl.some(w=>w.id===x.id))],i=Be[p]||Be.dark,[l,u]=react.useState(false),y={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},g={color:i.textSecondary},[v,k]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,f]=react.useState({});react.useEffect(()=>{a?(k({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)):(k({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return v.name.trim()||(x.name="El nombre es requerido"),v.startDate&&v.endDate&&v.startDate>v.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),f(x),Object.keys(x).length===0},D=async x=>{if(x.preventDefault(),!!T())try{await s(v),t();}catch(w){console.error("Error submitting task:",w);}},h=(x,w)=>{k(M=>{let C={...M,[x]:w};if(x==="progress"){let B=typeof w=="number"?w:parseInt(w,10);B===100&&M.status!=="completed"?C.status="completed":B>0&&B<100&&M.status==="todo"?C.status="in-progress":B===0&&M.status!=="todo"&&(C.status="todo");}return C}),b[x]&&f(M=>{let C={...M};return delete C[x],C});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:D,className:"p-6 space-y-5 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1.5",style:g,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:v.name,onChange:x=>h("name",x.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:d,autoFocus:true}),b.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),b.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium flex items-center gap-2",style:g,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fechas"]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:v.startDate?v.startDate.toISOString().split("T")[0]:"",onChange:x=>h("startDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||v.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:v.endDate?v.endDate.toISOString().split("T")[0]:"",onChange:x=>h("endDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||v.isMilestone})]})]}),b.endDate&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),b.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:g,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),o.length>0?jsxRuntime.jsx("div",{className:"space-y-1 max-h-[88px] overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.assignees?.some(w=>w.name===x.name),onChange:w=>{let M=w.target.checked?[...v.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(v.assignees||[]).filter(C=>C.name!==x.name);h("assignees",M);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold flex-shrink-0",style:{backgroundColor:i.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textTertiary},children:"No hay usuarios disponibles"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:v.status,onChange:x=>h("status",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:m.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.title},x.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:v.priority||"medium",onChange:x=>h("priority",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center justify-between",style:g,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-1.5 py-0.5 rounded text-xs",style:{color:v.progress<30?"#EF4444":v.progress<70?"#F59E0B":"#10B981",backgroundColor:v.progress<30?"rgba(239, 68, 68, 0.1)":v.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[v.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress,onChange:x=>h("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:v.progress<30?"#EF4444":v.progress<70?"#F59E0B":"#10B981"},disabled:d})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>h("progress",x),disabled:d,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:v.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":i.bgSecondary,color:v.progress===x?"#FFFFFF":i.textTertiary,border:`1px solid ${v.progress===x?"transparent":i.borderLight}`},children:[x,"%"]},x))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(zl,{value:v.color,onChange:x=>h("color",x),disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:v.description||"",onChange:x=>h("description",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none text-sm",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!l),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:i.textSecondary,backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=i.bgSecondary,children:[l?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),"Opciones avanzadas",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-4 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:v.isMilestone,onChange:x=>h("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-28 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:r.filter(x=>x.id!==a?.id).map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.dependencies?.includes(x.id),onChange:w=>{let M=w.target.checked?[...v.dependencies||[],x.id]:(v.dependencies||[]).filter(C=>C!==x.id);h("dependencies",M);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=i.textPrimary,x.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=i.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:D,disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:x=>!d&&(x.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:x=>!d&&(x.currentTarget.style.backgroundColor=i.accent),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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Ig=['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"'],Vl=()=>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"})]}),Ag=()=>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"})}),Lg=()=>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"})}),Fg=()=>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"})}),Bg=()=>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 Fo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[i,l]=react.useState(false),[u,y]=react.useState([]),[g,v]=react.useState(""),[k,b]=react.useState(false),[f,T]=react.useState(true),D=react.useRef(null),h=react.useRef(null),x=react.useRef(null),{enabled:w=true,placeholder:M='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:B,suggestions:z=Ig,maxHistory:R=50,persistHistory:$}=a,K=$?.storageKey||"gantt-ai-history",le=$?.maxMessages??5;react.useEffect(()=>{if($?.enabled)try{let I=localStorage.getItem(K);if(I){let _=JSON.parse(I).map(Y=>({...Y,timestamp:new Date(Y.timestamp)}));y(_.slice(-le));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[$?.enabled,K,le]),react.useEffect(()=>{if($?.enabled&&u.length>0)try{let I=u.filter(P=>!P.isLoading).slice(-le);localStorage.setItem(K,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[u,$?.enabled,K,le]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!i&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,i]);let be=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&d?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&c?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&p?.(I.taskId,I.dependencyFrom);break}},[o,s,d,c,p]),Ge=react.useCallback(async I=>{if(!I.trim()||k)return;let P={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};y(Y=>[...Y.slice(-(R-1)),P]),v(""),T(false),b(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(Y=>[...Y,_]);try{if(B){let Y=await B(I,e);y(j=>{let ye=j.filter(oe=>!oe.isLoading),F={id:`assistant-${Date.now()}`,role:"assistant",content:Y.message,timestamp:new Date,command:Y};return [...ye,F]}),be(Y);}else y(Y=>[...Y.filter(ye=>!ye.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(Y){y(j=>[...j.filter(F=>!F.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Y instanceof Error?Y.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[k,R,B,e,be]),Le=I=>{I.preventDefault(),Ge(g);},xe=I=>{v(I),D.current?.focus();};if(react.useEffect(()=>{let I=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),m(_=>!_),n||l(false)),P.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[n]),react.useEffect(()=>{if(!n)return;let I=_=>{let Y=_.target;x.current&&!x.current.contains(Y)&&m(false);},P=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",I);}},[n]),!w)return null;let E={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Ke,{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 ${E[C]} 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(Vl,{}),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:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${E[C]} 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(Vl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>l(I=>!I),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Fg,{})}),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(Lg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&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&&f&&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:z.slice(0,4).map((I,P)=>jsxRuntime.jsx("button",{onClick:()=>xe(I),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:I.length>30?I.slice(0,30)+"...":I},P))})]}),u.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:I.role==="user"?"white":t.textPrimary},children:[I.isLoading?jsxRuntime.jsx(Bg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:I.command.success?"#10B981":"#EF4444"},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Le,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:g,onChange:I=>v(I.target.value),placeholder:M,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!g.trim()||k,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:g.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:g.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ag,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function jl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(i=>{let l=typeof n=="function"?n(i.present):n;if(o.current)return {...i,present:l};if(!m)return {...i,present:l};let u=[...i.past,i.present];return u.length>t&&u.shift(),{past:u,present:l,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],i=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],i=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:i}});},[]),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 Kl({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 zg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${X.formatDate(e.startDate)} - ${X.formatDate(e.endDate)}`);let a=X.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=>X.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Yl(e){return {...zg,...e}}var jg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Jl=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:i,enableAutoCriticalPath:l=true,aiAssistant:u,locale:y="en",customTranslations:g,showCreateTaskButton:v=false,createTaskLabel:k,onCreateTask:b,onThemeChange:f,onTaskClick:T,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:x,onProgressChange:w,onTaskEdit:M,onTaskAddSubtask:C,onTaskMarkIncomplete:B,onTaskSetInProgress:z,onDependencyCreate:R,onDependencyDelete:$,onBeforeTaskAdd:K,onAfterTaskAdd:le,onBeforeTaskUpdate:be,onAfterTaskUpdate:Ge,onBeforeTaskDelete:Le,onAfterTaskDelete:xe}=a,I=react.useContext(vo)?.theme,[P,_]=react.useState(I||s||"dark"),[Y,j]=react.useState(d),[ye,F]=react.useState(c),[oe,q]=react.useState(1),[Fe,Re]=react.useState(0),[tt,Oe]=react.useState(false),[dt,ce]=react.useState(null),[vt,rt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ot,ze]=react.useState(null),[Pe,Ue]=react.useState(null);react.useEffect(()=>{I&&I!==P&&_(I);},[I]),react.useEffect(()=>{s&&s!==P&&_(s);},[s]);let ct=react.useCallback(N=>{_(N),f?.(N);},[f]),{state:de,setState:we,undo:Kt,redo:ha,canUndo:Et,canRedo:va,clearHistory:ya}=jl(t,50);react.useEffect(()=>{we(t);},[t,we]);let De=react.useRef(t),Ne=react.useRef(true);react.useEffect(()=>{if(Ne.current){Ne.current=false,De.current=de;return}if(!r)return;let N=JSON.stringify(De.current),O=JSON.stringify(de);N!==O&&(De.current=de,r(de));},[de,r]);let kt=react.useMemo(()=>jn(y,g),[y,g]),re=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,L]=react.useState(()=>re(kt));react.useEffect(()=>{L(N=>N.map(O=>({...O,label:kt.columns[O.id==="name"?"taskName":O.id]||O.label})));},[kt]);let G=react.useMemo(()=>Ce.filter(N=>N.visible).reduce((N,O)=>N+O.width,0)+60,[Ce]),pe=react.useMemo(()=>dt!==null?Math.max(280,dt,G):Math.max(280,G),[dt,G]),fe=react.useRef(null),J=react.useRef(null),me=react.useRef(null),Z=react.useMemo(()=>pl(P),[P]),A=react.useMemo(()=>({theme:Z,themeName:P}),[Z,P]),Q=react.useMemo(()=>Yl(i),[i]),Se=react.useMemo(()=>{if(!l)return de;let N=X.calculateCriticalPath(de),O=V=>V.map(ee=>({...ee,isCriticalPath:N.includes(ee.id),subtasks:ee.subtasks?O(ee.subtasks):void 0}));return O(de)},[de,l]),at=jg(ye);Kl({undo:Kt,redo:ha,canUndo:Et,canRedo:va,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>X.findTaskById(de,N),addTask:(N,O)=>{we(V=>{if(!O)return [...V,{...N,level:0}];let ee=se=>se.map(he=>he.id===O?{...he,subtasks:[...he.subtasks||[],{...N,parentId:O,level:(he.level||0)+1}],isExpanded:true}:he.subtasks?{...he,subtasks:ee(he.subtasks)}:he);return ee(V)});},updateTask:(N,O)=>{we(V=>{let ee=se=>se.map(he=>he.id===N?{...he,...O}:he.subtasks?{...he,subtasks:ee(he.subtasks)}:he);return ee(V)});},deleteTask:N=>{we(O=>{let V=ee=>ee.filter(se=>se.id===N?false:(se.subtasks&&(se.subtasks=V(se.subtasks)),true));return V(O)});},deleteTasks:N=>{we(O=>Qn(O,N));},duplicateTask:N=>{we(O=>es(O,[N]));},splitTask:(N,O,V=3)=>{we(ee=>X.splitTask(ee,N,O,V));},calculateEndDate:X.calculateEndDate,calculateDuration:X.calculateDuration,validateDependency:(N,O)=>!X.validateDependencies(de,N,O),getAllTasks:()=>X.flattenTasks(de),getTasksByStatus:N=>X.flattenTasks(de).filter(O=>O.status===N),getTasksByParent:N=>N?X.findTaskById(de,N)?.subtasks||[]:de.filter(V=>!V.parentId),getCriticalPath:()=>X.flattenTasks(de).filter(N=>N.isCriticalPath),indentTask:N=>{we(O=>Xn(O,[N]));},outdentTask:N=>{we(O=>Jn(O,[N]));},moveTask:(N,O)=>{we(V=>Zn(V,[N],O));},createSubtask:async N=>{let{tasks:O,newTask:V}=rs(de,N);if(K){let ee=K({...V,parentId:N});if((ee instanceof Promise?await ee:ee)===false)return}we(O),le&&le({...V,parentId:N});},scrollToTask:N=>{let V=X.flattenTasks(de).findIndex(ee=>ee.id===N);if(V!==-1&&fe.current){let ee=V*at;fe.current.scrollTo({top:ee,behavior:"smooth"}),J.current&&J.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(N,O=2e3)=>{},expandTask:N=>{we(O=>{let V=ee=>ee.map(se=>se.id===N?{...se,isExpanded:true}:se.subtasks?{...se,subtasks:V(se.subtasks)}:se);return V(O)});},collapseTask:N=>{we(O=>{let V=ee=>ee.map(se=>se.id===N?{...se,isExpanded:false}:se.subtasks?{...se,subtasks:V(se.subtasks)}:se);return V(O)});},expandAll:()=>{we(N=>{let O=V=>V.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?O(ee.subtasks):void 0}));return O(N)});},collapseAll:()=>{we(N=>{let O=V=>V.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?O(ee.subtasks):void 0}));return O(N)});},undo:Kt,redo:ha,canUndo:()=>Et,canRedo:()=>va,clearHistory:ya,exportToPNG:async()=>{if(!me.current)throw new Error("Gantt container not found");let N=await Xl__default.default(me.current,{backgroundColor:Z.bgPrimary,scale:2});return new Promise((O,V)=>{N.toBlob(ee=>{ee?O(ee):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await X.exportToPDF(de,N);},exportToExcel:async N=>{await X.exportToExcel(de,N);},exportToJSON:()=>X.exportToJSON(de),exportToCSV:()=>X.exportToCSV(de),importFromJSON:N=>{let O=X.importFromJSON(N);we(O);},getTasks:()=>de,refresh:()=>{we(N=>[...N]);},clearAll:()=>{we([]);}}),[de,Kt,ha,Et,va,ya,Z,at]);let ue=react.useCallback(N=>{L(O=>O.map(V=>V.id===N?{...V,visible:!V.visible}:V));},[]),_a=react.useCallback((N,O)=>{L(V=>V.map(ee=>{if(ee.id!==N)return ee;let se=ee.minWidth??100,he=ee.maxWidth??800,wt=Math.max(se,Math.min(he,O));return {...ee,width:wt}}));},[]),sr=react.useCallback(N=>{we(O=>as(O,N)),a.onTaskToggleExpand?.(N);},[a]),ir=react.useCallback((N,O)=>{if(be&&be(N,O)===false)return;let ee=X.findTaskById(de,N)?.progress,se=wt=>wt.map(Bt=>Bt.id===N?{...Bt,...O}:Bt.subtasks?{...Bt,subtasks:se(Bt.subtasks)}:Bt);we(se(de));let he=X.findTaskById(se(de),N);he&&(x?.(he),Ge?.(he),O.progress!==void 0&&ee!==void 0&&O.progress!==ee&&w?.(N,ee,O.progress));},[de,x,be,Ge,w]),mc=react.useCallback(N=>{N.length!==0&&(we(O=>Xn(O,N)),a.onTaskIndent?.(N[0]));},[a]),uc=react.useCallback(N=>{N.length!==0&&(we(O=>Jn(O,N)),a.onTaskOutdent?.(N[0]));},[a]),gc=react.useCallback((N,O,V)=>{we(ee=>Il(ee,N,O,V)),a.onTaskReparent?.(N,O,V);},[a]),fc=react.useCallback((N,O)=>{N.length!==0&&(we(V=>Zn(V,N,O)),a.onTaskMove?.(N[0],O));},[a]),Qo=react.useCallback(async N=>{let O=[];for(let V of N)Le&&await Promise.resolve(Le(V))===false||O.push(V);O.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(O):(we(V=>Qn(V,O)),O.forEach(V=>a.onTaskDelete?.(V))),xe&&O.forEach(V=>xe(V)));},[a,Le,xe]),bc=react.useCallback(N=>{we(O=>es(O,N)),N.forEach(O=>a.onTaskDuplicate?.(O));},[a]),hc=react.useCallback((N,O)=>{we(V=>{let{tasks:ee,newTask:se}=Ml(V,N,O);return K&&K(se)===false?V:(a.onTaskCreate?.(se.parentId,se.position||0),le?.(se),ee)});},[a,K,le]),vc=react.useCallback((N,O)=>{we(V=>ts(V,N,O)),a.onTaskRename?.(N,O);},[a]),en=react.useCallback(N=>{we(O=>{let{tasks:V}=rs(O,N);return a.onTaskCreate?.(N,0),V});},[a]),yc=react.useCallback((N,O,V)=>{let ee=N.startDate?Math.round((O.getTime()-N.startDate.getTime())/864e5):0,se=Bt=>Bt.map(oa=>oa.id===N.id?{...oa,startDate:O,endDate:V,...N.segments&&{segments:N.segments}}:oa.subtasks?{...oa,subtasks:se(oa.subtasks)}:oa),he=se(de);he=X.autoScheduleDependents(he,N.id,ee),we(he);let wt={...N,startDate:O,endDate:V};x?.(wt);},[de,x]),xc=react.useCallback((N,O)=>{h?.(N,O),rt({isOpen:true,x:O.clientX,y:O.clientY,task:N});},[h]),kc=react.useCallback((N,O)=>{let V=X.splitTask(de,N.id,O);we(V),rt({isOpen:false,x:0,y:0,task:null});},[de]),ei=react.useCallback(N=>{D?.(N),M||ze(N);},[D,M]),ti=react.useCallback((N,O,V)=>{let ee=new Map,se=na=>{na.forEach(Ta=>{Ta.dependencies&&ee.set(Ta.id,Ta.dependencies),Ta.subtasks&&se(Ta.subtasks);});};se(V);let he=ee.get(O)||[];ee.set(O,[...he,N]);let wt=new Set,Bt=new Set,oa=na=>{if(!wt.has(na)){wt.add(na),Bt.add(na);let Ta=ee.get(na)||[];for(let Sr of Ta){if(!wt.has(Sr)&&oa(Sr))return true;if(Bt.has(Sr))return true}}return Bt.delete(na),false};return oa(O)},[]),ai=react.useCallback((N,O)=>{if(ti(N.id,O,de)){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;"}),i=document.createElement("a");i.href=URL.createObjectURL(m),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=X.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?X.calculateDuration(n.startDate,n.endDate):0,i=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let y=t.find(g=>g.id===u);if(y){o(y);let g=r.get(u)?.ef||0;i=Math.max(i,g);}}let l=i+m;r.set(n.id,{es:i,ef:l});};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?X.calculateDuration(n.startDate,n.endDate):0,i=t.filter(y=>y.dependencies&&y.dependencies.includes(n.id)),l=s;if(i.length>0)for(let y of i){c(y);let g=d.get(y.id)?.ls||0;l=Math.min(l,g);}let u=l-m;d.set(n.id,{ls:u,lf:l});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),i=d.get(n.id);if(m&&i){let l=i.ls-m.es;Math.abs(l)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=X.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(X.calculateCriticalPath(e).includes(t))return 0;let o=X.getDependentTasks(e,t);if(o.length===0){let c=X.getLatestEndDate(e);if(!c)return null;let p=X.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=X.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>X.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=X.findTaskById(e,t);if(!r||!r.endDate)return e;let o=X.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=X.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=X.calculateEndDate(p,c),m=i=>i.map(l=>l.id===d.id?{...l,startDate:p,endDate:n}:l.subtasks?{...l,subtasks:m(l.subtasks)}:l);s=m(s),s=X.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,i=X.findTaskById(e,t);if(!i||!i.endDate)return [];let l=(u,y,g=new Set)=>{if(g.has(u))return;g.add(u);let v=X.getDependentTasks(e,u);for(let k of v){if(!k.startDate||!k.endDate)continue;let b=r.findIndex(B=>B.id===k.id);if(b===-1)continue;let f=k.startDate.getTime(),D=(k.endDate.getTime()-f)/m,x=(f-n)/m*s,w=x+y*s,M=Math.max(D*s,s),C=c+b*d+12;p.push({taskId:k.id,taskName:k.name,originalX:x,previewX:w,width:M,y:C,rowIndex:b,daysDelta:y,color:k.color}),l(k.id,y,g);}};return l(t,a),p},splitTask:(e,t,a,r=3)=>{let o=X.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(i=>i.id===o.id?{...i,endDate:c,segments:p}:i.subtasks?{...i,subtasks:n(i.subtasks)}:i);return n(e)}};function Ao({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:i,onDependencyCreate:l,onDependencyDelete:u}){let[g,v]=react.useState([]),[k,b]=react.useState(null),[f,T]=react.useState(null),D=react.useCallback(E=>{b(E);},[]),h=react.useCallback(E=>{T(E);},[]),x=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,M=x*w*d,C=E=>{let I=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),P=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-P);let _=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-_.getTime())/864e5+1)/7)},B=E=>{let I=E.getDay();return I===0||I===6},z=react.useCallback(E=>{let I=Math.round(E/(w*d)),P=new Date(o);return P.setDate(P.getDate()+I),P},[o,w,d]),R=react.useCallback((E,I)=>{if(I.startDate&&I.endDate)return;let P=E.currentTarget.ownerSVGElement;if(!P)return;let _=P.createSVGPoint();_.x=E.clientX,_.y=E.clientY;let Y=_.matrixTransform(P.getScreenCTM()?.inverse()),j=z(Y.x),ye=new Date(j);ye.setDate(ye.getDate()+1),i?.(I,j,ye);},[z,i]),$=react.useMemo(()=>{let E=Y=>Y.map(j=>{if(j.subtasks&&j.subtasks.length>0){let ye=E(j.subtasks),F=ye.filter(oe=>oe.startDate&&oe.endDate);if(F.length>0){let oe=F.map(tt=>tt.startDate.getTime()),q=F.map(tt=>tt.endDate.getTime()),Fe=new Date(Math.min(...oe)),Re=new Date(Math.max(...q));return {...j,subtasks:ye,startDate:Fe,endDate:Re}}return {...j,subtasks:ye}}return j}),I=(Y,j=[])=>{for(let ye of Y)j.push(ye),ye.subtasks&&ye.subtasks.length>0&&(ye.isExpanded===void 0||ye.isExpanded)&&I(ye.subtasks,j);return j},P=E(e);return I(P)},[e]),K=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let I=E.startDate.getTime(),P=E.endDate.getTime(),_=o.getTime(),Y=(I-_)/(1e3*60*60*24),j=(P-I)/(1e3*60*60*24),ye=Y*w*d,F=Math.max(w*d,40),oe=Math.max(j*w*d,F);return {x:ye,width:oe}},[o,w,d]),le=react.useMemo(()=>$.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:I,width:P}=K(E),Y=$.findIndex(j=>j.id===E.id)*a+12;return {id:E.id,x:I,y:Y,width:P,height:32}}),[$,K]),be=react.useCallback((E,I,P)=>{if(!P||I===0){v([]);return}let _=X.calculateCascadePreview(e,E,I,$,o,w*d,a,48);v(_);},[e,$,o,w,d,a,48]),Ge=react.useMemo(()=>{let E=[],I=new Date(o);for(;I<=s;){let Y=(I.getTime()-o.getTime())/864e5*w*d;if(r==="day")E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),I.setDate(I.getDate()+1);else if(r==="week"){let j=C(I);E.push({date:new Date(I),label:`Week ${j}`,x:Y}),I.setDate(I.getDate()+7);}else E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),I.setMonth(I.getMonth()+1);}return E},[o,s,r,w,d]),Le=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),xe=Math.max($.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(M,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(M,1e3),height:48,fill:t.bgGrid}),Ge.map((E,I)=>jsxRuntime.jsxs("g",{children:[I>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${I}`)),Le>=0&&Le<=M&&jsxRuntime.jsx("circle",{cx:Le,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(M,1e3),height:xe,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(M,1e3),height:xe,fill:t.bgPrimary}),Ge.map((E,I)=>{let P=Ge[I+1]?.x||M,_=B(E.date);return jsxRuntime.jsxs("g",{children:[_&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:P-E.x,height:$.length*a,fill:t.bgWeekend,opacity:1}),I>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:$.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},I)}),Le>=0&&Le<=M&&jsxRuntime.jsx("line",{x1:Le,y1:0,x2:Le,y2:$.length*a,stroke:t.today,strokeWidth:2,opacity:1}),$.map((E,I)=>{let P=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:I*a,width:M,height:a,fill:I%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:I*a,width:M,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:_=>R(_,E),onMouseEnter:_=>{_.currentTarget.setAttribute("fill",t.accentLight),_.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:_=>{_.currentTarget.setAttribute("fill","transparent"),_.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:Le>0?Le:100,y:I*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-${E.id}`)]})]},`row-group-${E.id}`)}),$.map((E,I)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(P=>{let _=$.find(F=>F.id===P);if(!_||!_.startDate||!_.endDate)return null;let Y=$.findIndex(F=>F.id===P),j=K(_),ye=K(E);return jsxRuntime.jsx(Eo,{x1:j.x+j.width,y1:Y*a+a/2,x2:ye.x,y2:I*a+a/2,theme:t,onDelete:()=>u?.(E.id,P),onHoverChange:h},`dep-${P}-${E.id}`)})),$.map((E,I)=>{if(!E.startDate||!E.endDate)return null;let{x:P,width:_}=K(E),Y=I*a+12,j=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Mo,{task:E,x:P+_/2,y:Y+16,theme:t,onClick:p},E.id):j?jsxRuntime.jsxs("g",{onClick:()=>p?.(E),onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),m?.(E,ye);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:P,y:Y,width:_,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:P,y1:Y,x2:P+_,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:P,y1:Y,x2:P,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:P+_,y1:Y,x2:P+_,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:P,y1:Y+32,x2:P+_,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),_>60&&jsxRuntime.jsx("text",{x:P+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(Do,{task:E,x:P,y:Y,width:_,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:i,onDependencyCreate:l,allTaskPositions:le,onDragMove:be,onHoverChange:D},E.id)}),g.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`)),f&&(()=>{let{x1:E,y1:I,x2:P,y2:_,onDelete:Y}=f,j=P-E,ye=_-I,F=E+j/2,oe=(I+_)/2,q=`M ${E} ${I} C ${F} ${I}, ${F} ${_}, ${P} ${_}`,Fe=6,Re=Math.atan2(ye,j),tt=P-Fe*Math.cos(Re-Math.PI/6),Oe=_-Fe*Math.sin(Re-Math.PI/6),dt=P-Fe*Math.cos(Re+Math.PI/6),pe=_-Fe*Math.sin(Re+Math.PI/6),vt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:q,fill:"none",stroke:vt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${P} ${_} L ${tt} ${Oe} M ${P} ${_} L ${dt} ${pe}`,fill:"none",stroke:vt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:P,cy:_,r:5,fill:vt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:rt=>{rt.stopPropagation(),Y();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:F,cy:oe,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:F-4,y1:oe-4,x2:F+4,y2:oe+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:F+4,y1:oe-4,x2:F-4,y2:oe+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),k&&jsxRuntime.jsx(Rl,{tooltipData:k,theme:t})]})]})}var zl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Ul({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:zl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:zl.find(r=>r.value===e)?.name||"Personalizado"})]})}var _l=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function Lo({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=[..._l,...n.filter(x=>!_l.some(w=>w.id===x.id))],i=Be[p]||Be.dark,[l,u]=react.useState(false),y={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},g={color:i.textSecondary},[v,k]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,f]=react.useState({});react.useEffect(()=>{a?(k({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)):(k({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return v.name.trim()||(x.name="El nombre es requerido"),v.startDate&&v.endDate&&v.startDate>v.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),f(x),Object.keys(x).length===0},D=async x=>{if(x.preventDefault(),!!T())try{await s(v),t();}catch(w){console.error("Error submitting task:",w);}},h=(x,w)=>{k(M=>{let C={...M,[x]:w};if(x==="progress"){let B=typeof w=="number"?w:parseInt(w,10);B===100&&M.status!=="completed"?C.status="completed":B>0&&B<100&&M.status==="todo"?C.status="in-progress":B===0&&M.status!=="todo"&&(C.status="todo");}return C}),b[x]&&f(M=>{let C={...M};return delete C[x],C});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:D,className:"p-6 space-y-5 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1.5",style:g,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:v.name,onChange:x=>h("name",x.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:d,autoFocus:true}),b.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),b.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium flex items-center gap-2",style:g,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fechas"]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:v.startDate?v.startDate.toISOString().split("T")[0]:"",onChange:x=>h("startDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||v.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:v.endDate?v.endDate.toISOString().split("T")[0]:"",onChange:x=>h("endDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||v.isMilestone})]})]}),b.endDate&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),b.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:g,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),o.length>0?jsxRuntime.jsx("div",{className:"space-y-1 max-h-[88px] overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.assignees?.some(w=>w.name===x.name),onChange:w=>{let M=w.target.checked?[...v.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(v.assignees||[]).filter(C=>C.name!==x.name);h("assignees",M);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold flex-shrink-0",style:{backgroundColor:i.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textTertiary},children:"No hay usuarios disponibles"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:v.status,onChange:x=>h("status",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:m.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.title},x.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:v.priority||"medium",onChange:x=>h("priority",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center justify-between",style:g,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-1.5 py-0.5 rounded text-xs",style:{color:v.progress<30?"#EF4444":v.progress<70?"#F59E0B":"#10B981",backgroundColor:v.progress<30?"rgba(239, 68, 68, 0.1)":v.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[v.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress,onChange:x=>h("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:v.progress<30?"#EF4444":v.progress<70?"#F59E0B":"#10B981"},disabled:d})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>h("progress",x),disabled:d,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:v.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":i.bgSecondary,color:v.progress===x?"#FFFFFF":i.textTertiary,border:`1px solid ${v.progress===x?"transparent":i.borderLight}`},children:[x,"%"]},x))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ul,{value:v.color,onChange:x=>h("color",x),disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:v.description||"",onChange:x=>h("description",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none text-sm",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!l),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:i.textSecondary,backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=i.bgSecondary,children:[l?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),"Opciones avanzadas",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-4 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:v.isMilestone,onChange:x=>h("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:g,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-28 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:r.filter(x=>x.id!==a?.id).map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.dependencies?.includes(x.id),onChange:w=>{let M=w.target.checked?[...v.dependencies||[],x.id]:(v.dependencies||[]).filter(C=>C!==x.id);h("dependencies",M);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=i.textPrimary,x.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=i.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:D,disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:x=>!d&&(x.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:x=>!d&&(x.currentTarget.style.backgroundColor=i.accent),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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Ig=['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"'],jl=()=>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"})]}),Ag=()=>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"})}),Lg=()=>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"})}),Fg=()=>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"})}),Bg=()=>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 Fo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[i,l]=react.useState(false),[u,y]=react.useState([]),[g,v]=react.useState(""),[k,b]=react.useState(false),[f,T]=react.useState(true),D=react.useRef(null),h=react.useRef(null),x=react.useRef(null),{enabled:w=true,placeholder:M='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:B,suggestions:z=Ig,maxHistory:R=50,persistHistory:$}=a,K=$?.storageKey||"gantt-ai-history",le=$?.maxMessages??5;react.useEffect(()=>{if($?.enabled)try{let I=localStorage.getItem(K);if(I){let _=JSON.parse(I).map(Y=>({...Y,timestamp:new Date(Y.timestamp)}));y(_.slice(-le));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[$?.enabled,K,le]),react.useEffect(()=>{if($?.enabled&&u.length>0)try{let I=u.filter(P=>!P.isLoading).slice(-le);localStorage.setItem(K,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[u,$?.enabled,K,le]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!i&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,i]);let be=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&d?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&c?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&p?.(I.taskId,I.dependencyFrom);break}},[o,s,d,c,p]),Ge=react.useCallback(async I=>{if(!I.trim()||k)return;let P={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};y(Y=>[...Y.slice(-(R-1)),P]),v(""),T(false),b(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(Y=>[...Y,_]);try{if(B){let Y=await B(I,e);y(j=>{let ye=j.filter(oe=>!oe.isLoading),F={id:`assistant-${Date.now()}`,role:"assistant",content:Y.message,timestamp:new Date,command:Y};return [...ye,F]}),be(Y);}else y(Y=>[...Y.filter(ye=>!ye.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(Y){y(j=>[...j.filter(F=>!F.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Y instanceof Error?Y.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[k,R,B,e,be]),Le=I=>{I.preventDefault(),Ge(g);},xe=I=>{v(I),D.current?.focus();};if(react.useEffect(()=>{let I=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),m(_=>!_),n||l(false)),P.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[n]),react.useEffect(()=>{if(!n)return;let I=_=>{let Y=_.target;x.current&&!x.current.contains(Y)&&m(false);},P=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",I);}},[n]),!w)return null;let E={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Ke,{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 ${E[C]} 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(jl,{}),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:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${E[C]} 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(jl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>l(I=>!I),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Fg,{})}),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(Lg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&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&&f&&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:z.slice(0,4).map((I,P)=>jsxRuntime.jsx("button",{onClick:()=>xe(I),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:I.length>30?I.slice(0,30)+"...":I},P))})]}),u.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:I.role==="user"?"white":t.textPrimary},children:[I.isLoading?jsxRuntime.jsx(Bg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:I.command.success?"#10B981":"#EF4444"},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Le,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:g,onChange:I=>v(I.target.value),placeholder:M,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!g.trim()||k,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:g.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:g.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ag,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Kl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(i=>{let l=typeof n=="function"?n(i.present):n;if(o.current)return {...i,present:l};if(!m)return {...i,present:l};let u=[...i.past,i.present];return u.length>t&&u.shift(),{past:u,present:l,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],i=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],i=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:i}});},[]),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 Yl({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 zg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${X.formatDate(e.startDate)} - ${X.formatDate(e.endDate)}`);let a=X.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=>X.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function ql(e){return {...zg,...e}}var jg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zl=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:i,enableAutoCriticalPath:l=true,aiAssistant:u,locale:y="en",customTranslations:g,showCreateTaskButton:v=false,createTaskLabel:k,onCreateTask:b,onThemeChange:f,onTaskClick:T,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:x,onProgressChange:w,onTaskEdit:M,onTaskAddSubtask:C,onTaskMarkIncomplete:B,onTaskSetInProgress:z,onDependencyCreate:R,onDependencyDelete:$,onBeforeTaskAdd:K,onAfterTaskAdd:le,onBeforeTaskUpdate:be,onAfterTaskUpdate:Ge,onBeforeTaskDelete:Le,onAfterTaskDelete:xe}=a,I=react.useContext(vo)?.theme,[P,_]=react.useState(I||s||"dark"),[Y,j]=react.useState(d),[ye,F]=react.useState(c),[oe,q]=react.useState(1),[Fe,Re]=react.useState(0),[tt,Oe]=react.useState(false),[dt,pe]=react.useState(null),[vt,rt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ot,ze]=react.useState(null),[Pe,Ue]=react.useState(null);react.useEffect(()=>{I&&I!==P&&_(I);},[I]),react.useEffect(()=>{s&&s!==P&&_(s);},[s]);let ct=react.useCallback(N=>{_(N),f?.(N);},[f]),{state:de,setState:we,undo:Kt,redo:ha,canUndo:Et,canRedo:va,clearHistory:ya}=Kl(t,50);react.useEffect(()=>{we(t);},[t,we]);let De=react.useRef(t),Ne=react.useRef(true);react.useEffect(()=>{if(Ne.current){Ne.current=false,De.current=de;return}if(!r)return;let N=JSON.stringify(De.current),O=JSON.stringify(de);N!==O&&(De.current=de,r(de));},[de,r]);let kt=react.useMemo(()=>jn(y,g),[y,g]),re=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,L]=react.useState(()=>re(kt));react.useEffect(()=>{L(N=>N.map(O=>({...O,label:kt.columns[O.id==="name"?"taskName":O.id]||O.label})));},[kt]);let G=react.useMemo(()=>Ce.filter(N=>N.visible).reduce((N,O)=>N+O.width,0)+60,[Ce]),me=react.useMemo(()=>dt!==null?Math.max(280,dt,G):Math.max(280,G),[dt,G]),fe=react.useRef(null),J=react.useRef(null),ue=react.useRef(null),Z=react.useMemo(()=>ml(P),[P]),A=react.useMemo(()=>({theme:Z,themeName:P}),[Z,P]),Q=react.useMemo(()=>ql(i),[i]),Se=react.useMemo(()=>{if(!l)return de;let N=X.calculateCriticalPath(de),O=V=>V.map(ee=>({...ee,isCriticalPath:N.includes(ee.id),subtasks:ee.subtasks?O(ee.subtasks):void 0}));return O(de)},[de,l]),at=jg(ye);Yl({undo:Kt,redo:ha,canUndo:Et,canRedo:va,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>X.findTaskById(de,N),addTask:(N,O)=>{we(V=>{if(!O)return [...V,{...N,level:0}];let ee=se=>se.map(he=>he.id===O?{...he,subtasks:[...he.subtasks||[],{...N,parentId:O,level:(he.level||0)+1}],isExpanded:true}:he.subtasks?{...he,subtasks:ee(he.subtasks)}:he);return ee(V)});},updateTask:(N,O)=>{we(V=>{let ee=se=>se.map(he=>he.id===N?{...he,...O}:he.subtasks?{...he,subtasks:ee(he.subtasks)}:he);return ee(V)});},deleteTask:N=>{we(O=>{let V=ee=>ee.filter(se=>se.id===N?false:(se.subtasks&&(se.subtasks=V(se.subtasks)),true));return V(O)});},deleteTasks:N=>{we(O=>Qn(O,N));},duplicateTask:N=>{we(O=>es(O,[N]));},splitTask:(N,O,V=3)=>{we(ee=>X.splitTask(ee,N,O,V));},calculateEndDate:X.calculateEndDate,calculateDuration:X.calculateDuration,validateDependency:(N,O)=>!X.validateDependencies(de,N,O),getAllTasks:()=>X.flattenTasks(de),getTasksByStatus:N=>X.flattenTasks(de).filter(O=>O.status===N),getTasksByParent:N=>N?X.findTaskById(de,N)?.subtasks||[]:de.filter(V=>!V.parentId),getCriticalPath:()=>X.flattenTasks(de).filter(N=>N.isCriticalPath),indentTask:N=>{we(O=>Xn(O,[N]));},outdentTask:N=>{we(O=>Jn(O,[N]));},moveTask:(N,O)=>{we(V=>Zn(V,[N],O));},createSubtask:async N=>{let{tasks:O,newTask:V}=rs(de,N);if(K){let ee=K({...V,parentId:N});if((ee instanceof Promise?await ee:ee)===false)return}we(O),le&&le({...V,parentId:N});},scrollToTask:N=>{let V=X.flattenTasks(de).findIndex(ee=>ee.id===N);if(V!==-1&&fe.current){let ee=V*at;fe.current.scrollTo({top:ee,behavior:"smooth"}),J.current&&J.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(N,O=2e3)=>{},expandTask:N=>{we(O=>{let V=ee=>ee.map(se=>se.id===N?{...se,isExpanded:true}:se.subtasks?{...se,subtasks:V(se.subtasks)}:se);return V(O)});},collapseTask:N=>{we(O=>{let V=ee=>ee.map(se=>se.id===N?{...se,isExpanded:false}:se.subtasks?{...se,subtasks:V(se.subtasks)}:se);return V(O)});},expandAll:()=>{we(N=>{let O=V=>V.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?O(ee.subtasks):void 0}));return O(N)});},collapseAll:()=>{we(N=>{let O=V=>V.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?O(ee.subtasks):void 0}));return O(N)});},undo:Kt,redo:ha,canUndo:()=>Et,canRedo:()=>va,clearHistory:ya,exportToPNG:async()=>{if(!ue.current)throw new Error("Gantt container not found");let N=await Jl__default.default(ue.current,{backgroundColor:Z.bgPrimary,scale:2});return new Promise((O,V)=>{N.toBlob(ee=>{ee?O(ee):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await X.exportToPDF(de,N);},exportToExcel:async N=>{await X.exportToExcel(de,N);},exportToJSON:()=>X.exportToJSON(de),exportToCSV:()=>X.exportToCSV(de),importFromJSON:N=>{let O=X.importFromJSON(N);we(O);},getTasks:()=>de,refresh:()=>{we(N=>[...N]);},clearAll:()=>{we([]);}}),[de,Kt,ha,Et,va,ya,Z,at]);let ge=react.useCallback(N=>{L(O=>O.map(V=>V.id===N?{...V,visible:!V.visible}:V));},[]),_a=react.useCallback((N,O)=>{L(V=>V.map(ee=>{if(ee.id!==N)return ee;let se=ee.minWidth??100,he=ee.maxWidth??800,wt=Math.max(se,Math.min(he,O));return {...ee,width:wt}}));},[]),sr=react.useCallback(N=>{we(O=>as(O,N)),a.onTaskToggleExpand?.(N);},[a]),ir=react.useCallback((N,O)=>{if(be&&be(N,O)===false)return;let ee=X.findTaskById(de,N)?.progress,se=wt=>wt.map(Bt=>Bt.id===N?{...Bt,...O}:Bt.subtasks?{...Bt,subtasks:se(Bt.subtasks)}:Bt);we(se(de));let he=X.findTaskById(se(de),N);he&&(x?.(he),Ge?.(he),O.progress!==void 0&&ee!==void 0&&O.progress!==ee&&w?.(N,ee,O.progress));},[de,x,be,Ge,w]),mc=react.useCallback(N=>{N.length!==0&&(we(O=>Xn(O,N)),a.onTaskIndent?.(N[0]));},[a]),uc=react.useCallback(N=>{N.length!==0&&(we(O=>Jn(O,N)),a.onTaskOutdent?.(N[0]));},[a]),gc=react.useCallback((N,O,V)=>{we(ee=>Al(ee,N,O,V)),a.onTaskReparent?.(N,O,V);},[a]),fc=react.useCallback((N,O)=>{N.length!==0&&(we(V=>Zn(V,N,O)),a.onTaskMove?.(N[0],O));},[a]),Qo=react.useCallback(async N=>{let O=[];for(let V of N)Le&&await Promise.resolve(Le(V))===false||O.push(V);O.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(O):(we(V=>Qn(V,O)),O.forEach(V=>a.onTaskDelete?.(V))),xe&&O.forEach(V=>xe(V)));},[a,Le,xe]),bc=react.useCallback(N=>{we(O=>es(O,N)),N.forEach(O=>a.onTaskDuplicate?.(O));},[a]),hc=react.useCallback((N,O)=>{we(V=>{let{tasks:ee,newTask:se}=Il(V,N,O);return K&&K(se)===false?V:(a.onTaskCreate?.(se.parentId,se.position||0),le?.(se),ee)});},[a,K,le]),vc=react.useCallback((N,O)=>{we(V=>ts(V,N,O)),a.onTaskRename?.(N,O);},[a]),en=react.useCallback(N=>{we(O=>{let{tasks:V}=rs(O,N);return a.onTaskCreate?.(N,0),V});},[a]),yc=react.useCallback((N,O,V)=>{let ee=N.startDate?Math.round((O.getTime()-N.startDate.getTime())/864e5):0,se=Bt=>Bt.map(oa=>oa.id===N.id?{...oa,startDate:O,endDate:V,...N.segments&&{segments:N.segments}}:oa.subtasks?{...oa,subtasks:se(oa.subtasks)}:oa),he=se(de);he=X.autoScheduleDependents(he,N.id,ee),we(he);let wt={...N,startDate:O,endDate:V};x?.(wt);},[de,x]),xc=react.useCallback((N,O)=>{h?.(N,O),rt({isOpen:true,x:O.clientX,y:O.clientY,task:N});},[h]),kc=react.useCallback((N,O)=>{let V=X.splitTask(de,N.id,O);we(V),rt({isOpen:false,x:0,y:0,task:null});},[de]),ti=react.useCallback(N=>{D?.(N),M||ze(N);},[D,M]),ai=react.useCallback((N,O,V)=>{let ee=new Map,se=na=>{na.forEach(Ta=>{Ta.dependencies&&ee.set(Ta.id,Ta.dependencies),Ta.subtasks&&se(Ta.subtasks);});};se(V);let he=ee.get(O)||[];ee.set(O,[...he,N]);let wt=new Set,Bt=new Set,oa=na=>{if(!wt.has(na)){wt.add(na),Bt.add(na);let Ta=ee.get(na)||[];for(let Sr of Ta){if(!wt.has(Sr)&&oa(Sr))return true;if(Bt.has(Sr))return true}}return Bt.delete(na),false};return oa(O)},[]),ri=react.useCallback((N,O)=>{if(ai(N.id,O,de)){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 V=ee=>ee.map(se=>{if(se.id===O){let he=se.dependencies||[];if(!he.includes(N.id))return {...se,dependencies:[...he,N.id]}}return se.subtasks?{...se,subtasks:V(se.subtasks)}:se});we(V(de)),R?.(N.id,O);},[de,R,
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let V=ee=>ee.map(se=>{if(se.id===O){let he=se.dependencies||[];if(!he.includes(N.id))return {...se,dependencies:[...he,N.id]}}return se.subtasks?{...se,subtasks:V(se.subtasks)}:se});we(V(de)),R?.(N.id,O);},[de,R,ai]),oi=react.useCallback((N,O)=>{let V=ee=>ee.map(se=>{if(se.id===N&&se.dependencies){let he=se.dependencies.filter(wt=>wt!==O);return {...se,dependencies:he}}return se.subtasks?{...se,subtasks:V(se.subtasks)}:se});we(V(de)),$?.(N,O);},[de,$]),{startDate:wc,endDate:Cc}=react.useMemo(()=>{let N=de.filter(he=>he.startDate&&he.endDate);if(N.length===0){let he=new Date,wt=new Date(he);wt.setDate(wt.getDate()-30);let Bt=new Date(he);return Bt.setDate(Bt.getDate()+60),{startDate:wt,endDate:Bt}}let O=N.flatMap(he=>[he.startDate,he.endDate]).filter(he=>he!==void 0),V=new Date(Math.min(...O.map(he=>he.getTime()))),ee=new Date(Math.max(...O.map(he=>he.getTime()))),se=Y==="day"?7:Y==="week"?14:30;return V.setDate(V.getDate()-se),ee.setDate(ee.getDate()+se),{startDate:V,endDate:ee}},[de,Y]),Tc=react.useCallback(async()=>{if(!ue.current)return;let N=await Jl__default.default(ue.current,{backgroundColor:Z.bgPrimary,scale:2}),O=document.createElement("a");O.download="gantt-chart.png",O.href=N.toDataURL("image/png"),O.click();},[Z]),Dc=react.useCallback(async()=>{await X.exportToPDF(de);},[de]),Nc=react.useCallback(async()=>{await X.exportToExcel(de);},[de]),Sc=react.useCallback(()=>{let N=X.exportToCSV(de),O=new Blob([N],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(O),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[de]),Ec=react.useCallback(()=>{let N=X.exportToJSON(de),O=new Blob([N],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(O),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[de]),Pc=react.useCallback(()=>{X.exportToMSProject(de,"Gantt Project","project.xml");},[de]),Mc=N=>{N.preventDefault(),Oe(true);};return react.useEffect(()=>{let N=J.current,O=fe.current;if(!N||!O)return;let V=O.querySelector(".gantt-taskgrid-content"),ee=()=>{let wt=N.scrollTop;Re(wt),V&&(V.style.transform=`translateY(-${wt}px)`);},se=wt=>{if(tt&&O){let oa=O.parentElement?.getBoundingClientRect()?.left||0,na=wt.clientX-oa,Ta=280,Sr=Math.min(window.innerWidth-300,800);na>=Ta&&na<=Sr&&pe(na);}},he=()=>{Oe(false);};return N.addEventListener("scroll",ee),document.addEventListener("mousemove",se),document.addEventListener("mouseup",he),()=>{N.removeEventListener("scroll",ee),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",he);}},[tt]),jsxRuntime.jsx(vr.Provider,{value:kt,children:jsxRuntime.jsx(nn.Provider,{value:A,children:jsxRuntime.jsxs("div",{ref:ue,className:"flex flex-col h-full w-full",style:{backgroundColor:Z.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(xo,{theme:Z,timeScale:Y,onTimeScaleChange:j,zoom:oe,onZoomChange:q,currentTheme:P,onThemeChange:ct,rowDensity:ye,onRowDensityChange:F,showThemeSelector:p,showCreateTaskButton:v,createTaskLabel:k,onCreateTask:b,onExportPNG:n?Tc:void 0,onExportPDF:n?Dc:void 0,onExportExcel:n?Nc:void 0,onExportCSV:n?Sc:void 0,onExportJSON:n?Ec:void 0,onExportMSProject:n?Pc:void 0}),jsxRuntime.jsxs("div",{ref:fe,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:me,overflow:"hidden"},children:jsxRuntime.jsx(To,{tasks:Se,theme:Z,rowHeight:at,availableUsers:m,templates:Q,onTaskClick:T,onTaskDblClick:ti,onTaskContextMenu:h,onTaskToggle:sr,scrollTop:Fe,columns:Ce,onToggleColumn:ge,onColumnResize:_a,onTaskUpdate:ir,onTaskIndent:mc,onTaskOutdent:uc,onTaskMove:fc,onMultiTaskDelete:Qo,onTaskDuplicate:bc,onTaskCreate:hc,onTaskRename:vc,onCreateSubtask:en,onOpenTaskModal:T?N=>T(N):void 0,onDeleteRequest:(N,O)=>Ue({taskId:N,taskName:O}),onTaskReparent:gc})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Mc}),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(Ao,{tasks:Se,theme:Z,rowHeight:at,timeScale:Y,startDate:wc,endDate:Cc,zoom:oe,templates:Q,onTaskClick:T,onTaskDblClick:ti,onTaskContextMenu:xc,onTaskDateChange:yc,onDependencyCreate:ri,onDependencyDelete:oi})})]}),vt.task&&jsxRuntime.jsx(yr,{isOpen:vt.isOpen,x:vt.x,y:vt.y,theme:Z,onClose:()=>rt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=vt.task;return N?N.subtasks&&N.subtasks.length>0?[{id:"addSubtask",label:kt.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{C?C(N):en(N.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:kt.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{Ue({taskId:N.id,taskName:N.name});}}]:[{id:"edit",label:kt.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{M?M(N):ze(N);}},{id:"addSubtask",label:kt.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{C?C(N):en(N.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:kt.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{B?B(N):ir(N.id,{status:"todo",progress:0});},disabled:N.status==="todo"},{id:"setInProgress",label:kt.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{z?z(N):ir(N.id,{status:"in-progress"});},disabled:N.status==="in-progress"},{id:"markComplete",label:kt.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{ir(N.id,{status:"completed",progress:100});},disabled:N.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:kt.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{if(!N.startDate||!N.endDate){console.warn("Cannot split task without dates");return}let V=N.startDate.getTime(),ee=N.endDate.getTime(),se=V+(ee-V)/2,he=new Date(se);kc(N,he);},disabled:!N.startDate||!N.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:kt.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{Ue({taskId:N.id,taskName:N.name});}}]:[]})()}),Ot&&jsxRuntime.jsx(Lo,{isOpen:true,onClose:()=>ze(null),task:Ot,onSubmit:N=>{ir(Ot.id,N),ze(null);},mode:"edit",theme:P}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Pe&&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:()=>Ue(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:Z.bgSecondary,border:`1px solid ${Z.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Z.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:Z.textPrimary,fontFamily:"Inter, sans-serif"},children:[kt.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Z.textPrimary},children:['"',Pe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Z.bgPrimary,borderTop:`1px solid ${Z.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ue(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=Z.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Qo([Pe.taskId]),Ue(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Fo,{tasks:de,theme:Z,config:u,onTasksUpdate:we,onTaskUpdate:ir,onTaskCreate:N=>{we(O=>[...O,N]);},onTaskDelete:N=>{Qo([N]);},onDependencyCreate:(N,O)=>{let V=X.findTaskById(de,N);V&&ri(V,O);},onDependencyDelete:oi})]})})})});var Ql=`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,17 +316,17 @@ 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 ed(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 ed(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Pa(e,t){let a=ed(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 ms(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 l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}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 y=new Date(r),g=y.getDay(),v=u-g;return v<=0&&(v+=7),y.setDate(y.getDate()+v),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let l=parseInt(s[1],10),u=s[2].toLowerCase(),y=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?y.setDate(y.getDate()+l):u==="week"||u==="semana"||u==="semanas"?y.setDate(y.getDate()+l*7):(u==="month"||u==="mes"||u==="meses")&&y.setMonth(y.getMonth()+l),y}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 l=parseInt(c[1],10),u=parseInt(c[2],10)-1,y=parseInt(c[3],10);return new Date(y,u,l)}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 l=parseInt(n[1],10),u=p[n[2].toLowerCase()],y=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,l)}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},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let l=m[i[1].toLowerCase()],u=parseInt(i[2],10),y=i[3]?parseInt(i[3],10):r.getFullYear();if(l!==void 0)return new Date(y,l,u)}return null}function us(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 gs(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 td(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 ad(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(),i=Pa(t,n),l=ms(m);if(!i)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(!l)return {type:"move_task",taskId:i.id,taskName:i.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=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(l);return y.setDate(y.getDate()+u),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:l,endDate:y},message:`Moved "${i.name}" to ${l.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(),i=Pa(t,n),l=us(m);if(!i)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!l||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(i.endDate);return u.setDate(u.getDate()+l),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:u},message:`Extended "${i.name}" by ${l} 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(),i=Pa(t,n),l=gs(m);return i?l===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:l},message:`Set "${i.name}" progress to ${l}%.`,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(),i=Pa(t,n);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:m},message:`Renamed "${i.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(),i=Pa(t,n),l=Pa(t,m);return i?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:i.id,dependencyTo:l.id,message:`Linked "${i.name}" \u2192 "${l.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=Pa(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 rd(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 Kg(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 Yg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ro(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let i=a.find(l=>l.id===m);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Ro(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:Kg(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 od(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:Yg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function nd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ro(r,e,t))}var fs={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"}},bs={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"}},Oo={en:fs,es:bs};function hs(e){return Oo[e]||Oo.en}function $o(e,t){let a=hs(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 dd(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(...dd(r.subtasks,t+1));return a}function nf({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 cd({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:i=true}=t,l=$o(p,n),u=c==="dark",[y,g]=react.useState(new Set),[v,k]=react.useState("startDate"),[b,f]=react.useState("asc"),[T,D]=react.useState("");react.useMemo(()=>{let C=new Set;function B(z){for(let R of z)R.subtasks?.length&&(C.add(R.id),B(R.subtasks));}B(e),g(C);},[e]);let h=react.useCallback(C=>{g(B=>{let z=new Set(B);return z.has(C)?z.delete(C):z.add(C),z}),a.onTaskToggleExpand?.(C);},[a]),x=react.useCallback(C=>{v===C?f(B=>B==="asc"?"desc":"asc"):(k(C),f("asc")),a.onSortChange?.({column:C,direction:b==="asc"?"desc":"asc"});},[v,b,a]),w=react.useMemo(()=>{let C=dd(e);if(T.trim()){let z=T.toLowerCase();C=C.filter(R=>R.name.toLowerCase().includes(z));}let B=[];for(let z of C){let R=z.level===0;z.level>0&&(R=true),(R||T.trim())&&B.push(z);}return T.trim()&&B.sort((z,R)=>{let $,K;switch(v){case "name":$=z.name.toLowerCase(),K=R.name.toLowerCase();break;case "startDate":$=z.startDate?.getTime()||0,K=R.startDate?.getTime()||0;break;case "endDate":$=z.endDate?.getTime()||0,K=R.endDate?.getTime()||0;break;case "progress":$=z.progress||0,K=R.progress||0;break;case "status":$=z.status||"todo",K=R.status||"todo";break;default:return 0}return $<K?b==="asc"?-1:1:$>K?b==="asc"?1:-1:0}),B},[e,T,v,b]),M=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:S("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:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:S("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:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("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:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:S("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:S("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:T,onChange:C=>D(C.target.value),placeholder:l.toolbar.searchPlaceholder,className:S("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:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",l.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:S("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:()=>x("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("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:w.map((C,B)=>{let z=y.has(C.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:B*.02},className:S("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:i?`${24+C.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(C),onDoubleClick:()=>a.onTaskDoubleClick?.(C),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[i&&C.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),h(C.id);},className:S("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),i&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(nf,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:S("truncate",u?"text-white":"text-gray-900",C.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:C.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:S("px-2 py-1 rounded-full text-xs font-medium",C.progress===100||C.status==="completed"?"bg-green-500/10 text-green-500":C.progress&&C.progress>0||C.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:C.progress===100||C.status==="completed"?l.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxRuntime.jsxs("div",{className:S("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"}),M(C.startDate)]}),jsxRuntime.jsxs("div",{className:S("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"}),M(C.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:S("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[C.progress||0,"%"]})]})})]},C.id)})}),w.length===0&&T&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:S("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:S(u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var vs={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"},ys={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"},xs={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"},Uo={dark:vs,light:ys,neutral:xs};function pd(e){return Uo[e]||Uo.dark}var ks={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"}},ws={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"}},Wo={en:ks,es:ws};function jr(e){return Wo[e]||Wo.en}function Go(e,t){let a=jr(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 md(e){let t=jr(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 ud(e,t=0,a=true){let r=jr(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 yf(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 Cs(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 hd({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 yd({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,i=Go(n,m),l=p==="dark",[u,y]=react.useState(r||new Date),[g,v]=react.useState(null),[k,b]=react.useState(null),[f,T]=react.useState(null),[D,h]=react.useState(new Date),[x,w]=react.useState({}),M=4,C=3,[B,z]=react.useState(false),[R,$]=react.useState(false),[K,le]=react.useState(false),be=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),Ge=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Le=react.useCallback(()=>{y(new Date);},[]),xe=react.useMemo(()=>{let F=u.getFullYear(),oe=u.getMonth(),q=new Date(F,oe,1),Fe=new Date(F,oe+1,0),Re=q.getDay(),tt=Fe.getDate(),Oe=yf(e),dt=new Date;dt.setHours(0,0,0,0);let ce=[],vt=Re,rt=new Date(F,oe,0).getDate();for(let ze=vt-1;ze>=0;ze--){let Pe=new Date(F,oe-1,rt-ze);ce.push({date:Pe,isCurrentMonth:false,isToday:false,isWeekend:Pe.getDay()===0||Pe.getDay()===6,events:Oe.filter(Ue=>Cs(Pe,Ue)).map(Ue=>({id:Ue.id,title:Ue.name,start:Ue.startDate,end:Ue.endDate,task:Ue}))});}for(let ze=1;ze<=tt;ze++){let Pe=new Date(F,oe,ze),Ue=Pe.getTime()===dt.getTime();ce.push({date:Pe,isCurrentMonth:true,isToday:Ue,isWeekend:Pe.getDay()===0||Pe.getDay()===6,events:Oe.filter(ct=>Cs(Pe,ct)).map(ct=>({id:ct.id,title:ct.name,start:ct.startDate,end:ct.endDate,task:ct}))});}let Ot=42-ce.length;for(let ze=1;ze<=Ot;ze++){let Pe=new Date(F,oe+1,ze);ce.push({date:Pe,isCurrentMonth:false,isToday:false,isWeekend:Pe.getDay()===0||Pe.getDay()===6,events:Oe.filter(Ue=>Cs(Pe,Ue)).map(Ue=>({id:Ue.id,title:Ue.name,start:Ue.startDate,end:Ue.endDate,task:Ue}))});}return ce},[u,e]),E=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],I=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),P=react.useCallback(F=>{let oe=F.progress===100?0:100,q=oe===100?"completed":"todo";a.onTaskUpdate?.({...F,status:q,progress:oe});},[a]),_=react.useCallback((F,oe)=>{if(!g)return;let q={...g,[F]:oe};v(q),a.onTaskUpdate?.(q);},[g,a]),Y=react.useCallback(F=>{if(!g)return;let oe=g.progress||0;F==="completed"?oe=100:F==="todo"&&(oe=0);let q={...g,status:F,progress:oe};v(q),a.onTaskUpdate?.(q),z(false);},[g,a]),j=react.useCallback((F,oe)=>{if(!g)return;let q={...g,startDate:F,endDate:oe};v(q),a.onTaskUpdate?.(q);},[g,a]),ye=react.useCallback(()=>{z(false),$(false),T(null);},[]);return o?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"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:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[i.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:i.labels.noEvents}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:i.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",l?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:S("flex-shrink-0 px-6 py-4 border-b",l?"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:S("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:I}),jsxRuntime.jsx("button",{onClick:Le,className:S("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:i.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:be,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ge,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:E.map(F=>jsxRuntime.jsx("div",{className:S("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:F},F))}),jsxRuntime.jsx("div",{className:S("grid grid-cols-7 auto-rows-min gap-px rounded-lg overflow-hidden",l?"bg-white/5":"bg-gray-200"),children:xe.map((F,oe)=>{let q=F.date.getDay()===0||F.date.getDay()===6;return jsxRuntime.jsxs("div",{className:S("min-h-[120px] p-2 transition-colors flex flex-col relative",l?q?"bg-[#1A1D21]":F.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":q?"bg-gray-100":F.isCurrentMonth?"bg-white":"bg-gray-50",F.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Fe=x[oe]||M,Re=F.events.slice(0,Fe),tt=F.events.length-Fe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Re.map(Oe=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{v(Oe.task),a.onEventClick?.(Oe);},whileHover:{scale:1.02},className:S("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Oe.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hd,{task:Oe.task}),jsxRuntime.jsx("span",{className:"truncate",children:Oe.title})]}),jsxRuntime.jsx("div",{className:S("absolute left-0 bottom-full mb-1 px-2 py-1 rounded text-xs whitespace-nowrap z-50 opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity shadow-lg",l?"bg-[#1A1D25] text-white border border-white/10":"bg-gray-900 text-white"),children:Oe.title})]},Oe.id)),tt>0&&jsxRuntime.jsxs("button",{onClick:Oe=>{Oe.stopPropagation(),w(dt=>({...dt,[oe]:Fe+C}));},className:S("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",tt," ",n==="es"?"M\xC1S":"MORE"]}),Fe>M&&F.events.length>M&&jsxRuntime.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),w(dt=>({...dt,[oe]:M}));},className:S("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsx("div",{className:S("text-sm font-medium mt-1 text-right",F.isToday?"text-[#3B82F6]":F.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:F.date.getDate()})]},oe)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>v(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:S("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:S("px-6 py-4 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:S("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:n==="es"?"Tarea":"Task"}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:g.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>v(null),className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("h2",{className:S("text-xl font-semibold",l?"text-white":"text-gray-900"),children:g.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:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ye(),z(!B);},className:S("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.progress===100||g.status==="completed"?"bg-green-500/20 text-green-400":g.progress&&g.progress>0||g.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:g.progress===100||g.status==="completed"?n==="es"?"COMPLETADO":"DONE":g.progress&&g.progress>0||g.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),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},className:S("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-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(F=>jsxRuntime.jsxs("button",{onClick:()=>Y(F.id),className:S("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(g.status===F.id||F.id==="completed"&&g.progress===100||F.id==="in-progress"&&g.progress&&g.progress>0&&g.progress<100||F.id==="todo"&&(!g.progress||g.progress===0)&&g.status!=="in-progress"&&g.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:S("w-2 h-2 rounded-full",F.id==="completed"?"bg-green-500":F.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:F.label})]},F.id))})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),g.assignees&&g.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[g.assignees.slice(0,3).map((F,oe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full bg-purple-500 flex items-center justify-center text-white text-xs font-medium",title:F.name,children:F.name.charAt(0).toUpperCase()},oe)),g.assignees.length>3&&jsxRuntime.jsxs("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",g.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:S("text-sm",l?"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:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{T(f?null:"start"),h(g.startDate||new Date);},className:S("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[g.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:S("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),g.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(g.startDate||g.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:F=>{F.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:S("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:S("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,oe=new Date(F);oe.setDate(F.getDate()+1);let q=new Date(F);q.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let Fe=new Date(F);Fe.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let Re=new Date(F);Re.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let tt=new Date(F);tt.setDate(F.getDate()+14);let Oe=new Date(F);return Oe.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:oe,display:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:q,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Fe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Re,display:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Oe,display:Oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ce,vt)=>jsxRuntime.jsxs("button",{className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(f==="start"){let rt=g.endDate&&ce.date>g.endDate?ce.date:g.endDate;j(ce.date,rt),T("end");}else {let rt=g.startDate&&ce.date<g.startDate?ce.date:g.startDate;j(rt,ce.date),T(null);}},children:[jsxRuntime.jsx("span",{children:ce.label}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ce.display})]},vt))})(),jsxRuntime.jsx("div",{className:S("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{j(void 0,void 0),T(null);},className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:S("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f==="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:S("font-medium",l?"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:S("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:S("p-1 rounded",l?"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:S("p-1 rounded",l?"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(F=>jsxRuntime.jsx("div",{className:S("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=D.getFullYear(),oe=D.getMonth(),q=new Date(F,oe,1).getDay(),Fe=new Date(F,oe+1,0).getDate(),Re=new Date(F,oe,0).getDate(),tt=new Date,Oe=[];for(let ce=q-1;ce>=0;ce--)Oe.push({day:Re-ce,isCurrentMonth:false,date:new Date(F,oe-1,Re-ce)});for(let ce=1;ce<=Fe;ce++)Oe.push({day:ce,isCurrentMonth:true,date:new Date(F,oe,ce)});let dt=42-Oe.length;for(let ce=1;ce<=dt;ce++)Oe.push({day:ce,isCurrentMonth:false,date:new Date(F,oe+1,ce)});return Oe.map((ce,vt)=>{let rt=ce.date.toDateString()===tt.toDateString(),Ot=g.startDate?.toDateString()===ce.date.toDateString(),ze=g.endDate?.toDateString()===ce.date.toDateString(),Pe=Ot||ze,Ue=g.startDate&&g.endDate&&ce.date>=g.startDate&&ce.date<=g.endDate;return jsxRuntime.jsx("button",{className:S("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!ce.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),ce.isCurrentMonth&&(l?"text-white":"text-gray-900"),rt&&"ring-2 ring-[#3B82F6]",Ot&&"bg-[#3B82F6] text-white",ze&&!Ot&&"bg-[#7C3AED] text-white",Ue&&!Pe&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!Pe&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ct=new Date(ce.date);if(f==="start"){let de=g.endDate&&ct>g.endDate?ct:g.endDate;j(ct,de),T("end");}else {let de=g.startDate&&ct<g.startDate?ct:g.startDate;j(de,ct),T(null);}},children:ce.day},vt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ye(),$(!R);},className:S("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.priority==="high"||g.priority==="urgent"?"bg-red-500/20 text-red-400":g.priority==="medium"?"bg-yellow-500/20 text-yellow-400":g.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g.priority?g.priority==="high"||g.priority==="urgent"?n==="es"?"Urgente":"Urgent":g.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:S("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{_("priority",F.id),$(false);},className:S("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",g.priority===F.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:S("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-white":"text-gray-900"),children:g.startDate&&g.endDate?`${Math.ceil((g.endDate.getTime()-g.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:S("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[K?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:g.progress||0,onChange:F=>{let oe=parseInt(F.target.value),q=g.status;oe===100?q="completed":oe>0?q="in-progress":q="todo";let Fe={...g,progress:oe,status:q};v(Fe),a.onTaskUpdate?.(Fe);},onBlur:()=>le(false),className:S("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>le(true),className:S("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",g.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${g.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[g.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"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:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:g.dependencies&&g.dependencies.length>0?`${g.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:S("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("div",{className:S("min-h-[60px] p-3 rounded-lg text-sm",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-50 text-gray-600"),children:g.description||(n==="es"?"Sin descripci\xF3n":"No description")})]}),g.subtasks&&g.subtasks.length>0&&jsxRuntime.jsxs("div",{className:S("mt-4 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Subtareas":"Subtasks"," (",g.subtasks.length,")"]})]}),jsxRuntime.jsx("div",{className:"space-y-2",children:g.subtasks.slice(0,5).map(F=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded border flex items-center justify-center",F.progress===100?"bg-green-500 border-green-500":l?"border-white/20":"border-gray-300"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:S("text-sm",F.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:F.name})]},F.id))})]})]}),jsxRuntime.jsx("div",{className:S("px-6 py-4 border-t flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("button",{onClick:()=>{P(g),v(null);},className:S("px-4 py-2 rounded-lg font-medium transition-colors",g.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:g.progress===100?n==="es"?"Reabrir tarea":"Reopen task":n==="es"?"Completar tarea":"Complete task"})})]}),jsxRuntime.jsxs("div",{className:S("w-[280px] border-l flex flex-col",l?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:S("font-medium",l?"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:S("text-sm text-center py-8",l?"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:S("p-3 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:S("flex items-center gap-2 px-3 py-2 rounded-lg",l?"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:S("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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:S("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:k.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:S("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:k.events.map(F=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),v(F.task);},className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hd,{task:F.task}),jsxRuntime.jsx("span",{className:S("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:F.title}),F.task.priority==="high"||F.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},F.id))})]})]})})]})}var Ts={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"},Ds={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"},Ns={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"},Vo={dark:Ts,light:Ds,neutral:Ns};function xd(e){return Vo[e]||Vo.dark}function kf({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]),i=react.useMemo(()=>{let u=m.length,y=new Set(m.flatMap(k=>k.assignedUserIds||[])).size,g=m.map(k=>k.priority).filter(Boolean),v=new Set(m.flatMap(k=>k.labels||[])).size;return {totalCards:u,uniqueAssignees:y,priorities:g,labels:v}},[m]),l=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:S("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:l,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:S("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:i.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:[i.uniqueAssignees," assignees"]})]}),i.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:[i.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:y=>{y.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 Yr(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 qr(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 Cd(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 Td({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),i=react.useRef(null),l=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(f=>{let T=f.timestamp.toISOString().split("T")[0],D=b.get(T);D?D.push(f):b.set(T,[f]);}),Array.from(b.entries()).sort((f,T)=>T[0].localeCompare(f[0])).map(([f,T])=>({date:new Date(f),events:T.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,f=new Set;return e.forEach(T=>{b.add(T.userId),f.add(T.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(f)}},[e]),g=b=>{m(f=>{let T=new Set(f);return T.has(b)?T.delete(b):T.add(b),T});},v=b=>{let T=new Date().getTime()-b.getTime(),D=Math.floor(T/6e4),h=Math.floor(T/36e5),x=Math.floor(T/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:x<7?`${x}d ago`:b.toLocaleDateString()},k=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&&i.current){let b=i.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:S("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:S("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 f=b.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[qr(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let f=b.target.value;a({...t,users:f?[f]: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})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:i,children:l.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((f,T)=>{let D=n.has(f.id),h=s===f.id,x=Cd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:S("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:x},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:qr(f.type)})}),T<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:x}})]}),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&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Yr(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?v(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),g(f.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([w,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(M.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(M.to)})]})]},w)),f.metadata&&Object.keys(f.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(f.metadata).map(([w,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(M)})]},w))]})]})]})]},f.id)})})]},b.date?.toISOString()||"all"))})]})}function Nd({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],i=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:S("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:S("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:i&&qr(i.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:i&&Yr(i)}),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:i&&i.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:`${l}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,y)=>jsxRuntime.jsx("div",{className:S("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>c(y),title:Yr(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:S("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:i&&i.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:S("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 Ss(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 Es(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 Sd(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 Ed(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Sf(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 i=a/2,l=r/2;m.vx+=(i-m.x)*o.centerForce*n,m.vy+=(l-m.y)*o.centerForce*n,d.forEach(u=>{if(m.id===u.id)return;let y=m.x-u.x,g=m.y-u.y,v=Math.sqrt(y*y+g*g)||1,k=o.chargeStrength*n/(v*v);m.vx+=y/v*k,m.vy+=g/v*k;});}),t.forEach(m=>{let i=c.get(typeof m.source=="string"?m.source:m.source.id),l=c.get(typeof m.target=="string"?m.target:m.target.id);if(!i||!l)return;let u=l.x-i.x,y=l.y-i.y,g=Math.sqrt(u*u+y*y)||1,v=(g-o.linkDistance)/g*o.forceStrength*n;i.vx+=u*v,i.vy+=y*v,l.vx-=u*v,l.vy-=y*v;}),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 Pd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:p}){let n=react.useRef(null),[m,i]=react.useState([]),[l,u]=react.useState(null),[y,g]=react.useState(null),[v,k]=react.useState(null),[b,f]=react.useState(1),[T,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=Sf(e,t,a.width,a.height,a,150);i(R);},[e,t,a]);let h=react.useCallback((R,$)=>{a.enableDragging&&($.stopPropagation(),u(R));},[a.enableDragging]),x=react.useCallback(R=>{if(!l||!n.current)return;let K=n.current.getBoundingClientRect(),le=(R.clientX-K.left-T.x)/b,be=(R.clientY-K.top-T.y)/b;i(Ge=>Ge.map(Le=>Le.id===l?{...Le,x:le,y:be,fx:le,fy:be}:Le));},[l,b,T]),w=react.useCallback(()=>{u(null);},[]),M=react.useCallback((R,$)=>{$.stopPropagation(),c?.({type:"node-click",node:R,position:{x:$.clientX,y:$.clientY}});},[c]),C=react.useCallback((R,$)=>{$.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:$.clientX,y:$.clientY}});},[c]),B=react.useCallback(R=>{let $=m.find(K=>K.id===R);return $?{x:$.x,y:$.y}:{x:0,y:0}},[m]),z=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=R.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:S("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:S("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:()=>f(R=>Math.min(R+.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:()=>f(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Ss(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sd(R)," ",Es(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:x,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let $=B(typeof R.source=="string"?R.source:R.source.id),K=B(typeof R.target=="string"?R.target:R.target.id),le=Ed(R.type),be=v===R.id,Ge=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-edge",be&&"hovered",Ge&&"critical"),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:Le=>C(R,Le),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:K.x,y2:K.y,stroke:Ss(R.type),strokeWidth:Ge?a.edgeWidth*2:a.edgeWidth,strokeOpacity:be?1:.6,markerEnd:le?"url(#arrowhead)":void 0}),a.showEdgeLabels&&be&&jsxRuntime.jsx("text",{x:($.x+K.x)/2,y:($.y+K.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Es(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(R=>{let $=y===R.id,K=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-node",$&&"hovered",K&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:le=>h(R.id,le),onMouseEnter:()=>g(R.id),onMouseLeave:()=>g(null),onClick:le=>M(R,le),children:[jsxRuntime.jsx("circle",{r:K?a.nodeSize*1.2:a.nodeSize,fill:z(R),stroke:K?"#fbbf24":"#ffffff",strokeWidth:K?3:2,opacity:$?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Ad({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),[i,l]=react.useState(null),u=react.useRef(null),y=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=f=>{f.key==="Escape"&&!y&&g();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let g=()=>{y||(d(""),m(null),l(null),t());},v=async()=>{if(!(!s.trim()||y)){p(true),m(null),l(null);try{let b=await r(s.trim());l(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{p(false);}}},k=()=>{i&&(a(i),g());};return e?jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:g}),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:g,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:i?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!"})]}),i.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:i.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:i.columns.map((b,f)=>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},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",i.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.cards.slice(0,10).map((b,f)=>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})]})},f)),i.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.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:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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,f)=>jsxRuntime.jsx("button",{onClick:()=>d(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:g,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),i?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ps={"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 Pf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mf={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 If(e,t,a){let r=Ps[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Xr(e){return `$${e.toFixed(4)}`}var Ms=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=If(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(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,l)=>i+l.cost,0),s=a.reduce((i,l)=>i+l.inputTokens,0),d=a.reduce((i,l)=>i+l.outputTokens,0),c=a.filter(i=>i.success),p=a.reduce((i,l)=>i+l.duration,0),n={},m={};return a.forEach(i=>{n[i.feature]=(n[i.feature]||0)+1,m[i.feature]=(m[i.feature]||0)+i.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)}},ar=new Ms;function Bd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(ar.getStats()),[s,d]=react.useState(ar.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(ar.getStats()),d(ar.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=ar.getRecentOperations(5);return jsxRuntime.jsxs(Ke,{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:Xr(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,i=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:Xr(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:`${i}%`}})})]},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:Xr(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 $d({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[p,n]=react.useState(""),[m,i]=react.useState(""),[l,u]=react.useState(false),[y,g]=react.useState(null),[v,k]=react.useState(null),[b,f]=react.useState(null),T=react.useRef(null),D=l||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let C=B=>{B.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,D]);let h=()=>{D||(c(""),n(""),i(""),g(null),k(null),f(null),t());},x=async()=>{if(!(!d.trim()||D)){u(true),g(null),k(null),f(null);try{let C=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});k(C.tasks.tasks),f({from_cache:C.from_cache,tokens_used:C.tokens_used,mock_mode:C.mock_mode,similarity:C.similarity,tokens_saved:C.tokens_saved});}catch(C){g(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{v&&(a(v),h());};if(!e)return null;let M=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ke,{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:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[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 (",M,"% 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:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((C,B)=>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:["#",B+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:C.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"})]}),C.start," \u2192 ",C.end]}),jsxRuntime.jsxs("span",{children:[C.duration," days"]}),C.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",C.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${C.priority==="high"?"bg-red-500/20 text-red-400":C.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:C.priority})]})},C.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:T,value:d,onChange:C=>c(C.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:C=>n(C.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:C=>i(C.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})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((C,B)=>jsxRuntime.jsx("button",{onClick:()=>c(C),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:C},B))})]})]})}),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"}),v?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:x,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 Yo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&oo(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,b,f)=>{console.warn(`Retry attempt ${b} after ${f}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),s=react.useCallback(async(v,k,b)=>{r(f=>{let T=f.cards.find(C=>C.id===v);if(!T)return f;let D=T.columnId,h={...T,columnId:k,position:b},x=f.cards.map(C=>C.id===v?h:C),w=f.columns.map(C=>{if(C.id===D)return {...C,cardIds:C.cardIds.filter(B=>B!==v)};if(C.id===k){let B=x.filter(z=>z.columnId===k).sort((z,R)=>z.position-R.position);return {...C,cardIds:B.map(z=>z.id)}}return C}),M={...f,cards:x,columns:w};return o(M),M});},[o]),d=react.useCallback(async(v,k)=>{r(b=>{let f=b.cards.map(D=>D.id===v?{...D,...k}:D),T={...b,cards:f};return o(T),T});},[o]),c=react.useCallback(async v=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let f={...v,id:k},T=b.columns.map(h=>h.id===v.columnId?{...h,cardIds:[...h.cardIds,k]}:h),D={...b,cards:[...b.cards,f],columns:T};return o(D),D});},[o]),p=react.useCallback(async v=>{r(k=>{let b=k.cards.find(h=>h.id===v);if(!b)return k;let f=k.cards.filter(h=>h.id!==v),T=k.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(x=>x!==v)}:h),D={...k,cards:f,columns:T};return o(D),D});},[o]),n=react.useCallback(async v=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let f={...v,id:k,cardIds:[]},T={...b,columns:[...b.columns,f]};return o(T),T});},[o]),m=react.useCallback(async(v,k)=>{r(b=>{let f=b.columns.map(D=>D.id===v?{...D,...k}:D),T={...b,columns:f};return o(T),T});},[o]),i=react.useCallback(async v=>{r(k=>{let b=k.cards.filter(D=>D.columnId!==v),f=k.columns.filter(D=>D.id!==v),T={...k,cards:b,columns:f};return o(T),T});},[o]),l=react.useCallback(v=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(v),k},[c]),u=react.useCallback(v=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(v),k},[n]),y=react.useCallback(()=>{r(v=>{let k={...v,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:i},setBoard:r,helpers:{addCard:l,addColumn:u,deleteCard:p,deleteColumn:i,clearBoard:y}}}function Ud({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Yo({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(i=>i.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(i=>i.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 Jr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Gd={by:"none",order:"asc"};function Hd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Jr,...e}),[s,d]=react.useState({...Gd,...t}),c=react.useCallback(g=>{o(v=>({...v,...g}));},[]),p=react.useCallback(g=>{d(v=>({...v,...g}));},[]),n=react.useCallback(()=>{o(Jr),d(Gd);},[]),m=react.useCallback(()=>{a&&o({...Jr,assignees:[a]});},[a]),i=react.useCallback(()=>{o({...Jr,dateFilter:"overdue"});},[]),l=react.useCallback(()=>{o({...Jr,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]),y=react.useCallback(g=>{let v=[...g];if(r.search){let k=r.search.toLowerCase();v=v.filter(b=>b.title.toLowerCase().includes(k)||b.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,b=k.getFullYear(),f=String(k.getMonth()+1).padStart(2,"0"),T=String(k.getDate()).padStart(2,"0"),D=`${b}-${f}-${T}`;v=v.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let x=h.endDate||h.dueDate;if(!x)return false;let w;if(typeof x=="string")w=x.split("T")[0]||x;else {let M=x.getUTCFullYear(),C=String(x.getUTCMonth()+1).padStart(2,"0"),B=String(x.getUTCDate()).padStart(2,"0");w=`${M}-${C}-${B}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let M=new Date(D+"T00:00:00"),C=new Date(w+"T00:00:00"),B=new Date(M);return B.setDate(B.getDate()+7),C>=M&&C<=B;case "custom":if(r.dateRange){let z=typeof x=="string"?new Date(x):x;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(v=v.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(v=v.filter(k=>k.labels&&k.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(v=v.filter(k=>r.columns.includes(k.columnId))),s.by!=="none"&&v.sort((k,b)=>{let f=0;switch(s.by){case "created":let T=k.createdAt?new Date(k.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;f=T-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=h[k.priority||"LOW"],w=h[b.priority||"LOW"];f=x-w;break;case "dueDate":let M=k.endDate||k.dueDate,C=b.endDate||b.dueDate;if(!M)return 1;if(!C)return -1;let B=typeof M=="string"?new Date(M).getTime():M.getTime(),z=typeof C=="string"?new Date(C).getTime():C.getTime();f=B-z;break;case "title":f=k.title.localeCompare(b.title);break;case "estimate":let R=k.estimatedTime||0,$=b.estimatedTime||0;f=R-$;break;default:f=0;}return s.order==="asc"?f:-f}),v},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:i,filterHighPriority:l,applyFilters:y,hasActiveFilters:u}}var Vd,jd;if(typeof window<"u")try{let e=to("ai");Vd=e.generateObject,jd=e.generateText;}catch{}function Kd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vd&&jd&&e.apiKey),d=react.useCallback(async i=>{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:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(l){let u=l instanceof Error?l:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(l){let u=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async i=>{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(l){let u=l instanceof Error?l:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(l){let u=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(l){let u=l instanceof Error?l: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 As(){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 Yd(e){let{cards:t}=e,[a,r]=As(),o=react.useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),s=react.useCallback((i,l)=>{if(!l){r({selectedCardIds:[i],lastSelectedCardId:i});return}let u=l.ctrlKey||l.metaKey,y=l.shiftKey;if(u)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(g=>g!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(y&&a.lastSelectedCardId){let g=t.find(k=>k.id===i),v=t.find(k=>k.id===a.lastSelectedCardId);if(g&&v&&g.columnId===v.columnId){let k=t.filter(w=>w.columnId===g.columnId).sort((w,M)=>w.position-M.position),b=k.findIndex(w=>w.id===a.lastSelectedCardId),f=k.findIndex(w=>w.id===i),[T,D]=b<f?[b,f]:[f,b],h=k.slice(T,D+1).map(w=>w.id),x=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:x,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),d=react.useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(i=>{a.selectedCardIds.includes(i)?d(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,d,r]),m=react.useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.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 qd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qd,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((g,v,k,b,f)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:g,cardIds:v,columnId:k,strategy:b,color:f,isExpanded:true,position:s.filter(D=>D.columnId===k).length,createdAt:new Date};d(D=>[...D,T]);},[o.minCardsPerStack,s]),p=react.useCallback(g=>{d(v=>v.filter(k=>k.id!==g));},[]),n=react.useCallback(g=>{d(v=>v.map(k=>k.id===g?{...k,isExpanded:!k.isExpanded}:k));},[]),m=react.useCallback((g,v)=>{d(k=>k.map(b=>b.id===g&&!b.cardIds.includes(v)?{...b,cardIds:[...b.cardIds,v]}:b));},[]),i=react.useCallback((g,v)=>{d(k=>k.map(b=>{if(b.id===g){let f=b.cardIds.filter(T=>T!==v);return f.length<o.minCardsPerStack?null:{...b,cardIds:f}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),l=react.useCallback(g=>s.filter(v=>v.columnId===g).sort((v,k)=>v.position-k.position),[s]),u=react.useCallback(async g=>{let v=t.filter(D=>D.columnId===g);if(v.length<o.minCardsPerStack*2)return [];let k=[],b=new Map;v.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&&k.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(x=>x.id),columnId:g,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let f=new Map;v.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{f.has(h)||f.set(h,[]),f.get(h).push(D);});}),f.forEach((D,h)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(x=>x.id),columnId:g,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(v.forEach(D=>{D.priority&&(T.has(D.priority)||T.set(D.priority,[]),T.get(D.priority).push(D));}),T.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";k.push({stack:{title:`${x} ${h} Priority`,cardIds:D.map(w=>w.id),columnId:g,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 v){let x=(await r.findSimilar(D,v)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let w=[D.id,...x.map(C=>C.card.id)],M=x.reduce((C,B)=>C+B.similarity,0)/x.length;k.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:g,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:M});}}return k.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(g=>{c(g.stack.title,g.stack.cardIds,g.stack.columnId,g.stack.strategy,g.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let k=await u(v),b=k[0];k.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:i,getStacksForColumn:l,getSuggestions:u,applySuggestion:y,config:o}}var Jd=react.createContext(null);function Zd({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}=to("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=to("@libxai/core");d.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=to("@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(Jd.Provider,{value:{store:o},children:e})}function qo(){let e=react.useContext(Jd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Qr(){let e=qo(),[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,f)=>{e.updateColumn(b,f);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),i=react.useCallback(b=>e.getColumn(b),[e]),l=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,f)=>{e.updateCard(b,f);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),g=react.useCallback((b,f,T)=>{e.moveCard(b,f,T);},[e]),v=react.useCallback(b=>e.getCard(b),[e]),k=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:i,addCard:l,updateCard:u,deleteCard:y,moveCard:g,getCard:v,getCardsByColumn:k}}function ec(e){let{cards:t}=Qr();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}=Qr();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 Xo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=si.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);}},Yf=new Xo;function rc({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}),i=m.getVirtualItems(),l={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:l,className:o,children:jsxRuntime.jsx("div",{style:u,children:i.map(y=>{let g=e[y.index];if(!g)return null;let v=p?p(g,y.index):y.index,k={position:"absolute",top:d?0:y.start,left:d?y.start:0,width:d?y.size:"100%",height:d?"100%":y.size};return jsxRuntime.jsx("div",{style:k,"data-index":y.index,children:r(g,y.index)},v)})})})}function oc(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 sc({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),i=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:d,gap:c}),l=i.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:y,children:l.map(g=>{let v=e[g.index];if(!v)return null;let k=p?p(v,g.index):g.index,b={position:"absolute",top:0,left:g.start,width:g.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":g.index,children:o(v,g.index)},k)})})})}function ic(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 lc(e,t=10){return e>t}var Rs={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Os={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},$s={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},zs={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Us={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ws={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Gs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Hs={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)"},_s={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)"},Vs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},js={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}},Ks={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}},Jo={spacing:Rs,borderRadius:Os,fontSize:$s,fontWeight:zs,lineHeight:Us,zIndex:Ws,duration:Gs,easing:Hs,shadows:_s,opacity:Vs,kanban:js,gantt:Ks};function dc(e,t,a){return e[t]??a}function Ys(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)?Ys(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Jf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function qs(e="asakaa"){let t=Ys(Jo),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=Jf(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 Pa(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 ms(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 l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}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 y=new Date(r),g=y.getDay(),v=u-g;return v<=0&&(v+=7),y.setDate(y.getDate()+v),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let l=parseInt(s[1],10),u=s[2].toLowerCase(),y=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?y.setDate(y.getDate()+l):u==="week"||u==="semana"||u==="semanas"?y.setDate(y.getDate()+l*7):(u==="month"||u==="mes"||u==="meses")&&y.setMonth(y.getMonth()+l),y}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 l=parseInt(c[1],10),u=parseInt(c[2],10)-1,y=parseInt(c[3],10);return new Date(y,u,l)}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 l=parseInt(n[1],10),u=p[n[2].toLowerCase()],y=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,l)}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},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let l=m[i[1].toLowerCase()],u=parseInt(i[2],10),y=i[3]?parseInt(i[3],10):r.getFullYear();if(l!==void 0)return new Date(y,l,u)}return null}function us(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 gs(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 ad(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 rd(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(),i=Pa(t,n),l=ms(m);if(!i)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(!l)return {type:"move_task",taskId:i.id,taskName:i.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=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(l);return y.setDate(y.getDate()+u),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:l,endDate:y},message:`Moved "${i.name}" to ${l.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(),i=Pa(t,n),l=us(m);if(!i)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!l||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(i.endDate);return u.setDate(u.getDate()+l),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:u},message:`Extended "${i.name}" by ${l} 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(),i=Pa(t,n),l=gs(m);return i?l===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:l},message:`Set "${i.name}" progress to ${l}%.`,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(),i=Pa(t,n);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:m},message:`Renamed "${i.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(),i=Pa(t,n),l=Pa(t,m);return i?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:i.id,dependencyTo:l.id,message:`Linked "${i.name}" \u2192 "${l.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=Pa(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 od(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 Kg(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 Yg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ro(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let i=a.find(l=>l.id===m);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Ro(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:Kg(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 nd(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:Yg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function sd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ro(r,e,t))}var fs={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"}},bs={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"}},Oo={en:fs,es:bs};function hs(e){return Oo[e]||Oo.en}function $o(e,t){let a=hs(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 cd(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(...cd(r.subtasks,t+1));return a}function nf({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 pd({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:i=true}=t,l=$o(p,n),u=c==="dark",[y,g]=react.useState(new Set),[v,k]=react.useState("startDate"),[b,f]=react.useState("asc"),[T,D]=react.useState("");react.useMemo(()=>{let C=new Set;function B(z){for(let R of z)R.subtasks?.length&&(C.add(R.id),B(R.subtasks));}B(e),g(C);},[e]);let h=react.useCallback(C=>{g(B=>{let z=new Set(B);return z.has(C)?z.delete(C):z.add(C),z}),a.onTaskToggleExpand?.(C);},[a]),x=react.useCallback(C=>{v===C?f(B=>B==="asc"?"desc":"asc"):(k(C),f("asc")),a.onSortChange?.({column:C,direction:b==="asc"?"desc":"asc"});},[v,b,a]),w=react.useMemo(()=>{let C=cd(e);if(T.trim()){let z=T.toLowerCase();C=C.filter(R=>R.name.toLowerCase().includes(z));}let B=[];for(let z of C){let R=z.level===0;z.level>0&&(R=true),(R||T.trim())&&B.push(z);}return T.trim()&&B.sort((z,R)=>{let $,K;switch(v){case "name":$=z.name.toLowerCase(),K=R.name.toLowerCase();break;case "startDate":$=z.startDate?.getTime()||0,K=R.startDate?.getTime()||0;break;case "endDate":$=z.endDate?.getTime()||0,K=R.endDate?.getTime()||0;break;case "progress":$=z.progress||0,K=R.progress||0;break;case "status":$=z.status||"todo",K=R.status||"todo";break;default:return 0}return $<K?b==="asc"?-1:1:$>K?b==="asc"?1:-1:0}),B},[e,T,v,b]),M=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:S("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:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:S("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:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("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:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:S("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:S("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:T,onChange:C=>D(C.target.value),placeholder:l.toolbar.searchPlaceholder,className:S("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:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",l.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:S("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:()=>x("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("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:w.map((C,B)=>{let z=y.has(C.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:B*.02},className:S("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:i?`${24+C.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(C),onDoubleClick:()=>a.onTaskDoubleClick?.(C),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[i&&C.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),h(C.id);},className:S("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),i&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(nf,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:S("truncate",u?"text-white":"text-gray-900",C.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:C.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:S("px-2 py-1 rounded-full text-xs font-medium",C.progress===100||C.status==="completed"?"bg-green-500/10 text-green-500":C.progress&&C.progress>0||C.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:C.progress===100||C.status==="completed"?l.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxRuntime.jsxs("div",{className:S("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"}),M(C.startDate)]}),jsxRuntime.jsxs("div",{className:S("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"}),M(C.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:S("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[C.progress||0,"%"]})]})})]},C.id)})}),w.length===0&&T&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:S("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:S(u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var vs={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"},ys={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"},xs={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"},Uo={dark:vs,light:ys,neutral:xs};function md(e){return Uo[e]||Uo.dark}var ks={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"}},ws={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"}},Wo={en:ks,es:ws};function jr(e){return Wo[e]||Wo.en}function Go(e,t){let a=jr(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 ud(e){let t=jr(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 gd(e,t=0,a=true){let r=jr(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 yf(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 Cs(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 vd({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 yd({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,i=Go(n,m),l=p==="dark",[u,y]=react.useState(r||new Date),[g,v]=react.useState(null),[k,b]=react.useState(null),[f,T]=react.useState(null),[D,h]=react.useState(new Date),[x,w]=react.useState({}),M=4,C=3,[B,z]=react.useState(false),[R,$]=react.useState(false),[K,le]=react.useState(false),be=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),Ge=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Le=react.useCallback(()=>{y(new Date);},[]),xe=react.useMemo(()=>{let F=u.getFullYear(),oe=u.getMonth(),q=new Date(F,oe,1),Fe=new Date(F,oe+1,0),Re=q.getDay(),tt=Fe.getDate(),Oe=yf(e),dt=new Date;dt.setHours(0,0,0,0);let pe=[],vt=Re,rt=new Date(F,oe,0).getDate();for(let ze=vt-1;ze>=0;ze--){let Pe=new Date(F,oe-1,rt-ze);pe.push({date:Pe,isCurrentMonth:false,isToday:false,isWeekend:Pe.getDay()===0||Pe.getDay()===6,events:Oe.filter(Ue=>Cs(Pe,Ue)).map(Ue=>({id:Ue.id,title:Ue.name,start:Ue.startDate,end:Ue.endDate,task:Ue}))});}for(let ze=1;ze<=tt;ze++){let Pe=new Date(F,oe,ze),Ue=Pe.getTime()===dt.getTime();pe.push({date:Pe,isCurrentMonth:true,isToday:Ue,isWeekend:Pe.getDay()===0||Pe.getDay()===6,events:Oe.filter(ct=>Cs(Pe,ct)).map(ct=>({id:ct.id,title:ct.name,start:ct.startDate,end:ct.endDate,task:ct}))});}let Ot=42-pe.length;for(let ze=1;ze<=Ot;ze++){let Pe=new Date(F,oe+1,ze);pe.push({date:Pe,isCurrentMonth:false,isToday:false,isWeekend:Pe.getDay()===0||Pe.getDay()===6,events:Oe.filter(Ue=>Cs(Pe,Ue)).map(Ue=>({id:Ue.id,title:Ue.name,start:Ue.startDate,end:Ue.endDate,task:Ue}))});}return pe},[u,e]),E=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],I=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),P=react.useCallback(F=>{let oe=F.progress===100?0:100,q=oe===100?"completed":"todo";a.onTaskUpdate?.({...F,status:q,progress:oe});},[a]),_=react.useCallback((F,oe)=>{if(!g)return;let q={...g,[F]:oe};v(q),a.onTaskUpdate?.(q);},[g,a]),Y=react.useCallback(F=>{if(!g)return;let oe=g.progress||0;F==="completed"?oe=100:F==="todo"&&(oe=0);let q={...g,status:F,progress:oe};v(q),a.onTaskUpdate?.(q),z(false);},[g,a]),j=react.useCallback((F,oe)=>{if(!g)return;let q={...g,startDate:F,endDate:oe};v(q),a.onTaskUpdate?.(q);},[g,a]),ye=react.useCallback(()=>{z(false),$(false),T(null);},[]);return o?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"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:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[i.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:i.labels.noEvents}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:i.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",l?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:S("flex-shrink-0 px-6 py-4 border-b",l?"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:S("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:I}),jsxRuntime.jsx("button",{onClick:Le,className:S("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:i.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:be,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ge,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:E.map(F=>jsxRuntime.jsx("div",{className:S("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:F},F))}),jsxRuntime.jsx("div",{className:S("grid grid-cols-7 auto-rows-min gap-px rounded-lg overflow-hidden",l?"bg-white/5":"bg-gray-200"),children:xe.map((F,oe)=>{let q=F.date.getDay()===0||F.date.getDay()===6;return jsxRuntime.jsxs("div",{className:S("min-h-[120px] p-2 transition-colors flex flex-col relative",l?q?"bg-[#1A1D21]":F.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":q?"bg-gray-100":F.isCurrentMonth?"bg-white":"bg-gray-50",F.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Fe=x[oe]||M,Re=F.events.slice(0,Fe),tt=F.events.length-Fe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Re.map(Oe=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{v(Oe.task),a.onEventClick?.(Oe);},whileHover:{scale:1.02},className:S("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Oe.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(vd,{task:Oe.task}),jsxRuntime.jsx("span",{className:"truncate",children:Oe.title})]}),jsxRuntime.jsx("div",{className:S("absolute left-0 bottom-full mb-1 px-2 py-1 rounded text-xs whitespace-nowrap z-50 opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity shadow-lg",l?"bg-[#1A1D25] text-white border border-white/10":"bg-gray-900 text-white"),children:Oe.title})]},Oe.id)),tt>0&&jsxRuntime.jsxs("button",{onClick:Oe=>{Oe.stopPropagation(),w(dt=>({...dt,[oe]:Fe+C}));},className:S("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",tt," ",n==="es"?"M\xC1S":"MORE"]}),Fe>M&&F.events.length>M&&jsxRuntime.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),w(dt=>({...dt,[oe]:M}));},className:S("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsx("div",{className:S("text-sm font-medium mt-1 text-right",F.isToday?"text-[#3B82F6]":F.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:F.date.getDate()})]},oe)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>v(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:S("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:S("px-6 py-4 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:S("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:n==="es"?"Tarea":"Task"}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:g.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>v(null),className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("h2",{className:S("text-xl font-semibold",l?"text-white":"text-gray-900"),children:g.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:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ye(),z(!B);},className:S("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.progress===100||g.status==="completed"?"bg-green-500/20 text-green-400":g.progress&&g.progress>0||g.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:g.progress===100||g.status==="completed"?n==="es"?"COMPLETADO":"DONE":g.progress&&g.progress>0||g.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),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},className:S("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-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(F=>jsxRuntime.jsxs("button",{onClick:()=>Y(F.id),className:S("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(g.status===F.id||F.id==="completed"&&g.progress===100||F.id==="in-progress"&&g.progress&&g.progress>0&&g.progress<100||F.id==="todo"&&(!g.progress||g.progress===0)&&g.status!=="in-progress"&&g.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:S("w-2 h-2 rounded-full",F.id==="completed"?"bg-green-500":F.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:F.label})]},F.id))})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),g.assignees&&g.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[g.assignees.slice(0,3).map((F,oe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},oe)),g.assignees.length>3&&jsxRuntime.jsxs("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",g.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:S("text-sm",l?"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:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{T(f?null:"start"),h(g.startDate||new Date);},className:S("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[g.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:S("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),g.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(g.startDate||g.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:F=>{F.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:S("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:S("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,oe=new Date(F);oe.setDate(F.getDate()+1);let q=new Date(F);q.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let Fe=new Date(F);Fe.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let Re=new Date(F);Re.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let tt=new Date(F);tt.setDate(F.getDate()+14);let Oe=new Date(F);return Oe.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:oe,display:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:q,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Fe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Re,display:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Oe,display:Oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((pe,vt)=>jsxRuntime.jsxs("button",{className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(f==="start"){let rt=g.endDate&&pe.date>g.endDate?pe.date:g.endDate;j(pe.date,rt),T("end");}else {let rt=g.startDate&&pe.date<g.startDate?pe.date:g.startDate;j(rt,pe.date),T(null);}},children:[jsxRuntime.jsx("span",{children:pe.label}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:pe.display})]},vt))})(),jsxRuntime.jsx("div",{className:S("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{j(void 0,void 0),T(null);},className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:S("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f==="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:S("font-medium",l?"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:S("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:S("p-1 rounded",l?"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:S("p-1 rounded",l?"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(F=>jsxRuntime.jsx("div",{className:S("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=D.getFullYear(),oe=D.getMonth(),q=new Date(F,oe,1).getDay(),Fe=new Date(F,oe+1,0).getDate(),Re=new Date(F,oe,0).getDate(),tt=new Date,Oe=[];for(let pe=q-1;pe>=0;pe--)Oe.push({day:Re-pe,isCurrentMonth:false,date:new Date(F,oe-1,Re-pe)});for(let pe=1;pe<=Fe;pe++)Oe.push({day:pe,isCurrentMonth:true,date:new Date(F,oe,pe)});let dt=42-Oe.length;for(let pe=1;pe<=dt;pe++)Oe.push({day:pe,isCurrentMonth:false,date:new Date(F,oe+1,pe)});return Oe.map((pe,vt)=>{let rt=pe.date.toDateString()===tt.toDateString(),Ot=g.startDate?.toDateString()===pe.date.toDateString(),ze=g.endDate?.toDateString()===pe.date.toDateString(),Pe=Ot||ze,Ue=g.startDate&&g.endDate&&pe.date>=g.startDate&&pe.date<=g.endDate;return jsxRuntime.jsx("button",{className:S("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!pe.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),pe.isCurrentMonth&&(l?"text-white":"text-gray-900"),rt&&"ring-2 ring-[#3B82F6]",Ot&&"bg-[#3B82F6] text-white",ze&&!Ot&&"bg-[#7C3AED] text-white",Ue&&!Pe&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!Pe&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ct=new Date(pe.date);if(f==="start"){let de=g.endDate&&ct>g.endDate?ct:g.endDate;j(ct,de),T("end");}else {let de=g.startDate&&ct<g.startDate?ct:g.startDate;j(de,ct),T(null);}},children:pe.day},vt)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ye(),$(!R);},className:S("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.priority==="high"||g.priority==="urgent"?"bg-red-500/20 text-red-400":g.priority==="medium"?"bg-yellow-500/20 text-yellow-400":g.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g.priority?g.priority==="high"||g.priority==="urgent"?n==="es"?"Urgente":"Urgent":g.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:S("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{_("priority",F.id),$(false);},className:S("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",g.priority===F.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:S("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-white":"text-gray-900"),children:g.startDate&&g.endDate?`${Math.ceil((g.endDate.getTime()-g.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:S("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[K?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:g.progress||0,onChange:F=>{let oe=parseInt(F.target.value),q=g.status;oe===100?q="completed":oe>0?q="in-progress":q="todo";let Fe={...g,progress:oe,status:q};v(Fe),a.onTaskUpdate?.(Fe);},onBlur:()=>le(false),className:S("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>le(true),className:S("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",g.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${g.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[g.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"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:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:g.dependencies&&g.dependencies.length>0?`${g.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:S("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("div",{className:S("min-h-[60px] p-3 rounded-lg text-sm",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-50 text-gray-600"),children:g.description||(n==="es"?"Sin descripci\xF3n":"No description")})]}),g.subtasks&&g.subtasks.length>0&&jsxRuntime.jsxs("div",{className:S("mt-4 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Subtareas":"Subtasks"," (",g.subtasks.length,")"]})]}),jsxRuntime.jsx("div",{className:"space-y-2",children:g.subtasks.slice(0,5).map(F=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded border flex items-center justify-center",F.progress===100?"bg-green-500 border-green-500":l?"border-white/20":"border-gray-300"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:S("text-sm",F.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:F.name})]},F.id))})]})]}),jsxRuntime.jsx("div",{className:S("px-6 py-4 border-t flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("button",{onClick:()=>{P(g),v(null);},className:S("px-4 py-2 rounded-lg font-medium transition-colors",g.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:g.progress===100?n==="es"?"Reabrir tarea":"Reopen task":n==="es"?"Completar tarea":"Complete task"})})]}),jsxRuntime.jsxs("div",{className:S("w-[280px] border-l flex flex-col",l?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:S("font-medium",l?"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:S("text-sm text-center py-8",l?"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:S("p-3 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:S("flex items-center gap-2 px-3 py-2 rounded-lg",l?"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:S("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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:S("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:k.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:S("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:k.events.map(F=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),v(F.task);},className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(vd,{task:F.task}),jsxRuntime.jsx("span",{className:S("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:F.title}),F.task.priority==="high"||F.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},F.id))})]})]})})]})}var Ds={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"},Ns={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"},Ss={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"},Vo={dark:Ds,light:Ns,neutral:Ss};function xd(e){return Vo[e]||Vo.dark}function kf({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]),i=react.useMemo(()=>{let u=m.length,y=new Set(m.flatMap(k=>k.assignedUserIds||[])).size,g=m.map(k=>k.priority).filter(Boolean),v=new Set(m.flatMap(k=>k.labels||[])).size;return {totalCards:u,uniqueAssignees:y,priorities:g,labels:v}},[m]),l=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:S("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:l,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:S("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:i.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:[i.uniqueAssignees," assignees"]})]}),i.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:[i.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:y=>{y.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 Yr(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 qr(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 Cd(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 Td({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),i=react.useRef(null),l=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(f=>{let T=f.timestamp.toISOString().split("T")[0],D=b.get(T);D?D.push(f):b.set(T,[f]);}),Array.from(b.entries()).sort((f,T)=>T[0].localeCompare(f[0])).map(([f,T])=>({date:new Date(f),events:T.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,f=new Set;return e.forEach(T=>{b.add(T.userId),f.add(T.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(f)}},[e]),g=b=>{m(f=>{let T=new Set(f);return T.has(b)?T.delete(b):T.add(b),T});},v=b=>{let T=new Date().getTime()-b.getTime(),D=Math.floor(T/6e4),h=Math.floor(T/36e5),x=Math.floor(T/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:x<7?`${x}d ago`:b.toLocaleDateString()},k=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&&i.current){let b=i.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:S("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:S("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 f=b.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[qr(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let f=b.target.value;a({...t,users:f?[f]: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})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:i,children:l.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((f,T)=>{let D=n.has(f.id),h=s===f.id,x=Cd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:S("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:x},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:qr(f.type)})}),T<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:x}})]}),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&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Yr(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?v(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),g(f.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([w,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(M.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(M.to)})]})]},w)),f.metadata&&Object.keys(f.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(f.metadata).map(([w,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(M)})]},w))]})]})]})]},f.id)})})]},b.date?.toISOString()||"all"))})]})}function Nd({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],i=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:S("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:S("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:i&&qr(i.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:i&&Yr(i)}),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:i&&i.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:`${l}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,y)=>jsxRuntime.jsx("div",{className:S("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>c(y),title:Yr(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:S("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:i&&i.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:S("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 Es(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 Ps(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 Sd(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 Ed(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Sf(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 i=a/2,l=r/2;m.vx+=(i-m.x)*o.centerForce*n,m.vy+=(l-m.y)*o.centerForce*n,d.forEach(u=>{if(m.id===u.id)return;let y=m.x-u.x,g=m.y-u.y,v=Math.sqrt(y*y+g*g)||1,k=o.chargeStrength*n/(v*v);m.vx+=y/v*k,m.vy+=g/v*k;});}),t.forEach(m=>{let i=c.get(typeof m.source=="string"?m.source:m.source.id),l=c.get(typeof m.target=="string"?m.target:m.target.id);if(!i||!l)return;let u=l.x-i.x,y=l.y-i.y,g=Math.sqrt(u*u+y*y)||1,v=(g-o.linkDistance)/g*o.forceStrength*n;i.vx+=u*v,i.vy+=y*v,l.vx-=u*v,l.vy-=y*v;}),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 Pd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:p}){let n=react.useRef(null),[m,i]=react.useState([]),[l,u]=react.useState(null),[y,g]=react.useState(null),[v,k]=react.useState(null),[b,f]=react.useState(1),[T,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=Sf(e,t,a.width,a.height,a,150);i(R);},[e,t,a]);let h=react.useCallback((R,$)=>{a.enableDragging&&($.stopPropagation(),u(R));},[a.enableDragging]),x=react.useCallback(R=>{if(!l||!n.current)return;let K=n.current.getBoundingClientRect(),le=(R.clientX-K.left-T.x)/b,be=(R.clientY-K.top-T.y)/b;i(Ge=>Ge.map(Le=>Le.id===l?{...Le,x:le,y:be,fx:le,fy:be}:Le));},[l,b,T]),w=react.useCallback(()=>{u(null);},[]),M=react.useCallback((R,$)=>{$.stopPropagation(),c?.({type:"node-click",node:R,position:{x:$.clientX,y:$.clientY}});},[c]),C=react.useCallback((R,$)=>{$.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:$.clientX,y:$.clientY}});},[c]),B=react.useCallback(R=>{let $=m.find(K=>K.id===R);return $?{x:$.x,y:$.y}:{x:0,y:0}},[m]),z=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=R.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:S("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:S("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:()=>f(R=>Math.min(R+.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:()=>f(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Es(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sd(R)," ",Ps(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:x,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let $=B(typeof R.source=="string"?R.source:R.source.id),K=B(typeof R.target=="string"?R.target:R.target.id),le=Ed(R.type),be=v===R.id,Ge=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-edge",be&&"hovered",Ge&&"critical"),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:Le=>C(R,Le),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:K.x,y2:K.y,stroke:Es(R.type),strokeWidth:Ge?a.edgeWidth*2:a.edgeWidth,strokeOpacity:be?1:.6,markerEnd:le?"url(#arrowhead)":void 0}),a.showEdgeLabels&&be&&jsxRuntime.jsx("text",{x:($.x+K.x)/2,y:($.y+K.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ps(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(R=>{let $=y===R.id,K=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-node",$&&"hovered",K&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:le=>h(R.id,le),onMouseEnter:()=>g(R.id),onMouseLeave:()=>g(null),onClick:le=>M(R,le),children:[jsxRuntime.jsx("circle",{r:K?a.nodeSize*1.2:a.nodeSize,fill:z(R),stroke:K?"#fbbf24":"#ffffff",strokeWidth:K?3:2,opacity:$?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Ad({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),[i,l]=react.useState(null),u=react.useRef(null),y=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=f=>{f.key==="Escape"&&!y&&g();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let g=()=>{y||(d(""),m(null),l(null),t());},v=async()=>{if(!(!s.trim()||y)){p(true),m(null),l(null);try{let b=await r(s.trim());l(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{p(false);}}},k=()=>{i&&(a(i),g());};return e?jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:g}),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:g,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:i?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!"})]}),i.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:i.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:i.columns.map((b,f)=>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},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",i.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.cards.slice(0,10).map((b,f)=>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})]})},f)),i.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.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:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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,f)=>jsxRuntime.jsx("button",{onClick:()=>d(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:g,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),i?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ms={"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 Pf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mf={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 If(e,t,a){let r=Ms[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Xr(e){return `$${e.toFixed(4)}`}var Is=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=If(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(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,l)=>i+l.cost,0),s=a.reduce((i,l)=>i+l.inputTokens,0),d=a.reduce((i,l)=>i+l.outputTokens,0),c=a.filter(i=>i.success),p=a.reduce((i,l)=>i+l.duration,0),n={},m={};return a.forEach(i=>{n[i.feature]=(n[i.feature]||0)+1,m[i.feature]=(m[i.feature]||0)+i.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)}},ar=new Is;function Bd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(ar.getStats()),[s,d]=react.useState(ar.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(ar.getStats()),d(ar.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=ar.getRecentOperations(5);return jsxRuntime.jsxs(Ke,{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:Xr(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,i=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:Xr(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:`${i}%`}})})]},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:Xr(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 $d({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[p,n]=react.useState(""),[m,i]=react.useState(""),[l,u]=react.useState(false),[y,g]=react.useState(null),[v,k]=react.useState(null),[b,f]=react.useState(null),T=react.useRef(null),D=l||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let C=B=>{B.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,D]);let h=()=>{D||(c(""),n(""),i(""),g(null),k(null),f(null),t());},x=async()=>{if(!(!d.trim()||D)){u(true),g(null),k(null),f(null);try{let C=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});k(C.tasks.tasks),f({from_cache:C.from_cache,tokens_used:C.tokens_used,mock_mode:C.mock_mode,similarity:C.similarity,tokens_saved:C.tokens_saved});}catch(C){g(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{v&&(a(v),h());};if(!e)return null;let M=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ke,{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:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[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 (",M,"% 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:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((C,B)=>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:["#",B+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:C.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"})]}),C.start," \u2192 ",C.end]}),jsxRuntime.jsxs("span",{children:[C.duration," days"]}),C.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",C.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${C.priority==="high"?"bg-red-500/20 text-red-400":C.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:C.priority})]})},C.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:T,value:d,onChange:C=>c(C.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:C=>n(C.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:C=>i(C.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})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((C,B)=>jsxRuntime.jsx("button",{onClick:()=>c(C),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:C},B))})]})]})}),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"}),v?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:x,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 Yo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&oo(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,b,f)=>{console.warn(`Retry attempt ${b} after ${f}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),s=react.useCallback(async(v,k,b)=>{r(f=>{let T=f.cards.find(C=>C.id===v);if(!T)return f;let D=T.columnId,h={...T,columnId:k,position:b},x=f.cards.map(C=>C.id===v?h:C),w=f.columns.map(C=>{if(C.id===D)return {...C,cardIds:C.cardIds.filter(B=>B!==v)};if(C.id===k){let B=x.filter(z=>z.columnId===k).sort((z,R)=>z.position-R.position);return {...C,cardIds:B.map(z=>z.id)}}return C}),M={...f,cards:x,columns:w};return o(M),M});},[o]),d=react.useCallback(async(v,k)=>{r(b=>{let f=b.cards.map(D=>D.id===v?{...D,...k}:D),T={...b,cards:f};return o(T),T});},[o]),c=react.useCallback(async v=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let f={...v,id:k},T=b.columns.map(h=>h.id===v.columnId?{...h,cardIds:[...h.cardIds,k]}:h),D={...b,cards:[...b.cards,f],columns:T};return o(D),D});},[o]),p=react.useCallback(async v=>{r(k=>{let b=k.cards.find(h=>h.id===v);if(!b)return k;let f=k.cards.filter(h=>h.id!==v),T=k.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(x=>x!==v)}:h),D={...k,cards:f,columns:T};return o(D),D});},[o]),n=react.useCallback(async v=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let f={...v,id:k,cardIds:[]},T={...b,columns:[...b.columns,f]};return o(T),T});},[o]),m=react.useCallback(async(v,k)=>{r(b=>{let f=b.columns.map(D=>D.id===v?{...D,...k}:D),T={...b,columns:f};return o(T),T});},[o]),i=react.useCallback(async v=>{r(k=>{let b=k.cards.filter(D=>D.columnId!==v),f=k.columns.filter(D=>D.id!==v),T={...k,cards:b,columns:f};return o(T),T});},[o]),l=react.useCallback(v=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(v),k},[c]),u=react.useCallback(v=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(v),k},[n]),y=react.useCallback(()=>{r(v=>{let k={...v,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:i},setBoard:r,helpers:{addCard:l,addColumn:u,deleteCard:p,deleteColumn:i,clearBoard:y}}}function Ud({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Yo({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(i=>i.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(i=>i.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 Jr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Gd={by:"none",order:"asc"};function Hd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Jr,...e}),[s,d]=react.useState({...Gd,...t}),c=react.useCallback(g=>{o(v=>({...v,...g}));},[]),p=react.useCallback(g=>{d(v=>({...v,...g}));},[]),n=react.useCallback(()=>{o(Jr),d(Gd);},[]),m=react.useCallback(()=>{a&&o({...Jr,assignees:[a]});},[a]),i=react.useCallback(()=>{o({...Jr,dateFilter:"overdue"});},[]),l=react.useCallback(()=>{o({...Jr,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]),y=react.useCallback(g=>{let v=[...g];if(r.search){let k=r.search.toLowerCase();v=v.filter(b=>b.title.toLowerCase().includes(k)||b.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,b=k.getFullYear(),f=String(k.getMonth()+1).padStart(2,"0"),T=String(k.getDate()).padStart(2,"0"),D=`${b}-${f}-${T}`;v=v.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let x=h.endDate||h.dueDate;if(!x)return false;let w;if(typeof x=="string")w=x.split("T")[0]||x;else {let M=x.getUTCFullYear(),C=String(x.getUTCMonth()+1).padStart(2,"0"),B=String(x.getUTCDate()).padStart(2,"0");w=`${M}-${C}-${B}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let M=new Date(D+"T00:00:00"),C=new Date(w+"T00:00:00"),B=new Date(M);return B.setDate(B.getDate()+7),C>=M&&C<=B;case "custom":if(r.dateRange){let z=typeof x=="string"?new Date(x):x;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(v=v.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(v=v.filter(k=>k.labels&&k.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(v=v.filter(k=>r.columns.includes(k.columnId))),s.by!=="none"&&v.sort((k,b)=>{let f=0;switch(s.by){case "created":let T=k.createdAt?new Date(k.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;f=T-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=h[k.priority||"LOW"],w=h[b.priority||"LOW"];f=x-w;break;case "dueDate":let M=k.endDate||k.dueDate,C=b.endDate||b.dueDate;if(!M)return 1;if(!C)return -1;let B=typeof M=="string"?new Date(M).getTime():M.getTime(),z=typeof C=="string"?new Date(C).getTime():C.getTime();f=B-z;break;case "title":f=k.title.localeCompare(b.title);break;case "estimate":let R=k.estimatedTime||0,$=b.estimatedTime||0;f=R-$;break;default:f=0;}return s.order==="asc"?f:-f}),v},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:i,filterHighPriority:l,applyFilters:y,hasActiveFilters:u}}var Vd,jd;if(typeof window<"u")try{let e=to("ai");Vd=e.generateObject,jd=e.generateText;}catch{}function Kd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vd&&jd&&e.apiKey),d=react.useCallback(async i=>{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:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(l){let u=l instanceof Error?l:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(l){let u=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async i=>{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(l){let u=l instanceof Error?l:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(l){let u=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(l){let u=l instanceof Error?l: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 Ls(){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 Yd(e){let{cards:t}=e,[a,r]=Ls(),o=react.useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),s=react.useCallback((i,l)=>{if(!l){r({selectedCardIds:[i],lastSelectedCardId:i});return}let u=l.ctrlKey||l.metaKey,y=l.shiftKey;if(u)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(g=>g!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(y&&a.lastSelectedCardId){let g=t.find(k=>k.id===i),v=t.find(k=>k.id===a.lastSelectedCardId);if(g&&v&&g.columnId===v.columnId){let k=t.filter(w=>w.columnId===g.columnId).sort((w,M)=>w.position-M.position),b=k.findIndex(w=>w.id===a.lastSelectedCardId),f=k.findIndex(w=>w.id===i),[T,D]=b<f?[b,f]:[f,b],h=k.slice(T,D+1).map(w=>w.id),x=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:x,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),d=react.useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(i=>{a.selectedCardIds.includes(i)?d(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,d,r]),m=react.useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.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 qd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qd,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((g,v,k,b,f)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:g,cardIds:v,columnId:k,strategy:b,color:f,isExpanded:true,position:s.filter(D=>D.columnId===k).length,createdAt:new Date};d(D=>[...D,T]);},[o.minCardsPerStack,s]),p=react.useCallback(g=>{d(v=>v.filter(k=>k.id!==g));},[]),n=react.useCallback(g=>{d(v=>v.map(k=>k.id===g?{...k,isExpanded:!k.isExpanded}:k));},[]),m=react.useCallback((g,v)=>{d(k=>k.map(b=>b.id===g&&!b.cardIds.includes(v)?{...b,cardIds:[...b.cardIds,v]}:b));},[]),i=react.useCallback((g,v)=>{d(k=>k.map(b=>{if(b.id===g){let f=b.cardIds.filter(T=>T!==v);return f.length<o.minCardsPerStack?null:{...b,cardIds:f}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),l=react.useCallback(g=>s.filter(v=>v.columnId===g).sort((v,k)=>v.position-k.position),[s]),u=react.useCallback(async g=>{let v=t.filter(D=>D.columnId===g);if(v.length<o.minCardsPerStack*2)return [];let k=[],b=new Map;v.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&&k.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(x=>x.id),columnId:g,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let f=new Map;v.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{f.has(h)||f.set(h,[]),f.get(h).push(D);});}),f.forEach((D,h)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(x=>x.id),columnId:g,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(v.forEach(D=>{D.priority&&(T.has(D.priority)||T.set(D.priority,[]),T.get(D.priority).push(D));}),T.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";k.push({stack:{title:`${x} ${h} Priority`,cardIds:D.map(w=>w.id),columnId:g,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 v){let x=(await r.findSimilar(D,v)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let w=[D.id,...x.map(C=>C.card.id)],M=x.reduce((C,B)=>C+B.similarity,0)/x.length;k.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:g,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:M});}}return k.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(g=>{c(g.stack.title,g.stack.cardIds,g.stack.columnId,g.stack.strategy,g.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let k=await u(v),b=k[0];k.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:i,getStacksForColumn:l,getSuggestions:u,applySuggestion:y,config:o}}var Jd=react.createContext(null);function Zd({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}=to("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=to("@libxai/core");d.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=to("@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(Jd.Provider,{value:{store:o},children:e})}function qo(){let e=react.useContext(Jd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Qr(){let e=qo(),[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,f)=>{e.updateColumn(b,f);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),i=react.useCallback(b=>e.getColumn(b),[e]),l=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,f)=>{e.updateCard(b,f);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),g=react.useCallback((b,f,T)=>{e.moveCard(b,f,T);},[e]),v=react.useCallback(b=>e.getCard(b),[e]),k=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:i,addCard:l,updateCard:u,deleteCard:y,moveCard:g,getCard:v,getCardsByColumn:k}}function ec(e){let{cards:t}=Qr();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}=Qr();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 Xo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ii.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);}},Yf=new Xo;function rc({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}),i=m.getVirtualItems(),l={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:l,className:o,children:jsxRuntime.jsx("div",{style:u,children:i.map(y=>{let g=e[y.index];if(!g)return null;let v=p?p(g,y.index):y.index,k={position:"absolute",top:d?0:y.start,left:d?y.start:0,width:d?y.size:"100%",height:d?"100%":y.size};return jsxRuntime.jsx("div",{style:k,"data-index":y.index,children:r(g,y.index)},v)})})})}function oc(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 sc({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),i=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:d,gap:c}),l=i.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:y,children:l.map(g=>{let v=e[g.index];if(!v)return null;let k=p?p(v,g.index):g.index,b={position:"absolute",top:0,left:g.start,width:g.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":g.index,children:o(v,g.index)},k)})})})}function ic(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 lc(e,t=10){return e>t}var Os={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$s={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},zs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Us={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ws={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Gs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Hs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},_s={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)"},Vs={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)"},js={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ks={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}},Ys={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}},Jo={spacing:Os,borderRadius:$s,fontSize:zs,fontWeight:Us,lineHeight:Ws,zIndex:Gs,duration:Hs,easing:_s,shadows:Vs,opacity:js,kanban:Ks,gantt:Ys};function dc(e,t,a){return e[t]??a}function qs(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)?qs(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Jf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Xs(e="asakaa"){let t=qs(Jo),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=Jf(o);a.push(` ${s}: ${d};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function eo(e,t="asakaa"){let a=[],r=
|
|
326
|
+
}`}function eo(e,t="asakaa"){let a=[],r=qs(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 Zo={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"}},
|
|
329
|
+
}`}var Zo={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"}},Js={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"}},Zs={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 Qs(e=Zo,t="asakaa"){let a=Xs(t),r=eo(e,t);return `${a}
|
|
330
330
|
|
|
331
331
|
${r}`}function cc(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|
|
@@ -334,21 +334,21 @@ ${r}`}function cc(){return `/**
|
|
|
334
334
|
* Do not edit this file directly
|
|
335
335
|
*/
|
|
336
336
|
|
|
337
|
-
${
|
|
337
|
+
${Qs(Zo)}
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${eo(
|
|
341
|
+
${eo(Js,"asakaa").split(`
|
|
342
342
|
`).slice(1,-1).join(`
|
|
343
343
|
`)}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/* Neutral theme */
|
|
347
347
|
[data-theme="neutral"] {
|
|
348
|
-
${eo(
|
|
348
|
+
${eo(Zs,"asakaa").split(`
|
|
349
349
|
`).slice(1,-1).join(`
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
352
|
`}var Zf=({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 pc({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(Zf,{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=Bd;exports.AI_FEATURES=Mf;exports.AI_MODELS=
|
|
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=Bd;exports.AI_FEATURES=Mf;exports.AI_MODELS=Ms;exports.AddCardButton=vn;exports.AddColumnButton=hn;exports.AttachmentUploader=Or;exports.BoardProvider=Zd;exports.BulkOperationsToolbar=fo;exports.BurnDownChart=Pn;exports.CalendarBoard=yd;exports.Card=Da;exports.CardDetailModal=Cn;exports.CardDetailModalV2=Nn;exports.CardHistoryReplay=Nd;exports.CardHistoryTimeline=Td;exports.CardRelationshipsGraph=Pd;exports.CardStack=kf;exports.CardTemplateSelector=Rn;exports.CircuitBreaker=an;exports.Column=pr;exports.ColumnManager=ko;exports.CommandPalette=kn;exports.ConfigMenu=Un;exports.ContextMenu=yr;exports.DEFAULT_SHORTCUTS=zr;exports.DEFAULT_TEMPLATES=Bn;exports.DateRangePicker=Er;exports.DependenciesSelector=Mr;exports.DependencyLine=Eo;exports.DistributionCharts=Mn;exports.EditableColumnTitle=pn;exports.ErrorBoundary=mr;exports.ExportImportModal=$n;exports.FilterBar=zn;exports.GANTT_AI_SYSTEM_PROMPT=Ql;exports.GanttAIAssistant=Fo;exports.GanttBoard=Zl;exports.GanttI18nContext=vr;exports.GanttMilestone=Mo;exports.GanttToolbar=xo;exports.GenerateGanttTasksDialog=$d;exports.GeneratePlanModal=Ad;exports.GroupBySelector=Ln;exports.KanbanBoard=Fa;exports.KanbanToolbar=fn;exports.KanbanViewAdapter=Br;exports.KeyboardShortcutsHelp=Fn;exports.ListView=pd;exports.MenuIcons=it;exports.PluginManager=Xo;exports.PrioritySelector=ja;exports.RATE_LIMITS=Pf;exports.SwimlaneBoardView=In;exports.TaskBar=Do;exports.TaskFormModal=Lo;exports.TaskGrid=To;exports.ThemeModal=_n;exports.ThemeProvider=pl;exports.ThemeSwitcher=pc;exports.Timeline=Ao;exports.UserAssignmentSelector=Ya;exports.VelocityChart=En;exports.VirtualGrid=sc;exports.VirtualList=rc;exports.aiUsageTracker=ar;exports.borderRadius=$s;exports.calculatePosition=ro;exports.calendarDarkTheme=Ds;exports.calendarEnTranslations=ks;exports.calendarEsTranslations=ws;exports.calendarLightTheme=Ns;exports.calendarNeutralTheme=Ss;exports.calendarThemes=Vo;exports.calendarTranslations=Wo;exports.cardToGanttTask=Ro;exports.cardsToGanttTasks=sd;exports.cn=S;exports.createKanbanView=ji;exports.createRetryWrapper=Oc;exports.darkTheme=Wn;exports.darkTokenTheme=Zo;exports.defaultTheme=ho;exports.designTokens=Jo;exports.duration=Hs;exports.easing=_s;exports.exportTokensToCSS=cc;exports.findTaskByName=Pa;exports.fontSize=zs;exports.fontWeight=Us;exports.formatCost=Xr;exports.ganttEnTranslations=yo;exports.ganttEsTranslations=ul;exports.ganttTaskToCardUpdate=nd;exports.ganttThemes=Be;exports.ganttTokens=Ys;exports.ganttTranslations=Vn;exports.ganttUtils=X;exports.generateCSSVariables=Xs;exports.generateCompleteCSS=Qs;exports.generateInitialPositions=Lc;exports.generateTasksContext=ed;exports.generateThemeVariables=eo;exports.getCalendarTheme=xd;exports.getCalendarTranslations=jr;exports.getListViewTheme=md;exports.getListViewTranslations=hs;exports.getMonthNames=ud;exports.getToken=dc;exports.getTranslations=gl;exports.getWeekdayNames=gd;exports.kanbanTokens=Ks;exports.lightTheme=Gn;exports.lightTokenTheme=Js;exports.lineHeight=Ws;exports.listViewDarkTheme=vs;exports.listViewEnTranslations=fs;exports.listViewEsTranslations=bs;exports.listViewLightTheme=ys;exports.listViewNeutralTheme=xs;exports.listViewThemes=Uo;exports.listViewTranslations=Oo;exports.mergeCalendarTranslations=Go;exports.mergeListViewTranslations=$o;exports.mergeTranslations=jn;exports.neutralTheme=Hn;exports.neutralTokenTheme=Zs;exports.opacity=js;exports.parseLocalCommand=rd;exports.parseNaturalDate=ms;exports.parseNaturalDuration=us;exports.parseProgress=gs;exports.parseStatus=ad;exports.pluginManager=Yf;exports.retrySyncOperation=Rc;exports.retryWithBackoff=oo;exports.shadows=Vs;exports.shouldVirtualizeGrid=lc;exports.spacing=Os;exports.themes=Za;exports.useAI=Kd;exports.useBoard=Ud;exports.useBoardCore=Qr;exports.useBoardStore=qo;exports.useCardStacking=Xd;exports.useDragState=un;exports.useFilteredCards=ec;exports.useFilters=Hd;exports.useGanttI18n=Ur;exports.useKanbanState=Yo;exports.useKeyboardShortcuts=ll;exports.useMultiSelect=Yd;exports.useSelectionState=Ls;exports.useSortedCards=tc;exports.useTheme=br;exports.useVirtualGrid=ic;exports.useVirtualList=oc;exports.validateAIResponse=od;exports.withErrorBoundary=yn;exports.wouldCreateCircularDependency=so;exports.zIndex=Gs;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|