@libxai/board 0.17.81 → 0.17.83
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 +50 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +50 -50
- package/dist/index.js.map +1 -1
- package/dist/styles.css +140 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=si(t[0]),r=[],o=new Map,n=[];for(let l=1;l<t.length;l++)try{let d=si(t[l]||"");if(d.length>a.length){n.push(`Line ${l+1}: Too many columns`);continue}if(a.length-d.length>3){n.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((u,y)=>{i[u]=d[y]||"";});let m=i.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let s=o.get(m),p={id:i["Card ID"]||`card-${l}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:s.id,position:s.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),s.cardIds.push(p.id);}catch(d){n.push(`Line ${l+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function si(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],l=e[o+1];n==='"'&&r&&l==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function ii(e,t){switch(t){case "json":return Bc(e);case "csv":return Rc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function li(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 en=react.createContext(null);function di(){return react.useContext(en)}var ci=react.createContext(null);function pi({children:e,themeName:t}){return jsxRuntime.jsx(ci.Provider,{value:{themeName:t},children:e})}function nr(){return react.useContext(ci)}function $e({children:e,container:t}){let[a,r]=react.useState(false),o=di(),n=nr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:d,themeName:c}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),l)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var bi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},_c="#BDC3C7",Vc=({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 Ha({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState({top:0,left:0}),d=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let u=c.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,h=160,w=220,f=4,g=u.right-h;g<10&&(g=u.left),g+h>k-10&&(g=k-h-10);let T=y-u.bottom,D=u.top,b;T>=w+f?b=u.bottom+f:D>=w+f?b=u.top-w-f:b=T>=D?u.bottom+f:Math.max(10,u.top-w-f),l({top:b,left:g}),o(true);};react.useEffect(()=>{let u=y=>{d.current&&!d.current.contains(y.target)&&!c.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);},s=e?bi[e]:null,p=s?.color||_c;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:s?.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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx($e,{children:jsxRuntime.jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(bi).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: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(Vc,{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 jc=[{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 Dr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[l,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=(nr()?.themeName||"dark")==="dark",u=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),T=window.innerHeight,D=window.innerWidth,b=320,x=380,v=4,P=g.left;P+b>D-10&&(P=D-b-10),P<10&&(P=10);let C=T-g.bottom,L=g.top,$;C>=x+v?$=g.bottom+v:L>=x+v?$=g.top-x-v:$=C>=L?g.bottom+v:Math.max(10,g.top-x-v),d({top:$,left:P}),n(true);};react.useEffect(()=>{let g=T=>{c.current&&!c.current.contains(T.target)&&!i.current?.contains(T.target)&&n(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=T=>{T.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let y=g=>{let T=new Date,D=P=>{let C=P.getFullYear(),L=String(P.getMonth()+1).padStart(2,"0"),$=String(P.getDate()).padStart(2,"0");return `${C}-${L}-${$}`},b=D(T),x=new Date(T);x.setDate(x.getDate()+g);let v=D(x);a(b,v),n(false);},k=()=>{if(!e||!t)return "Set date";let g=x=>{if(x instanceof Date)return x;if(typeof x!="string"||!x.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=x.split("-").map(Number);if(v.length!==3||v.some($=>isNaN($)))return null;let P=v[0],C=v[1],L=v[2];return P===void 0||C===void 0||L===void 0?null:new Date(P,C-1,L)},T=g(e),D=g(t);if(!T||!D||isNaN(T.getTime())||isNaN(D.getTime()))return "Set date";let b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${b[T.getMonth()]} ${T.getDate()} \u2013 ${b[D.getMonth()]} ${D.getDate()}`},h=e&&t,f=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),g<T})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?n(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${f?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${k()}`:"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:k()})]}),o&&jsxRuntime.jsx($e,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:jc.map(g=>jsxRuntime.jsx("button",{onClick:()=>y(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Va({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,l]=react.useState(false),[d,c]=react.useState(""),[i,m]=react.useState({top:0,left:0}),s=react.useRef(null),p=react.useRef(null),u=()=>{if(!p.current)return;let f=p.current.getBoundingClientRect(),g=window.innerHeight,T=window.innerWidth,D=300,b=380,x=4,v=f.right-D;v<10&&(v=f.left),v+D>T-10&&(v=T-D-10);let P=g-f.bottom,C=f.top,L;P>=b+x?L=f.bottom+x:C>=b+x?L=f.top-b-x:L=P>=C?f.bottom+x:Math.max(10,f.top-b-x),m({top:L,left:v}),l(true);};react.useEffect(()=>{let f=g=>{s.current&&!s.current.contains(g.target)&&!p.current?.contains(g.target)&&(l(false),c(""));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=g=>{g.key==="Escape"&&(l(false),c(""));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n]);let y=f=>{let g=e.some(T=>T.id===f.id);a(g?e.filter(T=>T.id!==f.id):[...e,f]);},k=t.filter(f=>f.name.toLowerCase().includes(d.toLowerCase())),h=e.slice(0,o),w=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>n?l(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:[h.map(f=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:f.name,children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"asakaa-avatar-img"}):f.initials},f.id)),w>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",w]})]}):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"})]})})}),n&&jsxRuntime.jsx($e,{children:jsxRuntime.jsxs("div",{ref:s,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:f=>c(f.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:k.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"}):k.map(f=>{let g=e.some(T=>T.id===f.id);return jsxRuntime.jsxs("button",{onClick:()=>y(f),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:f.color,color:"#fff"},children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"w-full h-full rounded-full object-cover"}):f.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:f.name}),g&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},f.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(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 ao(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(m=>{if(typeof m=="string")return m;let s=m;return s.taskId||s.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,l=new Set,d=c=>{if(!n.has(c)){n.add(c),l.add(c);let i=r.get(c)||[];for(let m of i){if(!n.has(m)&&d(m))return true;if(l.has(m))return true}}return l.delete(c),false};return d(a)}function Sr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:l}){let[d,c]=react.useState(false),[i,m]=react.useState(""),[s,p]=react.useState(t.length>0),[u,y]=react.useState({top:0,left:0}),[k,h]=react.useState(null),w=react.useRef(null),f=react.useRef(null),g=()=>{if(!f.current)return;let v=f.current.getBoundingClientRect(),P=window.innerHeight,C=window.innerWidth,L=300,$=s?380:120,F=4,O=v.right-L;O<10&&(O=v.left),O+L>C-10&&(O=C-L-10);let _=P-v.bottom,ae=v.top,pe;_>=$+F?pe=v.bottom+F:ae>=$+F?pe=v.top-$-F:pe=_>=ae?v.bottom+F:Math.max(10,v.top-$-F),y({top:pe,left:O}),c(true);};react.useEffect(()=>{if(!d||!f.current)return;let v=f.current.getBoundingClientRect(),P=window.innerHeight,C=window.innerWidth,L=300,$=s?380:120,F=4,O=v.right-L;O<10&&(O=v.left),O+L>C-10&&(O=C-L-10);let _=P-v.bottom,ae=v.top,pe;_>=$+F?pe=v.bottom+F:ae>=$+F?pe=v.top-$-F:pe=_>=ae?v.bottom+F:Math.max(10,v.top-$-F),y({top:pe,left:O});},[s,d]),react.useEffect(()=>{let v=P=>{w.current&&!w.current.contains(P.target)&&!f.current?.contains(P.target)&&(c(false),m(""));};if(d)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[d]),react.useEffect(()=>{let v=P=>{P.key==="Escape"&&(c(false),m(""));};if(d)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[d]);let T=v=>{let P=t.includes(v),C=a.find(L=>L.id===v);if(h(null),P){let L=t.filter($=>$!==v);r(L),L.length===0&&p(false);}else {if(n&&ao(a,v,e)){let $=`Cannot add "${C?.title||v}" as dependency - would create circular reference`;h($),l?.(v,C?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),p(true);}},D=()=>{let v=!s;p(v),v||r([]);},b=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),x=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:f,onClick:()=>d?c(false):g(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke: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})]}),d&&jsxRuntime.jsx($e,{children:jsxRuntime.jsxs("div",{ref:w,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:[k&&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:k})]}),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:s?"#3b82f6":"transparent",borderColor:s?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:s&&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"})]})}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>m(v.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:b.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"}):b.map(v=>{let P=t.includes(v.id);return jsxRuntime.jsxs("button",{onClick:()=>T(v.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:P?"#3b82f6":"transparent",borderColor:P?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:P&&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:v.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Da=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:l,availableUsers:d=[],allCards:c=[]})=>{let{attributes:i,listeners:m,setNodeRef:s,transform:p,transition:u,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:Zr.Transform.toString(p),transition:u};if(t)return jsxRuntime.jsx("div",{ref:s,style:k,...i,...m,onClick:()=>a?.(e),children:t(e)});let h=d.filter(g=>e.assignedUserIds?.includes(g.id)),w=e.progress===100,f={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:s,style:f,className:B("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...i,...m,onClick:g=>{g.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:w?"line-through":"none",opacity:w?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ha,{priority:e.priority,onChange:g=>l?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Dr,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(g,T)=>l?.(e.id,{startDate:g,endDate:T})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Va,{assignedUsers:h,availableUsers:d,onChange:g=>l?.(e.id,{assignedUserIds:g.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Sr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:c,onChange:g=>l?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies));Da.displayName="Card";var ro={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"}},Ni=({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 Si({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[l,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=[...Object.entries(ro).map(([h,w])=>({id:h,label:w.label,color:w.color,icon:w.icon})),...r.filter(h=>!Object.keys(ro).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],s=()=>{let h=ro[e];if(h)return {...h,id:e};let w=r.find(f=>f.id===e);return w?{id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}:{...ro.todo,id:"todo"}},p=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),w=window.innerHeight,f=window.innerWidth,g=180,T=280,D=4,b=h.right-g;b<10&&(b=h.left),b+g>f-10&&(b=f-g-10);let x=w-h.bottom,v=h.top,P;x>=T+D?P=h.bottom+D:v>=T+D?P=h.top-T-D:P=x>=v?h.bottom+D:Math.max(10,h.top-T-D),d({top:P,left:b}),n(true);};react.useEffect(()=>{let h=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&n(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=w=>{w.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let u=h=>{t(h),n(false);},y=s(),k=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?n(false):p(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:y.label,children:jsxRuntime.jsx(Ni,{icon:y.icon,color:k})}),o&&jsxRuntime.jsx($e,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.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(h=>jsxRuntime.jsxs("button",{onClick:()=>u(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ni,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Ei({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,l]=react.useState(false),[d,c]=react.useState(false),[i,m]=react.useState(e),[s,p]=react.useState({top:0,left:0}),u=react.useRef(null),y=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(n&&y.current){let g=y.current.getBoundingClientRect();p({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[n]),react.useEffect(()=>{let g=T=>{u.current&&!u.current.contains(T.target)&&!y.current?.contains(T.target)&&(l(false),c(false));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=T=>{T.key==="Escape"&&(l(false),c(false),m(e));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n,e]),react.useEffect(()=>{d&&k.current&&(k.current.focus(),k.current.select());},[d]);let h=()=>{c(true),m(e);},w=()=>{let g=i.trim();g&&g!==e&&t(g),c(false),l(false),m(e);},f=g=>{g.key==="Enter"?w():g.key==="Escape"&&(c(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>l(!n),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"})]})}),n&&jsxRuntime.jsx($e,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${s.top}px`,left:`${s.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:d?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:k,type:"text",value:i,onChange:g=>m(g.target.value),onKeyDown:f,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"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(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var lr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:l,onCardUpdate:d,availableUsers:c,allCards:i,enableVirtualization:m,cardHeight:s=120,isCollapsed:p,onToggleCollapse:u,onColumnRename:y,onColumnDelete:k,isDeletable:h=false,className:w})=>{let{setNodeRef:f,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),D=m??ei(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>s,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:f,className:w,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let L=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:L}:L>=80?{state:"warning",percentage:L}:L>=60?{state:"approaching",percentage:L}:{state:"ok",percentage:L}})(),P=v.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:f,className:B("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",P&&"ring-2 ring-asakaa-accent-red",w),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:B(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.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"})]}),v.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"})]}),v.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"})}),v.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||k)&&jsxRuntime.jsx(Ei,{columnTitle:e.title,onRename:L=>y?.(e.id,L),onDelete:k?()=>k(e.id):void 0,isDeletable:h}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(L=>L.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${b.getTotalSize()}px`,position:"relative"},children:b.getVirtualItems().map(L=>{let $=t[L.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${L.start}px)`},children:jsxRuntime.jsx(Da,{card:$,render:r,onClick:l,onUpdate:d,availableUsers:c,allCards:i})},$.id):null})}):t.map(L=>jsxRuntime.jsx(Da,{card:L,render:r,onClick:l,onUpdate:d,availableUsers:c,allCards:i},L.id))})})]})});lr.displayName="Column";function nn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let c=()=>{let m=n.trim();m&&m!==e?t(m):l(e),o(false);},i=m=>{m.key==="Enter"?c():m.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:n,onChange:m=>l(m.target.value),onBlur:c,onKeyDown:i,className:B("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:B("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function ln(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function La({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:l,style:d,isLoading:c,error:i,children:m}){let[s,p]=ln(),u=o?.theme||"dark",k=u==="dark"||u==="neutral"?"dark":"",h=react.useCallback((C,L)=>{t.onCardUpdate?.(C,L);},[t]),w=react.useCallback((C,L)=>{t.onColumnUpdate?.(C,{title:L});},[t]),f=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),g=["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(L=>{let $=L.cardIds.map(F=>e.cards.find(O=>O.id===F)).filter(F=>F!==void 0).sort((F,O)=>F.position-O.position);C.set(L.id,$);}),C},[e.cards,e.columns]),b=react.useCallback(C=>{let{active:L}=C,$=e.cards.find(F=>F.id===L.id);$&&p({isDragging:true,draggedCardId:$.id,sourceColumnId:$.columnId,targetColumnId:$.columnId});},[e.cards,p]),x=react.useCallback(C=>{let{active:L,over:$}=C;if(!$||!e.cards.find(_=>_.id===L.id))return;let O=null;$.data.current?.type==="column"?O=$.id:$.data.current?.type==="card"&&(O=e.cards.find(ae=>ae.id===$.id)?.columnId||null),O&&O!==s.targetColumnId&&p({...s,targetColumnId:O});},[e.cards,s,p]),v=react.useCallback(async C=>{let{active:L,over:$}=C;if(p({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!$)return;let F=e.cards.find(pe=>pe.id===L.id);if(!F)return;let O,_;if($.data.current?.type==="column"){O=$.id;let pe=D.get(O)||[];_=Xo(pe,0);}else {let pe=e.cards.find(ne=>ne.id===$.id);if(!pe)return;O=pe.columnId;let Le=D.get(O)||[],Pe=Le.findIndex(ne=>ne.id===$.id);_=Xo(Le,Pe);}let ae=e.columns.find(pe=>pe.id===O);if(ae&&ae.wipLimit&&ae.wipLimitType==="hard"){let pe=D.get(O)||[];if(F.columnId!==O&&pe.length>=ae.wipLimit){t.onWipLimitExceeded?.(ae,F);return}}(F.columnId!==O||F.position!==_)&&await t.onCardMove?.(F.id,O,_);},[e.cards,e.columns,D,t,p]),P=react.useCallback(C=>{a?.(C);},[a]);return c?jsxRuntime.jsx("div",{className:B("asakaa-board",k,l),style:d,children:jsxRuntime.jsx(bp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:B("asakaa-board",k,l),style:d,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsx(pi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:b,onDragOver:x,onDragEnd:v,children:[jsxRuntime.jsxs("div",{className:B("asakaa-board",k,l),style:d,"data-theme":u,children:[e.columns.sort((C,L)=>C.position-L.position).map(C=>{let L=D.get(C.id)||[],$=!g.includes(C.id);return jsxRuntime.jsx(lr,{column:C,cards:L,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:P,onCardUpdate:h,onColumnRename:w,onColumnDelete:f,isDeletable:$,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:s.draggedCardId?jsxRuntime.jsx(Da,{card:e.cards.find(C=>C.id===s.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function bp({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 kp={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)"},wp={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)"},Cp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Tp={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Dp({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,l]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let i=m=>{d.current&&!d.current.contains(m.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]);let c=i=>{t(i),l(false);};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,m)=>i.position-m.position).map((i,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Np({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,l]=react.useState(false),[d,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let u=y=>{i.current&&!i.current.contains(y.target)&&l(false);};return n&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),!(a||r||o))return null;let s=[{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),p=async(u,y)=>{if(y){c(u);try{await y();}catch(k){console.error(`Export ${u} failed:`,k);}finally{c(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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:s.map((u,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(u.id,u.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<s.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===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 Sp({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 cn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:l,onExportJSON:d,onExportExcel:c,translations:i}){let m=r==="dark"?kp:wp,s={...o==="es"?Cp:Tp,...i},p=l||d||c;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:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Np,{theme:m,t:s,onExportCSV:l,onExportJSON:d,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(n?jsxRuntime.jsx(Dp,{columns:e,onSelect:t,theme:m,t:s,createTaskLabel:a}):jsxRuntime.jsx(Sp,{onClick:()=>t(),label:a||s.newTask}))]})})}function mn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,l]=react.useState(false),[d,c]=react.useState(""),i=react.useCallback(()=>{let p=d.trim();p&&(e(p),c(""),l(false));},[d,e]),m=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(c(""),l(false));},[i]),s=react.useCallback(()=>{setTimeout(()=>{d.trim()||l(false);},150);},[d]);return n?jsxRuntime.jsx("div",{className:B("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:d,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:s,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!d.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),l(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:B("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(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 un({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:l=false,theme:d="dark",locale:c="es"}){let[i,m]=react.useState(false),[s,p]=react.useState(false),[u,y]=react.useState(""),[k,h]=react.useState([]),[w,f]=react.useState(""),[g,T]=react.useState(""),[D,b]=react.useState(""),[x,v]=react.useState(false),[P,C]=react.useState(false),[L,$]=react.useState(false),F=react.useRef(null),O=react.useRef(null),_={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},ae=react.useCallback(()=>{y(""),h([]),f(""),T(""),b(""),v(false),C(false),$(false),m(false);},[]);react.useEffect(()=>{i&&F.current&&F.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let S=M=>{O.current&&!O.current.contains(M.target)&&(u.trim()||ae());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i,u,ae]);let pe=react.useCallback(async()=>{let S=u.trim();if(!(!S||s)){p(true);try{await t({name:S,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:w?new Date(w):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),y(""),h([]),f(""),T(""),b(""),v(!1),C(!1),$(!1),F.current?.focus();}catch(M){console.error("Error creating card:",M);}finally{p(false);}}},[u,e,k,w,g,D,t,s]),Le=react.useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),pe()):S.key==="Escape"&&ae();},[pe,ae]),Pe=react.useCallback(S=>{h(M=>M.includes(S)?M.filter(E=>E!==S):[...M,S]);},[]),ne=d==="dark";return i?jsxRuntime.jsxs("div",{ref:O,className:B("rounded-lg overflow-hidden shadow-lg",ne?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:F,type:"text",value:u,onChange:S=>y(S.target.value),onKeyDown:Le,placeholder:_.placeholder,disabled:s,className:B("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",ne?"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:()=>v(!x),className:B("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||k.length>0?"bg-emerald-500/20 text-emerald-400":ne?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:_.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"})]}),k.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:k.length})]}),jsxRuntime.jsx("button",{onClick:()=>C(!P),className:B("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",P||w||g?"bg-blue-500/20 text-blue-400":ne?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:_.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:()=>$(!L),className:B("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||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":ne?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:_.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:pe,disabled:!u.trim()||s,className:B("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:s?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):_.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:B("px-3 pb-3 pt-0","border-t",ne?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(S=>jsxRuntime.jsxs("button",{onClick:()=>Pe(S.id),className:B("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(S.id)?"bg-emerald-500 text-white":ne?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[S.avatar?jsxRuntime.jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:B("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),P&&jsxRuntime.jsx("div",{className:B("px-3 pb-3 pt-0","border-t",ne?"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:B("block text-[10px] uppercase tracking-wide mb-1",ne?"text-gray-500":"text-gray-400"),children:_.startDate}),jsxRuntime.jsx("input",{type:"date",value:w,onChange:S=>f(S.target.value),className:B("w-full px-2 py-1.5 rounded text-xs border",ne?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:B("block text-[10px] uppercase tracking-wide mb-1",ne?"text-gray-500":"text-gray-400"),children:_.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:S=>T(S.target.value),className:B("w-full px-2 py-1.5 rounded text-xs border",ne?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),L&&jsxRuntime.jsx("div",{className:B("px-3 pb-3 pt-0","border-t",ne?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(S=>jsxRuntime.jsx("button",{onClick:()=>b(D===S?"":S),className:B("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:ne?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:_[S]},S))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:l,className:B("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",ne?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"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:_.buttonLabel})]})}var Ar=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(La,{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(n=>n.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,n)=>{r.toBlob(l=>{l?o(l):n(new Error("Failed to create PNG blob"));},"image/png");})}};function Gi(e={}){return new Ar(e)}var dr=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:l}=this.props;return a&&r?n?n(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:l?`Error in ${l}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function gn(e,t){let a=r=>jsxRuntime.jsx(dr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function bn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:l,onPredictRisks:d,onOpenAIUsage:c,shortcut:i="k",className:m=""}){let[s,p]=react.useState(false),[u,y]=react.useState(""),[k,h]=react.useState("home"),[w,f]=react.useState(""),[g,T]=react.useState("");react.useEffect(()=>{let v=P=>{(P.metaKey||P.ctrlKey)&&P.key===i&&(P.preventDefault(),p(C=>!C)),P.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{s||(h("home"),y(""),f(""),T(""));},[s]);let D=react.useCallback(()=>{p(false);},[]),b=react.useCallback(v=>{let[P,C]=v.split(":");switch(P){case "create-card":h("create-card");break;case "create-card-in":f(C||"");break;case "navigate":C?(a?.(C),D()):h("navigate");break;case "search":r?.(u),D();break;case "priority":h("priority");break;case "set-priority":g&&C&&(o?.(g,C),D());break;case "assign":h("assign");break;case "assign-user":g&&C&&(n?.(g,C),D());break;case "ai":h("ai");break;case "ai-generate-plan":l?.(),D();break;case "ai-predict-risks":d?.(),D();break;case "ai-usage":c?.(),D();break;case "back":h("home");break;}},[u,g,t,a,r,o,n,l,d,c,D]),x=react.useCallback(()=>{w&&u.trim()&&(t?.(w,u.trim()),D());},[w,u,t,D]);return s?jsxRuntime.jsx($e,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:v=>v.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:k==="create-card"&&w?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&k==="create-card"&&w&&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."}),k==="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:b,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:b,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:b,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:b,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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},v.id))})]}),k==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${v.id}`,onSelect:b,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:v.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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(v=>{let P=e.columns.find(C=>C.id===v.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:b,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:v.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:P?.title})]}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},v.id)})})]}),k==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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:b,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:b,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:b,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 Fp(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 Bp(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 Rp(e){return e.startsWith("image/")}function Fr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[l,d]=react.useState(false),[c,i]=react.useState(false),[m,s]=react.useState(null),p=react.useRef(null),u=react.useCallback(b=>{let x=[],v=[];return e.length+b.length>n?(v.push(`Maximum ${n} files allowed`),{valid:x,errors:v}):(b.forEach(P=>{if(P.size/1048576>r){v.push(`${P.name} is too large (max ${r}MB)`);return}if(o&&!o.some(L=>P.type.match(L))){v.push(`${P.name} has invalid file type`);return}x.push(P);}),{valid:x,errors:v})},[e.length,n,r,o]),y=react.useCallback(async b=>{let{valid:x,errors:v}=u(b);if(v.length>0){s(v.join(", ")),setTimeout(()=>s(null),5e3);return}if(x.length!==0){i(true),s(null);try{await t?.(x);}catch(P){s(P instanceof Error?P.message:"Upload failed"),setTimeout(()=>s(null),5e3);}finally{i(false);}}},[u,t]),k=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),d(true);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),d(false);},[]),w=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),f=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),d(false);let x=Array.from(b.dataTransfer.files);y(x);},[y]),g=react.useCallback(b=>{let x=b.target.files?Array.from(b.target.files):[];y(x),p.current&&(p.current.value="");},[y]),T=react.useCallback(()=>{p.current?.click();},[]),D=react.useCallback(b=>{confirm("Are you sure you want to delete this attachment?")&&a?.(b);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${c?"uploading":""}`,onDragEnter:k,onDragLeave:h,onDragOver:w,onDrop:f,onClick:T,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"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,"/",n," 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(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Rp(b.type)&&b.url?jsxRuntime.jsx("img",{src:b.thumbnailUrl||b.url,alt:b.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Bp(b.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:b.name,children:b.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Fp(b.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(b.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(b.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"})})})]},b.id))})]})}function vn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:d=[],aiInsights:c=[],attachments:i=[],onAddComment:m,onDeleteComment:s,onUploadAttachments:p,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:k,onEstimateEffort:h,currentUserId:w="user-1"}){let[f,g]=react.useState("details"),[T,D]=react.useState(false),[b,x]=react.useState({}),[v,P]=react.useState(""),[C,L]=react.useState(false),[$,F]=react.useState({});if(!t||!e)return null;let O=react.useCallback(()=>{D(false),x({}),g("details"),P(""),F({}),a();},[a]),_=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),x({}),D(false));},[e.id,b,r]),ae=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),O());},[e.id,o,O]),pe=react.useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),P(""));},[e.id,v,m]),Le=react.useCallback(async()=>{if(y){L(true);try{let E=await y(e);F(U=>({...U,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{L(false);}}},[e,y]),Pe=react.useCallback(async()=>{if(k){L(true);try{let E=await k(e);F(U=>({...U,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{L(false);}}},[e,k]),ne=react.useCallback(async()=>{if(h){L(true);try{let E=await h(e);F(U=>({...U,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{L(false);}}},[e,h]),S={...e,...b},M=n.filter(E=>S.assignedUserIds?.includes(E.id));return jsxRuntime.jsx($e,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:O,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:b.title??S.title,onChange:E=>x({...b,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:S.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:_,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:ae,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:O,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>g("details"),className:`card-detail-tab ${f==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${f==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${f==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${f==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${f==="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:[f==="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:b.description??S.description??"",onChange:E=>x({...b,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:S.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:b.assignedUserIds??S.assignedUserIds??[],onChange:E=>{let U=Array.from(E.target.selectedOptions,K=>K.value);x({...b,assignedUserIds:U});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:M.length>0?M.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),T?jsxRuntime.jsxs("select",{value:b.priority??S.priority??"",onChange:E=>x({...b,priority:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:S.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:S.labels&&S.labels.length>0?S.labels.map(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),T?jsxRuntime.jsx("input",{type:"date",value:b.startDate?new Date(b.startDate).toISOString().split("T")[0]:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:"",onChange:E=>x({...b,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.startDate?new Date(S.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:b.endDate?new Date(b.endDate).toISOString().split("T")[0]:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:"",onChange:E=>x({...b,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.endDate?new Date(S.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:b.estimatedTime??S.estimatedTime??"",onChange:E=>x({...b,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.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:S.dependencies&&S.dependencies.length>0?S.dependencies.map(E=>{let U=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",U.slice(-4)]},U)}):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:S.createdAt?new Date(S.createdAt).toLocaleString():"Unknown"})]})]}),f==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:v,onChange:E=>P(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:pe,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(E=>{let U=n.find(K=>K.id===E.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[U&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:U?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),s&&jsxRuntime.jsx("button",{onClick:()=>s(E.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:E.content})]},E.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),f==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(E=>{let U=n.find(K=>K.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:U?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),f==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Fr,{cardId:e.id,attachments:i,onUpload:p?E=>p(e.id,E):void 0,onDelete:u,currentUserId:w,maxSizeMB:10,maxFiles:20})}),f==="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:Le,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:Pe,disabled:C||!k,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:ne,disabled:C||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((E,U)=>{let K=n.find(V=>V.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:K?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},U)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((E,U)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},U))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Br({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:l=""}){let[d,c]=react.useState({top:0,left:0}),i=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let s=e.current.getBoundingClientRect(),p=window.innerHeight,u=window.innerWidth,y=4,k=s.left;k+o>u-10&&(k=u-o-10),k<10&&(k=10);let h=p-s.bottom,w=s.top,f;return h>=n+y?f=s.bottom+y:w>=n+y?f=s.top-n-y:h>=w?f=s.bottom+y:f=Math.max(10,s.top-n-y),{top:f,left:k}},[e,o,n]);return react.useEffect(()=>{t&&c(m());},[t,m]),react.useEffect(()=>{if(!t)return;let s=u=>{let y=u.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",s);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",s);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let s=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,a]),t?jsxRuntime.jsx($e,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${l}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var _p=["LOW","MEDIUM","HIGH","URGENT"],Vp=["todo","in-progress","review","done"];function kn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:d=[],onAddComment:c,onDeleteComment:i,currentUser:m,onAIGenerateDescription:s,onAICreateSubtasks:p,onAIFindSimilar:u,availableColumns:y=[],availableLabels:k=[],onUploadCoverImage:h,unsplashAccessKey:w,theme:f,onSubtasksChange:g}){let T=nr(),D=f||T?.themeName||"dark",[b,x]=react.useState(e),[v,P]=react.useState(false),[C,L]=react.useState(e?.subtasks||[]),[$,F]=react.useState(false),[O,_]=react.useState(""),[ae,pe]=react.useState(""),[Le,Pe]=react.useState("all"),[ne,S]=react.useState(false),[M,E]=react.useState(false),[U,K]=react.useState(false),[V,be]=react.useState(false),[he,He]=react.useState(false),[me,qe]=react.useState(false),Ke=react.useRef(null),Mt=react.useRef(null),Jt=react.useRef(null),zt=react.useRef(null),It=react.useRef(null),At=react.useRef(null),St=react.useRef(null),fa=react.useRef(null),mt=react.useRef(null),ot=react.useRef(null),Lt=react.useRef(null),Ca=react.useRef(null);react.useEffect(()=>{e&&!b?(x({...e}),L(e.subtasks||[])):e&&b&&e.id!==b.id&&(x({...e}),L(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let I=X=>{let Te=X.target;zt.current&&!zt.current.contains(Te)&&S(false),It.current&&!It.current.contains(Te)&&E(false),At.current&&!At.current.contains(Te)&&K(false),St.current&&!St.current.contains(Te)&&be(false);};if(ne||M||U||V)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[ne,M,U,V]),react.useEffect(()=>{if(!t)return;let I=X=>{let Te=X.target,Ye=Te.tagName==="INPUT"||Te.tagName==="TEXTAREA"||Te.isContentEditable;if(X.key==="Escape"){X.preventDefault(),ne||M||U||V||he||me?(S(false),E(false),K(false),be(false),He(false),qe(false)):Ye||a();return}if(Ye&&X.key!=="Escape")return;let de=X.metaKey||X.ctrlKey;switch(X.key.toLowerCase()){case "s":X.preventDefault(),S(true);break;case "a":X.preventDefault(),K(true);break;case "p":X.preventDefault(),E(true);break;case "l":X.preventDefault(),be(true);break;case "d":de||(X.preventDefault(),He(true),setTimeout(()=>fa.current?.focus(),0));break;case "e":de||(X.preventDefault(),qe(true));break;case "i":X.preventDefault(),P(true),setTimeout(()=>Mt.current?.focus(),0);break;case "t":X.preventDefault(),F(true);break;case "c":X.preventDefault(),Jt.current?.focus();break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,a,ne,M,U,V,he,me]);let se=react.useCallback(I=>{let X=I.currentTarget.textContent?.trim()||"";if(b&&X!==b.title){let Te={...b,title:X};x(Te),r?.(b.id,{title:X});}},[b,r]),ve=react.useCallback(I=>{I.key==="Enter"&&(I.preventDefault(),I.currentTarget.blur()),I.key==="Escape"&&(I.preventDefault(),I.currentTarget.textContent=b?.title||"",I.currentTarget.blur());},[b]),_t=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),P(false);},[b,e,r]),ba=react.useCallback(I=>{if(b){let X={...b,columnId:I};x(X),r?.(b.id,{columnId:I}),S(false);}},[b,r]),xt=react.useCallback(I=>{if(b){let X={...b,priority:I};x(X),r?.(b.id,{priority:I}),E(false);}},[b,r]),ha=react.useCallback(I=>{if(b){let X=b.assignedUserIds||[],Te=X.includes(I)?X.filter(de=>de!==I):[...X,I],Ye={...b,assignedUserIds:Te};x(Ye),r?.(b.id,{assignedUserIds:Te});}},[b,r]),va=react.useCallback(I=>{if(b){let X=b.labels||[],Te=X.includes(I)?X.filter(de=>de!==I):[...X,I],Ye={...b,labels:Te};x(Ye),r?.(b.id,{labels:Te});}},[b,r]),ke=react.useCallback(I=>{if(b){let X=I.target.value,Te={...b,endDate:X};x(Te),r?.(b.id,{endDate:X}),He(false);}},[b,r]),Ce=react.useCallback(I=>{if(b){let X={...b,estimatedTime:parseFloat(I)||0};x(X),r?.(b.id,{estimatedTime:parseFloat(I)||0});}},[b,r]),ut=react.useCallback(()=>{if(O.trim()&&b){let I={id:`subtask-${Date.now()}`,title:O.trim(),completed:false,createdAt:new Date},X=[...C,I];L(X),_(""),F(false),g?.(b.id,X);}},[O,C,b,g]),ee=react.useCallback(I=>{let X=C.map(Te=>Te.id===I?{...Te,completed:!Te.completed,updatedAt:new Date}:Te);L(X),b&&g?.(b.id,X);},[C,b,g]),ye=react.useCallback(I=>{let X=C.filter(Te=>Te.id!==I);L(X),b&&g?.(b.id,X);},[C,b,g]),A=react.useCallback(()=>{ae.trim()&&b&&c&&(c(b.id,ae.trim()),pe(""));},[ae,b,c]),W=react.useCallback(I=>{(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&(I.preventDefault(),A());},[A]),ie=I=>jsxRuntime.jsx(Gp__default.default,{remarkPlugins:[Up__default.default],rehypePlugins:[Hp__default.default],components:{a:({node:X,...Te})=>jsxRuntime.jsx("a",{...Te,target:"_blank",rel:"noopener noreferrer"})},children:I}),ce=d.filter(I=>Le==="comments"?I.type.includes("COMMENT"):Le==="history"?!I.type.includes("COMMENT"):true);if(!t||!e)return null;let Y=b||e,le=n.filter(I=>Y.assignedUserIds?.includes(I.id)),q=C.filter(I=>I.completed).length;return jsxRuntime.jsx($e,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ke,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:se,onKeyDown:ve,children:Y.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:zt,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>S(!ne),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Y.columnId||"No status"})]}),jsxRuntime.jsx(Br,{triggerRef:mt,isOpen:ne,onClose:()=>S(false),width:250,estimatedHeight:200,children:(y.length>0?y:Vp.map(I=>({id:I,title:I}))).map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Y.columnId===I.id?"active":""}`,onClick:()=>ba(I.id),children:I.title},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:At,children:[jsxRuntime.jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>K(!U),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:le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:le.map(I=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:I.color},title:I.name,children:I.initials},I.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Br,{triggerRef:ot,isOpen:U,onClose:()=>K(false),width:280,estimatedHeight:300,children:n.map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Y.assignedUserIds?.includes(I.id)?"active":""}`,onClick:()=>ha(I.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:I.color},children:I.initials}),I.name,Y.assignedUserIds?.includes(I.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:It,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>E(!M),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:Y.priority||"None"})]}),jsxRuntime.jsxs(Br,{triggerRef:Lt,isOpen:M,onClose:()=>E(false),width:180,estimatedHeight:220,children:[_p.map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${I.toLowerCase()} ${Y.priority===I?"active":""}`,onClick:()=>xt(I),children:I},I)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>xt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:St,children:[jsxRuntime.jsxs("button",{ref:Ca,className:"modal-v2-field",onClick:()=>be(!V),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:Y.labels&&Y.labels.length>0?jsxRuntime.jsx("span",{children:Y.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Br,{triggerRef:Ca,isOpen:V,onClose:()=>be(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Y.labels?.includes(I)?"active":""}`,onClick:()=>va(I),children:[I,Y.labels?.includes(I)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},I))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{He(!he),setTimeout(()=>fa.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:Y.endDate?new Date(Y.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:fa,type:"date",value:typeof Y.endDate=="string"?Y.endDate.split("T")[0]:Y.endDate?(()=>{let I=new Date(Y.endDate),X=I.getUTCFullYear(),Te=String(I.getUTCMonth()+1).padStart(2,"0"),Ye=String(I.getUTCDate()).padStart(2,"0");return `${X}-${Te}-${Ye}`})():"",onChange:ke,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>qe(!me),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:Y.estimatedTime?`${Y.estimatedTime}h`:"Not set"})]}),me&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Y.estimatedTime||"",onChange:I=>Ce(I.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>qe(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"})]}),v?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Y.description||"",onChange:I=>{if(b){let X={...b,description:I.target.value};x(X);}},onBlur:_t,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>P(true),children:Y.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:ie(Y.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:[q,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>F(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(I=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${I.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ee(I.id),children:I.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:I.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ye(I.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},I.id)),$&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:O,onChange:I=>_(I.target.value),onKeyDown:I=>{I.key==="Enter"&&ut(),I.key==="Escape"&&(F(false),_(""));},onBlur:ut,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 ${Le==="all"?"active":""}`,onClick:()=>Pe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="comments"?"active":""}`,onClick:()=>Pe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="history"?"active":""}`,onClick:()=>Pe("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:Jt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ae,onChange:I=>pe(I.target.value),onKeyDown:W,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:A,disabled:!ae.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ce.map(I=>{let X=n.find(Ye=>Ye.id===I.userId);if(I.type.includes("COMMENT")){let Ye=l.find(de=>de.id===I.metadata?.commentId);return Ye?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[X&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:X?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ye.content})]})]},I.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:X?.name||"Unknown"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)}),ce.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 em({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 Cn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(l=>({...l,average:l.average??e.reduce((d,c)=>d+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(em,{})}),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((l,d)=>l+d.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,d)=>l+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.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((l,d)=>l+(d.planned||0),0)})]})]})]})}function dm({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 Tn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,c=n>0?(n-l)/n*100:0,i=l<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(dm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var vm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Ji=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ym({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let l=r+(o-r)*.5,d=e+l*Math.cos(-a*(Math.PI/180)),c=t+l*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:d,y:c,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function Zi({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 Dn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((c,i)=>c+i.value,0),l=e.map(c=>({...c,totalValue:n,color:c.color||vm[c.name]||Ji[e.indexOf(c)%Ji.length]})),d=l.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?ym:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Zi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let m=i.payload,s=n>0?(m.value/n*100).toFixed(0):"0";return `${c} (${m.value} - ${s}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,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(Zi,{})}),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:l.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var po=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[l,d]=react.useState(false),[c,i]=react.useState(false),[m,s]=react.useState(false),[p,u]=react.useState(false);if(e.length===0)return null;let y=e.map(T=>T.id),k=T=>{r.onBulkUpdate?.(y,{priority:T}),d(false);},h=T=>{r.onBulkMove?.(y,T),i(false),a();},w=T=>{r.onBulkUpdate?.(y,{assignedUserIds:T}),s(false);},f=T=>{let D=new Set;e.forEach(x=>{x.labels?.forEach(v=>D.add(v));});let b=Array.from(new Set([...D,...T]));r.onBulkUpdate?.(y,{labels:b}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(T),children:[jsxRuntime.jsx("span",{className:B("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:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(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:()=>s(!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:()=>w([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))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([T]),children:T},T))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});po.displayName="BulkOperationsToolbar";function Tm(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,l,d,c,i;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let y=a?.find(k=>k.id===u);l=`assignee-${u}`,d=y?.name||`User ${u}`,c=y?.color,i=y?.avatar,r.has(l)||r.set(l,{id:l,title:d,groupValue:u,cardIds:[],color:c,icon:i}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",d="Unassigned",c="#6b7280",i="\u{1F464}",r.has(l)||r.set(l,{id:l,title:d,groupValue:null,cardIds:[],color:c,icon:i}),r.get(l).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",l=`priority-${n}`;let p={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"}}[n];d=p.title,c=p.color,r.has(l)||r.set(l,{id:l,title:d,groupValue:n,cardIds:[],color:c}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,d=u,c="#6b7280",r.has(l)||r.set(l,{id:l,title:d,groupValue:u,cardIds:[],color:c}),r.get(l).cardIds.push(o.id);}):(l="label-none",d="No Labels",c="#6b7280",r.has(l)||r.set(l,{id:l,title:d,groupValue:null,cardIds:[],color:c}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Nn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,l]=react.useState(new Set),d=react.useMemo(()=>Tm(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{l(m=>{let s=new Set(m);return s.has(i)?s.delete(i):s.add(i),s});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(La,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:B("asakaa-swimlane-view",o),children:[d.map(i=>{let m=n.has(i.id),s=e.cards.filter(u=>i.cardIds.includes(u.id)),p={...e,cards:s};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(La,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Sn=[{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 En({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null),d=Sn.find(i=>i.value===e)||Sn[0];react.useEffect(()=>{function i(m){n.current&&!n.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:B("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:d.icon}),jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx("svg",{className:B("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:n,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:Sn.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:B("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Rr=[{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 Sm(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return n&&l&&d&&c}function rl(e={}){let{shortcuts:t=Rr,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let l=react.useCallback(c=>{o.current=[...o.current,c];},[]),d=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!n.current)return;let m=i.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let s of o.current)if(Sm(i,s)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:s.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:l,unregisterShortcut:d,isEnabled:a}}function Pm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Mm(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 Im(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Mm(e),r=t?Pm(t):"";return a?`${a} + ${r}`:r}function Am(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 Pn({shortcuts:e=Rr,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function d(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let l=Am(e);return jsxRuntime.jsxs("div",{className:B("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(l).map(([d,c])=>c.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"}),d]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.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:Im(i)})]},i.action))})]},d))})}),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 Mn=[{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'),Yl=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),jp=require('react-markdown'),Kp=require('remark-gfm'),Yp=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Yl__default=/*#__PURE__*/_interopDefault(Yl);var jp__default=/*#__PURE__*/_interopDefault(jp);var Kp__default=/*#__PURE__*/_interopDefault(Kp);var Yp__default=/*#__PURE__*/_interopDefault(Yp);var Zr=(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 Qr=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 [Qr.Translate.toString(e),Qr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function P(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function eo(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 Ic(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zo(e,t){return e.length===0?1e3:t===0?eo(null,e[0].position):t>=e.length?eo(e[e.length-1].position,null):eo(e[t-1].position,e[t].position)}function ai(e,t=100){return e>t}var Ac=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 Lc(e,t,a,r){let o=t*Math.pow(a,e-1),n=o*.2*Math.random();return Math.min(o+n,r)}async function to(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:l=Ac,onRetry:c}=t,p,s=0;for(let m=1;m<=a;m++){s=m;try{return {data:await e(),attempts:s,success:!0}}catch(i){if(p=i,m===a||!l(p,m))return {error:p,attempts:s,success:false};let u=Lc(m,r,o,n);if(c)try{c(p,m,u);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,u));}}return {error:p||new Error("Unknown error"),attempts:s,success:false}}function Fc(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 Bc(e,t={}){return async(...a)=>to(()=>e(...a),t)}var Qo=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 ri=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.NONE=4]="NONE",n))(ri||{}),Ga=class Ga{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...l}=t,c=`[${a}] [${r}] [${n}]`,p=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(c,o,p?l:"");break;case "INFO":console.info(c,o,p?l:"");break;case "WARN":console.warn(c,o,p?l:"");break;case "ERROR":console.error(c,o,p?l:""),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",...Ga.globalOptions};}static configure(t){Ga.globalOptions={...Ga.globalOptions,...t};}child(t){return new Ga({...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 ao((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new ao(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ri[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ga.globalOptions={};var en=Ga,ao=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}},oi=new en;function Oc(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 $c(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(n=>{let l=e.columns.find(c=>c.id===n.columnId);return [n.id,tn(n.title),tn(n.description||""),tn(l?.title||""),n.priority||"",(n.labels||[]).join(";"),(n.assignedUserIds||[]).join(";"),n.startDate||"",n.endDate||"",n.createdAt||"",n.updatedAt||""]});return [a.join(","),...r.map(n=>n.join(","))].join(`
|
|
2
|
+
`)}async function zc(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await Yl__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=l.toDataURL("image/png"),p=297,s=210,m=l.width/l.height,i=p-20,d=i/m;d>s-20&&(d=s-20,i=d*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 x=(p-i)/2;return u.addImage(c,"PNG",x,20,i,d),u}catch(l){console.error("Error capturing board:",l);}let o=new jspdf.jsPDF,n=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,n),n+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,n),n+=15,o.setTextColor(0,0,0),e.columns.forEach(l=>{let c=e.cards.filter(p=>p.columnId===l.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,n),n+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,n),o.setTextColor(0,0,0),n+=10):c.forEach(p=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,n),n+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(p.description,160);o.text(m,25,n),n+=m.length*5;}let s=[];if(p.priority&&s.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&s.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&s.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}`),s.push(m.join(" \u2192 "));}s.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(s.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function tn(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function si(e,t,a,r){switch(t){case "json":return Oc(e,r);case "csv":return $c(e);case "pdf":return await zc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ii(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 n=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:l[t]}),p=URL.createObjectURL(c),s=document.createElement("a");s.href=p,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(p);}function Wc(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 Uc(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=li(t[0]),r=[],o=new Map,n=[];for(let l=1;l<t.length;l++)try{let c=li(t[l]||"");if(c.length>a.length){n.push(`Line ${l+1}: Too many columns`);continue}if(a.length-c.length>3){n.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let s={};a.forEach((u,x)=>{s[u]=c[x]||"";});let m=s.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),d={id:s["Card ID"]||`card-${l}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:i.id,position:i.cardIds.length+1,priority:s.Priority||void 0,labels:s.Labels?s.Labels.split(";").filter(Boolean):void 0,assignedUserIds:s["Assigned Users"]?s["Assigned Users"].split(";").filter(Boolean):void 0,startDate:s["Start Date"]?s["Start Date"]:void 0,endDate:s["End Date"]?s["End Date"]:void 0,createdAt:s["Created At"]?s["Created At"]:void 0,updatedAt:s["Updated At"]?s["Updated At"]:void 0};r.push(d),i.cardIds.push(d.id);}catch(c){n.push(`Line ${l+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function li(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],l=e[o+1];n==='"'&&r&&l==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function di(e,t){switch(t){case "json":return Wc(e);case "csv":return Uc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ci(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 an=react.createContext(null);function pi(){return react.useContext(an)}var mi=react.createContext(null);function ui({children:e,themeName:t}){return jsxRuntime.jsx(mi.Provider,{value:{themeName:t},children:e})}function nr(){return react.useContext(mi)}function ze({children:e,container:t}){let[a,r]=react.useState(false),o=pi(),n=nr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:c,themeName:p}=o,s={"--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:s,children:e}),l)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var vi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},qc="#BDC3C7",Xc=({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 Ha({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null),s=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,h=160,w=220,g=4,f=u.right-h;f<10&&(f=u.left),f+h>v-10&&(f=v-h-10);let T=x-u.bottom,N=u.top,b;T>=w+g?b=u.bottom+g:N>=w+g?b=u.top-w-g:b=T>=N?u.bottom+g:Math.max(10,u.top-w-g),l({top:b,left:f}),o(true);};react.useEffect(()=>{let u=x=>{c.current&&!c.current.contains(x.target)&&!p.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=x=>{x.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?vi[e]:null,d=i?.color||qc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):s(),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?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}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:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ze,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(vi).map(([u,x])=>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:x.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Xc,{color:x.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:x.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 Jc=[{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 Nr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),s=react.useRef(null),d=(nr()?.themeName||"dark")==="dark",u=()=>{if(!s.current)return;let f=s.current.getBoundingClientRect(),T=window.innerHeight,N=window.innerWidth,b=320,k=380,C=4,M=f.left;M+b>N-10&&(M=N-b-10),M<10&&(M=10);let y=T-f.bottom,A=f.top,O;y>=k+C?O=f.bottom+C:A>=k+C?O=f.top-k-C:O=y>=A?f.bottom+C:Math.max(10,f.top-k-C),c({top:O,left:M}),n(true);};react.useEffect(()=>{let f=T=>{p.current&&!p.current.contains(T.target)&&!s.current?.contains(T.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let x=f=>{let T=new Date,N=M=>{let y=M.getFullYear(),A=String(M.getMonth()+1).padStart(2,"0"),O=String(M.getDate()).padStart(2,"0");return `${y}-${A}-${O}`},b=N(T),k=new Date(T);k.setDate(k.getDate()+f);let C=N(k);a(b,C),n(false);},v=()=>{if(!e||!t)return "Set date";let f=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=k.split("-").map(Number);if(C.length!==3||C.some(O=>isNaN(O)))return null;let M=C[0],y=C[1],A=C[2];return M===void 0||y===void 0||A===void 0?null:new Date(M,y-1,A)},T=f(e),N=f(t);if(!T||!N||isNaN(T.getTime())||isNaN(N.getTime()))return "Set date";let b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${b[T.getMonth()]} ${T.getDate()} \u2013 ${b[N.getMonth()]} ${N.getDate()}`},h=e&&t,g=(()=>{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:s,onClick:()=>o?n(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${g?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${v()}`:"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:v()})]}),o&&jsxRuntime.jsx(ze,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"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:d?"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:d?"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:Jc.map(f=>jsxRuntime.jsx("button",{onClick:()=>x(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${d?"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:d?"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:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"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:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(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 Va({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,l]=react.useState(false),[c,p]=react.useState(""),[s,m]=react.useState({top:0,left:0}),i=react.useRef(null),d=react.useRef(null),u=()=>{if(!d.current)return;let g=d.current.getBoundingClientRect(),f=window.innerHeight,T=window.innerWidth,N=300,b=380,k=4,C=g.right-N;C<10&&(C=g.left),C+N>T-10&&(C=T-N-10);let M=f-g.bottom,y=g.top,A;M>=b+k?A=g.bottom+k:y>=b+k?A=g.top-b-k:A=M>=y?g.bottom+k:Math.max(10,g.top-b-k),m({top:A,left:C}),l(true);};react.useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&!d.current?.contains(f.target)&&(l(false),p(""));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&(l(false),p(""));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let x=g=>{let f=e.some(T=>T.id===g.id);a(f?e.filter(T=>T.id!==g.id):[...e,g]);},v=t.filter(g=>g.name.toLowerCase().includes(c.toLowerCase())),h=e.slice(0,o),w=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>n?l(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:[h.map(g=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"asakaa-avatar-img"}):g.initials},g.id)),w>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",w]})]}):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"})]})})}),n&&jsxRuntime.jsx(ze,{children:jsxRuntime.jsxs("div",{ref:i,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${s.top}px`,left:`${s.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:g=>p(g.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:v.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"}):v.map(g=>{let f=e.some(T=>T.id===g.id);return jsxRuntime.jsxs("button",{onClick:()=>x(g),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:g.color,color:"#fff"},children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.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:g.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(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 ro(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let s=p.dependencies.map(m=>{if(typeof m=="string")return m;let i=m;return i.taskId||i.targetId||""}).filter(Boolean);r.set(p.id,s);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,l=new Set,c=p=>{if(!n.has(p)){n.add(p),l.add(p);let s=r.get(p)||[];for(let m of s){if(!n.has(m)&&c(m))return true;if(l.has(m))return true}}return l.delete(p),false};return c(a)}function Sr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:l}){let[c,p]=react.useState(false),[s,m]=react.useState(""),[i,d]=react.useState(t.length>0),[u,x]=react.useState({top:0,left:0}),[v,h]=react.useState(null),w=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let C=g.current.getBoundingClientRect(),M=window.innerHeight,y=window.innerWidth,A=300,O=i?380:120,B=4,$=C.right-A;$<10&&($=C.left),$+A>y-10&&($=y-A-10);let V=M-C.bottom,ne=C.top,ce;V>=O+B?ce=C.bottom+B:ne>=O+B?ce=C.top-O-B:ce=V>=ne?C.bottom+B:Math.max(10,C.top-O-B),x({top:ce,left:$}),p(true);};react.useEffect(()=>{if(!c||!g.current)return;let C=g.current.getBoundingClientRect(),M=window.innerHeight,y=window.innerWidth,A=300,O=i?380:120,B=4,$=C.right-A;$<10&&($=C.left),$+A>y-10&&($=y-A-10);let V=M-C.bottom,ne=C.top,ce;V>=O+B?ce=C.bottom+B:ne>=O+B?ce=C.top-O-B:ce=V>=ne?C.bottom+B:Math.max(10,C.top-O-B),x({top:ce,left:$});},[i,c]),react.useEffect(()=>{let C=M=>{w.current&&!w.current.contains(M.target)&&!g.current?.contains(M.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=M=>{M.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);let T=C=>{let M=t.includes(C),y=a.find(A=>A.id===C);if(h(null),M){let A=t.filter(O=>O!==C);r(A),A.length===0&&d(false);}else {if(n&&ro(a,C,e)){let O=`Cannot add "${y?.title||C}" as dependency - would create circular reference`;h(O),l?.(C,y?.title||C),setTimeout(()=>h(null),3e3);return}r([...t,C]),d(true);}},N=()=>{let C=!i;d(C),C||r([]);},b=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(s.toLowerCase())||C.id.toLowerCase().includes(s.toLowerCase())),k=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:g,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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),c&&jsxRuntime.jsx(ze,{children:jsxRuntime.jsxs("div",{ref:w,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:[v&&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:v})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background: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:s,onChange:C=>m(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:b.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"}):b.map(C=>{let M=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>T(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:y=>{y.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:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),d(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 Na=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:l,availableUsers:c=[],allCards:p=[]})=>{let{attributes:s,listeners:m,setNodeRef:i,transform:d,transition:u,isDragging:x}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),v={transform:Qr.Transform.toString(d),transition:u};if(t)return jsxRuntime.jsx("div",{ref:i,style:v,...s,...m,onClick:()=>a?.(e),children:t(e)});let h=c.filter(f=>e.assignedUserIds?.includes(f.id)),w=e.progress===100,g={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:i,style:g,className:P("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...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:w?"line-through":"none",opacity:w?.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(Ha,{priority:e.priority,onChange:f=>l?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Nr,{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)=>l?.(e.id,{startDate:f,endDate:T})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Va,{assignedUsers:h,availableUsers:c,onChange:f=>l?.(e.id,{assignedUserIds:f.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Sr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>l?.(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));Na.displayName="Card";var oo={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"}},Ei=({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 Pi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),s=react.useRef(null),m=[...Object.entries(oo).map(([h,w])=>({id:h,label:w.label,color:w.color,icon:w.icon})),...r.filter(h=>!Object.keys(oo).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let h=oo[e];if(h)return {...h,id:e};let w=r.find(g=>g.id===e);return w?{id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}:{...oo.todo,id:"todo"}},d=()=>{if(!s.current)return;let h=s.current.getBoundingClientRect(),w=window.innerHeight,g=window.innerWidth,f=180,T=280,N=4,b=h.right-f;b<10&&(b=h.left),b+f>g-10&&(b=g-f-10);let k=w-h.bottom,C=h.top,M;k>=T+N?M=h.bottom+N:C>=T+N?M=h.top-T-N:M=k>=C?h.bottom+N:Math.max(10,h.top-T-N),c({top:M,left:b}),n(true);};react.useEffect(()=>{let h=w=>{p.current&&!p.current.contains(w.target)&&!s.current?.contains(w.target)&&n(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=w=>{w.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let u=h=>{t(h),n(false);},x=i(),v=x.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:s,onClick:()=>o?n(false):d(),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:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:x.label,children:jsxRuntime.jsx(Ei,{icon:x.icon,color:v})}),o&&jsxRuntime.jsx(ze,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.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(h=>jsxRuntime.jsxs("button",{onClick:()=>u(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ei,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Mi({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,l]=react.useState(false),[c,p]=react.useState(false),[s,m]=react.useState(e),[i,d]=react.useState({top:0,left:0}),u=react.useRef(null),x=react.useRef(null),v=react.useRef(null);react.useEffect(()=>{if(n&&x.current){let f=x.current.getBoundingClientRect();d({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=T=>{u.current&&!u.current.contains(T.target)&&!x.current?.contains(T.target)&&(l(false),p(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&(l(false),p(false),m(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),react.useEffect(()=>{c&&v.current&&(v.current.focus(),v.current.select());},[c]);let h=()=>{p(true),m(e);},w=()=>{let f=s.trim();f&&f!==e&&t(f),p(false),l(false),m(e);},g=f=>{f.key==="Enter"?w():f.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:x,onClick:()=>l(!n),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"})]})}),n&&jsxRuntime.jsx(ze,{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:v,type:"text",value:s,onChange:f=>m(f.target.value),onKeyDown:g,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"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(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var lr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:l,onCardUpdate:c,availableUsers:p,allCards:s,enableVirtualization:m,cardHeight:i=120,isCollapsed:d,onToggleCollapse:u,onColumnRename:x,onColumnDelete:v,isDeletable:h=false,className:w})=>{let{setNodeRef:g,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),N=m??ai(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>i,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:g,className:w,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let A=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:A}:A>=80?{state:"warning",percentage:A}:A>=60?{state:"approaching",percentage:A}:{state:"ok",percentage:A}})(),M=C.state==="exceeded",y=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:g,className:P("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",w),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:P(y()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),C.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),C.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),C.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(x||v)&&jsxRuntime.jsx(Mi,{columnTitle:e.title,onRename:A=>x?.(e.id,A),onDelete:v?()=>v(e.id):void 0,isDeletable:h}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),!d&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(A=>A.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):N?jsxRuntime.jsx("div",{style:{height:`${b.getTotalSize()}px`,position:"relative"},children:b.getVirtualItems().map(A=>{let O=t[A.index];return O?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${A.start}px)`},children:jsxRuntime.jsx(Na,{card:O,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:s})},O.id):null})}):t.map(A=>jsxRuntime.jsx(Na,{card:A,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:s},A.id))})})]})});lr.displayName="Column";function ln({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=n.trim();m&&m!==e?t(m):l(e),o(false);},s=m=>{m.key==="Enter"?p():m.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:n,onChange:m=>l(m.target.value),onBlur:p,onKeyDown:s,className:P("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:P("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function cn(){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 La({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:l,style:c,isLoading:p,error:s,children:m}){let[i,d]=cn(),u=o?.theme||"dark",v=u==="dark"||u==="neutral"?"dark":"",h=react.useCallback((y,A)=>{t.onCardUpdate?.(y,A);},[t]),w=react.useCallback((y,A)=>{t.onColumnUpdate?.(y,{title:A});},[t]),g=react.useCallback(y=>{t.onColumnDelete?.(y);},[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})),N=react.useMemo(()=>{let y=new Map;return e.columns.forEach(A=>{let O=A.cardIds.map(B=>e.cards.find($=>$.id===B)).filter(B=>B!==void 0).sort((B,$)=>B.position-$.position);y.set(A.id,O);}),y},[e.cards,e.columns]),b=react.useCallback(y=>{let{active:A}=y,O=e.cards.find(B=>B.id===A.id);O&&d({isDragging:true,draggedCardId:O.id,sourceColumnId:O.columnId,targetColumnId:O.columnId});},[e.cards,d]),k=react.useCallback(y=>{let{active:A,over:O}=y;if(!O||!e.cards.find(V=>V.id===A.id))return;let $=null;O.data.current?.type==="column"?$=O.id:O.data.current?.type==="card"&&($=e.cards.find(ne=>ne.id===O.id)?.columnId||null),$&&$!==i.targetColumnId&&d({...i,targetColumnId:$});},[e.cards,i,d]),C=react.useCallback(async y=>{let{active:A,over:O}=y;if(d({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!O)return;let B=e.cards.find(ce=>ce.id===A.id);if(!B)return;let $,V;if(O.data.current?.type==="column"){$=O.id;let ce=N.get($)||[];V=Zo(ce,0);}else {let ce=e.cards.find(fe=>fe.id===O.id);if(!ce)return;$=ce.columnId;let Ae=N.get($)||[],Me=Ae.findIndex(fe=>fe.id===O.id);V=Zo(Ae,Me);}let ne=e.columns.find(ce=>ce.id===$);if(ne&&ne.wipLimit&&ne.wipLimitType==="hard"){let ce=N.get($)||[];if(B.columnId!==$&&ce.length>=ne.wipLimit){t.onWipLimitExceeded?.(ne,B);return}}(B.columnId!==$||B.position!==V)&&await t.onCardMove?.(B.id,$,V);},[e.cards,e.columns,N,t,d]),M=react.useCallback(y=>{a?.(y);},[a]);return p?jsxRuntime.jsx("div",{className:P("asakaa-board",v,l),style:c,children:jsxRuntime.jsx(kp,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:P("asakaa-board",v,l),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 s=="string"?s:s.message})]})})}):jsxRuntime.jsx(ui,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:b,onDragOver:k,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:P("asakaa-board",v,l),style:c,"data-theme":u,children:[e.columns.sort((y,A)=>y.position-A.position).map(y=>{let A=N.get(y.id)||[],O=!f.includes(y.id);return jsxRuntime.jsx(lr,{column:y,cards:A,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:M,onCardUpdate:h,onColumnRename:w,onColumnDelete:g,isDeletable:O,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},y.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(Na,{card:e.cards.find(y=>y.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function kp({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 Dp={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)"},Sp={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)"},Ep={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Pp={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Mp({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,l]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let s=m=>{c.current&&!c.current.contains(m.target)&&l(false);};return n&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]);let p=s=>{t(s),l(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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((s,m)=>s.position-m.position).map((s,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(s.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:s.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:s.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[s.cardIds.length," ",s.cardIds.length===1?"tarea":"tareas"]})]})]},s.id))]})})})]})}function Ip({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,l]=react.useState(false),[c,p]=react.useState(null),s=react.useRef(null);if(react.useEffect(()=>{let u=x=>{s.current&&!s.current.contains(x.target)&&l(false);};return n&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),!(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),d=async(u,x)=>{if(x){p(u);try{await x();}catch(v){console.error(`Export ${u} failed:`,v);}finally{p(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(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:x<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children: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 Ap({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 mn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:l,onExportJSON:c,onExportExcel:p,translations:s}){let m=r==="dark"?Dp:Sp,i={...o==="es"?Ep:Pp,...s},d=l||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:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ip,{theme:m,t:i,onExportCSV:l,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(n?jsxRuntime.jsx(Mp,{columns:e,onSelect:t,theme:m,t:i,createTaskLabel:a}):jsxRuntime.jsx(Ap,{onClick:()=>t(),label:a||i.newTask}))]})})}function gn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,l]=react.useState(false),[c,p]=react.useState(""),s=react.useCallback(()=>{let d=c.trim();d&&(e(d),p(""),l(false));},[c,e]),m=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),s()):d.key==="Escape"&&(p(""),l(false));},[s]),i=react.useCallback(()=>{setTimeout(()=>{c.trim()||l(false);},150);},[c]);return n?jsxRuntime.jsx("div",{className:P("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:d=>p(d.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:s,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(""),l(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:P("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(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 fn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:l=false,theme:c="dark",locale:p="es"}){let[s,m]=react.useState(false),[i,d]=react.useState(false),[u,x]=react.useState(""),[v,h]=react.useState([]),[w,g]=react.useState(""),[f,T]=react.useState(""),[N,b]=react.useState(""),[k,C]=react.useState(false),[M,y]=react.useState(false),[A,O]=react.useState(false),B=react.useRef(null),$=react.useRef(null),V={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(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"},ne=react.useCallback(()=>{x(""),h([]),g(""),T(""),b(""),C(false),y(false),O(false),m(false);},[]);react.useEffect(()=>{s&&B.current&&B.current.focus();},[s]),react.useEffect(()=>{if(!s)return;let E=I=>{$.current&&!$.current.contains(I.target)&&(u.trim()||ne());};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[s,u,ne]);let ce=react.useCallback(async()=>{let E=u.trim();if(!(!E||i)){d(true);try{await t({name:E,columnId:e,assigneeIds:v.length>0?v:void 0,startDate:w?new Date(w):void 0,endDate:f?new Date(f):void 0,priority:N||void 0}),x(""),h([]),g(""),T(""),b(""),C(!1),y(!1),O(!1),B.current?.focus();}catch(I){console.error("Error creating card:",I);}finally{d(false);}}},[u,e,v,w,f,N,t,i]),Ae=react.useCallback(E=>{E.key==="Enter"&&!E.shiftKey?(E.preventDefault(),ce()):E.key==="Escape"&&ne();},[ce,ne]),Me=react.useCallback(E=>{h(I=>I.includes(E)?I.filter(S=>S!==E):[...I,E]);},[]),fe=c==="dark";return s?jsxRuntime.jsxs("div",{ref:$,className:P("rounded-lg overflow-hidden shadow-lg",fe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:B,type:"text",value:u,onChange:E=>x(E.target.value),onKeyDown:Ae,placeholder:V.placeholder,disabled:i,className:P("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",fe?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!k),className:P("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||v.length>0?"bg-emerald-500/20 text-emerald-400":fe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:V.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"})]}),v.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:v.length})]}),jsxRuntime.jsx("button",{onClick:()=>y(!M),className:P("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||w||f?"bg-blue-500/20 text-blue-400":fe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:V.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:()=>O(!A),className:P("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":fe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:V.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:ce,disabled:!u.trim()||i,className:P("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"}):V.save})]})]}),k&&a.length>0&&jsxRuntime.jsx("div",{className:P("px-3 pb-3 pt-0","border-t",fe?"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:()=>Me(E.id),className:P("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",v.includes(E.id)?"bg-emerald-500 text-white":fe?"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:P("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",v.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:P("px-3 pb-3 pt-0","border-t",fe?"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:P("block text-[10px] uppercase tracking-wide mb-1",fe?"text-gray-500":"text-gray-400"),children:V.startDate}),jsxRuntime.jsx("input",{type:"date",value:w,onChange:E=>g(E.target.value),className:P("w-full px-2 py-1.5 rounded text-xs border",fe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:P("block text-[10px] uppercase tracking-wide mb-1",fe?"text-gray-500":"text-gray-400"),children:V.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:E=>T(E.target.value),className:P("w-full px-2 py-1.5 rounded text-xs border",fe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),A&&jsxRuntime.jsx("div",{className:P("px-3 pb-3 pt-0","border-t",fe?"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:()=>b(N===E?"":E),className:P("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===E?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[E]} text-white`:fe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:V[E]},E))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:l,className:P("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",fe?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"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:V.buttonLabel})]})}var Ar=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(La,{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(n=>n.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,n)=>{r.toBlob(l=>{l?o(l):n(new Error("Failed to create PNG blob"));},"image/png");})}};function Hi(e={}){return new Ar(e)}var dr=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:l}=this.props;return a&&r?n?n(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:l?`Error in ${l}`:"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 bn(e,t){let a=r=>jsxRuntime.jsx(dr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function vn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:l,onPredictRisks:c,onOpenAIUsage:p,shortcut:s="k",className:m=""}){let[i,d]=react.useState(false),[u,x]=react.useState(""),[v,h]=react.useState("home"),[w,g]=react.useState(""),[f,T]=react.useState("");react.useEffect(()=>{let C=M=>{(M.metaKey||M.ctrlKey)&&M.key===s&&(M.preventDefault(),d(y=>!y)),M.key==="Escape"&&(d(false),h("home"),x(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]),react.useEffect(()=>{i||(h("home"),x(""),g(""),T(""));},[i]);let N=react.useCallback(()=>{d(false);},[]),b=react.useCallback(C=>{let[M,y]=C.split(":");switch(M){case "create-card":h("create-card");break;case "create-card-in":g(y||"");break;case "navigate":y?(a?.(y),N()):h("navigate");break;case "search":r?.(u),N();break;case "priority":h("priority");break;case "set-priority":f&&y&&(o?.(f,y),N());break;case "assign":h("assign");break;case "assign-user":f&&y&&(n?.(f,y),N());break;case "ai":h("ai");break;case "ai-generate-plan":l?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":p?.(),N();break;case "back":h("home");break;}},[u,f,t,a,r,o,n,l,c,p,N]),k=react.useCallback(()=>{w&&u.trim()&&(t?.(w,u.trim()),N());},[w,u,t,N]);return i?jsxRuntime.jsx(ze,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:x,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:v==="create-card"&&w?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&w&&k();}}),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."}),v==="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:b,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:b,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:b,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:b,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},C.id))})]}),v==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),v==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(C=>{let M=e.columns.find(y=>y.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:b,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:M?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(y=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:y},y))})]},C.id)})})]}),v==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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:b,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:b,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:b,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function zp(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Wp(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 Up(e){return e.startsWith("image/")}function Fr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[l,c]=react.useState(false),[p,s]=react.useState(false),[m,i]=react.useState(null),d=react.useRef(null),u=react.useCallback(b=>{let k=[],C=[];return e.length+b.length>n?(C.push(`Maximum ${n} files allowed`),{valid:k,errors:C}):(b.forEach(M=>{if(M.size/1048576>r){C.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some(A=>M.type.match(A))){C.push(`${M.name} has invalid file type`);return}k.push(M);}),{valid:k,errors:C})},[e.length,n,r,o]),x=react.useCallback(async b=>{let{valid:k,errors:C}=u(b);if(C.length>0){i(C.join(", ")),setTimeout(()=>i(null),5e3);return}if(k.length!==0){s(true),i(null);try{await t?.(k);}catch(M){i(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{s(false);}}},[u,t]),v=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(true);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(false);},[]),w=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),g=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(false);let k=Array.from(b.dataTransfer.files);x(k);},[x]),f=react.useCallback(b=>{let k=b.target.files?Array.from(b.target.files):[];x(k),d.current&&(d.current.value="");},[x]),T=react.useCallback(()=>{d.current?.click();},[]),N=react.useCallback(b=>{confirm("Are you sure you want to delete this attachment?")&&a?.(b);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:w,onDrop:g,onClick:T,children:[jsxRuntime.jsx("input",{ref:d,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:l?"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,"/",n," 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(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Up(b.type)&&b.url?jsxRuntime.jsx("img",{src:b.thumbnailUrl||b.url,alt:b.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Wp(b.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:b.name,children:b.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:zp(b.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(b.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>N(b.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"})})})]},b.id))})]})}function xn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:s=[],onAddComment:m,onDeleteComment:i,onUploadAttachments:d,onDeleteAttachment:u,onSuggestAssignee:x,onGenerateSubtasks:v,onEstimateEffort:h,currentUserId:w="user-1"}){let[g,f]=react.useState("details"),[T,N]=react.useState(false),[b,k]=react.useState({}),[C,M]=react.useState(""),[y,A]=react.useState(false),[O,B]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{N(false),k({}),f("details"),M(""),B({}),a();},[a]),V=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),k({}),N(false));},[e.id,b,r]),ne=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),ce=react.useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),M(""));},[e.id,C,m]),Ae=react.useCallback(async()=>{if(x){A(true);try{let S=await x(e);B(W=>({...W,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{A(false);}}},[e,x]),Me=react.useCallback(async()=>{if(v){A(true);try{let S=await v(e);B(W=>({...W,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{A(false);}}},[e,v]),fe=react.useCallback(async()=>{if(h){A(true);try{let S=await h(e);B(W=>({...W,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{A(false);}}},[e,h]),E={...e,...b},I=n.filter(S=>E.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(ze,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:b.title??E.title,onChange:S=>k({...b,title:S.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:V,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ne,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 ${g==="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 ${g==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${g==="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 ${g==="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",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${g==="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:[g==="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:b.description??E.description??"",onChange:S=>k({...b,description:S.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:b.assignedUserIds??E.assignedUserIds??[],onChange:S=>{let W=Array.from(S.target.selectedOptions,j=>j.value);k({...b,assignedUserIds:W});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:I.length>0?I.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),T?jsxRuntime.jsxs("select",{value:b.priority??E.priority??"",onChange:S=>k({...b,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background: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(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),T?jsxRuntime.jsx("input",{type:"date",value:b.startDate?new Date(b.startDate).toISOString().split("T")[0]:E.startDate?new Date(E.startDate).toISOString().split("T")[0]:"",onChange:S=>k({...b,startDate:S.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:b.endDate?new Date(b.endDate).toISOString().split("T")[0]:E.endDate?new Date(E.endDate).toISOString().split("T")[0]:"",onChange:S=>k({...b,endDate:S.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:b.estimatedTime??E.estimatedTime??"",onChange:S=>k({...b,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children: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(S=>{let W=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",W.slice(-4)]},W)}):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"})]})]}),g==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:S=>M(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ce,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(S=>{let W=n.find(j=>j.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[W&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:W.color},children:W.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:W?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),g==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(S=>{let W=n.find(j=>j.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:W?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),g==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Fr,{cardId:e.id,attachments:s,onUpload:d?S=>d(e.id,S):void 0,onDelete:u,currentUserId:w,maxSizeMB:10,maxFiles:20})}),g==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:y||!x,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:Me,disabled:y||!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("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:fe,disabled:y||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),O.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),O.assignees.map((S,W)=>{let j=n.find(K=>K.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[j&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:j.color},children:j.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:j?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},W)})]}),O.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),O.subtasks.map((S,W)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},W))]}),O.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:[O.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(O.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!O.assignees&&!O.subtasks&&!O.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 Br({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),s=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let i=e.current.getBoundingClientRect(),d=window.innerHeight,u=window.innerWidth,x=4,v=i.left;v+o>u-10&&(v=u-o-10),v<10&&(v=10);let h=d-i.bottom,w=i.top,g;return h>=n+x?g=i.bottom+x:w>=n+x?g=i.top-n-x:h>=w?g=i.bottom+x:g=Math.max(10,i.top-n-x),{top:g,left:v}},[e,o,n]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let i=u=>{let x=u.target;s.current&&!s.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},d=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(d),document.removeEventListener("mousedown",i);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let i=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsxRuntime.jsx(ze,{children:jsxRuntime.jsx("div",{ref:s,className:`smart-popover ${l}`,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 qp=["LOW","MEDIUM","HIGH","URGENT"],Xp=["todo","in-progress","review","done"];function Cn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:s,currentUser:m,onAIGenerateDescription:i,onAICreateSubtasks:d,onAIFindSimilar:u,availableColumns:x=[],availableLabels:v=[],onUploadCoverImage:h,unsplashAccessKey:w,theme:g,onSubtasksChange:f}){let T=nr(),N=g||T?.themeName||"dark",[b,k]=react.useState(e),[C,M]=react.useState(false),[y,A]=react.useState(e?.subtasks||[]),[O,B]=react.useState(false),[$,V]=react.useState(""),[ne,ce]=react.useState(""),[Ae,Me]=react.useState("all"),[fe,E]=react.useState(false),[I,S]=react.useState(false),[W,j]=react.useState(false),[K,he]=react.useState(false),[ve,_e]=react.useState(false),[me,Xe]=react.useState(false),Ye=react.useRef(null),Mt=react.useRef(null),Jt=react.useRef(null),zt=react.useRef(null),It=react.useRef(null),At=react.useRef(null),St=react.useRef(null),fa=react.useRef(null),mt=react.useRef(null),ot=react.useRef(null),Lt=react.useRef(null),Ca=react.useRef(null);react.useEffect(()=>{e&&!b?(k({...e}),A(e.subtasks||[])):e&&b&&e.id!==b.id&&(k({...e}),A(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let L=J=>{let Ne=J.target;zt.current&&!zt.current.contains(Ne)&&E(false),It.current&&!It.current.contains(Ne)&&S(false),At.current&&!At.current.contains(Ne)&&j(false),St.current&&!St.current.contains(Ne)&&he(false);};if(fe||I||W||K)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[fe,I,W,K]),react.useEffect(()=>{if(!t)return;let L=J=>{let Ne=J.target,qe=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(J.key==="Escape"){J.preventDefault(),fe||I||W||K||ve||me?(E(false),S(false),j(false),he(false),_e(false),Xe(false)):qe||a();return}if(qe&&J.key!=="Escape")return;let de=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),E(true);break;case "a":J.preventDefault(),j(true);break;case "p":J.preventDefault(),S(true);break;case "l":J.preventDefault(),he(true);break;case "d":de||(J.preventDefault(),_e(true),setTimeout(()=>fa.current?.focus(),0));break;case "e":de||(J.preventDefault(),Xe(true));break;case "i":J.preventDefault(),M(true),setTimeout(()=>Mt.current?.focus(),0);break;case "t":J.preventDefault(),B(true);break;case "c":J.preventDefault(),Jt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,fe,I,W,K,ve,me]);let se=react.useCallback(L=>{let J=L.currentTarget.textContent?.trim()||"";if(b&&J!==b.title){let Ne={...b,title:J};k(Ne),r?.(b.id,{title:J});}},[b,r]),xe=react.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=b?.title||"",L.currentTarget.blur());},[b]),_t=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),M(false);},[b,e,r]),ba=react.useCallback(L=>{if(b){let J={...b,columnId:L};k(J),r?.(b.id,{columnId:L}),E(false);}},[b,r]),xt=react.useCallback(L=>{if(b){let J={...b,priority:L};k(J),r?.(b.id,{priority:L}),S(false);}},[b,r]),ha=react.useCallback(L=>{if(b){let J=b.assignedUserIds||[],Ne=J.includes(L)?J.filter(de=>de!==L):[...J,L],qe={...b,assignedUserIds:Ne};k(qe),r?.(b.id,{assignedUserIds:Ne});}},[b,r]),va=react.useCallback(L=>{if(b){let J=b.labels||[],Ne=J.includes(L)?J.filter(de=>de!==L):[...J,L],qe={...b,labels:Ne};k(qe),r?.(b.id,{labels:Ne});}},[b,r]),Ce=react.useCallback(L=>{if(b){let J=L.target.value,Ne={...b,endDate:J};k(Ne),r?.(b.id,{endDate:J}),_e(false);}},[b,r]),Te=react.useCallback(L=>{if(b){let J={...b,estimatedTime:parseFloat(L)||0};k(J),r?.(b.id,{estimatedTime:parseFloat(L)||0});}},[b,r]),ut=react.useCallback(()=>{if($.trim()&&b){let L={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},J=[...y,L];A(J),V(""),B(false),f?.(b.id,J);}},[$,y,b,f]),te=react.useCallback(L=>{let J=y.map(Ne=>Ne.id===L?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);A(J),b&&f?.(b.id,J);},[y,b,f]),ke=react.useCallback(L=>{let J=y.filter(Ne=>Ne.id!==L);A(J),b&&f?.(b.id,J);},[y,b,f]),F=react.useCallback(()=>{ne.trim()&&b&&p&&(p(b.id,ne.trim()),ce(""));},[ne,b,p]),U=react.useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),F());},[F]),ie=L=>jsxRuntime.jsx(jp__default.default,{remarkPlugins:[Kp__default.default],rehypePlugins:[Yp__default.default],components:{a:({node:J,...Ne})=>jsxRuntime.jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:L}),pe=c.filter(L=>Ae==="comments"?L.type.includes("COMMENT"):Ae==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let q=b||e,le=n.filter(L=>q.assignedUserIds?.includes(L.id)),X=y.filter(L=>L.completed).length;return jsxRuntime.jsx(ze,{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:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ye,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:se,onKeyDown:xe,children:q.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:zt,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>E(!fe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("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:q.columnId||"No status"})]}),jsxRuntime.jsx(Br,{triggerRef:mt,isOpen:fe,onClose:()=>E(false),width:250,estimatedHeight:200,children:(x.length>0?x:Xp.map(L=>({id:L,title:L}))).map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===L.id?"active":""}`,onClick:()=>ba(L.id),children:L.title},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:At,children:[jsxRuntime.jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>j(!W),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:le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:le.map(L=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Br,{triggerRef:ot,isOpen:W,onClose:()=>j(false),width:280,estimatedHeight:300,children:n.map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ha(L.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,q.assignedUserIds?.includes(L.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"})})]},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:It,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>S(!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:q.priority||"None"})]}),jsxRuntime.jsxs(Br,{triggerRef:Lt,isOpen:I,onClose:()=>S(false),width:180,estimatedHeight:220,children:[qp.map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${q.priority===L?"active":""}`,onClick:()=>xt(L),children:L},L)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>xt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:St,children:[jsxRuntime.jsxs("button",{ref:Ca,className:"modal-v2-field",onClick:()=>he(!K),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:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Br,{triggerRef:Ca,isOpen:K,onClose:()=>he(false),width:220,estimatedHeight:200,children:(v.length>0?v:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(L)?"active":""}`,onClick:()=>va(L),children:[L,q.labels?.includes(L)&&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"})})]},L))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{_e(!ve),setTimeout(()=>fa.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:q.endDate?new Date(q.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:fa,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let L=new Date(q.endDate),J=L.getUTCFullYear(),Ne=String(L.getUTCMonth()+1).padStart(2,"0"),qe=String(L.getUTCDate()).padStart(2,"0");return `${J}-${Ne}-${qe}`})():"",onChange:Ce,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!me),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:q.estimatedTime?`${q.estimatedTime}h`:"Not set"})]}),me&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:L=>Te(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),C?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:L=>{if(b){let J={...b,description:L.target.value};k(J);}},onBlur:_t,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>M(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:ie(q.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"}),y.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[X,"/",y.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>B(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:[y.map(L=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>te(L.id),children:L.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:L.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ke(L.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"})]})})]},L.id)),O&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:L=>V(L.target.value),onKeyDown:L=>{L.key==="Enter"&&ut(),L.key==="Escape"&&(B(false),V(""));},onBlur:ut,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="all"?"active":""}`,onClick:()=>Me("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="comments"?"active":""}`,onClick:()=>Me("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="history"?"active":""}`,onClick:()=>Me("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:Jt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ne,onChange:L=>ce(L.target.value),onKeyDown:U,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:F,disabled:!ne.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[pe.map(L=>{let J=n.find(qe=>qe.id===L.userId);if(L.type.includes("COMMENT")){let qe=l.find(de=>de.id===L.metadata?.commentId);return qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[J&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:J?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:qe.content})]})]},L.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:J?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),pe.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 nm({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 Nn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(l=>({...l,average:l.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:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(nm,{})}),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((l,c)=>l+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((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.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((l,c)=>l+(c.planned||0),0)})]})]})]})}function gm({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 Dn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=n>0?(n-l)/n*100:0,s=l<=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(gm,{})}),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:s?"#10B981":"#EF4444",fill:s?"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:s?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:s?"#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:s?"#10B981":"#EF4444"},children:l})]}),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:s?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:s?"#10B981":"#EF4444"},children:s?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Cm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Qi=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Tm({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function el({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 Sn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((p,s)=>p+s.value,0),l=e.map(p=>({...p,totalValue:n,color:p.color||Cm[p.name]||Qi[e.indexOf(p)%Qi.length]})),c=l.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:l,cx:"50%",cy:"50%",labelLine:false,label:o?Tm:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(el,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,s)=>{let m=s.payload,i=n>0?(m.value/n*100).toFixed(0):"0";return `${p} (${m.value} - ${i}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,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(el,{})}),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:l.map((p,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))})]})}),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:n})]}),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,s)=>s.value>p.value?s:p).name})]})]})]})}var mo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[l,c]=react.useState(false),[p,s]=react.useState(false),[m,i]=react.useState(false),[d,u]=react.useState(false);if(e.length===0)return null;let x=e.map(T=>T.id),v=T=>{r.onBulkUpdate?.(x,{priority:T}),c(false);},h=T=>{r.onBulkMove?.(x,T),s(false),a();},w=T=>{r.onBulkUpdate?.(x,{assignedUserIds:T}),i(false);},g=T=>{let N=new Set;e.forEach(k=>{k.labels?.forEach(C=>N.add(C));});let b=Array.from(new Set([...N,...T]));r.onBulkUpdate?.(x,{labels:b}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),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(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(T),children:[jsxRuntime.jsx("span",{className:P("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:()=>s(!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:()=>h(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:()=>w([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))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([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"})})]})]})})});mo.displayName="BulkOperationsToolbar";function Pm(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,l,c,p,s;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let x=a?.find(v=>v.id===u);l=`assignee-${u}`,c=x?.name||`User ${u}`,p=x?.color,s=x?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:s}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",s="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:s}),r.get(l).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",l=`priority-${n}`;let d={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"}}[n];c=d.title,p=d.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:n,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function En({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,l]=react.useState(new Set),c=react.useMemo(()=>Pm(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(s=>{l(m=>{let i=new Set(m);return i.has(s)?i.delete(s):i.add(s),i});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(La,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:P("asakaa-swimlane-view",o),children:[c.map(s=>{let m=n.has(s.id),i=e.cards.filter(u=>s.cardIds.includes(u.id)),d={...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(s.id),style:{borderLeft:s.color?`4px solid ${s.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[s.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:s.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:s.color},children:s.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",s.cardIds.length," ",s.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(La,{board:d,callbacks:r,availableUsers:a})})]},s.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 Pn=[{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 Mn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=Pn.find(s=>s.value===e)||Pn[0];react.useEffect(()=>{function s(m){n.current&&!n.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let p=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:P("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,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:P("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:n,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:Pn.map(s=>jsxRuntime.jsxs("button",{onClick:()=>p(s.value),className:P("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===s.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:s.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:s.label}),e===s.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:s.description})]})]},s.value))})]})]})}var Rr=[{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 Am(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(s=>e.key===s||e.code===s))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return n&&l&&c&&p}function nl(e={}){let{shortcuts:t=Rr,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(s=>s.action!==p);},[]);return react.useEffect(()=>{function p(s){if(!n.current)return;let m=s.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let i of o.current)if(Am(s,i)){r&&s.preventDefault();let d=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function Fm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Bm(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 Rm(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Bm(e),r=t?Fm(t):"";return a?`${a} + ${r}`:r}function Om(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 In({shortcuts:e=Rr,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(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 l=Om(e);return jsxRuntime.jsxs("div",{className:P("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 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(l).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(s=>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:s.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:Rm(s)})]},s.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 An=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
6
6
|
1.
|
|
7
7
|
|
|
8
8
|
**Expected behavior:**
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function In({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function i(m){n.current&&!n.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,m)=>{let s=m.category||"Other";return i[s]||(i[s]=[]),i[s].push(m),i},{});return jsxRuntime.jsxs("div",{className:B("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:B("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:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,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:i})}),jsxRuntime.jsx("div",{children:m.map(s=>jsxRuntime.jsxs("button",{onClick:()=>d(s),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:s.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:s.name}),s.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:s.description})]})]},s.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ln({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,d]=react.useState("export"),[c,i]=react.useState("json"),[m,s]=react.useState(null),p=react.useRef(null);if(!t)return null;let u=async()=>{let k=o?.current||void 0,h=await oi(e,c,k);ni(h,c);},y=async k=>{let h=k.target.files?.[0];if(h){try{let w=await li(h),f=h.name.endsWith(".json")?"json":"csv",g=ii(w,f);s(g),g.success&&r&&r(g,w);}catch(w){s({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:B("fixed inset-0 z-[9999] flex items-center justify-center",n),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:B("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:B("flex-1 px-6 py-4 font-semibold transition-colors",l==="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:[l==="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(k=>jsxRuntime.jsxs("button",{onClick:()=>i(k),className:B("p-4 rounded-lg border-2 transition-all text-center",c===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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"})]}),l==="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:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.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:B("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:B("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((k,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},h))})]})]})]})]})]})}var Om=["URGENT","HIGH","MEDIUM","LOW"],$m=[{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"}],zm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Fn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:m=[],showQuickFilters:s=true,compact:p=false,groupBy:u="none",onGroupByChange:y}){let[k,h]=react.useState(true),w=react.useCallback(b=>{a({search:b.target.value});},[a]),f=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),g=react.useCallback(b=>{r({by:b.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 ${p?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:k?"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)"]})]}),!k&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[s&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:w,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:f,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:b=>{let x=b.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Om.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let x=b.target.value;a({assignees:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let x=b.target.value;a({labels:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:$m.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.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:b=>y(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:zm.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Bn({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,m]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let u=y=>{s.current&&!s.current.contains(y.target)&&m(false);};return i&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[i]);let p=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:B("relative",r),ref:s,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(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:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>p(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("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:()=>p(()=>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("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:()=>p(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:()=>p(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 Rn={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"}},On={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"}},$n={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"}},qa={dark:Rn,light:On,neutral:$n},uo="dark";var go=react.createContext(void 0),qm="asakaa-theme";function sl({children:e,defaultTheme:t=uo,storageKey:a=qm}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),n=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=qa[r];Object.entries(c.colors).forEach(([m,s])=>{s&&d.style.setProperty(`--theme-${Xm(m)}`,s);}),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,s])=>{let p=c.colors[m];p&&d.style.setProperty(s,p);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:qa};return jsxRuntime.jsx(go.Provider,{value:l,children:e})}function ur(){let e=react.useContext(go);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Xm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function zn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ur();return e?jsxRuntime.jsxs("div",{className:B("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(qa).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:B("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}var Me={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 il(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Me[e]||Me.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Me[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Me[e].bgSecondary),bgGrid:r("--theme-bg-card",Me[e].bgGrid),bgWeekend:r("--theme-bg-hover",Me[e].bgWeekend),border:r("--theme-border-primary",Me[e].border),borderLight:r("--theme-border-subtle",Me[e].borderLight),textPrimary:r("--theme-text-primary",Me[e].textPrimary),textSecondary:r("--theme-text-secondary",Me[e].textSecondary),textTertiary:r("--theme-text-tertiary",Me[e].textTertiary),accent:r("--theme-accent-primary",Me[e].accent),accentHover:r("--theme-accent-hover",Me[e].accentHover),accentLight:r("--theme-accent-primary",Me[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Me[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Me[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Me[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Me[e].dependency),dependencyHover:r("--theme-border-secondary",Me[e].dependencyHover),criticalPath:r("--theme-error",Me[e].criticalPath),criticalPathLight:r("--theme-error",Me[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Me[e].today):e==="neutral"?r("--theme-text-primary",Me[e].today):r("--theme-error",Me[e].today),todayLight:e==="light"?r("--theme-accent-primary",Me[e].todayLight):e==="neutral"?r("--theme-text-primary",Me[e].todayLight):r("--theme-error",Me[e].todayLight),milestone:r("--theme-warning",Me[e].milestone),milestoneLight:r("--theme-warning",Me[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Me[e].statusTodo),statusInProgress:r("--theme-accent-primary",Me[e].statusInProgress),statusCompleted:r("--theme-success",Me[e].statusCompleted),hoverBg:r("--theme-bg-hover",Me[e].hoverBg),focusRing:r("--theme-accent-primary",Me[e].focusRing)}}var fo={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"}},ll={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"}},Wn={en:fo,es:ll};function dl(e){return Wn[e]||Wn.en}function Gn(e,t){let a=dl(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 fr=react.createContext(fo);function Or(){return react.useContext(fr)}function uu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[d,c]=react.useState(false),[i,m]=react.useState(null),s=react.useRef(null),p=Or();if(react.useEffect(()=>{let h=w=>{s.current&&!s.current.contains(w.target)&&c(false);};return d&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[d]),!(t||a||r||o||n||l))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:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(h=>h.handler),k=async(h,w)=>{if(w){m(h);try{await w();}catch(f){console.error(`Export ${h} failed:`,f);}finally{m(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&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((h,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.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:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function gu({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(n=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.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:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function fu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 bu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=Or();react.useEffect(()=>{let i=m=>{n.current&&!n.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],c=d.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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:`${l.toolbar.density||"Density"}: ${c}`,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:d.map((i,m)=>{let s=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:s?e.accentLight:"transparent",borderBottom:m<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:s?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:s?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},children:i.label}),s&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function bo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:m=false,createTaskLabel:s,onCreateTask:p,onExportPNG:u,onExportPDF:y,onExportExcel:k,onExportCSV:h,onExportJSON:w,onExportMSProject:f}){let g=Or(),T=u||y||k||h||w||f,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],b=[{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(fu,{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(bu,{theme:e,value:d,onChange:c})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,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:s||g.toolbar.createTask})]}),(T||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(uu,{theme:e,onExportPNG:u,onExportPDF:y,onExportExcel:k,onExportCSV:h,onExportJSON:w,onExportMSProject:f}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(gu,{options:b,value:n,onChange:x=>l(x),theme:e})]})]})}function ho({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),d=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=s=>{d.current&&!d.current.contains(s.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let i=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();l({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($e,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${n.x}px`,top:`${n.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(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:s=>{s.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:s=>{s.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 br({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null),[d,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,s=r.length*36+8,p=8,u=window.innerWidth,y=window.innerHeight,k=t,h=a;t+m+p>u&&(k=t-m,k<p&&(k=p)),a+s+p>y&&(h=y-s-p,h<p&&(h=p)),c({x:k,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=p=>{l.current&&!l.current.contains(p.target)&&o();},s=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",s);}},[e,o]),!e)return null;let i=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(n.bgSecondary),border:`1px solid ${n.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:n.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?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:s=>{m.disabled||(s.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:n.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:n.textTertiary}})]})]},m.id))})})})}var Qe={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 wl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:m,onOpenTaskModal:s,enableKeyboard:p=true}){let u=react.useRef(false),y=react.useCallback(g=>{u.current=g;},[]),k=react.useCallback(g=>{let T=[],D=b=>{for(let x of b)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&D(x.subtasks);};return D(g),T},[]),h=react.useCallback(()=>{let g=k(e);for(let T of g)if(t.has(T.id))return T;return null},[e,t,k]),w=react.useCallback((g,T)=>{let D=k(e);if(D.length===0)return;let b=h();if(!b){a(D[0].id,false);return}let x=D.findIndex(C=>C.id===b.id);if(x===-1)return;let v=g==="up"?x-1:x+1;if(v<0||v>=D.length)return;let P=D[v];a(P.id,T);},[e,h,k,a]),f=react.useCallback(g=>{if(!p)return;let T=g.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){g.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,v=Array.from(t),P=h();if(g.key==="ArrowUp"){g.preventDefault(),w("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),w("down",g.shiftKey);return}if(P&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){P.subtasks&&P.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!P.isExpanded||g.key==="ArrowLeft"&&P.isExpanded)&&m(P.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){v.length>0&&(g.preventDefault(),l(v,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){v.length>0&&(g.preventDefault(),d(v));return}if(g.key==="Tab"&&g.shiftKey){v.length>0&&(g.preventDefault(),c(v));return}if(g.key==="Enter"&&!g.shiftKey&&!x){P&&(g.preventDefault(),r(P.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!x){P&&(g.preventDefault(),r(P.id,"above"));return}if(g.key==="Enter"&&x){P&&(g.preventDefault(),s(P.id));return}if(g.key==="F2"){P&&(g.preventDefault(),i(P.id));return}if(g.key==="Delete"||g.key==="Backspace"&&x){v.length>0&&(g.preventDefault(),o(v));return}if(g.key==="d"&&x&&!g.shiftKey){v.length>0&&(g.preventDefault(),n(v));return}},[p,t,h,w,r,o,n,l,d,c,i,m,s]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[p,f]),{setIsEditing:y}}function Tl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(s=>{t(new Set([s])),r(s);},[]),n=react.useCallback(s=>{t(p=>{let u=new Set(p);return u.has(s)?u.delete(s):u.add(s),u}),r(s);},[]),l=react.useCallback((s,p)=>{if(!a){o(s);return}let u=p.indexOf(a),y=p.indexOf(s);if(u===-1||y===-1){o(s);return}let k=Math.min(u,y),h=Math.max(u,y),w=p.slice(k,h+1);t(new Set(w)),r(s);},[a,o]),d=react.useCallback((s,p,u,y)=>{y?l(s,p):u?n(s):o(s);},[o,n,l]),c=react.useCallback((s,p)=>{p?t(u=>{let y=new Set(u);return y.add(s),y}):o(s);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(s=>e.has(s),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:m}}function hr(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let d={...r[l],parentId:o,level:n,position:l};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,n+1);}};return a(e),t}function Dl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Dl(a.subtasks,t);if(r)return r}}return null}function _n(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=_n(a.subtasks,t);if(r)return r}return null}function Vn(e,t){if(t.length===0)return e;let a=hr(e),r=t[0],o=a.findIndex(s=>s.id===r);if(o<=0)return e;let n=a[o-1],l=(s,p)=>{let u=[];return {tasks:s.filter(k=>{if(p.has(k.id))return u.push(k),false;if(k.subtasks){let h=l(k.subtasks,p);k.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},d=(s,p,u)=>s.map(y=>y.id===p?{...y,subtasks:[...y.subtasks||[],...u],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,p,u)}:y),c=new Set(t),{tasks:i,removed:m}=l(e,c);return d(i,n.id,m)}function jn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=_n(a,r);if(!o)continue;let n=_n(a,o.id),l=(i,m,s)=>{for(let p=0;p<i.length;p++){let u=i[p];if(u.id===m&&u.subtasks){let y=u.subtasks.findIndex(k=>k.id===s);if(y!==-1){let[k]=u.subtasks.splice(y,1);return k}}if(u.subtasks){let y=l(u.subtasks,m,s);if(y)return y}}return null},d=(i,m,s)=>{let p=i.findIndex(u=>u.id===m);if(p!==-1)return i.splice(p+1,0,s),i;for(let u of i)u.subtasks&&d(u.subtasks,m,s);return i},c=l(a,o.id,r);c&&(n&&n.subtasks?d(n.subtasks,o.id,c):d(a,o.id,c));}return a}function Kn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,d,c)=>{let i=l.findIndex(s=>s.id===d);if(i===-1){for(let s of l)if(s.subtasks&&n(s.subtasks,d,c))return true;return false}let m=c==="up"?i-1:i+1;return m<0||m>=l.length?false:([l[i],l[m]]=[l[m],l[i]],true)};return n(r,o,a),r}function Yn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function qn(e,t){let a=[...e];for(let r of t){let o=l=>{let d=l.findIndex(m=>m.id===r);if(d===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let c=l[d],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?n(c.subtasks):void 0};return l.splice(d+1,0,i),true},n=l=>l.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?n(d.subtasks):void 0}));o(a);}return a}function Nl(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},d=c=>{let i=c.findIndex(s=>s.id===t);if(i===-1){for(let s of c)if(s.subtasks&&d(s.subtasks))return true;return false}let m=a==="above"?i:i+1;return c.splice(m,0,l),true};return d(r),{tasks:r,newTask:l}}function Xn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Xn(r.subtasks,t,a)}:r)}function Jn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Jn(a.subtasks,t)}:a)}function Zn(e,t){let a=m=>{for(let s of m){if(s.id===t)return s;if(s.subtasks){let p=a(s.subtasks);if(p)return p}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,d=r?.endDate||n,c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(d),color:r?.color||"#3B82F6"},i=m=>m.map(s=>{if(s.id===t){let p=s.subtasks||[];return {...s,subtasks:[...p,c],isExpanded:true}}return s.subtasks?{...s,subtasks:i(s.subtasks)}:s});return {tasks:i(e),newTask:c}}function Sl(e,t,a,r){if(t===a)return e;let o=Dl(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===i||d(m,i))return true;return false};if(d(o,a))return e}let n=d=>d.filter(c=>c.id!==t).map(c=>c.subtasks&&c.subtasks.length>0?{...c,subtasks:n(c.subtasks)}:c),l=n(e);if(a===null){let d=r!==void 0?r:l.length;l.splice(d,0,{...o,parentId:void 0});}else {let d=c=>c.map(i=>{if(i.id===a){let m=i.subtasks||[],s=r!==void 0?r:m.length,p=[...m];return p.splice(s,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});l=d(l);}return l}function xo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:m,onToggleColumn:s,onColumnResize:p,onTaskUpdate:u,onTaskIndent:y,onTaskOutdent:k,onTaskMove:h,onMultiTaskDelete:w,onTaskDuplicate:f,onTaskCreate:g,onTaskRename:T,onCreateSubtask:D,onOpenTaskModal:b,onDeleteRequest:x,onTaskReparent:v}){let P=react.useContext(fr),[C,L]=react.useState(null),[$,F]=react.useState(false),[O,_]=react.useState(null),[ae,pe]=react.useState(""),Le=react.useRef(null),Pe=react.useRef(null),[ne,S]=react.useState(null),[M,E]=react.useState(0),[U,K]=react.useState(0),[V,be]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[he,He]=react.useState(null),[me,qe]=react.useState(null),[Ke,Mt]=react.useState(null),Jt=react.useRef(0),zt=5,It=react.useRef(false);react.useEffect(()=>{function A(W){Le.current&&!Le.current.contains(W.target)&&F(false);}if($)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[$]),react.useEffect(()=>{O&&Pe.current&&(Pe.current.focus(),Pe.current.select());},[O]),react.useEffect(()=>{if(!ne)return;let A=ie=>{let ce=ie.clientX-M,Y=U+ce;p?.(ne,Y);},W=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,M,U,p]);let{selectedTaskIds:At,handleTaskClick:St,isTaskSelected:fa}=Tl(),{setIsEditing:mt}=wl({tasks:e,selectedTaskIds:At,onTaskSelect:(A,W)=>{let ce=hr(e).map(Y=>Y.id);St(A,ce,W||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:A=>{let W=hr(e).find(ie=>ie.id===A);W&&ve(W);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:A=>{let W=hr(e).find(ie=>ie.id===A);W&&b&&b(W);},enableKeyboard:true}),ot=(A,W=0)=>{let ie=[];for(let ce of A)ie.push({task:ce,level:W}),ce.subtasks&&ce.subtasks.length>0&&ce.isExpanded&&ie.push(...ot(ce.subtasks,W+1));return ie},Lt=ot(e),Ca=48,se=A=>!A.startDate||!A.endDate?"-":`${Math.ceil((A.endDate.getTime()-A.startDate.getTime())/(1e3*60*60*24))}d`,ve=A=>{_(A.id),pe(A.name),mt(true);},_t=A=>{ae.trim()&&ae!==e.find(W=>W.id===A)?.name&&T?.(A,ae.trim()),_(null),pe(""),mt(false);},ba=()=>{_(null),pe(""),mt(false);},xt=(A,W)=>{W.stopPropagation(),D?.(A.id);},ha=(A,W)=>{W.preventDefault(),Jt.current=W.clientY,He(A),It.current=false;},va=A=>{if(!he||(Math.abs(A.clientY-Jt.current)>zt&&(It.current=true),!It.current))return;let ie=document.querySelectorAll("[data-task-row]"),ce=null,Y=null;ie.forEach(le=>{let q=le.getBoundingClientRect(),I=le.getAttribute("data-task-row");if(I&&I!==he&&A.clientY>=q.top&&A.clientY<=q.bottom){ce=I;let X=A.clientY-q.top,Te=q.height;X<Te*.25?Y="above":X>Te*.75?Y="below":Y="child";}}),qe(ce),Mt(Y);},ke=()=>{if(It.current&&he&&me&&Ke){if(Ke==="child")v?.(he,me);else if(Ke==="above"||Ke==="below"){let A=(ce,Y,le=null)=>{for(let q of ce){if(q.id===Y)return le;if(q.subtasks){let I=A(q.subtasks,Y,q.id);if(I!==void 0)return I}}},W=A(e,me,null),ie=(ce,Y)=>{let le=ce.findIndex(q=>q.id===Y);return Ke==="below"?le+1:le};if(W===null){let ce=ie(e,me);v?.(he,null,ce);}else {let ce=Lt.find(Y=>Y.task.id===W)?.task;if(ce?.subtasks){let Y=ie(ce.subtasks,me);v?.(he,W,Y);}}}}He(null),qe(null),Mt(null),It.current=false;};react.useEffect(()=>{if(he)return document.addEventListener("mousemove",va),document.addEventListener("mouseup",ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",va),document.removeEventListener("mouseup",ke),document.body.style.cursor="",document.body.style.userSelect="";}},[he,me,Ke]);let Ce=(A,W,ie)=>{switch(A.id){case "name":let ce=O===W.id,Y=C===W.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ie*20}px`},children:[v&&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:Y?1:.3},onMouseDown:de=>ha(W.id,de),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),W.subtasks&&W.subtasks.length>0?jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),c?.(W.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:W.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"}),!(W.subtasks&&W.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:W.color||"#3B82F6",opacity:W.parentId?.6:1,borderColor:W.isMilestone?t.accent:"transparent",borderWidth:W.isMilestone?"2px":"0px"},title:W.isMilestone?"Milestone":W.parentId?"Subtask":"Task"}),ce?jsxRuntime.jsx("input",{ref:Pe,type:"text",value:ae,onChange:de=>pe(de.target.value),onKeyDown:de=>{de.key==="Enter"?_t(W.id):de.key==="Escape"&&ba();},onBlur:()=>_t(W.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:de=>de.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:W.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:W.parentId?"13px":"14px",fontWeight:W.isMilestone?600:W.parentId?400:600,letterSpacing:W.parentId?"0":"-0.01em"},title:W.name,children:W.name}),Y&&!ce&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:de=>xt(W,de),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:de=>{de.stopPropagation(),ve(W);},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 le=W.startDate?typeof W.startDate=="string"?W.startDate:W.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:le||"",onChange:de=>{u?.(W.id,{startDate:de.target.value?new Date(de.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 q=W.endDate?typeof W.endDate=="string"?W.endDate:W.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:q||"",onChange:de=>{u?.(W.id,{endDate:de.target.value?new Date(de.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:se(W)})});case "assignees":let I=r.filter(de=>W.assignees?.some(Ga=>Ga.name===de.name||Ga.initials===de.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Va,{assignedUsers:I,availableUsers:r,onChange:de=>{let Ga=de.map(rr=>({id:rr.id,name:rr.name,initials:rr.initials,color:rr.color}));u?.(W.id,{assignees:Ga.length>0?Ga:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Si,{status:W.status||"todo",onChange:de=>{u?.(W.id,{status:de,progress:de==="completed"?100:W.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:`${W.progress}%`,backgroundColor:W.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:[W.progress,"%"]})]});case "priority":let X={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Te={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ye=X[W.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Ha,{priority:Ye,onChange:de=>{de&&u?.(W.id,{priority:Te[de]||"medium"});}})});default:return null}},ut=A=>[{id:"hide",label:"Hide Column",icon:Qe.Hide,onClick:()=>s(A),disabled:A==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Qe.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Qe.SortDesc,onClick:()=>{}}],ee=A=>A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:Qe.Add,onClick:()=>{D?.(A.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:Qe.Delete,onClick:()=>{x?x(A.id,A.name):w?.([A.id]);}}]:[{id:"edit",label:P?.contextMenu?.editTask||"Edit Task",icon:Qe.Pencil,onClick:()=>{l?.(A);}},{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:Qe.Add,onClick:()=>{D?.(A.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:P?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qe.MarkIncomplete,onClick:()=>{u?.(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:P?.contextMenu?.setInProgress||"Set In Progress",icon:Qe.SetInProgress,onClick:()=>{u?.(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:P?.contextMenu?.markComplete||"Mark Complete",icon:Qe.MarkComplete,onClick:()=>{u?.(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:P?.contextMenu?.splitTask||"Split Task",icon:Qe.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:Qe.Delete,onClick:()=>{x?x(A.id,A.name):w?.([A.id]);}}],ye=m.filter(A=>A.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:`${Ca}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ye.map((A,W)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${A.id==="name"?"justify-between":"justify-center"}`,style:{...A.id==="name"?{flex:"1 1 auto",minWidth:`${A.minWidth??150}px`}:{width:`${A.width}px`,minWidth:`${A.minWidth??60}px`,maxWidth:`${A.maxWidth??2e3}px`,flexShrink:0},borderRight:W<ye.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ie=>{ie.preventDefault(),be({isOpen:true,x:ie.clientX,y:ie.clientY,type:"header",columnId:A.id});},onMouseEnter:ie=>{ie.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ie=>{ie.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:A.id==="name"?"1 1 auto":"none",minWidth:0},title:A.label,children:A.label}),A.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(ho,{columns:m,onToggleColumn:s,theme:t}),jsxRuntime.jsx("button",{onClick:()=>F(!$),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"})})]}),A.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===A.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation(),S(A.id),E(ie.clientX),K(A.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"}})})]},A.id)),$&&jsxRuntime.jsxs("div",{ref:Le,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:A=>A.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:()=>F(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:Lt.map(({task:A,level:W},ie)=>{let ce=fa(A.id),Y=me===A.id,le={};return Y&&Ke&&(Ke==="above"?(le.borderTopWidth="2px",le.borderTopStyle="solid",le.borderTopColor=t.accent):Ke==="below"?(le.borderBottomWidth="2px",le.borderBottomStyle="solid",le.borderBottomColor=t.accent):Ke==="child"&&(le.backgroundColor=t.accentLight,le.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":A.id,className:`flex items-center cursor-pointer group ${he===A.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:ce?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ce||Y&&Ke==="child"?t.accentLight:ie%2===0?t.bgPrimary:t.bgGrid,...le},onMouseEnter:()=>L(A.id),onMouseLeave:()=>L(null),onClick:q=>{let X=hr(e).map(de=>de.id),Ye=navigator.platform.toUpperCase().indexOf("MAC")>=0?q.metaKey:q.ctrlKey;St(A.id,X,Ye,q.shiftKey),n?.(A);},onDoubleClick:q=>{q.stopPropagation(),l?.(A);},onContextMenu:q=>{q.preventDefault(),be({isOpen:true,x:q.clientX,y:q.clientY,type:"task",task:A}),d?.(A,q);},whileHover:{backgroundColor:ce?t.accentLight:t.hoverBg},children:ye.map((q,I)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${q.id==="name"?"justify-start":"justify-center"} ${I<ye.length-1?"border-r":""}`,style:{...q.id==="name"?{flex:"1 1 auto",minWidth:`${q.minWidth??150}px`}:{width:`${q.width}px`,minWidth:`${q.minWidth??60}px`,maxWidth:`${q.maxWidth??2e3}px`,flexShrink:0},borderColor:C===A.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ce(q,A,q.id==="name"?W:0)},`${A.id}-${q.id}`))},A.id)})}),jsxRuntime.jsx(br,{isOpen:V.isOpen,x:V.x,y:V.y,items:V.type==="header"&&V.columnId?ut(V.columnId):V.type==="task"&&V.task?ee(V.task):[],onClose:()=>be({...V,isOpen:false}),theme:t})]})}function El(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,d]=react.useState(e),[c,i]=react.useState(t),[m,s]=react.useState(null),[p,u]=react.useState(null),[y,k]=react.useState(null),[h,w]=react.useState(null),[f,g]=react.useState(0),[T,D]=react.useState(0),[b,x]=react.useState(null),[v,P]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:m,setConnectionLine:s,hoveredTaskId:p,setHoveredTaskId:u,activeZone:y,setActiveZone:k,draggedSegmentIndex:h,setDraggedSegmentIndex:w,draggedSegmentStartX:f,setDraggedSegmentStartX:g,segmentDragOffsetX:T,setSegmentDragOffsetX:D,hoveredSegmentIndex:b,setHoveredSegmentIndex:x,isHovered:v,setIsHovered:P,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(O,_)=>{r("none"),s(null),u(null),d(O),i(_),D(0),w(null),g(0);}}}function ko({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:d,onClick:c,onDoubleClick:i,onContextMenu:m,onDateChange:s,onDependencyCreate:p,allTaskPositions:u=[],onDragMove:y,onHoverChange:k}){let h=El(t,r),w=react.useRef(null),{dragMode:f,setDragMode:g,dragOffset:T,setDragOffset:D,ghostX:b,setGhostX:x,ghostWidth:v,setGhostWidth:P,connectionLine:C,setConnectionLine:L,hoveredTaskId:$,setHoveredTaskId:F,activeZone:O,setActiveZone:_,draggedSegmentIndex:ae,setDraggedSegmentIndex:pe,draggedSegmentStartX:Le,setDraggedSegmentStartX:Pe,segmentDragOffsetX:ne,setSegmentDragOffsetX:S,hoveredSegmentIndex:M,setHoveredSegmentIndex:E,isHovered:U,setIsHovered:K,isDragging:V,isResizing:be,isConnecting:he,resetDragState:He}=h,me=32,qe=8,Ke=e.endDate&&e.endDate<new Date&&e.progress<100,Mt=e.isCriticalPath,Jt=o.name==="neutral"||o.today==="#1C1917",zt=e.status==="completed"||e.progress===100,It={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||Ke?"#DC2626":e.color?e.color:e.priority&&It[e.priority]?It[e.priority]:o.taskBarPrimary,mt=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),ot=r<50,Lt=r<40;react.useEffect(()=>{if(k)if(U&&!V&&!e.segments){let ee=a<100;k({task:e,x:t,y:a,width:r,height:me,showBelow:ee});}else k(null);},[U,V,e,t,a,r,me,k]);let Ca=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),se=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},ve=ee=>Math.round(ee/n)*n,_t=ee=>{let ye=Math.round(ee/n),A=new Date(l);return A.setDate(A.getDate()+ye),A},ba=(ee,ye)=>{for(let A of u){if(A.id===e.id)continue;let W=5;if(ee>=A.x-W&&ee<=A.x+A.width+W&&ye>=A.y-W&&ye<=A.y+A.height+W)return A.id}return null},xt=react.useCallback((ee,ye,A)=>{ee.preventDefault(),ee.stopPropagation();let W=w.current?.ownerSVGElement;if(!W)return;let ie=W.createSVGPoint();ie.x=ee.clientX,ie.y=ee.clientY;let ce=ie.matrixTransform(W.getScreenCTM()?.inverse()),Y=A!==void 0?A:t,le=ye;if(!le){let q=ce.x-Y;ee.shiftKey?(le="connect",L({x:t+r,y:a+me/2})):ee.ctrlKey||ee.metaKey?le="move":ee.altKey?le=q<r/2?"resize-start":"resize-end":Lt?q<r/2?le="move":le="resize-end":ot?q<=mt/2?le="resize-start":q>=r-mt/2?le="resize-end":le="move":q<=mt?le="resize-start":q>=r-mt?le="resize-end":le="move";}g(le),K(false),_(null),le==="move"?D(ce.x-Y):le==="connect"?L({x:t+r,y:a+me/2}):D(0),x(Y),P(r);},[t,r,a,me]),ha=react.useCallback(ee=>{if(f==="none")return;let ye=w.current?.ownerSVGElement;if(!ye)return;let A=ye.createSVGPoint();A.x=ee.clientX,A.y=ee.clientY;let W=A.matrixTransform(ye.getScreenCTM()?.inverse());if(f==="connect"){L({x:W.x,y:W.y});let ie=ba(W.x,W.y);F(ie);}else if(f==="move"){let ie=W.x-T,ce=ve(ie);x(ce),P(r);let Y=Math.round((ce-t)/n);if(y?.(e.id,Y,true),e.segments&&e.segments.length>0&&ae!==null){let le=ce-Le;S(le);}}else if(f==="resize-start"){let ie=W.x,ce=ve(ie),Y=t+r-ce;Y>=n&&(x(ce),P(Y));}else if(f==="resize-end"){let ie=W.x,Y=ve(ie)-t;Y>=n&&P(Y);}},[f,t,r,n,T,e,ve,ae,Le,ba,F,L,x,P,S,y]),va=react.useCallback(()=>{if(f!=="none"){if(f==="connect")$&&p&&p(e,$),L(null),F(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),ye,A,W=true;if(f==="move"){if(ye=_t(b),A=new Date(ye.getTime()+ee),e.segments&&e.segments.length>0&&ae!==null){let ie=Math.round(ne/n),ce=e.segments.map((I,X)=>{if(X===ae){let Te=new Date(I.startDate),Ye=new Date(I.endDate);return Te.setDate(Te.getDate()+ie),Ye.setDate(Ye.getDate()+ie),{startDate:Te,endDate:Ye}}return I}),Y=ce.flatMap(I=>[I.startDate,I.endDate]),le=new Date(Math.min(...Y.map(I=>I.getTime()))),q=new Date(Math.max(...Y.map(I=>I.getTime())));s?.({...e,segments:ce},le,q),He(t,r);return}}else f==="resize-start"?(ye=_t(b),A=e.endDate,ye>=A&&(console.warn("Invalid date range: start date must be before end date"),W=false)):f==="resize-end"?(ye=e.startDate,A=_t(b+v),A<=ye&&(console.warn("Invalid date range: end date must be after start date"),W=false)):W=false;W&&ye&&A&&(A.getTime()-ye.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):s?.(e,ye,A));}y?.(e.id,0,false),He(t,r);}},[f,b,v,e,s,$,p,t,r,n,_t,ne,ae,He,y]);react.useEffect(()=>{if(f==="none")return;let ee=A=>{ha(A);},ye=()=>{va();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",ye),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",ye);}},[f,ha,va]);let ke=V&&!he?b:t,Ce=V&&!he?v:r,ut=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:w,onMouseEnter:()=>!V&&K(true),onMouseLeave:()=>{V||(K(false),_(null));},onClick:()=>!V&&c?.(e),onDoubleClick:ee=>{V||(ee.stopPropagation(),i?.(e));},onContextMenu:ee=>{ee.preventDefault(),m?.(e,ee);},children:[U&&!V&&!ot&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:mt,height:me,fill:O==="resize-start"?o.accent:"transparent",opacity:O==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>_("resize-start"),onMouseDown:ee=>xt(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:me,fill:O==="move"?o.accent:"transparent",opacity:O==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>_("move"),onMouseDown:ee=>xt(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-mt,y:a,width:mt,height:me,fill:O==="resize-end"?o.accent:"transparent",opacity:O==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>_("resize-end"),onMouseDown:ee=>xt(ee,"resize-end")})]}),U&&!V&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:me,fill:O==="move"?o.accent:"transparent",opacity:O==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>_("move"),onMouseDown:ee=>xt(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:me,fill:O==="resize-end"?o.accent:"transparent",opacity:O==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>_("resize-end"),onMouseDown:ee=>xt(ee,"resize-end")}),U&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),V&&!he&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:b,y:a,width:v,height:me,rx:qe,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:ke,y:a,width:Ce,height:me,rx:qe,fill:St,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:V&&!he?.15:e.parentId?.6:U?.9:.8,scale:U&&!V?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>xt(ee),style:{cursor:V?he?"crosshair":be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ke,y:a,width:Ce*(e.progress/100),height:me,rx:qe,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ee,ye)=>{let A=(ee.startDate.getTime()-l.getTime())/864e5*n,ie=(ee.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-A+n,ce=V&&f==="move"&&ae===ye,Y=M===ye,le=ce?A+ne:A;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!V&&E(ye),onMouseLeave:()=>!V&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:le,y:a,width:ie,height:me,rx:qe,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:ce||e.parentId?.6:Y?.9:.8,scale:Y&&!V?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:q=>{q.stopPropagation(),pe(ye),Pe(A),xt(q,void 0,A);},style:{cursor:V?he?"crosshair":be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:le,y:a,width:ie*(e.progress/100),height:me,rx:qe,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ye}`)}),Jt&&(Ke||Mt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Mt&&!Ke&&jsxRuntime.jsx("rect",{x:ke,y:a,width:Ce,height:me,rx:qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ke&&jsxRuntime.jsx("rect",{x:ke,y:a,width:Ce,height:me,rx:qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ce>60&&!e.segments&&(()=>{let ee=d.taskLabel(e),ye=typeof ee=="string"?ee:e.name,A=ye.length>Math.floor(Ce/8)?`${ye.substring(0,Math.floor(Ce/8))}...`:ye;return jsxRuntime.jsx("text",{x:ke+12,y:a+me/2,dominantBaseline:"middle",fill:zt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:zt?"line-through":"none"},children:A})})(),Ce>100&&e.progress>0&&e.progress<100&&!V&&!e.segments&&jsxRuntime.jsxs("text",{x:ke+Ce-12,y:a+me/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&&Ce>80&&!V&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ke+Ce-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ke+Ce-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(U||be)&&!he&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ot?ke-15:ke-10,y:a-5,width:ot?25:20,height:me+10,fill:"transparent",onMouseDown:ee=>xt(ee,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?ke-8:ke-3,y:a+6,width:ot?8:6,height:ot?me-12:me-16,rx:3,fill:f==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:f==="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:ke+Ce-10,y:a-5,width:ot?25:20,height:me+10,fill:"transparent",onMouseDown:ee=>xt(ee,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?ke+Ce:ke+Ce-3,y:a+6,width:ot?8:6,height:ot?me-12:me-16,rx:3,fill:f==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:f==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&!V&&!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+me/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:ee=>{ee.stopPropagation(),xt(ee,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+me/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),he&&C&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+me/2,x2:C.x,y2:C.y,stroke:$?o.statusCompleted:o.accent,strokeWidth:$?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:$?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:C.x,cy:C.y,r:$?8:6,fill:$?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),$&&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"})]}),(U||V)&&!he&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke-2,y:a-2,width:Ce+4,height:me+4,rx:qe+2,fill:"none",stroke:V?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:V?.6:.4,initial:{opacity:0},animate:{opacity:V?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:b,y1:0,x2:b,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:b+v,y1:0,x2:b+v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&!V&&!e.segments&&!k&&(()=>{let A=a<100,W=A?a+me+13:a-82-13,ie=A?`M ${ke+Ce/2-6} ${a+me+3} L ${ke+Ce/2} ${a+me+13} L ${ke+Ce/2+6} ${a+me+3}`:`M ${ke+Ce/2-6} ${a-13} L ${ke+Ce/2} ${a-3} L ${ke+Ce/2+6} ${a-13}`,ce=W+22,Y=W+40,le=W+55,q=W+70,I=A?W+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:A?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:A?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ie,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ke+Ce/2-120,y:W,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:ke+Ce/2,y:ce,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:ke+Ce/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ke+Ce/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.startDate)}),jsxRuntime.jsx("text",{x:ke+Ce/2-110,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ke+Ce/2-70,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.endDate)}),jsxRuntime.jsx("text",{x:ke+Ce/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ke+Ce/2+65,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:se()}),jsxRuntime.jsx("text",{x:ke+Ce/2+10,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ke+Ce/2+65,y:le,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:ke+Ce/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ke+Ce/2-50,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(X=>X.name).join(", ").substring(0,30),e.assignees.map(X=>X.name).join(", ").length>30?"...":""]})]}),!A&&jsxRuntime.jsx("text",{x:ke+Ce/2,y:I,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ot?"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 Il({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:n,height:l,showBelow:d}=e,c=82,i=13,m=d?o+l+i:o-c-i,s=d?`M ${r+n/2-6} ${o+l+3} L ${r+n/2} ${o+l+13} L ${r+n/2+6} ${o+l+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,p=m+22,u=m+40,y=m+55,k=m+70,h=d?m+c-5:o-18,w=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),f=()=>{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":""}`},g=n<50,T=n<40;return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:s,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+n/2-120,y:m,width:240,height:c,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+n/2,y:p,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+n/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?w(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?w(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+n/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:f()}),jsxRuntime.jsx("text",{x:r+n/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/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+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+n/2-50,y:k,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?"...":""]})]}),!d&&jsxRuntime.jsx("text",{x:r+n/2,y:h,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:T?"Left: move \u2022 Right: resize":g?"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 To({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:l}){let[d,c]=react.useState(false),i=a-e,m=r-t,s=e+i/2,p=`M ${e} ${t} C ${s} ${t}, ${s} ${r}, ${a} ${r}`,u=6,y=Math.atan2(m,i),k=a-u*Math.cos(y-Math.PI/6),h=r-u*Math.sin(y-Math.PI/6),w=a-u*Math.cos(y+Math.PI/6),f=r-u*Math.sin(y+Math.PI/6),g=o.dependency;return react.useEffect(()=>{l&&n&&l(d?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[d,e,t,a,r,n,l]),jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:p,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:d&&l?0:d?1:.6,strokeWidth:d?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 ${k} ${h} M ${a} ${r} L ${w} ${f}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:d&&l?0:d?1:.6,scale:d?1.1:1,strokeWidth:d?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:d&&l?0:d?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),d&&n&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:s,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:s-4,y1:(t+r)/2-4,x2:s+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:s+4,y1:(t+r)/2-4,x2:s-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function No({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),d=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var j={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,d=new Set,c=i=>{if(!l.has(i)){l.add(i),d.add(i);let m=r.get(i)||[];for(let s of m){if(!l.has(s)&&c(s))return true;if(d.has(s))return true}}return d.delete(i),false};return c(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=j.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=j.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=j.findTaskById(e,o);if(n)a.unshift(n),o=n.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=j.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.join(","));}),r.join(`
|
|
46
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Ln({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function s(m){n.current&&!n.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=s=>{t(s),o(false);},p=e.reduce((s,m)=>{let i=m.category||"Other";return s[i]||(s[i]=[]),s[i].push(m),s},{});return jsxRuntime.jsxs("div",{className:P("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,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:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",s.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",s.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:P("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:n,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(([s,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:s})}),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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.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))})]},s)),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 Bn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,c]=react.useState("export"),[p,s]=react.useState("json"),[m,i]=react.useState(null),d=react.useRef(null);if(!t)return null;let u=async()=>{let v=o?.current||void 0,h=await si(e,p,v);ii(h,p);},x=async v=>{let h=v.target.files?.[0];if(h){try{let w=await ci(h),g=h.name.endsWith(".json")?"json":"csv",f=di(w,g);i(f),f.success&&r&&r(f,w);}catch(w){i({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxRuntime.jsxs("div",{className:P("fixed inset-0 z-[9999] flex items-center justify-center",n),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:P("flex-1 px-6 py-4 font-semibold transition-colors",l==="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:P("flex-1 px-6 py-4 font-semibold transition-colors",l==="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:[l==="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(v=>jsxRuntime.jsxs("button",{onClick:()=>s(v),className:P("p-4 rounded-lg border-2 transition-all text-center",p===v?"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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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"})]}),l==="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:d,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>d.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:P("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:P("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((v,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var Gm=["URGENT","HIGH","MEDIUM","LOW"],Hm=[{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"}],_m=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Rn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:p=[],availableLabels:s=[],availableColumns:m=[],showQuickFilters:i=true,compact:d=false,groupBy:u="none",onGroupByChange:x}){let[v,h]=react.useState(true),w=react.useCallback(b=>{a({search:b.target.value});},[a]),g=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),f=react.useCallback(b=>{r({by:b.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&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:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,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:w,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:g,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:b=>{let k=b.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Gm.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let k=b.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let k=b.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),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:Hm.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.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"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>x(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:_m.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function On({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:p}){let[s,m]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let u=x=>{i.current&&!i.current.contains(x.target)&&m(false);};return s&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[s]);let d=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:P("relative",r),ref:i,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!s),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":s,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"})]}),s&&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:()=>d(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:()=>d(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>d(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>d(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:()=>d(()=>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:()=>d(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:()=>d(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 $n={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"}},zn={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"}},Wn={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"}},qa={dark:$n,light:zn,neutral:Wn},go="dark";var fo=react.createContext(void 0),eu="asakaa-theme";function ll({children:e,defaultTheme:t=go,storageKey:a=eu}){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}),n=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=qa[r];Object.entries(p.colors).forEach(([m,i])=>{i&&c.style.setProperty(`--theme-${tu(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 d=p.colors[m];d&&c.style.setProperty(i,d);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:qa};return jsxRuntime.jsx(fo.Provider,{value:l,children:e})}function ur(){let e=react.useContext(fo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function tu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Un({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ur();return e?jsxRuntime.jsxs("div",{className:P("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(qa).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:P("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}var Ie={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 dl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ie[e]||Ie.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ie[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ie[e].bgSecondary),bgGrid:r("--theme-bg-card",Ie[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ie[e].bgWeekend),border:r("--theme-border-primary",Ie[e].border),borderLight:r("--theme-border-subtle",Ie[e].borderLight),textPrimary:r("--theme-text-primary",Ie[e].textPrimary),textSecondary:r("--theme-text-secondary",Ie[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ie[e].textTertiary),accent:r("--theme-accent-primary",Ie[e].accent),accentHover:r("--theme-accent-hover",Ie[e].accentHover),accentLight:r("--theme-accent-primary",Ie[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ie[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ie[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ie[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ie[e].dependency),dependencyHover:r("--theme-border-secondary",Ie[e].dependencyHover),criticalPath:r("--theme-error",Ie[e].criticalPath),criticalPathLight:r("--theme-error",Ie[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ie[e].today):e==="neutral"?r("--theme-text-primary",Ie[e].today):r("--theme-error",Ie[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ie[e].todayLight):e==="neutral"?r("--theme-text-primary",Ie[e].todayLight):r("--theme-error",Ie[e].todayLight),milestone:r("--theme-warning",Ie[e].milestone),milestoneLight:r("--theme-warning",Ie[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ie[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ie[e].statusInProgress),statusCompleted:r("--theme-success",Ie[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ie[e].hoverBg),focusRing:r("--theme-accent-primary",Ie[e].focusRing)}}var bo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},cl={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"}},Gn={en:bo,es:cl};function pl(e){return Gn[e]||Gn.en}function Hn(e,t){let a=pl(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 fr=react.createContext(bo);function Or(){return react.useContext(fr)}function vu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[c,p]=react.useState(false),[s,m]=react.useState(null),i=react.useRef(null),d=Or();if(react.useEffect(()=>{let h=w=>{i.current&&!i.current.contains(w.target)&&p(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||a||r||o||n||l))return null;let x=[{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:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(h=>h.handler),v=async(h,w)=>{if(w){m(h);try{await w();}catch(g){console.error(`Export ${h} failed:`,g);}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:d.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:x.map((h,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(h.id,h.handler),disabled:s!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.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:s===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function yu({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(n=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.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:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function xu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 ku({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=Or();react.useEffect(()=>{let s=m=>{n.current&&!n.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=c.find(s=>s.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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:`${l.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((s,m)=>{let i=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(s.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:s.label}),i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function ho({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:c,onRowDensityChange:p,showThemeSelector:s=false,showCreateTaskButton:m=false,createTaskLabel:i,onCreateTask:d,onExportPNG:u,onExportPDF:x,onExportExcel:v,onExportCSV:h,onExportJSON:w,onExportMSProject:g}){let f=Or(),T=u||x||v||h||w||g,N=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],b=[{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(xu,{options:N,value:t,onChange:k=>a(k),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(ku,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:d,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||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vu,{theme:e,onExportPNG:u,onExportPDF:x,onExportExcel:v,onExportCSV:h,onExportJSON:w,onExportMSProject:g}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(yu,{options:b,value:n,onChange:k=>l(k),theme:e})]})]})}function vo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=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 s=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();l({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(ze,{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:`${n.x}px`,top:`${n.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"}),s.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 br({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=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,d=8,u=window.innerWidth,x=window.innerHeight,v=t,h=a;t+m+d>u&&(v=t-m,v<d&&(v=d)),a+i+d>x&&(h=x-i-d,h<d&&(h=d)),p({x:v,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=d=>{l.current&&!l.current.contains(d.target)&&o();},i=d=>{d.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 s=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:s(n.bgSecondary),border:`1px solid ${n.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:n.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?n.textTertiary:n.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=n.hoverBg);},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:n.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:n.textTertiary}})]})]},m.id))})})})}var et={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 Tl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:c,onTaskOutdent:p,onTaskRename:s,onTaskToggleExpand:m,onOpenTaskModal:i,enableKeyboard:d=true}){let u=react.useRef(false),x=react.useCallback(f=>{u.current=f;},[]),v=react.useCallback(f=>{let T=[],N=b=>{for(let k of b)T.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&N(k.subtasks);};return N(f),T},[]),h=react.useCallback(()=>{let f=v(e);for(let T of f)if(t.has(T.id))return T;return null},[e,t,v]),w=react.useCallback((f,T)=>{let N=v(e);if(N.length===0)return;let b=h();if(!b){a(N[0].id,false);return}let k=N.findIndex(y=>y.id===b.id);if(k===-1)return;let C=f==="up"?k-1:k+1;if(C<0||C>=N.length)return;let M=N[C];a(M.id,T);},[e,h,v,a]),g=react.useCallback(f=>{if(!d)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 k=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),M=h();if(f.key==="ArrowUp"){f.preventDefault(),w("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),w("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")){C.length>0&&(f.preventDefault(),l(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),p(C));return}if(f.key==="Enter"&&!f.shiftKey&&!k){M&&(f.preventDefault(),r(M.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!k){M&&(f.preventDefault(),r(M.id,"above"));return}if(f.key==="Enter"&&k){M&&(f.preventDefault(),i(M.id));return}if(f.key==="F2"){M&&(f.preventDefault(),s(M.id));return}if(f.key==="Delete"||f.key==="Backspace"&&k){C.length>0&&(f.preventDefault(),o(C));return}if(f.key==="d"&&k&&!f.shiftKey){C.length>0&&(f.preventDefault(),n(C));return}},[d,t,h,w,r,o,n,l,c,p,s,m,i]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g);}},[d,g]),{setIsEditing:x}}function Dl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(i=>{t(new Set([i])),r(i);},[]),n=react.useCallback(i=>{t(d=>{let u=new Set(d);return u.has(i)?u.delete(i):u.add(i),u}),r(i);},[]),l=react.useCallback((i,d)=>{if(!a){o(i);return}let u=d.indexOf(a),x=d.indexOf(i);if(u===-1||x===-1){o(i);return}let v=Math.min(u,x),h=Math.max(u,x),w=d.slice(v,h+1);t(new Set(w)),r(i);},[a,o]),c=react.useCallback((i,d,u,x)=>{x?l(i,d):u?n(i):o(i);},[o,n,l]),p=react.useCallback((i,d)=>{d?t(u=>{let x=new Set(u);return x.add(i),x}):o(i);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:s,isTaskSelected:m}}function hr(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:n,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,n+1);}};return a(e),t}function Sl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Sl(a.subtasks,t);if(r)return r}}return null}function jn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=jn(a.subtasks,t);if(r)return r}return null}function Kn(e,t){if(t.length===0)return e;let a=hr(e),r=t[0],o=a.findIndex(i=>i.id===r);if(o<=0)return e;let n=a[o-1],l=(i,d)=>{let u=[];return {tasks:i.filter(v=>{if(d.has(v.id))return u.push(v),false;if(v.subtasks){let h=l(v.subtasks,d);v.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},c=(i,d,u)=>i.map(x=>x.id===d?{...x,subtasks:[...x.subtasks||[],...u],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,d,u)}:x),p=new Set(t),{tasks:s,removed:m}=l(e,p);return c(s,n.id,m)}function Yn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=jn(a,r);if(!o)continue;let n=jn(a,o.id),l=(s,m,i)=>{for(let d=0;d<s.length;d++){let u=s[d];if(u.id===m&&u.subtasks){let x=u.subtasks.findIndex(v=>v.id===i);if(x!==-1){let[v]=u.subtasks.splice(x,1);return v}}if(u.subtasks){let x=l(u.subtasks,m,i);if(x)return x}}return null},c=(s,m,i)=>{let d=s.findIndex(u=>u.id===m);if(d!==-1)return s.splice(d+1,0,i),s;for(let u of s)u.subtasks&&c(u.subtasks,m,i);return s},p=l(a,o.id,r);p&&(n&&n.subtasks?c(n.subtasks,o.id,p):c(a,o.id,p));}return a}function qn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,c,p)=>{let s=l.findIndex(i=>i.id===c);if(s===-1){for(let i of l)if(i.subtasks&&n(i.subtasks,c,p))return true;return false}let m=p==="up"?s-1:s+1;return m<0||m>=l.length?false:([l[s],l[m]]=[l[m],l[s]],true)};return n(r,o,a),r}function Xn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function Jn(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(m=>m.id===r);if(c===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let p=l[c],s={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?n(p.subtasks):void 0};return l.splice(c+1,0,s),true},n=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?n(c.subtasks):void 0}));o(a);}return a}function El(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},c=p=>{let s=p.findIndex(i=>i.id===t);if(s===-1){for(let i of p)if(i.subtasks&&c(i.subtasks))return true;return false}let m=a==="above"?s:s+1;return p.splice(m,0,l),true};return c(r),{tasks:r,newTask:l}}function Zn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Zn(r.subtasks,t,a)}:r)}function Qn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Qn(a.subtasks,t)}:a)}function es(e,t){let a=m=>{for(let i of m){if(i.id===t)return i;if(i.subtasks){let d=a(i.subtasks);if(d)return d}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,c=r?.endDate||n,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},s=m=>m.map(i=>{if(i.id===t){let d=i.subtasks||[];return {...i,subtasks:[...d,p],isExpanded:true}}return i.subtasks?{...i,subtasks:s(i.subtasks)}:i});return {tasks:s(e),newTask:p}}function Pl(e,t,a,r){if(t===a)return e;let o=Sl(e,t);if(!o)return e;if(a){let c=(p,s)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===s||c(m,s))return true;return false};if(c(o,a))return e}let n=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:n(p.subtasks)}:p),l=n(e);if(a===null){let c=r!==void 0?r:l.length;l.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(s=>{if(s.id===a){let m=s.subtasks||[],i=r!==void 0?r:m.length,d=[...m];return d.splice(i,0,{...o,parentId:a}),{...s,subtasks:d,isExpanded:true}}return s.subtasks&&s.subtasks.length>0?{...s,subtasks:c(s.subtasks)}:s});l=c(l);}return l}function ko({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:p,scrollTop:s,columns:m,onToggleColumn:i,onColumnResize:d,onTaskUpdate:u,onTaskIndent:x,onTaskOutdent:v,onTaskMove:h,onMultiTaskDelete:w,onTaskDuplicate:g,onTaskCreate:f,onTaskRename:T,onCreateSubtask:N,onOpenTaskModal:b,onDeleteRequest:k,onTaskReparent:C}){let M=react.useContext(fr),[y,A]=react.useState(null),[O,B]=react.useState(false),[$,V]=react.useState(null),[ne,ce]=react.useState(""),Ae=react.useRef(null),Me=react.useRef(null),[fe,E]=react.useState(null),[I,S]=react.useState(0),[W,j]=react.useState(0),[K,he]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ve,_e]=react.useState(null),[me,Xe]=react.useState(null),[Ye,Mt]=react.useState(null),Jt=react.useRef(0),zt=5,It=react.useRef(false);react.useEffect(()=>{function F(U){Ae.current&&!Ae.current.contains(U.target)&&B(false);}if(O)return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[O]),react.useEffect(()=>{$&&Me.current&&(Me.current.focus(),Me.current.select());},[$]),react.useEffect(()=>{if(!fe)return;let F=ie=>{let pe=ie.clientX-I,q=W+pe;d?.(fe,q);},U=()=>{E(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",F),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect="";}},[fe,I,W,d]);let{selectedTaskIds:At,handleTaskClick:St,isTaskSelected:fa}=Dl(),{setIsEditing:mt}=Tl({tasks:e,selectedTaskIds:At,onTaskSelect:(F,U)=>{let pe=hr(e).map(q=>q.id);St(F,pe,U||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:g||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:v||(()=>{}),onTaskRename:F=>{let U=hr(e).find(ie=>ie.id===F);U&&xe(U);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:F=>{let U=hr(e).find(ie=>ie.id===F);U&&b&&b(U);},enableKeyboard:true}),ot=(F,U=0)=>{let ie=[];for(let pe of F)ie.push({task:pe,level:U}),pe.subtasks&&pe.subtasks.length>0&&pe.isExpanded&&ie.push(...ot(pe.subtasks,U+1));return ie},Lt=ot(e),Ca=48,se=F=>!F.startDate||!F.endDate?"-":`${Math.ceil((F.endDate.getTime()-F.startDate.getTime())/(1e3*60*60*24))}d`,xe=F=>{V(F.id),ce(F.name),mt(true);},_t=F=>{ne.trim()&&ne!==e.find(U=>U.id===F)?.name&&T?.(F,ne.trim()),V(null),ce(""),mt(false);},ba=()=>{V(null),ce(""),mt(false);},xt=(F,U)=>{U.stopPropagation(),N?.(F.id);},ha=(F,U)=>{U.preventDefault(),Jt.current=U.clientY,_e(F),It.current=false;},va=F=>{if(!ve||(Math.abs(F.clientY-Jt.current)>zt&&(It.current=true),!It.current))return;let ie=document.querySelectorAll("[data-task-row]"),pe=null,q=null;ie.forEach(le=>{let X=le.getBoundingClientRect(),L=le.getAttribute("data-task-row");if(L&&L!==ve&&F.clientY>=X.top&&F.clientY<=X.bottom){pe=L;let J=F.clientY-X.top,Ne=X.height;J<Ne*.25?q="above":J>Ne*.75?q="below":q="child";}}),Xe(pe),Mt(q);},Ce=()=>{if(It.current&&ve&&me&&Ye){if(Ye==="child")C?.(ve,me);else if(Ye==="above"||Ye==="below"){let F=(pe,q,le=null)=>{for(let X of pe){if(X.id===q)return le;if(X.subtasks){let L=F(X.subtasks,q,X.id);if(L!==void 0)return L}}},U=F(e,me,null),ie=(pe,q)=>{let le=pe.findIndex(X=>X.id===q);return Ye==="below"?le+1:le};if(U===null){let pe=ie(e,me);C?.(ve,null,pe);}else {let pe=Lt.find(q=>q.task.id===U)?.task;if(pe?.subtasks){let q=ie(pe.subtasks,me);C?.(ve,U,q);}}}}_e(null),Xe(null),Mt(null),It.current=false;};react.useEffect(()=>{if(ve)return document.addEventListener("mousemove",va),document.addEventListener("mouseup",Ce),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",va),document.removeEventListener("mouseup",Ce),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,me,Ye]);let Te=(F,U,ie)=>{switch(F.id){case "name":let pe=$===U.id,q=y===U.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ie*20}px`},children:[C&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:q?1:.3},onMouseDown:de=>ha(U.id,de),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),U.subtasks&&U.subtasks.length>0?jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),p?.(U.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:U.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"}),!(U.subtasks&&U.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:U.color||"#3B82F6",opacity:U.parentId?.6:1,borderColor:U.isMilestone?t.accent:"transparent",borderWidth:U.isMilestone?"2px":"0px"},title:U.isMilestone?"Milestone":U.parentId?"Subtask":"Task"}),pe?jsxRuntime.jsx("input",{ref:Me,type:"text",value:ne,onChange:de=>ce(de.target.value),onKeyDown:de=>{de.key==="Enter"?_t(U.id):de.key==="Escape"&&ba();},onBlur:()=>_t(U.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:de=>de.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:U.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:U.parentId?"13px":"14px",fontWeight:U.isMilestone?600:U.parentId?400:600,letterSpacing:U.parentId?"0":"-0.01em"},title:U.name,children:U.name}),q&&!pe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:de=>xt(U,de),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:de=>{de.stopPropagation(),xe(U);},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 le=U.startDate?typeof U.startDate=="string"?U.startDate:U.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:le||"",onChange:de=>{u?.(U.id,{startDate:de.target.value?new Date(de.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 X=U.endDate?typeof U.endDate=="string"?U.endDate:U.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:X||"",onChange:de=>{u?.(U.id,{endDate:de.target.value?new Date(de.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:se(U)})});case "assignees":let L=r.filter(de=>U.assignees?.some(Ua=>Ua.name===de.name||Ua.initials===de.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Va,{assignedUsers:L,availableUsers:r,onChange:de=>{let Ua=de.map(rr=>({id:rr.id,name:rr.name,initials:rr.initials,color:rr.color}));u?.(U.id,{assignees:Ua.length>0?Ua:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Pi,{status:U.status||"todo",onChange:de=>{u?.(U.id,{status:de,progress:de==="completed"?100:U.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:`${U.progress}%`,backgroundColor:U.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:[U.progress,"%"]})]});case "priority":let J={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ne={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},qe=J[U.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Ha,{priority:qe,onChange:de=>{de&&u?.(U.id,{priority:Ne[de]||"medium"});}})});default:return null}},ut=F=>[{id:"hide",label:"Hide Column",icon:et.Hide,onClick:()=>i(F),disabled:F==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:et.SortDesc,onClick:()=>{}}],te=F=>F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{N?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{k?k(F.id,F.name):w?.([F.id]);}}]:[{id:"edit",label:M?.contextMenu?.editTask||"Edit Task",icon:et.Pencil,onClick:()=>{l?.(F);}},{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{N?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:M?.contextMenu?.markIncomplete||"Mark Incomplete",icon:et.MarkIncomplete,onClick:()=>{u?.(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:M?.contextMenu?.setInProgress||"Set In Progress",icon:et.SetInProgress,onClick:()=>{u?.(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:M?.contextMenu?.markComplete||"Mark Complete",icon:et.MarkComplete,onClick:()=>{u?.(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:M?.contextMenu?.splitTask||"Split Task",icon:et.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{k?k(F.id,F.name):w?.([F.id]);}}],ke=m.filter(F=>F.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Ca}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ke.map((F,U)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${F.id==="name"?"justify-between":"justify-center"}`,style:{...F.id==="name"?{flex:"1 1 auto",minWidth:`${F.minWidth??150}px`}:{width:`${F.width}px`,minWidth:`${F.minWidth??60}px`,maxWidth:`${F.maxWidth??2e3}px`,flexShrink:0},borderRight:U<ke.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ie=>{ie.preventDefault(),he({isOpen:true,x:ie.clientX,y:ie.clientY,type:"header",columnId:F.id});},onMouseEnter:ie=>{ie.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ie=>{ie.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:F.id==="name"?"1 1 auto":"none",minWidth:0},title:F.label,children:F.label}),F.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(vo,{columns:m,onToggleColumn:i,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!O),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),F.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:fe===F.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation(),E(F.id),S(ie.clientX),j(F.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},F.id)),O&&jsxRuntime.jsxs("div",{ref:Ae,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>B(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:Lt.map(({task:F,level:U},ie)=>{let pe=fa(F.id),q=me===F.id,le={};return q&&Ye&&(Ye==="above"?(le.borderTopWidth="2px",le.borderTopStyle="solid",le.borderTopColor=t.accent):Ye==="below"?(le.borderBottomWidth="2px",le.borderBottomStyle="solid",le.borderBottomColor=t.accent):Ye==="child"&&(le.backgroundColor=t.accentLight,le.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":F.id,className:`flex items-center cursor-pointer group ${ve===F.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:pe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:pe||q&&Ye==="child"?t.accentLight:ie%2===0?t.bgPrimary:t.bgGrid,...le},onMouseEnter:()=>A(F.id),onMouseLeave:()=>A(null),onClick:X=>{let J=hr(e).map(de=>de.id),qe=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;St(F.id,J,qe,X.shiftKey),n?.(F);},onDoubleClick:X=>{X.stopPropagation(),l?.(F);},onContextMenu:X=>{X.preventDefault(),he({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:F}),c?.(F,X);},whileHover:{backgroundColor:pe?t.accentLight:t.hoverBg},children:ke.map((X,L)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${X.id==="name"?"justify-start":"justify-center"} ${L<ke.length-1?"border-r":""}`,style:{...X.id==="name"?{flex:"1 1 auto",minWidth:`${X.minWidth??150}px`}:{width:`${X.width}px`,minWidth:`${X.minWidth??60}px`,maxWidth:`${X.maxWidth??2e3}px`,flexShrink:0},borderColor:y===F.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Te(X,F,X.id==="name"?U:0)},`${F.id}-${X.id}`))},F.id)})}),jsxRuntime.jsx(br,{isOpen:K.isOpen,x:K.x,y:K.y,items:K.type==="header"&&K.columnId?ut(K.columnId):K.type==="task"&&K.task?te(K.task):[],onClose:()=>he({...K,isOpen:false}),theme:t})]})}function Ml(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,c]=react.useState(e),[p,s]=react.useState(t),[m,i]=react.useState(null),[d,u]=react.useState(null),[x,v]=react.useState(null),[h,w]=react.useState(null),[g,f]=react.useState(0),[T,N]=react.useState(0),[b,k]=react.useState(null),[C,M]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:c,ghostWidth:p,setGhostWidth:s,connectionLine:m,setConnectionLine:i,hoveredTaskId:d,setHoveredTaskId:u,activeZone:x,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:w,draggedSegmentStartX:g,setDraggedSegmentStartX:f,segmentDragOffsetX:T,setSegmentDragOffsetX:N,hoveredSegmentIndex:b,setHoveredSegmentIndex:k,isHovered:C,setIsHovered:M,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,V)=>{r("none"),i(null),u(null),c($),s(V),N(0),w(null),f(0);}}}function wo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:c,onClick:p,onDoubleClick:s,onContextMenu:m,onDateChange:i,onDependencyCreate:d,allTaskPositions:u=[],onDragMove:x,onHoverChange:v}){let h=Ml(t,r),w=react.useRef(null),{dragMode:g,setDragMode:f,dragOffset:T,setDragOffset:N,ghostX:b,setGhostX:k,ghostWidth:C,setGhostWidth:M,connectionLine:y,setConnectionLine:A,hoveredTaskId:O,setHoveredTaskId:B,activeZone:$,setActiveZone:V,draggedSegmentIndex:ne,setDraggedSegmentIndex:ce,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Me,segmentDragOffsetX:fe,setSegmentDragOffsetX:E,hoveredSegmentIndex:I,setHoveredSegmentIndex:S,isHovered:W,setIsHovered:j,isDragging:K,isResizing:he,isConnecting:ve,resetDragState:_e}=h,me=32,Xe=8,Ye=e.endDate&&e.endDate<new Date&&e.progress<100,Mt=e.isCriticalPath,Jt=o.name==="neutral"||o.today==="#1C1917",zt=e.status==="completed"||e.progress===100,It={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||Ye?"#DC2626":e.color?e.color:e.priority&&It[e.priority]?It[e.priority]:o.taskBarPrimary,mt=(te=>te>=80?20:te>=60?15:te>=50?12:10)(r),ot=r<50,Lt=r<40;react.useEffect(()=>{if(v)if(W&&!K&&!e.segments){let te=a<100;v({task:e,x:t,y:a,width:r,height:me,showBelow:te});}else v(null);},[W,K,e,t,a,r,me,v]);let Ca=te=>te.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),se=()=>{let te=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${te} day${te!==1?"s":""}`},xe=te=>Math.round(te/n)*n,_t=te=>{let ke=Math.round(te/n),F=new Date(l);return F.setDate(F.getDate()+ke),F},ba=(te,ke)=>{for(let F of u){if(F.id===e.id)continue;let U=5;if(te>=F.x-U&&te<=F.x+F.width+U&&ke>=F.y-U&&ke<=F.y+F.height+U)return F.id}return null},xt=react.useCallback((te,ke,F)=>{te.preventDefault(),te.stopPropagation();let U=w.current?.ownerSVGElement;if(!U)return;let ie=U.createSVGPoint();ie.x=te.clientX,ie.y=te.clientY;let pe=ie.matrixTransform(U.getScreenCTM()?.inverse()),q=F!==void 0?F:t,le=ke;if(!le){let X=pe.x-q;te.shiftKey?(le="connect",A({x:t+r,y:a+me/2})):te.ctrlKey||te.metaKey?le="move":te.altKey?le=X<r/2?"resize-start":"resize-end":Lt?X<r/2?le="move":le="resize-end":ot?X<=mt/2?le="resize-start":X>=r-mt/2?le="resize-end":le="move":X<=mt?le="resize-start":X>=r-mt?le="resize-end":le="move";}f(le),j(false),V(null),le==="move"?N(pe.x-q):le==="connect"?A({x:t+r,y:a+me/2}):N(0),k(q),M(r);},[t,r,a,me]),ha=react.useCallback(te=>{if(g==="none")return;let ke=w.current?.ownerSVGElement;if(!ke)return;let F=ke.createSVGPoint();F.x=te.clientX,F.y=te.clientY;let U=F.matrixTransform(ke.getScreenCTM()?.inverse());if(g==="connect"){A({x:U.x,y:U.y});let ie=ba(U.x,U.y);B(ie);}else if(g==="move"){let ie=U.x-T,pe=xe(ie);k(pe),M(r);let q=Math.round((pe-t)/n);if(x?.(e.id,q,true),e.segments&&e.segments.length>0&&ne!==null){let le=pe-Ae;E(le);}}else if(g==="resize-start"){let ie=U.x,pe=xe(ie),q=t+r-pe;q>=n&&(k(pe),M(q));}else if(g==="resize-end"){let ie=U.x,q=xe(ie)-t;q>=n&&M(q);}},[g,t,r,n,T,e,xe,ne,Ae,ba,B,A,k,M,E,x]),va=react.useCallback(()=>{if(g!=="none"){if(g==="connect")O&&d&&d(e,O),A(null),B(null);else {let te=e.endDate.getTime()-e.startDate.getTime(),ke,F,U=true;if(g==="move"){if(ke=_t(b),F=new Date(ke.getTime()+te),e.segments&&e.segments.length>0&&ne!==null){let ie=Math.round(fe/n),pe=e.segments.map((L,J)=>{if(J===ne){let Ne=new Date(L.startDate),qe=new Date(L.endDate);return Ne.setDate(Ne.getDate()+ie),qe.setDate(qe.getDate()+ie),{startDate:Ne,endDate:qe}}return L}),q=pe.flatMap(L=>[L.startDate,L.endDate]),le=new Date(Math.min(...q.map(L=>L.getTime()))),X=new Date(Math.max(...q.map(L=>L.getTime())));i?.({...e,segments:pe},le,X),_e(t,r);return}}else g==="resize-start"?(ke=_t(b),F=e.endDate,ke>=F&&(console.warn("Invalid date range: start date must be before end date"),U=false)):g==="resize-end"?(ke=e.startDate,F=_t(b+C),F<=ke&&(console.warn("Invalid date range: end date must be after start date"),U=false)):U=false;U&&ke&&F&&(F.getTime()-ke.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):i?.(e,ke,F));}x?.(e.id,0,false),_e(t,r);}},[g,b,C,e,i,O,d,t,r,n,_t,fe,ne,_e,x]);react.useEffect(()=>{if(g==="none")return;let te=F=>{ha(F);},ke=()=>{va();};return window.addEventListener("mousemove",te),window.addEventListener("mouseup",ke),()=>{window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",ke);}},[g,ha,va]);let Ce=K&&!ve?b:t,Te=K&&!ve?C:r,ut=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:w,onMouseEnter:()=>!K&&j(true),onMouseLeave:()=>{K||(j(false),V(null));},onClick:()=>!K&&p?.(e),onDoubleClick:te=>{K||(te.stopPropagation(),s?.(e));},onContextMenu:te=>{te.preventDefault(),m?.(e,te);},children:[W&&!K&&!ot&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:mt,height:me,fill:$==="resize-start"?o.accent:"transparent",opacity:$==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>V("resize-start"),onMouseDown:te=>xt(te,"resize-start")}),jsxRuntime.jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:me,fill:$==="move"?o.accent:"transparent",opacity:$==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>V("move"),onMouseDown:te=>xt(te,"move")}),jsxRuntime.jsx("rect",{x:t+r-mt,y:a,width:mt,height:me,fill:$==="resize-end"?o.accent:"transparent",opacity:$==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>V("resize-end"),onMouseDown:te=>xt(te,"resize-end")})]}),W&&!K&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:me,fill:$==="move"?o.accent:"transparent",opacity:$==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>V("move"),onMouseDown:te=>xt(te,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:me,fill:$==="resize-end"?o.accent:"transparent",opacity:$==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>V("resize-end"),onMouseDown:te=>xt(te,"resize-end")}),W&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),K&&!ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:b,y:a,width:C,height:me,rx:Xe,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:Ce,y:a,width:Te,height:me,rx:Xe,fill:St,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:K&&!ve?.15:e.parentId?.6:W?.9:.8,scale:W&&!K?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:te=>xt(te),style:{cursor:K?ve?"crosshair":he?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te*(e.progress/100),height:me,rx:Xe,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((te,ke)=>{let F=(te.startDate.getTime()-l.getTime())/864e5*n,ie=(te.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-F+n,pe=K&&g==="move"&&ne===ke,q=I===ke,le=pe?F+fe:F;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!K&&S(ke),onMouseLeave:()=>!K&&S(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:le,y:a,width:ie,height:me,rx:Xe,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:pe||e.parentId?.6:q?.9:.8,scale:q&&!K?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>{X.stopPropagation(),ce(ke),Me(F),xt(X,void 0,F);},style:{cursor:K?ve?"crosshair":he?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:le,y:a,width:ie*(e.progress/100),height:me,rx:Xe,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ke}`)}),Jt&&(Ye||Mt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Mt&&!Ye&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te,height:me,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ye&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te,height:me,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Te>60&&!e.segments&&(()=>{let te=c.taskLabel(e),ke=typeof te=="string"?te:e.name,F=ke.length>Math.floor(Te/8)?`${ke.substring(0,Math.floor(Te/8))}...`:ke;return jsxRuntime.jsx("text",{x:Ce+12,y:a+me/2,dominantBaseline:"middle",fill:zt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:zt?"line-through":"none"},children:F})})(),Te>100&&e.progress>0&&e.progress<100&&!K&&!e.segments&&jsxRuntime.jsxs("text",{x:Ce+Te-12,y:a+me/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&&Te>80&&!K&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ce+Te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ce+Te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(W||he)&&!ve&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ot?Ce-15:Ce-10,y:a-5,width:ot?25:20,height:me+10,fill:"transparent",onMouseDown:te=>xt(te,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?Ce-8:Ce-3,y:a+6,width:ot?8:6,height:ot?me-12:me-16,rx:3,fill:g==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="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:Ce+Te-10,y:a-5,width:ot?25:20,height:me+10,fill:"transparent",onMouseDown:te=>xt(te,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?Ce+Te:Ce+Te-3,y:a+6,width:ot?8:6,height:ot?me-12:me-16,rx:3,fill:g==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&!K&&!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+me/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:te=>{te.stopPropagation(),xt(te,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+me/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ve&&y&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+me/2,x2:y.x,y2:y.y,stroke:O?o.statusCompleted:o.accent,strokeWidth:O?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:O?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:y.x,cy:y.y,r:O?8:6,fill:O?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),O&&jsxRuntime.jsx(framerMotion.motion.text,{x:y.x+15,y:y.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:y.x+10},animate:{opacity:1,x:y.x+15},transition:{duration:.2},children:"Connect"})]}),(W||K)&&!ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce-2,y:a-2,width:Te+4,height:me+4,rx:Xe+2,fill:"none",stroke:K?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:K?.6:.4,initial:{opacity:0},animate:{opacity:K?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:b,y1:0,x2:b,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:b+C,y1:0,x2:b+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&!K&&!e.segments&&!v&&(()=>{let F=a<100,U=F?a+me+13:a-82-13,ie=F?`M ${Ce+Te/2-6} ${a+me+3} L ${Ce+Te/2} ${a+me+13} L ${Ce+Te/2+6} ${a+me+3}`:`M ${Ce+Te/2-6} ${a-13} L ${Ce+Te/2} ${a-3} L ${Ce+Te/2+6} ${a-13}`,pe=U+22,q=U+40,le=U+55,X=U+70,L=F?U+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:F?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:F?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ie,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ce+Te/2-120,y:U,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:Ce+Te/2,y:pe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ce+Te/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ce+Te/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.startDate)}),jsxRuntime.jsx("text",{x:Ce+Te/2-110,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ce+Te/2-70,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.endDate)}),jsxRuntime.jsx("text",{x:Ce+Te/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ce+Te/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:se()}),jsxRuntime.jsx("text",{x:Ce+Te/2+10,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ce+Te/2+65,y:le,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:Ce+Te/2-110,y:X,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ce+Te/2-50,y:X,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(J=>J.name).join(", ").substring(0,30),e.assignees.map(J=>J.name).join(", ").length>30?"...":""]})]}),!F&&jsxRuntime.jsx("text",{x:Ce+Te/2,y:L,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ot?"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 Ll({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:n,height:l,showBelow:c}=e,p=82,s=13,m=c?o+l+s:o-p-s,i=c?`M ${r+n/2-6} ${o+l+3} L ${r+n/2} ${o+l+13} L ${r+n/2+6} ${o+l+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,d=m+22,u=m+40,x=m+55,v=m+70,h=c?m+p-5:o-18,w=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),g=()=>{if(!a.startDate||!a.endDate)return "N/A";let N=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${N} day${N!==1?"s":""}`},f=n<50,T=n<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+n/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+n/2,y:d,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+n/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?w(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?w(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+n/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:g()}),jsxRuntime.jsx("text",{x:r+n/2+10,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/2+65,y:x,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+n/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+n/2-50,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(N=>N.name).join(", ").substring(0,30),a.assignees.map(N=>N.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+n/2,y:h,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 No({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:l}){let[c,p]=react.useState(false),s=a-e,m=r-t,i=e+s/2,d=`M ${e} ${t} C ${i} ${t}, ${i} ${r}, ${a} ${r}`,u=6,x=Math.atan2(m,s),v=a-u*Math.cos(x-Math.PI/6),h=r-u*Math.sin(x-Math.PI/6),w=a-u*Math.cos(x+Math.PI/6),g=r-u*Math.sin(x+Math.PI/6),f=o.dependency;return react.useEffect(()=>{l&&n&&l(c?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[c,e,t,a,r,n,l]),jsxRuntime.jsxs("g",{onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&l?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 ${v} ${h} M ${a} ${r} L ${w} ${g}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&l?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&&l?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&n&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),n();},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 So({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),c=16,p=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(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:n?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:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&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:n&&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 Y={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=s=>{s.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,c=new Set,p=s=>{if(!l.has(s)){l.add(s),c.add(s);let m=r.get(s)||[];for(let i of m){if(!l.has(i)&&p(i))return true;if(c.has(i))return true}}return c.delete(s),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=Y.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Y.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=Y.findTaskById(e,o);if(n)a.unshift(n),o=n.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=Y.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.join(","));}),r.join(`
|
|
46
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Y.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=Y.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)=>Y.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Y.findTaskById(e,t);return !a||!a.dependencies?[]:Y.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Y.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Y.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=Y.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 n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!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=>Y.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,n=Y.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=n.map(p=>{let s=p.startDate&&p.endDate?Y.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?Y.formatDate(p.startDate):"N/A",p.endDate?Y.formatDate(p.endDate):"N/A",s>0?`${s} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:l,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=Y.flattenTasks(e).map(p=>{let s=p.startDate&&p.endDate?Y.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?Y.formatDate(p.startDate):"","End Date":p.endDate?Y.formatDate(p.endDate):"","Duration (days)":s>0?s:"","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}}),n=a.utils.json_to_sheet(o),l=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];n["!cols"]=l;let c=a.utils.book_new();a.utils.book_append_sheet(c,n,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Y.flattenTasks(e),o=new Map;r.forEach((d,u)=>{o.set(d.id,u+1);});let n=d=>d.toISOString().replace("Z",""),l=Y.getEarliestStartDate(e)||new Date,c=Y.getLatestEndDate(e)||new Date,p=r.map((d,u)=>{let x=o.get(d.id),v=d.startDate&&d.endDate?Y.calculateDuration(d.startDate,d.endDate):0,h=(d.dependencies||[]).filter(w=>o.has(w)).map(w=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${o.get(w)}</PredecessorUID>
|
|
49
49
|
<Type>1</Type>
|
|
@@ -52,38 +52,38 @@
|
|
|
52
52
|
<LagFormat>7</LagFormat>
|
|
53
53
|
</PredecessorLink>`).join("");return `
|
|
54
54
|
<Task>
|
|
55
|
-
<UID>${
|
|
55
|
+
<UID>${x}</UID>
|
|
56
56
|
<ID>${u+1}</ID>
|
|
57
|
-
<Name>${
|
|
57
|
+
<Name>${d.name.replace(/[<>&'"]/g,w=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[w]||w)}</Name>
|
|
58
58
|
<Type>0</Type>
|
|
59
59
|
<IsNull>0</IsNull>
|
|
60
60
|
<CreateDate>${n(new Date)}</CreateDate>
|
|
61
61
|
<WBS>${u+1}</WBS>
|
|
62
62
|
<OutlineNumber>${u+1}</OutlineNumber>
|
|
63
|
-
<OutlineLevel>${
|
|
63
|
+
<OutlineLevel>${d.level||0}</OutlineLevel>
|
|
64
64
|
<Priority>500</Priority>
|
|
65
|
-
<Start>${
|
|
66
|
-
<Finish>${
|
|
67
|
-
<Duration>PT${
|
|
65
|
+
<Start>${d.startDate?n(d.startDate):""}</Start>
|
|
66
|
+
<Finish>${d.endDate?n(d.endDate):""}</Finish>
|
|
67
|
+
<Duration>PT${v*8}H0M0S</Duration>
|
|
68
68
|
<DurationFormat>7</DurationFormat>
|
|
69
|
-
<Work>PT${
|
|
70
|
-
<Stop>${
|
|
71
|
-
<Resume>${
|
|
69
|
+
<Work>PT${v*8}H0M0S</Work>
|
|
70
|
+
<Stop>${d.endDate?n(d.endDate):""}</Stop>
|
|
71
|
+
<Resume>${d.startDate?n(d.startDate):""}</Resume>
|
|
72
72
|
<ResumeValid>0</ResumeValid>
|
|
73
73
|
<EffortDriven>1</EffortDriven>
|
|
74
74
|
<Recurring>0</Recurring>
|
|
75
75
|
<OverAllocated>0</OverAllocated>
|
|
76
76
|
<Estimated>0</Estimated>
|
|
77
|
-
<Milestone>${
|
|
78
|
-
<Summary>${
|
|
79
|
-
<Critical>${
|
|
77
|
+
<Milestone>${d.isMilestone?"1":"0"}</Milestone>
|
|
78
|
+
<Summary>${d.subtasks&&d.subtasks.length>0?"1":"0"}</Summary>
|
|
79
|
+
<Critical>${d.isCriticalPath?"1":"0"}</Critical>
|
|
80
80
|
<IsSubproject>0</IsSubproject>
|
|
81
81
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
82
82
|
<ExternalTask>0</ExternalTask>
|
|
83
|
-
<EarlyStart>${
|
|
84
|
-
<EarlyFinish>${
|
|
85
|
-
<LateStart>${
|
|
86
|
-
<LateFinish>${
|
|
83
|
+
<EarlyStart>${d.startDate?n(d.startDate):""}</EarlyStart>
|
|
84
|
+
<EarlyFinish>${d.endDate?n(d.endDate):""}</EarlyFinish>
|
|
85
|
+
<LateStart>${d.startDate?n(d.startDate):""}</LateStart>
|
|
86
|
+
<LateFinish>${d.endDate?n(d.endDate):""}</LateFinish>
|
|
87
87
|
<StartVariance>0</StartVariance>
|
|
88
88
|
<FinishVariance>0</FinishVariance>
|
|
89
89
|
<WorkVariance>0</WorkVariance>
|
|
@@ -91,22 +91,22 @@
|
|
|
91
91
|
<TotalSlack>0</TotalSlack>
|
|
92
92
|
<FixedCost>0</FixedCost>
|
|
93
93
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
94
|
-
<PercentComplete>${
|
|
95
|
-
<PercentWorkComplete>${
|
|
94
|
+
<PercentComplete>${d.progress}</PercentComplete>
|
|
95
|
+
<PercentWorkComplete>${d.progress}</PercentWorkComplete>
|
|
96
96
|
<Cost>0</Cost>
|
|
97
97
|
<OvertimeCost>0</OvertimeCost>
|
|
98
98
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
99
|
-
<ActualStart>${
|
|
100
|
-
<ActualFinish>${
|
|
101
|
-
<ActualDuration>PT${Math.round(
|
|
99
|
+
<ActualStart>${d.progress>0&&d.startDate?n(d.startDate):""}</ActualStart>
|
|
100
|
+
<ActualFinish>${d.progress===100&&d.endDate?n(d.endDate):""}</ActualFinish>
|
|
101
|
+
<ActualDuration>PT${Math.round(v*d.progress/100)*8}H0M0S</ActualDuration>
|
|
102
102
|
<ActualCost>0</ActualCost>
|
|
103
103
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
104
|
-
<ActualWork>PT${Math.round(
|
|
104
|
+
<ActualWork>PT${Math.round(v*d.progress/100)*8}H0M0S</ActualWork>
|
|
105
105
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
106
|
-
<RegularWork>PT${
|
|
107
|
-
<RemainingDuration>PT${Math.round(
|
|
106
|
+
<RegularWork>PT${v*8}H0M0S</RegularWork>
|
|
107
|
+
<RemainingDuration>PT${Math.round(v*(100-d.progress)/100)*8}H0M0S</RemainingDuration>
|
|
108
108
|
<RemainingCost>0</RemainingCost>
|
|
109
|
-
<RemainingWork>PT${Math.round(
|
|
109
|
+
<RemainingWork>PT${Math.round(v*(100-d.progress)/100)*8}H0M0S</RemainingWork>
|
|
110
110
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
111
111
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
112
112
|
<ACWP>0</ACWP>
|
|
@@ -126,16 +126,16 @@
|
|
|
126
126
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
127
127
|
<IsPublished>1</IsPublished>
|
|
128
128
|
<CommitmentType>0</CommitmentType>${h}
|
|
129
|
-
</Task>`}).join(""),
|
|
129
|
+
</Task>`}).join(""),s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
130
130
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
131
131
|
<SaveVersion>14</SaveVersion>
|
|
132
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
133
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
132
|
+
<Name>${t.replace(/[<>&'"]/g,d=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[d]||d)}</Name>
|
|
133
|
+
<Title>${t.replace(/[<>&'"]/g,d=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[d]||d)}</Title>
|
|
134
134
|
<CreationDate>${n(new Date)}</CreationDate>
|
|
135
135
|
<LastSaved>${n(new Date)}</LastSaved>
|
|
136
136
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
137
137
|
<StartDate>${n(l)}</StartDate>
|
|
138
|
-
<FinishDate>${n(
|
|
138
|
+
<FinishDate>${n(c)}</FinishDate>
|
|
139
139
|
<FYStartDate>1</FYStartDate>
|
|
140
140
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
141
141
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -271,11 +271,11 @@
|
|
|
271
271
|
</WeekDays>
|
|
272
272
|
</Calendar>
|
|
273
273
|
</Calendars>
|
|
274
|
-
<Tasks>${
|
|
274
|
+
<Tasks>${p}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,m=new Blob([i],{type:"application/xml;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(m),s.download=a,s.click(),URL.revokeObjectURL(s.href);},calculateCriticalPath:e=>{let t=j.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let m=i.startDate&&i.endDate?j.calculateDuration(i.startDate,i.endDate):0,s=0;if(i.dependencies&&i.dependencies.length>0)for(let u of i.dependencies){let y=t.find(k=>k.id===u);if(y){o(y);let k=r.get(u)?.ef||0;s=Math.max(s,k);}}let p=s+m;r.set(i.id,{es:s,ef:p});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(i=>i.ef)),l=new Map,d=i=>{if(l.has(i.id))return;let m=i.startDate&&i.endDate?j.calculateDuration(i.startDate,i.endDate):0,s=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),p=n;if(s.length>0)for(let y of s){d(y);let k=l.get(y.id)?.ls||0;p=Math.min(p,k);}let u=p-m;l.set(i.id,{ls:u,lf:p});};a.forEach(d);let c=[];for(let i of a){let m=r.get(i.id),s=l.get(i.id);if(m&&s){let p=s.ls-m.es;Math.abs(p)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=j.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(j.calculateCriticalPath(e).includes(t))return 0;let o=j.getDependentTasks(e,t);if(o.length===0){let d=j.getLatestEndDate(e);if(!d)return null;let c=j.calculateDuration(a.endDate,d);return Math.max(0,c)}let n=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,c)=>d-c)[0];if(!n)return null;let l=j.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>j.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=j.findTaskById(e,t);if(!r||!r.endDate)return e;let o=j.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let d=j.calculateDuration(l.startDate,l.endDate),c;a!==void 0?(c=new Date(l.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=j.calculateEndDate(c,d),m=s=>s.map(p=>p.id===l.id?{...p,startDate:c,endDate:i}:p.subtasks?{...p,subtasks:m(p.subtasks)}:p);n=m(n),n=j.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,d)=>{if(a===0)return [];let c=[],i=o.getTime(),m=1e3*60*60*24,s=j.findTaskById(e,t);if(!s||!s.endDate)return [];let p=(u,y,k=new Set)=>{if(k.has(u))return;k.add(u);let h=j.getDependentTasks(e,u);for(let w of h){if(!w.startDate||!w.endDate)continue;let f=r.findIndex(L=>L.id===w.id);if(f===-1)continue;let g=w.startDate.getTime(),D=(w.endDate.getTime()-g)/m,x=(g-i)/m*n,v=x+y*n,P=Math.max(D*n,n),C=d+f*l+12;c.push({taskId:w.id,taskName:w.name,originalX:x,previewX:v,width:P,y:C,rowIndex:f,daysDelta:y,color:w.color}),p(w.id,y,k);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=j.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 n=new Date(a);n.setDate(n.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:d}],i=m=>m.map(s=>s.id===o.id?{...s,endDate:d,segments:c}:s.subtasks?{...s,subtasks:i(s.subtasks)}:s);return i(e)}};function Eo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:d,onTaskClick:c,onTaskDblClick:i,onTaskContextMenu:m,onTaskDateChange:s,onDependencyCreate:p,onDependencyDelete:u}){let[k,h]=react.useState([]),[w,f]=react.useState(null),[g,T]=react.useState(null),D=react.useCallback(S=>{f(S);},[]),b=react.useCallback(S=>{T(S);},[]),x=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),v=r==="day"?60:r==="week"?20:8,P=x*v*l,C=S=>{let M=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),E=M.getUTCDay()||7;M.setUTCDate(M.getUTCDate()+4-E);let U=new Date(Date.UTC(M.getUTCFullYear(),0,1));return Math.ceil(((M.getTime()-U.getTime())/864e5+1)/7)},L=S=>{let M=S.getDay();return M===0||M===6},$=react.useCallback(S=>{let M=Math.round(S/(v*l)),E=new Date(o);return E.setDate(E.getDate()+M),E},[o,v,l]),F=react.useCallback((S,M)=>{if(M.startDate&&M.endDate)return;let E=S.currentTarget.ownerSVGElement;if(!E)return;let U=E.createSVGPoint();U.x=S.clientX,U.y=S.clientY;let K=U.matrixTransform(E.getScreenCTM()?.inverse()),V=$(K.x),be=new Date(V);be.setDate(be.getDate()+1),s?.(M,V,be);},[$,s]),O=react.useMemo(()=>{let S=K=>K.map(V=>{if(V.subtasks&&V.subtasks.length>0){let be=S(V.subtasks),he=be.filter(He=>He.startDate&&He.endDate);if(he.length>0){let He=he.map(Mt=>Mt.startDate.getTime()),me=he.map(Mt=>Mt.endDate.getTime()),qe=new Date(Math.min(...He)),Ke=new Date(Math.max(...me));return {...V,subtasks:be,startDate:qe,endDate:Ke}}return {...V,subtasks:be}}return V}),M=(K,V=[])=>{for(let be of K)V.push(be),be.subtasks&&be.subtasks.length>0&&(be.isExpanded===void 0||be.isExpanded)&&M(be.subtasks,V);return V},E=S(e);return M(E)},[e]),_=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let M=S.startDate.getTime(),E=S.endDate.getTime(),U=o.getTime(),K=(M-U)/(1e3*60*60*24),V=(E-M)/(1e3*60*60*24),be=K*v*l,he=Math.max(v*l,40),He=Math.max(V*v*l,he);return {x:be,width:He}},[o,v,l]),ae=react.useMemo(()=>O.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:M,width:E}=_(S),K=O.findIndex(V=>V.id===S.id)*a+12;return {id:S.id,x:M,y:K,width:E,height:32}}),[O,_]),pe=react.useCallback((S,M,E)=>{if(!E||M===0){h([]);return}let U=j.calculateCascadePreview(e,S,M,O,o,v*l,a,48);h(U);},[e,O,o,v,l,a,48]),Le=react.useMemo(()=>{let S=[],M=new Date(o);for(;M<=n;){let K=(M.getTime()-o.getTime())/864e5*v*l;if(r==="day")S.push({date:new Date(M),label:M.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:K}),M.setDate(M.getDate()+1);else if(r==="week"){let V=C(M);S.push({date:new Date(M),label:`Week ${V}`,x:K}),M.setDate(M.getDate()+7);}else S.push({date:new Date(M),label:M.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:K}),M.setMonth(M.getMonth()+1);}return S},[o,n,r,v,l]),Pe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*v*l,[o,v,l]),ne=Math.max(O.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(P,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(P,1e3),height:48,fill:t.bgGrid}),Le.map((S,M)=>jsxRuntime.jsxs("g",{children:[M>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${M}`)),Pe>=0&&Pe<=P&&jsxRuntime.jsx("circle",{cx:Pe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(P,1e3),height:ne,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(P,1e3),height:ne,fill:t.bgPrimary}),Le.map((S,M)=>{let E=Le[M+1]?.x||P,U=L(S.date);return jsxRuntime.jsxs("g",{children:[U&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:E-S.x,height:O.length*a,fill:t.bgWeekend,opacity:1}),M>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:O.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},M)}),Pe>=0&&Pe<=P&&jsxRuntime.jsx("line",{x1:Pe,y1:0,x2:Pe,y2:O.length*a,stroke:t.today,strokeWidth:2,opacity:1}),O.map((S,M)=>{let E=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:M*a,width:P,height:a,fill:M%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:M*a,width:P,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:U=>F(U,S),onMouseEnter:U=>{U.currentTarget.setAttribute("fill",t.accentLight),U.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:U=>{U.currentTarget.setAttribute("fill","transparent"),U.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Pe>0?Pe:100,y:M*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-${S.id}`)]})]},`row-group-${S.id}`)}),O.map((S,M)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(E=>{let U=O.find(he=>he.id===E);if(!U||!U.startDate||!U.endDate)return null;let K=O.findIndex(he=>he.id===E),V=_(U),be=_(S);return jsxRuntime.jsx(To,{x1:V.x+V.width,y1:K*a+a/2,x2:be.x,y2:M*a+a/2,theme:t,onDelete:()=>u?.(S.id,E),onHoverChange:b},`dep-${E}-${S.id}`)})),O.map((S,M)=>{if(!S.startDate||!S.endDate)return null;let{x:E,width:U}=_(S),K=M*a+12,V=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(No,{task:S,x:E+U/2,y:K+16,theme:t,onClick:c},S.id):V?jsxRuntime.jsxs("g",{onClick:()=>c?.(S),onContextMenu:be=>{be.preventDefault(),be.stopPropagation(),m?.(S,be);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:E,y:K,width:U,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:E,y1:K,x2:E+U,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E,y1:K,x2:E,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E+U,y1:K,x2:E+U,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E,y1:K+32,x2:E+U,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),U>60&&jsxRuntime.jsx("text",{x:E+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(ko,{task:S,x:E,y:K,width:U,theme:t,dayWidth:v*l,startDate:o,templates:d,onClick:c,onDoubleClick:i,onContextMenu:m,onDateChange:s,onDependencyCreate:p,allTaskPositions:ae,onDragMove:pe,onHoverChange:D},S.id)}),k.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:M,x2:E,y2:U,onDelete:K}=g,V=E-S,be=U-M,he=S+V/2,He=(M+U)/2,me=`M ${S} ${M} C ${he} ${M}, ${he} ${U}, ${E} ${U}`,qe=6,Ke=Math.atan2(be,V),Mt=E-qe*Math.cos(Ke-Math.PI/6),Jt=U-qe*Math.sin(Ke-Math.PI/6),zt=E-qe*Math.cos(Ke+Math.PI/6),It=U-qe*Math.sin(Ke+Math.PI/6),At=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:me,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${E} ${U} L ${Mt} ${Jt} M ${E} ${U} L ${zt} ${It}`,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:E,cy:U,r:5,fill:At}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:St=>{St.stopPropagation(),K();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:he,cy:He,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:he-4,y1:He-4,x2:he+4,y2:He+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:he+4,y1:He-4,x2:he-4,y2:He+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),w&&jsxRuntime.jsx(Il,{tooltipData:w,theme:t})]})]})}var Fl=[{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 Bl({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:Fl.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:Fl.find(r=>r.value===e)?.name||"Personalizado"})]})}var zl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function Po({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:d=a?"edit":"create",theme:c="dark",customStatuses:i=[]}){let m=[...zl,...i.filter(x=>!zl.some(v=>v.id===x.id))],s=Me[c]||Me.dark,[p,u]=react.useState(false),y={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},k={color:s.textSecondary},[h,w]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[f,g]=react.useState({});react.useEffect(()=>{a?(w({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)):(w({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return h.name.trim()||(x.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),g(x),Object.keys(x).length===0},D=async x=>{if(x.preventDefault(),!!T())try{await n(h),t();}catch(v){console.error("Error submitting task:",v);}},b=(x,v)=>{w(P=>{let C={...P,[x]:v};if(x==="progress"){let L=typeof v=="number"?v:parseInt(v,10);L===100&&P.status!=="completed"?C.status="completed":L>0&&L<100&&P.status==="todo"?C.status="in-progress":L===0&&P.status!=="todo"&&(C.status="todo");}return C}),f[x]&&g(P=>{let C={...P};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:s.bgPrimary,border:`1px solid ${s.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:d==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:l,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:k,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:h.name,onChange:x=>b("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=s.accent,onBlur:x=>x.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l,autoFocus:true}),f.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"}),f.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:k,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:s.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:h.startDate?h.startDate.toISOString().split("T")[0]:"",onChange:x=>b("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:l||h.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:s.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:h.endDate?h.endDate.toISOString().split("T")[0]:"",onChange:x=>b("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:l||h.isMilestone})]})]}),f.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"}),f.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:k,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:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:v=>v.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(v=>v.name===x.name),onChange:v=>{let P=v.target.checked?[...h.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(h.assignees||[]).filter(C=>C.name!==x.name);b("assignees",P);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:s.accent},disabled:l}),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:s.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.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:k,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:h.status,onChange:x=>b("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:l,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:k,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:h.priority||"medium",onChange:x=>b("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:l,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:k,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:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981",backgroundColor:h.progress<30?"rgba(239, 68, 68, 0.1)":h.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[h.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress,onChange:x=>b("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:s.bgSecondary,accentColor:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981"},disabled:l})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",x),disabled:l,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":s.bgSecondary,color:h.progress===x?"#FFFFFF":s.textTertiary,border:`1px solid ${h.progress===x?"transparent":s.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:k,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Bl,{value:h.color,onChange:x=>b("color",x),disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:k,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:s.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:h.description||"",onChange:x=>b("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=s.accent,onBlur:x=>x.currentTarget.style.borderColor=s.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!p),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:s.textSecondary,backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=s.bgSecondary,children:[p?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:s.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&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:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:h.isMilestone,onChange:x=>b("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.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:k,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:s.bgSecondary,border:`1px solid ${s.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:v=>v.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(x.id),onChange:v=>{let P=v.target.checked?[...h.dependencies||[],x.id]:(h.dependencies||[]).filter(C=>C!==x.id);b("dependencies",P);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.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 ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=s.textPrimary,x.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=s.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:D,disabled:l,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:s.accent,color:"#FFFFFF"},onMouseEnter:x=>!l&&(x.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:x=>!l&&(x.currentTarget.style.backgroundColor=s.accent),children:l?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"}),d==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Tg=['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"'],Gl=()=>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"})]}),Dg=()=>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"})}),Ng=()=>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"})}),Sg=()=>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"})}),Eg=()=>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 Mo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:d,onDependencyDelete:c}){let[i,m]=react.useState(false),[s,p]=react.useState(false),[u,y]=react.useState([]),[k,h]=react.useState(""),[w,f]=react.useState(false),[g,T]=react.useState(true),D=react.useRef(null),b=react.useRef(null),x=react.useRef(null),{enabled:v=true,placeholder:P='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:L,suggestions:$=Tg,maxHistory:F=50,persistHistory:O}=a,_=O?.storageKey||"gantt-ai-history",ae=O?.maxMessages??5;react.useEffect(()=>{if(O?.enabled)try{let M=localStorage.getItem(_);if(M){let U=JSON.parse(M).map(K=>({...K,timestamp:new Date(K.timestamp)}));y(U.slice(-ae));}}catch(M){console.warn("[GanttAIAssistant] Failed to load persisted history:",M);}},[O?.enabled,_,ae]),react.useEffect(()=>{if(O?.enabled&&u.length>0)try{let M=u.filter(E=>!E.isLoading).slice(-ae);localStorage.setItem(_,JSON.stringify(M));}catch(M){console.warn("[GanttAIAssistant] Failed to persist history:",M);}},[u,O?.enabled,_,ae]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{i&&!s&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,s]);let pe=react.useCallback(M=>{if(M.success)switch(M.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":M.taskId&&M.updates&&o?.(M.taskId,M.updates);break;case "create_task":M.newTask&&n?.(M.newTask);break;case "delete_task":M.taskId&&l?.(M.taskId);break;case "link_tasks":M.dependencyFrom&&M.dependencyTo&&d?.(M.dependencyFrom,M.dependencyTo);break;case "unlink_tasks":M.taskId&&M.dependencyFrom&&c?.(M.taskId,M.dependencyFrom);break}},[o,n,l,d,c]),Le=react.useCallback(async M=>{if(!M.trim()||w)return;let E={id:`user-${Date.now()}`,role:"user",content:M,timestamp:new Date};y(K=>[...K.slice(-(F-1)),E]),h(""),T(false),f(true);let U={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(K=>[...K,U]);try{if(L){let K=await L(M,e);y(V=>{let be=V.filter(He=>!He.isLoading),he={id:`assistant-${Date.now()}`,role:"assistant",content:K.message,timestamp:new Date,command:K};return [...be,he]}),pe(K);}else y(K=>[...K.filter(be=>!be.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(K){y(V=>[...V.filter(he=>!he.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${K instanceof Error?K.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[w,F,L,e,pe]),Pe=M=>{M.preventDefault(),Le(k);},ne=M=>{h(M),D.current?.focus();};if(react.useEffect(()=>{let M=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(U=>!U),i||p(false)),E.key==="Escape"&&i&&m(false);};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[i]),react.useEffect(()=>{if(!i)return;let M=U=>{let K=U.target;x.current&&!x.current.contains(K)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",M);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",M);}},[i]),!v)return null;let S={"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($e,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&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 ${S[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(Gl,{}),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:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:s?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[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(Gl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(M=>!M),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Sg,{})}),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(Ng,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:$.slice(0,4).map((M,E)=>jsxRuntime.jsx("button",{onClick:()=>ne(M),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:M.length>30?M.slice(0,30)+"...":M},E))})]}),u.map(M=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${M.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${M.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:M.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:M.role==="user"?"white":t.textPrimary},children:[M.isLoading?jsxRuntime.jsx(Eg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:M.content}),M.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:M.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:M.command.success?"#10B981":"#EF4444"},children:[M.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:M.command.type.replace(/_/g," ")})]})]})},M.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,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:k,onChange:M=>h(M.target.value),placeholder:P,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Dg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ul(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((i,m=true)=>{r(s=>{let p=typeof i=="function"?i(s.present):i;if(o.current)return {...s,present:p};if(!m)return {...s,present:p};let u=[...s.past,s.present];return u.length>t&&u.shift(),{past:u,present:p,future:[]}});},[t]),l=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let m=i.past[i.past.length-1],s=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:s,present:m,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let m=i.future[0],s=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:m,future:s}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Hl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=d?l.metaKey:l.ctrlKey;if(c&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!d&&c&&l.key==="y"){l.preventDefault(),t();return}if(d&&c&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Ag={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${j.formatDate(e.startDate)} - ${j.formatDate(e.endDate)}`);let a=j.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=>j.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function _l(e){return {...Ag,...e}}var zg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Kl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:d="comfortable",showThemeSelector:c=true,showExportButton:i=true,availableUsers:m=[],templates:s,enableAutoCriticalPath:p=true,aiAssistant:u,locale:y="en",customTranslations:k,showCreateTaskButton:h=false,createTaskLabel:w,onCreateTask:f,onThemeChange:g,onTaskClick:T,onTaskDblClick:D,onTaskContextMenu:b,onTaskUpdate:x,onProgressChange:v,onTaskEdit:P,onTaskAddSubtask:C,onTaskMarkIncomplete:L,onTaskSetInProgress:$,onDependencyCreate:F,onDependencyDelete:O,onBeforeTaskAdd:_,onAfterTaskAdd:ae,onBeforeTaskUpdate:pe,onAfterTaskUpdate:Le,onBeforeTaskDelete:Pe,onAfterTaskDelete:ne}=a,M=react.useContext(go)?.theme,[E,U]=react.useState(M||n||"dark"),[K,V]=react.useState(l),[be,he]=react.useState(d),[He,me]=react.useState(1),[qe,Ke]=react.useState(0),[Mt,Jt]=react.useState(false),[zt,It]=react.useState(null),[At,St]=react.useState({isOpen:false,x:0,y:0,task:null}),[fa,mt]=react.useState(null),[ot,Lt]=react.useState(null);react.useEffect(()=>{M&&M!==E&&U(M);},[M]),react.useEffect(()=>{n&&n!==E&&U(n);},[n]);let Ca=react.useCallback(N=>{U(N),g?.(N);},[g]),{state:se,setState:ve,undo:_t,redo:ba,canUndo:xt,canRedo:ha,clearHistory:va}=Ul(t,50);react.useEffect(()=>{ve(t);},[t,ve]);let ke=react.useRef(t),Ce=react.useRef(true);react.useEffect(()=>{if(Ce.current){Ce.current=false,ke.current=se;return}if(!r)return;let N=JSON.stringify(ke.current),R=JSON.stringify(se);N!==R&&(ke.current=se,r(se));},[se,r]);let ut=react.useMemo(()=>Gn(y,k),[y,k]),ee=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}],[]),[ye,A]=react.useState(()=>ee(ut));react.useEffect(()=>{A(N=>N.map(R=>({...R,label:ut.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ut]);let W=react.useMemo(()=>ye.filter(N=>N.visible).reduce((N,R)=>N+R.width,0)+60,[ye]),ie=react.useMemo(()=>zt!==null?Math.max(280,zt,W):Math.max(280,W),[zt,W]),ce=react.useRef(null),Y=react.useRef(null),le=react.useRef(null),q=react.useMemo(()=>il(E),[E]),I=react.useMemo(()=>({theme:q,themeName:E}),[q,E]),X=react.useMemo(()=>_l(s),[s]),Te=react.useMemo(()=>{if(!p)return se;let N=j.calculateCriticalPath(se),R=H=>H.map(J=>({...J,isCriticalPath:N.includes(J.id),subtasks:J.subtasks?R(J.subtasks):void 0}));return R(se)},[se,p]),Ye=zg(be);Hl({undo:_t,redo:ba,canUndo:xt,canRedo:ha,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>j.findTaskById(se,N),addTask:(N,R)=>{ve(H=>{if(!R)return [...H,{...N,level:0}];let J=re=>re.map(ue=>ue.id===R?{...ue,subtasks:[...ue.subtasks||[],{...N,parentId:R,level:(ue.level||0)+1}],isExpanded:true}:ue.subtasks?{...ue,subtasks:J(ue.subtasks)}:ue);return J(H)});},updateTask:(N,R)=>{ve(H=>{let J=re=>re.map(ue=>ue.id===N?{...ue,...R}:ue.subtasks?{...ue,subtasks:J(ue.subtasks)}:ue);return J(H)});},deleteTask:N=>{ve(R=>{let H=J=>J.filter(re=>re.id===N?false:(re.subtasks&&(re.subtasks=H(re.subtasks)),true));return H(R)});},deleteTasks:N=>{ve(R=>Yn(R,N));},duplicateTask:N=>{ve(R=>qn(R,[N]));},splitTask:(N,R,H=3)=>{ve(J=>j.splitTask(J,N,R,H));},calculateEndDate:j.calculateEndDate,calculateDuration:j.calculateDuration,validateDependency:(N,R)=>!j.validateDependencies(se,N,R),getAllTasks:()=>j.flattenTasks(se),getTasksByStatus:N=>j.flattenTasks(se).filter(R=>R.status===N),getTasksByParent:N=>N?j.findTaskById(se,N)?.subtasks||[]:se.filter(H=>!H.parentId),getCriticalPath:()=>j.flattenTasks(se).filter(N=>N.isCriticalPath),indentTask:N=>{ve(R=>Vn(R,[N]));},outdentTask:N=>{ve(R=>jn(R,[N]));},moveTask:(N,R)=>{ve(H=>Kn(H,[N],R));},createSubtask:async N=>{let{tasks:R,newTask:H}=Zn(se,N);if(_){let J=_({...H,parentId:N});if((J instanceof Promise?await J:J)===false)return}ve(R),ae&&ae({...H,parentId:N});},scrollToTask:N=>{let H=j.flattenTasks(se).findIndex(J=>J.id===N);if(H!==-1&&ce.current){let J=H*Ye;ce.current.scrollTo({top:J,behavior:"smooth"}),Y.current&&Y.current.scrollTo({top:J,behavior:"smooth"});}},highlightTask:(N,R=2e3)=>{},expandTask:N=>{ve(R=>{let H=J=>J.map(re=>re.id===N?{...re,isExpanded:true}:re.subtasks?{...re,subtasks:H(re.subtasks)}:re);return H(R)});},collapseTask:N=>{ve(R=>{let H=J=>J.map(re=>re.id===N?{...re,isExpanded:false}:re.subtasks?{...re,subtasks:H(re.subtasks)}:re);return H(R)});},expandAll:()=>{ve(N=>{let R=H=>H.map(J=>({...J,isExpanded:true,subtasks:J.subtasks?R(J.subtasks):void 0}));return R(N)});},collapseAll:()=>{ve(N=>{let R=H=>H.map(J=>({...J,isExpanded:false,subtasks:J.subtasks?R(J.subtasks):void 0}));return R(N)});},undo:_t,redo:ba,canUndo:()=>xt,canRedo:()=>ha,clearHistory:va,exportToPNG:async()=>{if(!le.current)throw new Error("Gantt container not found");let N=await jl__default.default(le.current,{backgroundColor:q.bgPrimary,scale:2});return new Promise((R,H)=>{N.toBlob(J=>{J?R(J):H(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await j.exportToPDF(se,N);},exportToExcel:async N=>{await j.exportToExcel(se,N);},exportToJSON:()=>j.exportToJSON(se),exportToCSV:()=>j.exportToCSV(se),importFromJSON:N=>{let R=j.importFromJSON(N);ve(R);},getTasks:()=>se,refresh:()=>{ve(N=>[...N]);},clearAll:()=>{ve([]);}}),[se,_t,ba,xt,ha,va,q,Ye]);let de=react.useCallback(N=>{A(R=>R.map(H=>H.id===N?{...H,visible:!H.visible}:H));},[]),Ga=react.useCallback((N,R)=>{A(H=>H.map(J=>{if(J.id!==N)return J;let re=J.minWidth??100,ue=J.maxWidth??800,gt=Math.max(re,Math.min(ue,R));return {...J,width:gt}}));},[]),rr=react.useCallback(N=>{ve(R=>Jn(R,N)),a.onTaskToggleExpand?.(N);},[a]),or=react.useCallback((N,R)=>{if(pe&&pe(N,R)===false)return;let J=j.findTaskById(se,N)?.progress,re=gt=>gt.map(Et=>Et.id===N?{...Et,...R}:Et.subtasks?{...Et,subtasks:re(Et.subtasks)}:Et);ve(re(se));let ue=j.findTaskById(re(se),N);ue&&(x?.(ue),Le?.(ue),R.progress!==void 0&&J!==void 0&&R.progress!==J&&v?.(N,J,R.progress));},[se,x,pe,Le,v]),nc=react.useCallback(N=>{N.length!==0&&(ve(R=>Vn(R,N)),a.onTaskIndent?.(N[0]));},[a]),sc=react.useCallback(N=>{N.length!==0&&(ve(R=>jn(R,N)),a.onTaskOutdent?.(N[0]));},[a]),ic=react.useCallback((N,R,H)=>{ve(J=>Sl(J,N,R,H)),a.onTaskReparent?.(N,R,H);},[a]),lc=react.useCallback((N,R)=>{N.length!==0&&(ve(H=>Kn(H,N,R)),a.onTaskMove?.(N[0],R));},[a]),Yo=react.useCallback(async N=>{let R=[];for(let H of N)Pe&&await Promise.resolve(Pe(H))===false||R.push(H);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ve(H=>Yn(H,R)),R.forEach(H=>a.onTaskDelete?.(H))),ne&&R.forEach(H=>ne(H)));},[a,Pe,ne]),dc=react.useCallback(N=>{ve(R=>qn(R,N)),N.forEach(R=>a.onTaskDuplicate?.(R));},[a]),cc=react.useCallback((N,R)=>{ve(H=>{let{tasks:J,newTask:re}=Nl(H,N,R);return _&&_(re)===false?H:(a.onTaskCreate?.(re.parentId,re.position||0),ae?.(re),J)});},[a,_,ae]),pc=react.useCallback((N,R)=>{ve(H=>Xn(H,N,R)),a.onTaskRename?.(N,R);},[a]),qo=react.useCallback(N=>{ve(R=>{let{tasks:H}=Zn(R,N);return a.onTaskCreate?.(N,0),H});},[a]),mc=react.useCallback((N,R,H)=>{let J=N.startDate?Math.round((R.getTime()-N.startDate.getTime())/864e5):0,re=Et=>Et.map(aa=>aa.id===N.id?{...aa,startDate:R,endDate:H,...N.segments&&{segments:N.segments}}:aa.subtasks?{...aa,subtasks:re(aa.subtasks)}:aa),ue=re(se);ue=j.autoScheduleDependents(ue,N.id,J),ve(ue);let gt={...N,startDate:R,endDate:H};x?.(gt);},[se,x]),uc=react.useCallback((N,R)=>{b?.(N,R),St({isOpen:true,x:R.clientX,y:R.clientY,task:N});},[b]),gc=react.useCallback((N,R)=>{let H=j.splitTask(se,N.id,R);ve(H),St({isOpen:false,x:0,y:0,task:null});},[se]),Xs=react.useCallback(N=>{D?.(N),P||mt(N);},[D,P]),Js=react.useCallback((N,R,H)=>{let J=new Map,re=ra=>{ra.forEach(Ta=>{Ta.dependencies&&J.set(Ta.id,Ta.dependencies),Ta.subtasks&&re(Ta.subtasks);});};re(H);let ue=J.get(R)||[];J.set(R,[...ue,N]);let gt=new Set,Et=new Set,aa=ra=>{if(!gt.has(ra)){gt.add(ra),Et.add(ra);let Ta=J.get(ra)||[];for(let Tr of Ta){if(!gt.has(Tr)&&aa(Tr))return true;if(Et.has(Tr))return true}}return Et.delete(ra),false};return aa(R)},[]),Zs=react.useCallback((N,R)=>{if(Js(N.id,R,se)){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([s],{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=Y.flattenTasks(e),a=t.filter(s=>s.startDate&&s.endDate);if(a.length===0)return [];let r=new Map,o=s=>{if(r.has(s.id))return;let m=s.startDate&&s.endDate?Y.calculateDuration(s.startDate,s.endDate):0,i=0;if(s.dependencies&&s.dependencies.length>0)for(let u of s.dependencies){let x=t.find(v=>v.id===u);if(x){o(x);let v=r.get(u)?.ef||0;i=Math.max(i,v);}}let d=i+m;r.set(s.id,{es:i,ef:d});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),l=new Map,c=s=>{if(l.has(s.id))return;let m=s.startDate&&s.endDate?Y.calculateDuration(s.startDate,s.endDate):0,i=t.filter(x=>x.dependencies&&x.dependencies.includes(s.id)),d=n;if(i.length>0)for(let x of i){c(x);let v=l.get(x.id)?.ls||0;d=Math.min(d,v);}let u=d-m;l.set(s.id,{ls:u,lf:d});};a.forEach(c);let p=[];for(let s of a){let m=r.get(s.id),i=l.get(s.id);if(m&&i){let d=i.ls-m.es;Math.abs(d)<.01&&p.push(s.id);}}return p},calculateSlack:(e,t)=>{let a=Y.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Y.calculateCriticalPath(e).includes(t))return 0;let o=Y.getDependentTasks(e,t);if(o.length===0){let c=Y.getLatestEndDate(e);if(!c)return null;let p=Y.calculateDuration(a.endDate,c);return Math.max(0,p)}let n=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!n)return null;let l=Y.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>Y.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Y.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Y.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=Y.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let s=Y.calculateEndDate(p,c),m=i=>i.map(d=>d.id===l.id?{...d,startDate:p,endDate:s}:d.subtasks?{...d,subtasks:m(d.subtasks)}:d);n=m(n),n=Y.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,c)=>{if(a===0)return [];let p=[],s=o.getTime(),m=1e3*60*60*24,i=Y.findTaskById(e,t);if(!i||!i.endDate)return [];let d=(u,x,v=new Set)=>{if(v.has(u))return;v.add(u);let h=Y.getDependentTasks(e,u);for(let w of h){if(!w.startDate||!w.endDate)continue;let g=r.findIndex(A=>A.id===w.id);if(g===-1)continue;let f=w.startDate.getTime(),N=(w.endDate.getTime()-f)/m,k=(f-s)/m*n,C=k+x*n,M=Math.max(N*n,n),y=c+g*l+12;p.push({taskId:w.id,taskName:w.name,originalX:k,previewX:C,width:M,y,rowIndex:g,daysDelta:x,color:w.color}),d(w.id,x,v);}};return d(t,a),p},splitTask:(e,t,a,r=3)=>{let o=Y.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 n=new Date(a);n.setDate(n.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:c}],s=m=>m.map(i=>i.id===o.id?{...i,endDate:c,segments:p}:i.subtasks?{...i,subtasks:s(i.subtasks)}:i);return s(e)}};function Po({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:s,onTaskContextMenu:m,onTaskDateChange:i,onDependencyCreate:d,onDependencyDelete:u}){let[v,h]=react.useState([]),[w,g]=react.useState(null),[f,T]=react.useState(null),N=react.useCallback(E=>{g(E);},[]),b=react.useCallback(E=>{T(E);},[]),k=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,M=k*C*l,y=E=>{let I=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),S=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-S);let W=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-W.getTime())/864e5+1)/7)},A=E=>{let I=E.getDay();return I===0||I===6},O=react.useCallback(E=>{let I=Math.round(E/(C*l)),S=new Date(o);return S.setDate(S.getDate()+I),S},[o,C,l]),B=react.useCallback((E,I)=>{if(I.startDate&&I.endDate)return;let S=E.currentTarget.ownerSVGElement;if(!S)return;let W=S.createSVGPoint();W.x=E.clientX,W.y=E.clientY;let j=W.matrixTransform(S.getScreenCTM()?.inverse()),K=O(j.x),he=new Date(K);he.setDate(he.getDate()+1),i?.(I,K,he);},[O,i]),$=react.useMemo(()=>{let E=j=>j.map(K=>{if(K.subtasks&&K.subtasks.length>0){let he=E(K.subtasks),ve=he.filter(_e=>_e.startDate&&_e.endDate);if(ve.length>0){let _e=ve.map(Mt=>Mt.startDate.getTime()),me=ve.map(Mt=>Mt.endDate.getTime()),Xe=new Date(Math.min(..._e)),Ye=new Date(Math.max(...me));return {...K,subtasks:he,startDate:Xe,endDate:Ye}}return {...K,subtasks:he}}return K}),I=(j,K=[])=>{for(let he of j)K.push(he),he.subtasks&&he.subtasks.length>0&&(he.isExpanded===void 0||he.isExpanded)&&I(he.subtasks,K);return K},S=E(e);return I(S)},[e]),V=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let I=E.startDate.getTime(),S=E.endDate.getTime(),W=o.getTime(),j=(I-W)/(1e3*60*60*24),K=(S-I)/(1e3*60*60*24),he=j*C*l,ve=Math.max(C*l,40),_e=Math.max(K*C*l,ve);return {x:he,width:_e}},[o,C,l]),ne=react.useMemo(()=>$.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:I,width:S}=V(E),j=$.findIndex(K=>K.id===E.id)*a+12;return {id:E.id,x:I,y:j,width:S,height:32}}),[$,V]),ce=react.useCallback((E,I,S)=>{if(!S||I===0){h([]);return}let W=Y.calculateCascadePreview(e,E,I,$,o,C*l,a,48);h(W);},[e,$,o,C,l,a,48]),Ae=react.useMemo(()=>{let E=[],I=new Date(o);for(;I<=n;){let j=(I.getTime()-o.getTime())/864e5*C*l;if(r==="day")E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:j}),I.setDate(I.getDate()+1);else if(r==="week"){let K=y(I);E.push({date:new Date(I),label:`Week ${K}`,x:j}),I.setDate(I.getDate()+7);}else E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:j}),I.setMonth(I.getMonth()+1);}return E},[o,n,r,C,l]),Me=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*l,[o,C,l]),fe=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}),Ae.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}`)),Me>=0&&Me<=M&&jsxRuntime.jsx("circle",{cx:Me,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(M,1e3),height:fe,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(M,1e3),height:fe,fill:t.bgPrimary}),Ae.map((E,I)=>{let S=Ae[I+1]?.x||M,W=A(E.date);return jsxRuntime.jsxs("g",{children:[W&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:S-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)}),Me>=0&&Me<=M&&jsxRuntime.jsx("line",{x1:Me,y1:0,x2:Me,y2:$.length*a,stroke:t.today,strokeWidth:2,opacity:1}),$.map((E,I)=>{let S=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}`),!S&&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:W=>B(W,E),onMouseEnter:W=>{W.currentTarget.setAttribute("fill",t.accentLight),W.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:W=>{W.currentTarget.setAttribute("fill","transparent"),W.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:Me>0?Me: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(S=>{let W=$.find(ve=>ve.id===S);if(!W||!W.startDate||!W.endDate)return null;let j=$.findIndex(ve=>ve.id===S),K=V(W),he=V(E);return jsxRuntime.jsx(No,{x1:K.x+K.width,y1:j*a+a/2,x2:he.x,y2:I*a+a/2,theme:t,onDelete:()=>u?.(E.id,S),onHoverChange:b},`dep-${S}-${E.id}`)})),$.map((E,I)=>{if(!E.startDate||!E.endDate)return null;let{x:S,width:W}=V(E),j=I*a+12,K=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(So,{task:E,x:S+W/2,y:j+16,theme:t,onClick:p},E.id):K?jsxRuntime.jsxs("g",{onClick:()=>p?.(E),onContextMenu:he=>{he.preventDefault(),he.stopPropagation(),m?.(E,he);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:j,width:W,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:j,x2:S+W,y2:j,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:j,x2:S,y2:j+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+W,y1:j,x2:S+W,y2:j+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:j+32,x2:S+W,y2:j+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),W>60&&jsxRuntime.jsx("text",{x:S+12,y:j+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(wo,{task:E,x:S,y:j,width:W,theme:t,dayWidth:C*l,startDate:o,templates:c,onClick:p,onDoubleClick:s,onContextMenu:m,onDateChange:i,onDependencyCreate:d,allTaskPositions:ne,onDragMove:ce,onHoverChange:N},E.id)}),v.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:S,y2:W,onDelete:j}=f,K=S-E,he=W-I,ve=E+K/2,_e=(I+W)/2,me=`M ${E} ${I} C ${ve} ${I}, ${ve} ${W}, ${S} ${W}`,Xe=6,Ye=Math.atan2(he,K),Mt=S-Xe*Math.cos(Ye-Math.PI/6),Jt=W-Xe*Math.sin(Ye-Math.PI/6),zt=S-Xe*Math.cos(Ye+Math.PI/6),It=W-Xe*Math.sin(Ye+Math.PI/6),At=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:me,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${S} ${W} L ${Mt} ${Jt} M ${S} ${W} L ${zt} ${It}`,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:S,cy:W,r:5,fill:At}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:St=>{St.stopPropagation(),j();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:ve,cy:_e,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:ve-4,y1:_e-4,x2:ve+4,y2:_e+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ve+4,y1:_e-4,x2:ve-4,y2:_e+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),w&&jsxRuntime.jsx(Ll,{tooltipData:w,theme:t})]})]})}var Rl=[{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 Ol({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:Rl.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:Rl.find(r=>r.value===e)?.name||"Personalizado"})]})}var Ul=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function Mo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:s=[]}){let m=[...Ul,...s.filter(k=>!Ul.some(C=>C.id===k.id))],i=Ie[p]||Ie.dark,[d,u]=react.useState(false),x={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},v={color:i.textSecondary},[h,w]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[g,f]=react.useState({});react.useEffect(()=>{a?(w({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)):(w({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let k={};return h.name.trim()||(k.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(k.endDate="La fecha de fin debe ser posterior a la de inicio"),f(k),Object.keys(k).length===0},N=async k=>{if(k.preventDefault(),!!T())try{await n(h),t();}catch(C){console.error("Error submitting task:",C);}},b=(k,C)=>{w(M=>{let y={...M,[k]:C};if(k==="progress"){let A=typeof C=="number"?C:parseInt(C,10);A===100&&M.status!=="completed"?y.status="completed":A>0&&A<100&&M.status==="todo"?y.status="in-progress":A===0&&M.status!=="todo"&&(y.status="todo");}return y}),g[k]&&f(M=>{let y={...M};return delete y[k],y});};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:k=>k.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:k=>k.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:N,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:v,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:h.name,onChange:k=>b("name",k.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:x,onFocus:k=>k.currentTarget.style.borderColor=i.accent,onBlur:k=>k.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l,autoFocus:true}),g.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"}),g.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:v,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:h.startDate?h.startDate.toISOString().split("T")[0]:"",onChange:k=>b("startDate",k.target.value?new Date(k.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:x,disabled:l||h.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:h.endDate?h.endDate.toISOString().split("T")[0]:"",onChange:k=>b("endDate",k.target.value?new Date(k.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:x,disabled:l||h.isMilestone})]})]}),g.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"}),g.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:v,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(k=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:C=>C.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(C=>C.name===k.name),onChange:C=>{let M=C.target.checked?[...h.assignees||[],{id:k.id,name:k.name,avatar:k.avatar,initials:k.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(h.assignees||[]).filter(y=>y.name!==k.name);b("assignees",M);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:l}),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:k.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:k.name})]},k.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:v,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:h.status,onChange:k=>b("status",k.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:x,disabled:l,children:m.map(k=>jsxRuntime.jsx("option",{value:k.id,children:k.title},k.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:h.priority||"medium",onChange:k=>b("priority",k.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:x,disabled:l,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:v,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:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981",backgroundColor:h.progress<30?"rgba(239, 68, 68, 0.1)":h.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[h.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress,onChange:k=>b("progress",parseInt(k.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981"},disabled:l})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(k=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",k),disabled:l,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===k?k<30?"#EF4444":k<70?"#F59E0B":"#10B981":i.bgSecondary,color:h.progress===k?"#FFFFFF":i.textTertiary,border:`1px solid ${h.progress===k?"transparent":i.borderLight}`},children:[k,"%"]},k))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ol,{value:h.color,onChange:k=>b("color",k),disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,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:h.description||"",onChange:k=>b("description",k.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:x,onFocus:k=>k.currentTarget.style.borderColor=i.accent,onBlur:k=>k.currentTarget.style.borderColor=i.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!d),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:k=>k.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor=i.bgSecondary,children:[d?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:d&&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:h.isMilestone,onChange:k=>b("isMilestone",k.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:l}),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:v,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(k=>k.id!==a?.id).map(k=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:C=>C.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(k.id),onChange:C=>{let M=C.target.checked?[...h.dependencies||[],k.id]:(h.dependencies||[]).filter(y=>y!==k.id);b("dependencies",M);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:l}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:k.name})]},k.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:k=>{k.currentTarget.style.color=i.textPrimary,k.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:k=>{k.currentTarget.style.color=i.textSecondary,k.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:N,disabled:l,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:k=>!l&&(k.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:k=>!l&&(k.currentTarget.style.backgroundColor=i.accent),children:l?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 Pg=['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"'],Hl=()=>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"})]}),Mg=()=>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"})}),Ig=()=>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"})}),Ag=()=>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"})}),Lg=()=>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 Io({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[s,m]=react.useState(false),[i,d]=react.useState(false),[u,x]=react.useState([]),[v,h]=react.useState(""),[w,g]=react.useState(false),[f,T]=react.useState(true),N=react.useRef(null),b=react.useRef(null),k=react.useRef(null),{enabled:C=true,placeholder:M='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:y="bottom-right",onCommand:A,suggestions:O=Pg,maxHistory:B=50,persistHistory:$}=a,V=$?.storageKey||"gantt-ai-history",ne=$?.maxMessages??5;react.useEffect(()=>{if($?.enabled)try{let I=localStorage.getItem(V);if(I){let W=JSON.parse(I).map(j=>({...j,timestamp:new Date(j.timestamp)}));x(W.slice(-ne));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[$?.enabled,V,ne]),react.useEffect(()=>{if($?.enabled&&u.length>0)try{let I=u.filter(S=>!S.isLoading).slice(-ne);localStorage.setItem(V,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[u,$?.enabled,V,ne]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{s&&!i&&N.current&&setTimeout(()=>N.current?.focus(),100);},[s,i]);let ce=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&&n?.(I.newTask);break;case "delete_task":I.taskId&&l?.(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,n,l,c,p]),Ae=react.useCallback(async I=>{if(!I.trim()||w)return;let S={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};x(j=>[...j.slice(-(B-1)),S]),h(""),T(false),g(true);let W={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(j=>[...j,W]);try{if(A){let j=await A(I,e);x(K=>{let he=K.filter(_e=>!_e.isLoading),ve={id:`assistant-${Date.now()}`,role:"assistant",content:j.message,timestamp:new Date,command:j};return [...he,ve]}),ce(j);}else x(j=>[...j.filter(he=>!he.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(j){x(K=>[...K.filter(ve=>!ve.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${j instanceof Error?j.message:"Unknown error"}`,timestamp:new Date}]);}finally{g(false);}},[w,B,A,e,ce]),Me=I=>{I.preventDefault(),Ae(v);},fe=I=>{h(I),N.current?.focus();};if(react.useEffect(()=>{let I=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),m(W=>!W),s||d(false)),S.key==="Escape"&&s&&m(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[s]),react.useEffect(()=>{if(!s)return;let I=W=>{let j=W.target;k.current&&!k.current.contains(j)&&m(false);},S=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",I);}},[s]),!C)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(ze,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&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[y]} 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(Hl,{}),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:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:k,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[y]} 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(Hl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>d(I=>!I),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ag,{})}),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(Ig,{})})]})]}),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:O.slice(0,4).map((I,S)=>jsxRuntime.jsx("button",{onClick:()=>fe(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},S))})]}),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(Lg,{}):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:b})]}),jsxRuntime.jsxs("form",{onSubmit:Me,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:N,type:"text",value:v,onChange:I=>h(I.target.value),placeholder:M,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:v.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:v.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Mg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function _l(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,m=true)=>{r(i=>{let d=typeof s=="function"?s(i.present):s;if(o.current)return {...i,present:d};if(!m)return {...i,present:d};let u=[...i.past,i.present];return u.length>t&&u.shift(),{past:u,present:d,future:[]}});},[t]),l=react.useCallback(()=>{r(s=>{if(s.past.length===0)return s;let m=s.past[s.past.length-1],i=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:m,future:[s.present,...s.future]}});},[]),c=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let m=s.future[0],i=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:m,future:i}});},[]),p=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Vl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Og={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Y.formatDate(e.startDate)} - ${Y.formatDate(e.endDate)}`);let a=Y.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=>Y.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function jl(e){return {...Og,...e}}var _g=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},ql=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:s=true,availableUsers:m=[],templates:i,enableAutoCriticalPath:d=true,aiAssistant:u,locale:x="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:w,onCreateTask:g,onThemeChange:f,onTaskClick:T,onTaskDblClick:N,onTaskContextMenu:b,onTaskUpdate:k,onProgressChange:C,onTaskEdit:M,onTaskAddSubtask:y,onTaskMarkIncomplete:A,onTaskSetInProgress:O,onDependencyCreate:B,onDependencyDelete:$,onBeforeTaskAdd:V,onAfterTaskAdd:ne,onBeforeTaskUpdate:ce,onAfterTaskUpdate:Ae,onBeforeTaskDelete:Me,onAfterTaskDelete:fe}=a,I=react.useContext(fo)?.theme,[S,W]=react.useState(I||n||"dark"),[j,K]=react.useState(l),[he,ve]=react.useState(c),[_e,me]=react.useState(1),[Xe,Ye]=react.useState(0),[Mt,Jt]=react.useState(false),[zt,It]=react.useState(null),[At,St]=react.useState({isOpen:false,x:0,y:0,task:null}),[fa,mt]=react.useState(null),[ot,Lt]=react.useState(null);react.useEffect(()=>{I&&I!==S&&W(I);},[I]),react.useEffect(()=>{n&&n!==S&&W(n);},[n]);let Ca=react.useCallback(D=>{W(D),f?.(D);},[f]),{state:se,setState:xe,undo:_t,redo:ba,canUndo:xt,canRedo:ha,clearHistory:va}=_l(t,50);react.useEffect(()=>{xe(t);},[t,xe]);let Ce=react.useRef(t),Te=react.useRef(true);react.useEffect(()=>{if(Te.current){Te.current=false,Ce.current=se;return}if(!r)return;let D=JSON.stringify(Ce.current),R=JSON.stringify(se);D!==R&&(Ce.current=se,r(se));},[se,r]);let ut=react.useMemo(()=>Hn(x,v),[x,v]),te=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:D.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:D.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:D.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:D.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:D.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:D.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:D.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ke,F]=react.useState(()=>te(ut));react.useEffect(()=>{F(D=>D.map(R=>({...R,label:ut.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ut]);let U=react.useMemo(()=>ke.filter(D=>D.visible).reduce((D,R)=>D+R.width,0)+60,[ke]),ie=react.useMemo(()=>zt!==null?Math.max(280,zt,U):Math.max(280,U),[zt,U]),pe=react.useRef(null),q=react.useRef(null),le=react.useRef(null),X=react.useMemo(()=>dl(S),[S]),L=react.useMemo(()=>({theme:X,themeName:S}),[X,S]),J=react.useMemo(()=>jl(i),[i]),Ne=react.useMemo(()=>{if(!d)return se;let D=Y.calculateCriticalPath(se),R=H=>H.map(Z=>({...Z,isCriticalPath:D.includes(Z.id),subtasks:Z.subtasks?R(Z.subtasks):void 0}));return R(se)},[se,d]),qe=_g(he);Vl({undo:_t,redo:ba,canUndo:xt,canRedo:ha,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>Y.findTaskById(se,D),addTask:(D,R)=>{xe(H=>{if(!R)return [...H,{...D,level:0}];let Z=re=>re.map(ue=>ue.id===R?{...ue,subtasks:[...ue.subtasks||[],{...D,parentId:R,level:(ue.level||0)+1}],isExpanded:true}:ue.subtasks?{...ue,subtasks:Z(ue.subtasks)}:ue);return Z(H)});},updateTask:(D,R)=>{xe(H=>{let Z=re=>re.map(ue=>ue.id===D?{...ue,...R}:ue.subtasks?{...ue,subtasks:Z(ue.subtasks)}:ue);return Z(H)});},deleteTask:D=>{xe(R=>{let H=Z=>Z.filter(re=>re.id===D?false:(re.subtasks&&(re.subtasks=H(re.subtasks)),true));return H(R)});},deleteTasks:D=>{xe(R=>Xn(R,D));},duplicateTask:D=>{xe(R=>Jn(R,[D]));},splitTask:(D,R,H=3)=>{xe(Z=>Y.splitTask(Z,D,R,H));},calculateEndDate:Y.calculateEndDate,calculateDuration:Y.calculateDuration,validateDependency:(D,R)=>!Y.validateDependencies(se,D,R),getAllTasks:()=>Y.flattenTasks(se),getTasksByStatus:D=>Y.flattenTasks(se).filter(R=>R.status===D),getTasksByParent:D=>D?Y.findTaskById(se,D)?.subtasks||[]:se.filter(H=>!H.parentId),getCriticalPath:()=>Y.flattenTasks(se).filter(D=>D.isCriticalPath),indentTask:D=>{xe(R=>Kn(R,[D]));},outdentTask:D=>{xe(R=>Yn(R,[D]));},moveTask:(D,R)=>{xe(H=>qn(H,[D],R));},createSubtask:async D=>{let{tasks:R,newTask:H}=es(se,D);if(V){let Z=V({...H,parentId:D});if((Z instanceof Promise?await Z:Z)===false)return}xe(R),ne&&ne({...H,parentId:D});},scrollToTask:D=>{let H=Y.flattenTasks(se).findIndex(Z=>Z.id===D);if(H!==-1&&pe.current){let Z=H*qe;pe.current.scrollTo({top:Z,behavior:"smooth"}),q.current&&q.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(D,R=2e3)=>{},expandTask:D=>{xe(R=>{let H=Z=>Z.map(re=>re.id===D?{...re,isExpanded:true}:re.subtasks?{...re,subtasks:H(re.subtasks)}:re);return H(R)});},collapseTask:D=>{xe(R=>{let H=Z=>Z.map(re=>re.id===D?{...re,isExpanded:false}:re.subtasks?{...re,subtasks:H(re.subtasks)}:re);return H(R)});},expandAll:()=>{xe(D=>{let R=H=>H.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?R(Z.subtasks):void 0}));return R(D)});},collapseAll:()=>{xe(D=>{let R=H=>H.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?R(Z.subtasks):void 0}));return R(D)});},undo:_t,redo:ba,canUndo:()=>xt,canRedo:()=>ha,clearHistory:va,exportToPNG:async()=>{if(!le.current)throw new Error("Gantt container not found");let D=await Yl__default.default(le.current,{backgroundColor:X.bgPrimary,scale:2});return new Promise((R,H)=>{D.toBlob(Z=>{Z?R(Z):H(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await Y.exportToPDF(se,D);},exportToExcel:async D=>{await Y.exportToExcel(se,D);},exportToJSON:()=>Y.exportToJSON(se),exportToCSV:()=>Y.exportToCSV(se),importFromJSON:D=>{let R=Y.importFromJSON(D);xe(R);},getTasks:()=>se,refresh:()=>{xe(D=>[...D]);},clearAll:()=>{xe([]);}}),[se,_t,ba,xt,ha,va,X,qe]);let de=react.useCallback(D=>{F(R=>R.map(H=>H.id===D?{...H,visible:!H.visible}:H));},[]),Ua=react.useCallback((D,R)=>{F(H=>H.map(Z=>{if(Z.id!==D)return Z;let re=Z.minWidth??100,ue=Z.maxWidth??800,gt=Math.max(re,Math.min(ue,R));return {...Z,width:gt}}));},[]),rr=react.useCallback(D=>{xe(R=>Qn(R,D)),a.onTaskToggleExpand?.(D);},[a]),or=react.useCallback((D,R)=>{if(ce&&ce(D,R)===false)return;let Z=Y.findTaskById(se,D)?.progress,re=gt=>gt.map(Et=>Et.id===D?{...Et,...R}:Et.subtasks?{...Et,subtasks:re(Et.subtasks)}:Et);xe(re(se));let ue=Y.findTaskById(re(se),D);ue&&(k?.(ue),Ae?.(ue),R.progress!==void 0&&Z!==void 0&&R.progress!==Z&&C?.(D,Z,R.progress));},[se,k,ce,Ae,C]),cc=react.useCallback(D=>{D.length!==0&&(xe(R=>Kn(R,D)),a.onTaskIndent?.(D[0]));},[a]),pc=react.useCallback(D=>{D.length!==0&&(xe(R=>Yn(R,D)),a.onTaskOutdent?.(D[0]));},[a]),mc=react.useCallback((D,R,H)=>{xe(Z=>Pl(Z,D,R,H)),a.onTaskReparent?.(D,R,H);},[a]),uc=react.useCallback((D,R)=>{D.length!==0&&(xe(H=>qn(H,D,R)),a.onTaskMove?.(D[0],R));},[a]),Xo=react.useCallback(async D=>{let R=[];for(let H of D)Me&&await Promise.resolve(Me(H))===false||R.push(H);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(xe(H=>Xn(H,R)),R.forEach(H=>a.onTaskDelete?.(H))),fe&&R.forEach(H=>fe(H)));},[a,Me,fe]),gc=react.useCallback(D=>{xe(R=>Jn(R,D)),D.forEach(R=>a.onTaskDuplicate?.(R));},[a]),fc=react.useCallback((D,R)=>{xe(H=>{let{tasks:Z,newTask:re}=El(H,D,R);return V&&V(re)===false?H:(a.onTaskCreate?.(re.parentId,re.position||0),ne?.(re),Z)});},[a,V,ne]),bc=react.useCallback((D,R)=>{xe(H=>Zn(H,D,R)),a.onTaskRename?.(D,R);},[a]),Jo=react.useCallback(D=>{xe(R=>{let{tasks:H}=es(R,D);return a.onTaskCreate?.(D,0),H});},[a]),hc=react.useCallback((D,R,H)=>{let Z=D.startDate?Math.round((R.getTime()-D.startDate.getTime())/864e5):0,re=Et=>Et.map(aa=>aa.id===D.id?{...aa,startDate:R,endDate:H,...D.segments&&{segments:D.segments}}:aa.subtasks?{...aa,subtasks:re(aa.subtasks)}:aa),ue=re(se);ue=Y.autoScheduleDependents(ue,D.id,Z),xe(ue);let gt={...D,startDate:R,endDate:H};k?.(gt);},[se,k]),vc=react.useCallback((D,R)=>{b?.(D,R),St({isOpen:true,x:R.clientX,y:R.clientY,task:D});},[b]),yc=react.useCallback((D,R)=>{let H=Y.splitTask(se,D.id,R);xe(H),St({isOpen:false,x:0,y:0,task:null});},[se]),Zs=react.useCallback(D=>{N?.(D),M||mt(D);},[N,M]),Qs=react.useCallback((D,R,H)=>{let Z=new Map,re=ra=>{ra.forEach(Ta=>{Ta.dependencies&&Z.set(Ta.id,Ta.dependencies),Ta.subtasks&&re(Ta.subtasks);});};re(H);let ue=Z.get(R)||[];Z.set(R,[...ue,D]);let gt=new Set,Et=new Set,aa=ra=>{if(!gt.has(ra)){gt.add(ra),Et.add(ra);let Ta=Z.get(ra)||[];for(let Tr of Ta){if(!gt.has(Tr)&&aa(Tr))return true;if(Et.has(Tr))return true}}return Et.delete(ra),false};return aa(R)},[]),ei=react.useCallback((D,R)=>{if(Qs(D.id,R,se)){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 H=
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let H=Z=>Z.map(re=>{if(re.id===R){let ue=re.dependencies||[];if(!ue.includes(D.id))return {...re,dependencies:[...ue,D.id]}}return re.subtasks?{...re,subtasks:H(re.subtasks)}:re});xe(H(se)),B?.(D.id,R);},[se,B,Qs]),ti=react.useCallback((D,R)=>{let H=Z=>Z.map(re=>{if(re.id===D&&re.dependencies){let ue=re.dependencies.filter(gt=>gt!==R);return {...re,dependencies:ue}}return re.subtasks?{...re,subtasks:H(re.subtasks)}:re});xe(H(se)),$?.(D,R);},[se,$]),{startDate:xc,endDate:kc}=react.useMemo(()=>{let D=se.filter(ue=>ue.startDate&&ue.endDate);if(D.length===0){let ue=new Date,gt=new Date(ue);gt.setDate(gt.getDate()-30);let Et=new Date(ue);return Et.setDate(Et.getDate()+60),{startDate:gt,endDate:Et}}let R=D.flatMap(ue=>[ue.startDate,ue.endDate]).filter(ue=>ue!==void 0),H=new Date(Math.min(...R.map(ue=>ue.getTime()))),Z=new Date(Math.max(...R.map(ue=>ue.getTime()))),re=j==="day"?7:j==="week"?14:30;return H.setDate(H.getDate()-re),Z.setDate(Z.getDate()+re),{startDate:H,endDate:Z}},[se,j]),wc=react.useCallback(async()=>{if(!le.current)return;let D=await Yl__default.default(le.current,{backgroundColor:X.bgPrimary,scale:2}),R=document.createElement("a");R.download="gantt-chart.png",R.href=D.toDataURL("image/png"),R.click();},[X]),Cc=react.useCallback(async()=>{await Y.exportToPDF(se);},[se]),Tc=react.useCallback(async()=>{await Y.exportToExcel(se);},[se]),Nc=react.useCallback(()=>{let D=Y.exportToCSV(se),R=new Blob([D],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(R),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href);},[se]),Dc=react.useCallback(()=>{let D=Y.exportToJSON(se),R=new Blob([D],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(R),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href);},[se]),Sc=react.useCallback(()=>{Y.exportToMSProject(se,"Gantt Project","project.xml");},[se]),Ec=D=>{D.preventDefault(),Jt(true);};return react.useEffect(()=>{let D=q.current,R=pe.current;if(!D||!R)return;let H=R.querySelector(".gantt-taskgrid-content"),Z=()=>{let gt=D.scrollTop;Ye(gt),H&&(H.style.transform=`translateY(-${gt}px)`);},re=gt=>{if(Mt&&R){let aa=R.parentElement?.getBoundingClientRect()?.left||0,ra=gt.clientX-aa,Ta=280,Tr=Math.min(window.innerWidth-300,800);ra>=Ta&&ra<=Tr&&It(ra);}},ue=()=>{Jt(false);};return D.addEventListener("scroll",Z),document.addEventListener("mousemove",re),document.addEventListener("mouseup",ue),()=>{D.removeEventListener("scroll",Z),document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",ue);}},[Mt]),jsxRuntime.jsx(fr.Provider,{value:ut,children:jsxRuntime.jsx(an.Provider,{value:L,children:jsxRuntime.jsxs("div",{ref:le,className:"flex flex-col h-full w-full",style:{backgroundColor:X.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(ho,{theme:X,timeScale:j,onTimeScaleChange:K,zoom:_e,onZoomChange:me,currentTheme:S,onThemeChange:Ca,rowDensity:he,onRowDensityChange:ve,showThemeSelector:p,showCreateTaskButton:h,createTaskLabel:w,onCreateTask:g,onExportPNG:s?wc:void 0,onExportPDF:s?Cc:void 0,onExportExcel:s?Tc:void 0,onExportCSV:s?Nc:void 0,onExportJSON:s?Dc:void 0,onExportMSProject:s?Sc:void 0}),jsxRuntime.jsxs("div",{ref:pe,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:ie,overflow:"hidden"},children:jsxRuntime.jsx(ko,{tasks:Ne,theme:X,rowHeight:qe,availableUsers:m,templates:J,onTaskClick:T,onTaskDblClick:Zs,onTaskContextMenu:b,onTaskToggle:rr,scrollTop:Xe,columns:ke,onToggleColumn:de,onColumnResize:Ua,onTaskUpdate:or,onTaskIndent:cc,onTaskOutdent:pc,onTaskMove:uc,onMultiTaskDelete:Xo,onTaskDuplicate:gc,onTaskCreate:fc,onTaskRename:bc,onCreateSubtask:Jo,onOpenTaskModal:T?D=>T(D):void 0,onDeleteRequest:(D,R)=>Lt({taskId:D,taskName:R}),onTaskReparent:mc})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Ec}),jsxRuntime.jsx("div",{ref:q,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Po,{tasks:Ne,theme:X,rowHeight:qe,timeScale:j,startDate:xc,endDate:kc,zoom:_e,templates:J,onTaskClick:T,onTaskDblClick:Zs,onTaskContextMenu:vc,onTaskDateChange:hc,onDependencyCreate:ei,onDependencyDelete:ti})})]}),At.task&&jsxRuntime.jsx(br,{isOpen:At.isOpen,x:At.x,y:At.y,theme:X,onClose:()=>St({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=At.task;return D?D.subtasks&&D.subtasks.length>0?[{id:"addSubtask",label:ut.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{y?y(D):Jo(D.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ut.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{Lt({taskId:D.id,taskName:D.name});}}]:[{id:"edit",label:ut.contextMenu?.editTask||"Edit Task",icon:et.Pencil,onClick:()=>{M?M(D):mt(D);}},{id:"addSubtask",label:ut.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{y?y(D):Jo(D.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ut.contextMenu?.markIncomplete||"Mark Incomplete",icon:et.MarkIncomplete,onClick:()=>{A?A(D):or(D.id,{status:"todo",progress:0});},disabled:D.status==="todo"},{id:"setInProgress",label:ut.contextMenu?.setInProgress||"Set In Progress",icon:et.SetInProgress,onClick:()=>{O?O(D):or(D.id,{status:"in-progress"});},disabled:D.status==="in-progress"},{id:"markComplete",label:ut.contextMenu?.markComplete||"Mark Complete",icon:et.MarkComplete,onClick:()=>{or(D.id,{status:"completed",progress:100});},disabled:D.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ut.contextMenu?.splitTask||"Split Task",icon:et.Split,onClick:()=>{if(!D.startDate||!D.endDate){console.warn("Cannot split task without dates");return}let H=D.startDate.getTime(),Z=D.endDate.getTime(),re=H+(Z-H)/2,ue=new Date(re);yc(D,ue);},disabled:!D.startDate||!D.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ut.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{Lt({taskId:D.id,taskName:D.name});}}]:[]})()}),fa&&jsxRuntime.jsx(Mo,{isOpen:true,onClose:()=>mt(null),task:fa,onSubmit:D=>{or(fa.id,D),mt(null);},mode:"edit",theme:S}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Lt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:D=>D.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:X.bgSecondary,border:`1px solid ${X.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${X.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:X.textPrimary,fontFamily:"Inter, sans-serif"},children:[ut.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},children:x==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},children:[x==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:X.textPrimary},children:['"',ot.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:X.bgPrimary,borderTop:`1px solid ${X.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=X.hoverBg;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:x==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Xo([ot.taskId]),Lt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),x==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Io,{tasks:se,theme:X,config:u,onTasksUpdate:xe,onTaskUpdate:or,onTaskCreate:D=>{xe(R=>[...R,D]);},onTaskDelete:D=>{Xo([D]);},onDependencyCreate:(D,R)=>{let H=Y.findTaskById(se,D);H&&ei(H,R);},onDependencyDelete:ti})]})})})});var Xl=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
279
279
|
|
|
280
280
|
AVAILABLE COMMANDS:
|
|
281
281
|
1. move_task - Move a task to a different date
|
|
@@ -316,39 +316,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
316
316
|
|
|
317
317
|
Always try to match task names case-insensitively and handle partial matches.
|
|
318
318
|
If you can't find a task by name, search through the provided task list.
|
|
319
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
320
|
-
${
|
|
319
|
+
If ambiguous, ask for clarification in the message field.`;function Jl(e){return `CURRENT TASKS:
|
|
320
|
+
${Zl(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${n}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Xl(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=Xl(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let n=a.find(d=>d.name.toLowerCase().includes(r));if(n)return n;let l=r.split(/\s+/);return a.find(d=>{let c=d.name.toLowerCase();return l.every(i=>c.includes(i))})}function is(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}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),k=y.getDay(),h=u-k;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let p=parseInt(n[1],10),u=n[2].toLowerCase(),y=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?y.setDate(y.getDate()+p):u==="week"||u==="semana"||u==="semanas"?y.setDate(y.getDate()+p*7):(u==="month"||u==="mes"||u==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let p=parseInt(d[1],10),u=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,u,p)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),u=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,p)}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},s=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(s&&s[1]&&s[2]){let p=m[s[1].toLowerCase()],u=parseInt(s[2],10),y=s[3]?parseInt(s[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,u)}return null}function ls(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function ds(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 Jl(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 Zl(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),m=r[2].trim(),s=Pa(t,i),p=is(m);if(!s)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:s.id,taskName:s.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=s.startDate&&s.endDate?Math.round((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+u),{type:"move_task",taskId:s.id,taskName:s.name,updates:{startDate:p,endDate:y},message:`Moved "${s.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),m=o[2].trim(),s=Pa(t,i),p=ls(m);if(!s)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!s.endDate)return {type:"resize_task",taskId:s.id,taskName:s.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(s.endDate);return u.setDate(u.getDate()+p),{type:"resize_task",taskId:s.id,taskName:s.name,updates:{endDate:u},message:`Extended "${s.name}" by ${p} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),m=n[2].trim(),s=Pa(t,i),p=ds(m);return s?p===null?{type:"set_progress",taskId:s.id,taskName:s.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:s.id,taskName:s.name,updates:{progress:p},message:`Set "${s.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),m=l[2].trim(),s=Pa(t,i);return s?{type:"rename_task",taskId:s.id,taskName:s.name,updates:{name:m},message:`Renamed "${s.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),m=d[2].trim(),s=Pa(t,i),p=Pa(t,m);return s?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:s.id,dependencyTo:p.id,message:`Linked "${s.name}" \u2192 "${p.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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),m=Pa(t,i);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Ql(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 Wg(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 Gg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ao(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let s=a.find(p=>p.id===m);return s?{name:s.name,initials:s.initials,color:s.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Ao(m,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},d=l(e.startDate),c=l(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:Wg(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function ed(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:Gg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function td(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ao(r,e,t))}var cs={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"}},ps={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"}},Lo={en:cs,es:ps};function ms(e){return Lo[e]||Lo.en}function Fo(e,t){let a=ms(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 nd(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(...nd(r.subtasks,t+1));return a}function Zg({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 sd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:l}){let{theme:d="dark",locale:c="en",customTranslations:i,showSearch:m=true,showHierarchy:s=true}=t,p=Fo(c,i),u=d==="dark",[y,k]=react.useState(new Set),[h,w]=react.useState("startDate"),[f,g]=react.useState("asc"),[T,D]=react.useState("");react.useMemo(()=>{let C=new Set;function L($){for(let F of $)F.subtasks?.length&&(C.add(F.id),L(F.subtasks));}L(e),k(C);},[e]);let b=react.useCallback(C=>{k(L=>{let $=new Set(L);return $.has(C)?$.delete(C):$.add(C),$}),a.onTaskToggleExpand?.(C);},[a]),x=react.useCallback(C=>{h===C?g(L=>L==="asc"?"desc":"asc"):(w(C),g("asc")),a.onSortChange?.({column:C,direction:f==="asc"?"desc":"asc"});},[h,f,a]),v=react.useMemo(()=>{let C=nd(e);if(T.trim()){let $=T.toLowerCase();C=C.filter(F=>F.name.toLowerCase().includes($));}let L=[];for(let $ of C){let F=$.level===0;$.level>0&&(F=true),(F||T.trim())&&L.push($);}return T.trim()&&L.sort(($,F)=>{let O,_;switch(h){case "name":O=$.name.toLowerCase(),_=F.name.toLowerCase();break;case "startDate":O=$.startDate?.getTime()||0,_=F.startDate?.getTime()||0;break;case "endDate":O=$.endDate?.getTime()||0,_=F.endDate?.getTime()||0;break;case "progress":O=$.progress||0,_=F.progress||0;break;case "status":O=$.status||"todo",_=F.status||"todo";break;default:return 0}return O<_?f==="asc"?-1:1:O>_?f==="asc"?1:-1:0}),L},[e,T,h,f]),P=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:B("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:B("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[p.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:B("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"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:B("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:B("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:B("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,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:B("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:p.empty.noTasks}),jsxRuntime.jsx("p",{className:B("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:p.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:B("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:B("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:B("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:p.toolbar.searchPlaceholder,className:B("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:B("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[v.length," ",p.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:B("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:[p.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:[p.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:[p.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:[p.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:v.map((C,L)=>{let $=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:L*.02},className:B("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:s?`${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:[s&&C.hasChildren&&jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),b(C.id);},className:B("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:$?jsxRuntime.jsx(lucideReact.ChevronDown,{className:B("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:B("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),s&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Zg,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:B("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:B("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"?p.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?p.status.inProgress:p.status.todo})}),jsxRuntime.jsxs("div",{className:B("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"}),P(C.startDate)]}),jsxRuntime.jsxs("div",{className:B("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"}),P(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:B("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:B("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:B("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[C.progress||0,"%"]})]})})]},C.id)})}),v.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:B("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:B(u?"text-[#9CA3AF]":"text-gray-600"),children:p.empty.noResults})]})})]})]})}var us={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"},gs={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"},fs={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"},Ro={dark:us,light:gs,neutral:fs};function id(e){return Ro[e]||Ro.dark}var bs={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"}},hs={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"}},Oo={en:bs,es:hs};function Hr(e){return Oo[e]||Oo.en}function $o(e,t){let a=Hr(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 ld(e){let t=Hr(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 dd(e,t=0,a=true){let r=Hr(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 lf(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 ys(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 df({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 md({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:l,style:d}){let{theme:c="dark",locale:i="en",customTranslations:m}=t,s=$o(i,m),p=c==="dark",[u,y]=react.useState(r||new Date),[k,h]=react.useState(null),w=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),f=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),g=react.useCallback(()=>{y(new Date);},[]),T=react.useMemo(()=>{let v=u.getFullYear(),P=u.getMonth(),C=new Date(v,P,1),L=new Date(v,P+1,0),$=C.getDay(),F=L.getDate(),O=lf(e),_=new Date;_.setHours(0,0,0,0);let ae=[],pe=$,Le=new Date(v,P,0).getDate();for(let ne=pe-1;ne>=0;ne--){let S=new Date(v,P-1,Le-ne);ae.push({date:S,isCurrentMonth:false,isToday:false,isWeekend:S.getDay()===0||S.getDay()===6,events:O.filter(M=>ys(S,M)).map(M=>({id:M.id,title:M.name,start:M.startDate,end:M.endDate,task:M}))});}for(let ne=1;ne<=F;ne++){let S=new Date(v,P,ne),M=S.getTime()===_.getTime();ae.push({date:S,isCurrentMonth:true,isToday:M,isWeekend:S.getDay()===0||S.getDay()===6,events:O.filter(E=>ys(S,E)).map(E=>({id:E.id,title:E.name,start:E.startDate,end:E.endDate,task:E}))});}let Pe=42-ae.length;for(let ne=1;ne<=Pe;ne++){let S=new Date(v,P+1,ne);ae.push({date:S,isCurrentMonth:false,isToday:false,isWeekend:S.getDay()===0||S.getDay()===6,events:O.filter(M=>ys(S,M)).map(M=>({id:M.id,title:M.name,start:M.startDate,end:M.endDate,task:M}))});}return ae},[u,e]),D=i==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],b=u.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),x=react.useCallback(v=>{let P=v.progress===100?0:100,C=P===100?"completed":"todo";a.onTaskUpdate?.({...v,status:C,progress:P});},[a]);return o?jsxRuntime.jsx("div",{className:B("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",l),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:B("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:[s.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:B("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",l),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:B("text-lg font-semibold mb-2",p?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:B("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:B("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",l),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.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:B("text-lg font-semibold mb-2",p?"text-white":"text-gray-900"),children:s.labels.noEvents}),jsxRuntime.jsx("p",{className:B("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:s.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:B("flex-1 flex flex-col w-full h-full overflow-hidden",p?"bg-[#0F1117]":"bg-white",l),style:d,children:[jsxRuntime.jsx("div",{className:B("flex-shrink-0 px-6 py-4 border-b",p?"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:B("text-xl font-semibold capitalize",p?"text-white":"text-gray-900"),children:b}),jsxRuntime.jsx("button",{onClick:g,className:B("px-3 py-1.5 text-sm rounded-lg transition-colors",p?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:s.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:w,className:B("p-2 rounded-lg transition-colors",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:B("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:f,className:B("p-2 rounded-lg transition-colors",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:B("w-5 h-5",p?"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:D.map(v=>jsxRuntime.jsx("div",{className:B("py-2 text-center text-xs font-medium uppercase",p?"text-[#9CA3AF]":"text-gray-500"),children:v},v))}),jsxRuntime.jsx("div",{className:B("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",p?"bg-white/5":"bg-gray-200"),children:T.map((v,P)=>jsxRuntime.jsxs("div",{className:B("min-h-[100px] p-2 transition-colors",p?"bg-[#0F1117]":"bg-white",!v.isCurrentMonth&&(p?"bg-[#0F1117]/50":"bg-gray-50"),v.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:B("text-sm font-medium mb-1",v.isToday?"text-[#3B82F6]":v.isCurrentMonth?p?"text-white":"text-gray-900":p?"text-[#6B7280]":"text-gray-400"),children:v.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[v.events.slice(0,3).map(C=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(C.task),a.onEventClick?.(C);},whileHover:{scale:1.02},className:B("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",C.task.progress===100?p?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":p?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(df,{task:C.task}),jsxRuntime.jsx("span",{className:"truncate",children:C.title})]},C.id)),v.events.length>3&&jsxRuntime.jsxs("div",{className:B("text-xs px-1.5",p?"text-[#6B7280]":"text-gray-400"),children:["+",v.events.length-3," ",i==="es"?"m\xE1s":"more"]})]})]},P))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:B("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",p?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:B("p-4 border-b flex items-center justify-between",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:B("font-semibold",p?"text-white":"text-gray-900"),children:i==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:B("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("div",{className:"p-4 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:B("text-xs uppercase",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:B("font-medium",p?"text-white":"text-gray-900"),children:k.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:B("text-xs uppercase",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:B("text-sm",p?"text-white":"text-gray-900"),children:k.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:B("text-xs uppercase",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:B("text-sm",p?"text-white":"text-gray-900"),children:k.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:B("text-xs uppercase mb-2 block",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:B("flex-1 h-2 rounded-full overflow-hidden",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:B("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:B("text-sm font-medium w-10",p?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{x(k),h(null);},className:B("w-full py-2 rounded-lg font-medium transition-colors",k.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:k.progress===100?i==="es"?"Marcar como pendiente":"Mark as pending":i==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(null),className:"fixed inset-0 bg-black/20 z-40"})})]})}var xs={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"},ks={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"},ws={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"},Wo={dark:xs,light:ks,neutral:ws};function ud(e){return Wo[e]||Wo.dark}function pf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:l,className:d}){let[c,i]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),s=react.useMemo(()=>{let u=m.length,y=new Set(m.flatMap(w=>w.assignedUserIds||[])).size,k=m.map(w=>w.priority).filter(Boolean),h=new Set(m.flatMap(w=>w.labels||[])).size;return {totalCards:u,uniqueAssignees:y,priorities:k,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:B("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,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:B("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:s.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(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:[s.uniqueAssignees," assignees"]})]}),s.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:[s.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(),n?.(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 fd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function _r(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 Vr(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 bd(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function hd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:l,className:d}){let c=react.useMemo(()=>({...fd,...l}),[l]),[i,m]=react.useState(new Set),s=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let f=new Map;return e.forEach(g=>{let T=g.timestamp.toISOString().split("T")[0],D=f.get(T);D?D.push(g):f.set(T,[g]);}),Array.from(f.entries()).sort((g,T)=>T[0].localeCompare(g[0])).map(([g,T])=>({date:new Date(g),events:T.sort((D,b)=>b.timestamp.getTime()-D.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:u,uniqueTypes:y}=react.useMemo(()=>{let f=new Set,g=new Set;return e.forEach(T=>{f.add(T.userId),g.add(T.type);}),{uniqueUsers:Array.from(f),uniqueTypes:Array.from(g)}},[e]),k=f=>{m(g=>{let T=new Set(g);return T.has(f)?T.delete(f):T.add(f),T});},h=f=>{let T=new Date().getTime()-f.getTime(),D=Math.floor(T/6e4),b=Math.floor(T/36e5),x=Math.floor(T/864e5);return D<1?"just now":D<60?`${D}m ago`:b<24?`${b}h ago`:x<7?`${x}d ago`:f.toLocaleDateString()},w=react.useMemo(()=>{let f=0;return t.types&&t.types.length>0&&f++,t.users&&t.users.length>0&&f++,t.dateRange&&f++,t.searchTerm&&f++,f},[t]);return react.useEffect(()=>{if(n&&s.current){let f=s.current.querySelector(`[data-event-id="${n}"]`);f&&f.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:B("history-timeline-empty",d),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:B("history-timeline",c.compact&&"compact",d),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:f=>{let g=f.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(f=>jsxRuntime.jsxs("option",{value:f,children:[Vr(f)," ",f.replace("_"," ")]},f))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:f=>{let g=f.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(f=>jsxRuntime.jsx("option",{value:f,children:f},f))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:f=>a({...t,searchTerm:f.target.value})})]}),w>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",w,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:s,children:p.map(f=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&f.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:f.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[f.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:f.events.map((g,T)=>{let D=i.has(g.id),b=n===g.id,x=bd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:B("history-timeline-event",D&&"expanded",b&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:x},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Vr(g.type)})}),T<f.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:[c.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:_r(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),k(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([v,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(P.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(P.to)})]})]},v)),g.metadata&&Object.keys(g.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(g.metadata).map(([v,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(P)})]},v))]})]})]})]},g.id)})})]},f.date?.toISOString()||"all"))})]})}function yd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:l,onGoToEvent:d,onSpeedChange:c,className:i}){let m=[.5,1,1.5,2,3],s=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:B("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:B("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:s&&Vr(s.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:s&&_r(s)}),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:s&&s.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=>d(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,y)=>jsxRuntime.jsx("div",{className:B("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:_r(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:l,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:B("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>c(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:s&&s.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:B("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Cs(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 Ts(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function xd(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function kd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function hf(e,t,a,r,o,n=100){let l=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(l.map(c=>[c.id,c]));for(let c=0;c<n;c++){let i=1-c/n;l.forEach(m=>{let s=a/2,p=r/2;m.vx+=(s-m.x)*o.centerForce*i,m.vy+=(p-m.y)*o.centerForce*i,l.forEach(u=>{if(m.id===u.id)return;let y=m.x-u.x,k=m.y-u.y,h=Math.sqrt(y*y+k*k)||1,w=o.chargeStrength*i/(h*h);m.vx+=y/h*w,m.vy+=k/h*w;});}),t.forEach(m=>{let s=d.get(typeof m.source=="string"?m.source:m.source.id),p=d.get(typeof m.target=="string"?m.target:m.target.id);if(!s||!p)return;let u=p.x-s.x,y=p.y-s.y,k=Math.sqrt(u*u+y*y)||1,h=(k-o.linkDistance)/k*o.forceStrength*i;s.vx+=u*h,s.vy+=y*h,p.vx-=u*h,p.vy-=y*h;}),l.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 l}function wd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:l,onInteraction:d,className:c}){let i=react.useRef(null),[m,s]=react.useState([]),[p,u]=react.useState(null),[y,k]=react.useState(null),[h,w]=react.useState(null),[f,g]=react.useState(1),[T,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let F=hf(e,t,a.width,a.height,a,150);s(F);},[e,t,a]);let b=react.useCallback((F,O)=>{a.enableDragging&&(O.stopPropagation(),u(F));},[a.enableDragging]),x=react.useCallback(F=>{if(!p||!i.current)return;let _=i.current.getBoundingClientRect(),ae=(F.clientX-_.left-T.x)/f,pe=(F.clientY-_.top-T.y)/f;s(Le=>Le.map(Pe=>Pe.id===p?{...Pe,x:ae,y:pe,fx:ae,fy:pe}:Pe));},[p,f,T]),v=react.useCallback(()=>{u(null);},[]),P=react.useCallback((F,O)=>{O.stopPropagation(),d?.({type:"node-click",node:F,position:{x:O.clientX,y:O.clientY}});},[d]),C=react.useCallback((F,O)=>{O.stopPropagation(),d?.({type:"edge-click",edge:F,position:{x:O.clientX,y:O.clientY}});},[d]),L=react.useCallback(F=>{let O=m.find(_=>_.id===F);return O?{x:O.x,y:O.y}:{x:0,y:0}},[m]),$=react.useCallback(F=>{if(F.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return F.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let O=F.card.priority;return O==="URGENT"?"#ef4444":O==="HIGH"?"#f59e0b":O==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return F.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:B("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:B("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.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:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(F=>Math.min(F+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(f*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(F=>Math.max(F-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(F=>F.type))).map(F=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Cs(F)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[xd(F)," ",Ts(F)]})]},F))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:x,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${f})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(F=>{let O=L(typeof F.source=="string"?F.source:F.source.id),_=L(typeof F.target=="string"?F.target:F.target.id),ae=kd(F.type),pe=h===F.id,Le=F.onCriticalPath;return jsxRuntime.jsxs("g",{className:B("relationships-graph-edge",pe&&"hovered",Le&&"critical"),onMouseEnter:()=>w(F.id),onMouseLeave:()=>w(null),onClick:Pe=>C(F,Pe),children:[jsxRuntime.jsx("line",{x1:O.x,y1:O.y,x2:_.x,y2:_.y,stroke:Cs(F.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:pe?1:.6,markerEnd:ae?"url(#arrowhead)":void 0}),a.showEdgeLabels&&pe&&jsxRuntime.jsx("text",{x:(O.x+_.x)/2,y:(O.y+_.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ts(F.type)})]},F.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(F=>{let O=y===F.id,_=F.onCriticalPath;return jsxRuntime.jsxs("g",{className:B("relationships-graph-node",O&&"hovered",_&&"critical"),transform:`translate(${F.x}, ${F.y})`,onMouseDown:ae=>b(F.id,ae),onMouseEnter:()=>k(F.id),onMouseLeave:()=>k(null),onClick:ae=>P(F,ae),children:[jsxRuntime.jsx("circle",{r:_?a.nodeSize*1.2:a.nodeSize,fill:$(F),stroke:_?"#fbbf24":"#ffffff",strokeWidth:_?3:2,opacity:O?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:F.card.title.length>20?F.card.title.substring(0,20)+"...":F.card.title})]},F.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 Dd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,l]=react.useState(""),[d,c]=react.useState(false),[i,m]=react.useState(null),[s,p]=react.useState(null),u=react.useRef(null),y=d||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let f=g=>{g.key==="Escape"&&!y&&k();};if(e)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,y]);let k=()=>{y||(l(""),m(null),p(null),t());},h=async()=>{if(!(!n.trim()||y)){c(true),m(null),p(null);try{let f=await r(n.trim());p(f);}catch(f){m(f instanceof Error?f.message:"Failed to generate plan");}finally{c(false);}}},w=()=>{s&&(a(s),k());};return e?jsxRuntime.jsxs($e,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:k,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:s?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!"})]}),s.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:s.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",s.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:s.columns.map((f,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:f.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",s.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[s.cards.slice(0,10).map((f,g)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:f.title}),f.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:f.description})]}),f.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${f.priority==="URGENT"?"bg-red-500/20 text-red-400":f.priority==="HIGH"?"bg-orange-500/20 text-orange-400":f.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:f.priority})]})},g)),s.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",s.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:n,onChange:f=>l(f.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((f,g)=>jsxRuntime.jsx("button",{onClick:()=>l(f),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:f},g))})]})]})}),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:k,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"}),s?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 Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!n.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 Ds={"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 yf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},xf={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 kf(e,t,a){let r=Ds[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function jr(e){return `$${e.toFixed(4)}`}var Ns=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=kf(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(s=>s.timestamp>=t.start&&s.timestamp<=t.end));let r=a.length,o=a.reduce((s,p)=>s+p.cost,0),n=a.reduce((s,p)=>s+p.inputTokens,0),l=a.reduce((s,p)=>s+p.outputTokens,0),d=a.filter(s=>s.success),c=a.reduce((s,p)=>s+p.duration,0),i={},m={};return a.forEach(s=>{i[s.feature]=(i[s.feature]||0)+1,m[s.feature]=(m[s.feature]||0)+s.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:l,operationsByFeature:i,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],n=new Date,l=new Date;a==="month"?l.setMonth(n.getMonth()-1):l.setDate(n.getDate()-1);let d=this.operations.filter(m=>m.timestamp>=l).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Qa=new Ns;function Ed({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qa.getStats()),[n,l]=react.useState(Qa.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Qa.getStats()),l(Qa.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let d=Qa.getRecentOperations(5);return jsxRuntime.jsxs($e,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:jr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let m=r.costsByFeature[c]||0,s=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:jr(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:`${s}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:d.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:jr(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Id({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[l,d]=react.useState(""),[c,i]=react.useState(""),[m,s]=react.useState(""),[p,u]=react.useState(false),[y,k]=react.useState(null),[h,w]=react.useState(null),[f,g]=react.useState(null),T=react.useRef(null),D=p||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let C=L=>{L.key==="Escape"&&!D&&b();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,D]);let b=()=>{D||(d(""),i(""),s(""),k(null),w(null),g(null),t());},x=async()=>{if(!(!l.trim()||D)){u(true),k(null),w(null),g(null);try{let C=await r({prompt:l.trim(),projectName:n||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});w(C.tasks.tasks),g({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){k(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},v=()=>{h&&(a(h),b());};if(!e)return null;let P=f?.similarity?((f.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs($e,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:b,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:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[f?.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"}),f?.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 (",P,"% 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:[f?.tokens_used||0," tokens"]}),f?.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:[f.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((C,L)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",L+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children: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:l,onChange:C=>d(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:c,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})]}),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=>s(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,L)=>jsxRuntime.jsx("button",{onClick:()=>d(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},L))})]})]})}),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:b,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"}),h?jsxRuntime.jsx("button",{onClick:v,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:!l.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 Ho({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&eo(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,f,g)=>{console.warn(`Retry attempt ${f} after ${g}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),n=react.useCallback(async(h,w,f)=>{r(g=>{let T=g.cards.find(C=>C.id===h);if(!T)return g;let D=T.columnId,b={...T,columnId:w,position:f},x=g.cards.map(C=>C.id===h?b:C),v=g.columns.map(C=>{if(C.id===D)return {...C,cardIds:C.cardIds.filter(L=>L!==h)};if(C.id===w){let L=x.filter($=>$.columnId===w).sort(($,F)=>$.position-F.position);return {...C,cardIds:L.map($=>$.id)}}return C}),P={...g,cards:x,columns:v};return o(P),P});},[o]),l=react.useCallback(async(h,w)=>{r(f=>{let g=f.cards.map(D=>D.id===h?{...D,...w}:D),T={...f,cards:g};return o(T),T});},[o]),d=react.useCallback(async h=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let g={...h,id:w},T=f.columns.map(b=>b.id===h.columnId?{...b,cardIds:[...b.cardIds,w]}:b),D={...f,cards:[...f.cards,g],columns:T};return o(D),D});},[o]),c=react.useCallback(async h=>{r(w=>{let f=w.cards.find(b=>b.id===h);if(!f)return w;let g=w.cards.filter(b=>b.id!==h),T=w.columns.map(b=>b.id===f.columnId?{...b,cardIds:b.cardIds.filter(x=>x!==h)}:b),D={...w,cards:g,columns:T};return o(D),D});},[o]),i=react.useCallback(async h=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let g={...h,id:w,cardIds:[]},T={...f,columns:[...f.columns,g]};return o(T),T});},[o]),m=react.useCallback(async(h,w)=>{r(f=>{let g=f.columns.map(D=>D.id===h?{...D,...w}:D),T={...f,columns:g};return o(T),T});},[o]),s=react.useCallback(async h=>{r(w=>{let f=w.cards.filter(D=>D.columnId!==h),g=w.columns.filter(D=>D.id!==h),T={...w,cards:f,columns:g};return o(T),T});},[o]),p=react.useCallback(h=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(h),w},[d]),u=react.useCallback(h=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),w},[i]),y=react.useCallback(()=>{r(h=>{let w={...h,cards:[],columns:[]};return o(w),w});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:l,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:m,onColumnDelete:s},setBoard:r,helpers:{addCard:p,addColumn:u,deleteCard:c,deleteColumn:s,clearBoard:y}}}function Ld({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Ho({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(c,i,m={})=>{n.addCard({title:i,columnId:c,position:r.cards.filter(s=>s.columnId===c).length,...m});},addColumn:(c,i)=>{let m=r.columns.length>0?Math.max(...r.columns.map(s=>s.position)):0;n.addColumn({title:c,position:i??m+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var Kr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Bd={by:"none",order:"asc"};function Rd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Kr,...e}),[n,l]=react.useState({...Bd,...t}),d=react.useCallback(k=>{o(h=>({...h,...k}));},[]),c=react.useCallback(k=>{l(h=>({...h,...k}));},[]),i=react.useCallback(()=>{o(Kr),l(Bd);},[]),m=react.useCallback(()=>{a&&o({...Kr,assignees:[a]});},[a]),s=react.useCallback(()=>{o({...Kr,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...Kr,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!==""||n.by!=="none",[r,n]),y=react.useCallback(k=>{let h=[...k];if(r.search){let w=r.search.toLowerCase();h=h.filter(f=>f.title.toLowerCase().includes(w)||f.description?.toLowerCase().includes(w));}if(r.dateFilter!=="all"){let w=new Date,f=w.getFullYear(),g=String(w.getMonth()+1).padStart(2,"0"),T=String(w.getDate()).padStart(2,"0"),D=`${f}-${g}-${T}`;h=h.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let x=b.endDate||b.dueDate;if(!x)return false;let v;if(typeof x=="string")v=x.split("T")[0]||x;else {let P=x.getUTCFullYear(),C=String(x.getUTCMonth()+1).padStart(2,"0"),L=String(x.getUTCDate()).padStart(2,"0");v=`${P}-${C}-${L}`;}switch(r.dateFilter){case "overdue":return v<D;case "today":return v===D;case "this-week":let P=new Date(D+"T00:00:00"),C=new Date(v+"T00:00:00"),L=new Date(P);return L.setDate(L.getDate()+7),C>=P&&C<=L;case "custom":if(r.dateRange){let $=typeof x=="string"?new Date(x):x;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(w=>w.priority&&r.priorities.includes(w.priority))),r.assignees.length>0&&(h=h.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(h=h.filter(w=>w.labels&&w.labels.some(f=>r.labels.includes(f)))),r.columns.length>0&&(h=h.filter(w=>r.columns.includes(w.columnId))),n.by!=="none"&&h.sort((w,f)=>{let g=0;switch(n.by){case "created":let T=w.createdAt?new Date(w.createdAt).getTime():0,D=f.createdAt?new Date(f.createdAt).getTime():0;g=T-D;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=b[w.priority||"LOW"],v=b[f.priority||"LOW"];g=x-v;break;case "dueDate":let P=w.endDate||w.dueDate,C=f.endDate||f.dueDate;if(!P)return 1;if(!C)return -1;let L=typeof P=="string"?new Date(P).getTime():P.getTime(),$=typeof C=="string"?new Date(C).getTime():C.getTime();g=L-$;break;case "title":g=w.title.localeCompare(f.title);break;case "estimate":let F=w.estimatedTime||0,O=f.estimatedTime||0;g=F-O;break;default:g=0;}return n.order==="asc"?g:-g}),h},[r,n]);return {filters:r,sort:n,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:m,filterOverdue:s,filterHighPriority:p,applyFilters:y,hasActiveFilters:u}}var $d,zd;if(typeof window<"u")try{let e=Jr("ai");$d=e.generateObject,zd=e.generateText;}catch{}function Wd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!($d&&zd&&e.apiKey),l=react.useCallback(async s=>{if(!n)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:",s),{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: ${s}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let u=p instanceof Error?p:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[n]),d=react.useCallback(async s=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",s.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let u=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[n]),c=react.useCallback(async s=>{if(!n)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(p){let u=p instanceof Error?p:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[n]),i=react.useCallback(async s=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",s.title),[{title:`Subtask 1 for: ${s.title}`,position:s.position+.1,columnId:s.columnId},{title:`Subtask 2 for: ${s.title}`,position:s.position+.2,columnId:s.columnId}]}catch(p){let u=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),m=react.useCallback(async s=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",s.title),{hours:8,confidence:.75}}catch(p){let u=p instanceof Error?p:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:l,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:m,isAvailable:n,isLoading:t,error:r}}function Es(){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 Gd(e){let{cards:t}=e,[a,r]=Es(),o=react.useCallback(s=>a.selectedCardIds.includes(s),[a.selectedCardIds]),n=react.useCallback((s,p)=>{if(!p){r({selectedCardIds:[s],lastSelectedCardId:s});return}let u=p.ctrlKey||p.metaKey,y=p.shiftKey;if(u)a.selectedCardIds.includes(s)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==s),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,s],lastSelectedCardId:s});else if(y&&a.lastSelectedCardId){let k=t.find(w=>w.id===s),h=t.find(w=>w.id===a.lastSelectedCardId);if(k&&h&&k.columnId===h.columnId){let w=t.filter(v=>v.columnId===k.columnId).sort((v,P)=>v.position-P.position),f=w.findIndex(v=>v.id===a.lastSelectedCardId),g=w.findIndex(v=>v.id===s),[T,D]=f<g?[f,g]:[g,f],b=w.slice(T,D+1).map(v=>v.id),x=Array.from(new Set([...a.selectedCardIds,...b]));r({selectedCardIds:x,lastSelectedCardId:s});}else r({selectedCardIds:[s],lastSelectedCardId:s});}else r({selectedCardIds:[s],lastSelectedCardId:s});},[t,a,r]),l=react.useCallback(s=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==s),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(s=>s.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(s=>{a.selectedCardIds.includes(s)?l(s):r({selectedCardIds:[...a.selectedCardIds,s],lastSelectedCardId:s});},[a,l,r]),m=react.useCallback(()=>t.filter(s=>a.selectedCardIds.includes(s.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:l,clearSelection:d,selectAll:c,toggleCard:i,getSelectedCards:m}}var Ud={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Hd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Ud,...a}),[a]),[n,l]=react.useState([]),d=react.useCallback((k,h,w,f,g)=>{if(h.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:k,cardIds:h,columnId:w,strategy:f,color:g,isExpanded:true,position:n.filter(D=>D.columnId===w).length,createdAt:new Date};l(D=>[...D,T]);},[o.minCardsPerStack,n]),c=react.useCallback(k=>{l(h=>h.filter(w=>w.id!==k));},[]),i=react.useCallback(k=>{l(h=>h.map(w=>w.id===k?{...w,isExpanded:!w.isExpanded}:w));},[]),m=react.useCallback((k,h)=>{l(w=>w.map(f=>f.id===k&&!f.cardIds.includes(h)?{...f,cardIds:[...f.cardIds,h]}:f));},[]),s=react.useCallback((k,h)=>{l(w=>w.map(f=>{if(f.id===k){let g=f.cardIds.filter(T=>T!==h);return g.length<o.minCardsPerStack?null:{...f,cardIds:g}}return f}).filter(f=>f!==null));},[o.minCardsPerStack]),p=react.useCallback(k=>n.filter(h=>h.columnId===k).sort((h,w)=>h.position-w.position),[n]),u=react.useCallback(async k=>{let h=t.filter(D=>D.columnId===k);if(h.length<o.minCardsPerStack*2)return [];let w=[],f=new Map;h.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(D);});}),f.forEach((D,b)=>{D.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:D.map(x=>x.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${b}"`,confidence:.85});});let g=new Map;h.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(b=>{g.has(b)||g.set(b,[]),g.get(b).push(D);});}),g.forEach((D,b)=>{D.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:D.map(x=>x.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(h.forEach(D=>{D.priority&&(T.has(D.priority)||T.set(D.priority,[]),T.get(D.priority).push(D));}),T.forEach((D,b)=>{if(D.length>=o.minCardsPerStack){let x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";w.push({stack:{title:`${x} ${b} Priority`,cardIds:D.map(v=>v.id),columnId:k,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${b} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of h){let x=(await r.findSimilar(D,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let v=[D.id,...x.map(C=>C.card.id)],P=x.reduce((C,L)=>C+L.similarity,0)/x.length;w.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:v,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:P});}}return w.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,b)=>b.confidence-D.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(k=>{d(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let w=await u(h),f=w[0];w.length>0&&f&&f.confidence>=.9&&y(f);});},[]),{stacks:n,createStack:d,deleteStack:c,toggleStack:i,addToStack:m,removeFromStack:s,getStacksForColumn:p,getSuggestions:u,applySuggestion:y,config:o}}var _d=react.createContext(null);function Vd({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,l=new Map;t?.columns?.forEach(c=>{let{Column:i}=Jr("@libxai/core");n.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Jr("@libxai/core");l.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=Jr("@libxai/core");d=new c(t.board);}r.current=new core.BoardStore({board:d,columns:n,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(_d.Provider,{value:{store:o},children:e})}function _o(){let e=react.useContext(_d);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function qr(){let e=_o(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let d=react.useCallback(f=>{e.updateBoard(f);},[e]),c=react.useCallback(f=>{e.addColumn(f);},[e]),i=react.useCallback((f,g)=>{e.updateColumn(f,g);},[e]),m=react.useCallback(f=>{e.deleteColumn(f);},[e]),s=react.useCallback(f=>e.getColumn(f),[e]),p=react.useCallback(f=>{e.addCard(f);},[e]),u=react.useCallback((f,g)=>{e.updateCard(f,g);},[e]),y=react.useCallback(f=>{e.deleteCard(f);},[e]),k=react.useCallback((f,g,T)=>{e.moveCard(f,g,T);},[e]),h=react.useCallback(f=>e.getCard(f),[e]),w=react.useCallback(f=>e.getCardsByColumn(f),[e]);return {board:t,columns:r,cards:n,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:m,getColumn:s,addCard:p,updateCard:u,deleteCard:y,moveCard:k,getCard:h,getCardsByColumn:w}}function Kd(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),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 Yd(e="position",t="asc"){let{cards:a}=qr();return react.useMemo(()=>[...a].sort((o,n)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(n.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?d[o.priority]:0,i=n.priority?d[n.priority]:0;l=c-i;break}case "createdAt":l=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":l=o.position-n.position;break}return t==="asc"?l:-l}),[a,e,t])}var Vo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ai.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let l=n[t];if(typeof l=="function")try{let d=await Promise.resolve(l.apply(n,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,d,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},$f=new Vo;function Xd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:l=false,gap:d=0,getItemKey:c}){let i=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:n,horizontal:l,gap:d}),s=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:u,children:s.map(y=>{let k=e[y.index];if(!k)return null;let h=c?c(k,y.index):y.index,w={position:"absolute",top:l?0:y.start,left:l?y.start:0,width:l?y.size:"100%",height:l?"100%":y.size};return jsxRuntime.jsx("div",{style:w,"data-index":y.index,children:r(k,y.index)},h)})})})}function Jd(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 Qd({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:l=3,gap:d=16,getItemKey:c,horizontal:i=true}){let m=react.useRef(null),s=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:d}),p=s.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${s.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:n,children:jsxRuntime.jsx("div",{style:y,children:p.map(k=>{let h=e[k.index];if(!h)return null;let w=c?c(h,k.index):k.index,f={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:f,"data-index":k.index,children:o(h,k.index)},w)})})})}function ec(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 tc(e,t=10){return e>t}var As={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ls={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Fs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Bs={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rs={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Os={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$s={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},zs={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)"},Ws={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)"},Gs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Us={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}},Hs={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:As,borderRadius:Ls,fontSize:Fs,fontWeight:Bs,lineHeight:Rs,zIndex:Os,duration:$s,easing:zs,shadows:Ws,opacity:Gs,kanban:Us,gantt:Hs};function ac(e,t,a){return e[t]??a}function _s(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?_s(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Gf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vs(e="asakaa"){let t=_s(jo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,l=Gf(o);a.push(` ${n}: ${l};`);}return `:root {
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Zl(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=Zl(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let n=a.find(c=>c.name.toLowerCase().includes(r));if(n)return n;let l=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return l.every(s=>p.includes(s))})}function ds(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 d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}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 x=new Date(r),v=x.getDay(),h=u-v;return h<=0&&(h+=7),x.setDate(x.getDate()+h),x}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let d=parseInt(n[1],10),u=n[2].toLowerCase(),x=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?x.setDate(x.getDate()+d):u==="week"||u==="semana"||u==="semanas"?x.setDate(x.getDate()+d*7):(u==="month"||u==="mes"||u==="meses")&&x.setMonth(x.getMonth()+d),x}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 d=parseInt(c[1],10),u=parseInt(c[2],10)-1,x=parseInt(c[3],10);return new Date(x,u,d)}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},s=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(s&&s[1]&&s[2]){let d=parseInt(s[1],10),u=p[s[2].toLowerCase()],x=s[3]?parseInt(s[3],10):r.getFullYear();if(u!==void 0)return new Date(x,u,d)}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 d=m[i[1].toLowerCase()],u=parseInt(i[2],10),x=i[3]?parseInt(i[3],10):r.getFullYear();if(d!==void 0)return new Date(x,d,u)}return null}function cs(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 ps(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 Ql(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 ed(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 s=r[1].trim(),m=r[2].trim(),i=Pa(t,s),d=ds(m);if(!i)return {type:"move_task",taskName:s,message:`Could not find a task named "${s}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)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,x=new Date(d);return x.setDate(x.getDate()+u),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:d,endDate:x},message:`Moved "${i.name}" to ${d.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),m=o[2].trim(),i=Pa(t,s),d=cs(m);if(!i)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"};if(!d||!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()+d),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:u},message:`Extended "${i.name}" by ${d} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let s=n[1].trim(),m=n[2].trim(),i=Pa(t,s),d=ps(m);return i?d===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:d},message:`Set "${i.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let s=l[1].trim(),m=l[2].trim(),i=Pa(t,s);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:s,message:`Could not find a task named "${s}".`,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 s=c[1].trim(),m=c[2].trim(),i=Pa(t,s),d=Pa(t,m);return i?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:i.id,dependencyTo:d.id,message:`Linked "${i.name}" \u2192 "${d.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:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let s=p[1].trim(),m=Pa(t,s);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}return null}function td(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 Vg(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 jg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Lo(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let i=a.find(d=>d.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=>Lo(m,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},c=l(e.startDate),p=l(e.endDate),s=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:Vg(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:s,isCriticalPath:e.metadata?.isCriticalPath===true}}function ad(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:jg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function rd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Lo(r,e,t))}var ms={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},us={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Fo={en:ms,es:us};function gs(e){return Fo[e]||Fo.en}function Bo(e,t){let a=gs(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 id(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(...id(r.subtasks,t+1));return a}function rf({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 ld({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:l}){let{theme:c="dark",locale:p="en",customTranslations:s,showSearch:m=true,showHierarchy:i=true}=t,d=Bo(p,s),u=c==="dark",[x,v]=react.useState(new Set),[h,w]=react.useState("startDate"),[g,f]=react.useState("asc"),[T,N]=react.useState("");react.useMemo(()=>{let y=new Set;function A(O){for(let B of O)B.subtasks?.length&&(y.add(B.id),A(B.subtasks));}A(e),v(y);},[e]);let b=react.useCallback(y=>{v(A=>{let O=new Set(A);return O.has(y)?O.delete(y):O.add(y),O}),a.onTaskToggleExpand?.(y);},[a]),k=react.useCallback(y=>{h===y?f(A=>A==="asc"?"desc":"asc"):(w(y),f("asc")),a.onSortChange?.({column:y,direction:g==="asc"?"desc":"asc"});},[h,g,a]),C=react.useMemo(()=>{let y=id(e);if(T.trim()){let O=T.toLowerCase();y=y.filter(B=>B.name.toLowerCase().includes(O));}let A=[];for(let O of y){let B=O.level===0;O.level>0&&(B=true),(B||T.trim())&&A.push(O);}return T.trim()&&A.sort((O,B)=>{let $,V;switch(h){case "name":$=O.name.toLowerCase(),V=B.name.toLowerCase();break;case "startDate":$=O.startDate?.getTime()||0,V=B.startDate?.getTime()||0;break;case "endDate":$=O.endDate?.getTime()||0,V=B.endDate?.getTime()||0;break;case "progress":$=O.progress||0,V=B.progress||0;break;case "status":$=O.status||"todo",V=B.status||"todo";break;default:return 0}return $<V?g==="asc"?-1:1:$>V?g==="asc"?1:-1:0}),A},[e,T,h,g]),M=y=>y?(y instanceof Date?y:new Date(y)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:P("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:P("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[d.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:P("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:P("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:P("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:P("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,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:P("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:d.empty.noTasks}),jsxRuntime.jsx("p",{className:P("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:P("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:P("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:P("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:y=>N(y.target.value),placeholder:d.toolbar.searchPlaceholder,className:P("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:P("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",d.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:P("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:()=>k("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>k("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>k("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>k("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>k("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((y,A)=>{let O=x.has(y.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:A*.02},className:P("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+y.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(y),onDoubleClick:()=>a.onTaskDoubleClick?.(y),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[i&&y.hasChildren&&jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),b(y.id);},className:P("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:O?jsxRuntime.jsx(lucideReact.ChevronDown,{className:P("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:P("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),i&&!y.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),a.onTaskUpdate?.({...y,progress:y.progress===100?0:100,status:y.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(rf,{status:y.status,progress:y.progress})}),jsxRuntime.jsx("span",{className:P("truncate",u?"text-white":"text-gray-900",y.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:y.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:P("px-2 py-1 rounded-full text-xs font-medium",y.progress===100||y.status==="completed"?"bg-green-500/10 text-green-500":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:y.progress===100||y.status==="completed"?d.status.completed:y.progress&&y.progress>0||y.status==="in-progress"?d.status.inProgress:d.status.todo})}),jsxRuntime.jsxs("div",{className:P("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(y.startDate)]}),jsxRuntime.jsxs("div",{className:P("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(y.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:P("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:P("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:P("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[y.progress||0,"%"]})]})})]},y.id)})}),C.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:P("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:P(u?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.noResults})]})})]})]})}var fs={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"},bs={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"},hs={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"},Oo={dark:fs,light:bs,neutral:hs};function dd(e){return Oo[e]||Oo.dark}var vs={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ys={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"}},$o={en:vs,es:ys};function Hr(e){return $o[e]||$o.en}function zo(e,t){let a=Hr(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 cd(e){let t=Hr(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 pd(e,t=0,a=true){let r=Hr(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 ks(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function fd({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 hd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:l,style:c}){let{theme:p="dark",locale:s="en",customTranslations:m}=t,i=zo(s,m),d=p==="dark",[u,x]=react.useState(r||new Date),[v,h]=react.useState(null),[w,g]=react.useState(null),f=react.useCallback(()=>{x(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),T=react.useCallback(()=>{x(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),N=react.useCallback(()=>{x(new Date);},[]),b=react.useMemo(()=>{let y=u.getFullYear(),A=u.getMonth(),O=new Date(y,A,1),B=new Date(y,A+1,0),$=O.getDay(),V=B.getDate(),ne=yf(e),ce=new Date;ce.setHours(0,0,0,0);let Ae=[],Me=$,fe=new Date(y,A,0).getDate();for(let I=Me-1;I>=0;I--){let S=new Date(y,A-1,fe-I);Ae.push({date:S,isCurrentMonth:false,isToday:false,isWeekend:S.getDay()===0||S.getDay()===6,events:ne.filter(W=>ks(S,W)).map(W=>({id:W.id,title:W.name,start:W.startDate,end:W.endDate,task:W}))});}for(let I=1;I<=V;I++){let S=new Date(y,A,I),W=S.getTime()===ce.getTime();Ae.push({date:S,isCurrentMonth:true,isToday:W,isWeekend:S.getDay()===0||S.getDay()===6,events:ne.filter(j=>ks(S,j)).map(j=>({id:j.id,title:j.name,start:j.startDate,end:j.endDate,task:j}))});}let E=42-Ae.length;for(let I=1;I<=E;I++){let S=new Date(y,A+1,I);Ae.push({date:S,isCurrentMonth:false,isToday:false,isWeekend:S.getDay()===0||S.getDay()===6,events:ne.filter(W=>ks(S,W)).map(W=>({id:W.id,title:W.name,start:W.startDate,end:W.endDate,task:W}))});}return Ae},[u,e]),k=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],C=u.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),M=react.useCallback(y=>{let A=y.progress===100?0:100,O=A===100?"completed":"todo";a.onTaskUpdate?.({...y,status:O,progress:A});},[a]);return o?jsxRuntime.jsx("div",{className:P("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",l),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:P("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:[i.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:P("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",l),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:P("text-lg font-semibold mb-2",d?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:P("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:P("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",l),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:P("text-lg font-semibold mb-2",d?"text-white":"text-gray-900"),children:i.labels.noEvents}),jsxRuntime.jsx("p",{className:P("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:i.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:P("flex-1 flex flex-col w-full h-full overflow-hidden",d?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:P("flex-shrink-0 px-6 py-4 border-b",d?"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:P("text-xl font-semibold capitalize",d?"text-white":"text-gray-900"),children:C}),jsxRuntime.jsx("button",{onClick:N,className:P("px-3 py-1.5 text-sm rounded-lg transition-colors",d?"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:f,className:P("p-2 rounded-lg transition-colors",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:P("w-5 h-5",d?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:T,className:P("p-2 rounded-lg transition-colors",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:P("w-5 h-5",d?"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:k.map(y=>jsxRuntime.jsx("div",{className:P("py-2 text-center text-xs font-medium uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:y},y))}),jsxRuntime.jsx("div",{className:P("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",d?"bg-white/5":"bg-gray-200"),children:b.map((y,A)=>jsxRuntime.jsxs("div",{className:P("min-h-[100px] p-2 transition-colors flex flex-col relative",d?"bg-[#0F1117]":"bg-white",!y.isCurrentMonth&&(d?"bg-[#0F1117]/50":"bg-gray-50"),y.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsxs("div",{className:"space-y-1 overflow-hidden flex-1",children:[y.events.slice(0,3).map(O=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(O.task),a.onEventClick?.(O);},whileHover:{scale:1.02},className:P("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",O.task.progress===100?d?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":d?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(fd,{task:O.task}),jsxRuntime.jsx("span",{className:"truncate",children:O.title})]}),jsxRuntime.jsx("div",{className:P("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",d?"bg-[#1A1D25] text-white border border-white/10":"bg-gray-900 text-white"),children:O.title})]},O.id)),y.events.length>3&&jsxRuntime.jsxs("button",{onClick:O=>{O.stopPropagation(),g(y);},className:P("text-xs px-1.5 hover:underline cursor-pointer",d?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",y.events.length-3," ",s==="es"?"m\xE1s":"more"]})]}),jsxRuntime.jsx("div",{className:P("text-sm font-medium mt-1 text-right",y.isToday?"text-[#3B82F6]":y.isCurrentMonth?d?"text-white":"text-gray-900":d?"text-[#6B7280]":"text-gray-400"),children:y.date.getDate()})]},A))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:P("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[90%] max-w-[900px] max-h-[85vh] rounded-xl shadow-2xl z-50 flex overflow-hidden",d?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:P("px-6 py-4 border-b flex items-center gap-3",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:P("text-xs px-2 py-0.5 rounded",d?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:s==="es"?"Tarea":"Task"}),jsxRuntime.jsx("span",{className:P("text-xs",d?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:P("p-1.5 rounded hover:bg-white/10",d?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:P("p-1.5 rounded hover:bg-white/10",d?"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:P("text-xl font-semibold",d?"text-white":"text-gray-900"),children:v.name})}),jsxRuntime.jsxs("div",{className:"px-6 flex-1 overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsxRuntime.jsx("span",{className:P("text-xs px-2 py-1 rounded font-medium",v.progress===100?"bg-green-500/20 text-green-400":v.progress&&v.progress>0?"bg-blue-500/20 text-blue-400":d?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100?s==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((y,A)=>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:y.name,children:y.name.charAt(0).toUpperCase()},A)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:P("text-xs",d?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:P("text-sm",d?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("span",{className:P("text-sm",d?"text-white":"text-gray-900"),children:[v.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||"-"," \u2192 ",v.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||"-"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Flag,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("span",{className:P("text-xs px-2 py-1 rounded font-medium",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":d?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v.priority?v.priority==="high"||v.priority==="urgent"?s==="es"?"Urgente":"Urgent":v.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:P("text-sm",d?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:P("w-4 h-4 rounded-full border-2",d?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[jsxRuntime.jsx("div",{className:P("flex-1 h-2 rounded-full overflow-hidden max-w-[120px]",d?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:P("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:P("text-sm font-medium",d?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:P("text-sm",d?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:P("text-sm",d?"text-[#6B7280]":"text-gray-400"),children:v.dependencies&&v.dependencies.length>0?`${v.dependencies.length} ${s==="es"?"dependencias":"dependencies"}`:s==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:P("mt-6 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:P("text-sm font-medium",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("div",{className:P("min-h-[60px] p-3 rounded-lg text-sm",d?"bg-white/5 text-[#9CA3AF]":"bg-gray-50 text-gray-600"),children:v.description||(s==="es"?"Sin descripci\xF3n":"No description")})]}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsxs("div",{className:P("mt-4 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:P("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("span",{className:P("text-sm font-medium",d?"text-[#9CA3AF]":"text-gray-500"),children:[s==="es"?"Subtareas":"Subtasks"," (",v.subtasks.length,")"]})]}),jsxRuntime.jsx("div",{className:"space-y-2",children:v.subtasks.slice(0,5).map(y=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:P("w-4 h-4 rounded border flex items-center justify-center",y.progress===100?"bg-green-500 border-green-500":d?"border-white/20":"border-gray-300"),children:y.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:P("text-sm",y.progress===100?"line-through text-[#6B7280]":d?"text-white":"text-gray-900"),children:y.name})]},y.id))})]})]}),jsxRuntime.jsx("div",{className:P("px-6 py-4 border-t flex items-center gap-3",d?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("button",{onClick:()=>{M(v),h(null);},className:P("px-4 py-2 rounded-lg font-medium transition-colors",v.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:v.progress===100?s==="es"?"Reabrir tarea":"Reopen task":s==="es"?"Completar tarea":"Complete task"})})]}),jsxRuntime.jsxs("div",{className:P("w-[280px] border-l flex flex-col",d?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:P("px-4 py-3 border-b flex items-center justify-between",d?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:P("font-medium",d?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:P("text-sm text-center py-8",d?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),s==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:P("p-3 border-t",d?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:P("flex items-center gap-2 px-3 py-2 rounded-lg",d?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:s==="es"?"Escribe un comentario...":"Write a comment...",className:P("flex-1 bg-transparent text-sm outline-none",d?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(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:P("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",d?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:P("px-4 py-3 border-b flex items-center justify-between",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:P("font-medium",d?"text-white":"text-gray-900"),children:w.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:P("p-1 rounded",d?"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:w.events.map(y=>jsxRuntime.jsxs("button",{onClick:()=>{g(null),h(y.task);},className:P("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",d?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(fd,{task:y.task}),jsxRuntime.jsx("span",{className:P("text-sm truncate flex-1",d?"text-white":"text-gray-900"),children:y.title}),y.task.priority==="high"||y.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},y.id))})]})]})})]})}var ws={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"},Cs={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"},Ts={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"},Go={dark:ws,light:Cs,neutral:Ts};function vd(e){return Go[e]||Go.dark}function kf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:l,className:c}){let[p,s]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),i=react.useMemo(()=>{let u=m.length,x=new Set(m.flatMap(w=>w.assignedUserIds||[])).size,v=m.map(w=>w.priority).filter(Boolean),h=new Set(m.flatMap(w=>w.labels||[])).size;return {totalCards:u,uniqueAssignees:x,priorities:v,labels:h}},[m]),d=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:P("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:d,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:P("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children: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(),l?.(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:x=>{x.stopPropagation(),n?.(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 xd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Vr(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 jr(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 kd(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 wd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:l,className:c}){let p=react.useMemo(()=>({...xd,...l}),[l]),[s,m]=react.useState(new Set),i=react.useRef(null),d=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let g=new Map;return e.forEach(f=>{let T=f.timestamp.toISOString().split("T")[0],N=g.get(T);N?N.push(f):g.set(T,[f]);}),Array.from(g.entries()).sort((f,T)=>T[0].localeCompare(f[0])).map(([f,T])=>({date:new Date(f),events:T.sort((N,b)=>b.timestamp.getTime()-N.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:x}=react.useMemo(()=>{let g=new Set,f=new Set;return e.forEach(T=>{g.add(T.userId),f.add(T.type);}),{uniqueUsers:Array.from(g),uniqueTypes:Array.from(f)}},[e]),v=g=>{m(f=>{let T=new Set(f);return T.has(g)?T.delete(g):T.add(g),T});},h=g=>{let T=new Date().getTime()-g.getTime(),N=Math.floor(T/6e4),b=Math.floor(T/36e5),k=Math.floor(T/864e5);return N<1?"just now":N<60?`${N}m ago`:b<24?`${b}h ago`:k<7?`${k}d ago`:g.toLocaleDateString()},w=react.useMemo(()=>{let g=0;return t.types&&t.types.length>0&&g++,t.users&&t.users.length>0&&g++,t.dateRange&&g++,t.searchTerm&&g++,g},[t]);return react.useEffect(()=>{if(n&&i.current){let g=i.current.querySelector(`[data-event-id="${n}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:P("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:P("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:g=>{let f=g.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(g=>jsxRuntime.jsxs("option",{value:g,children:[jr(g)," ",g.replace("_"," ")]},g))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:g=>{let f=g.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(g=>jsxRuntime.jsx("option",{value:g,children:g},g))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:g=>a({...t,searchTerm:g.target.value})})]}),w>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",w,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:i,children:d.map(g=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&g.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:g.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[g.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:g.events.map((f,T)=>{let N=s.has(f.id),b=n===f.id,k=kd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:P("history-timeline-event",N&&"expanded",b&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:jr(f.type)})}),T<g.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),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:Vr(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(f.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(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)})]})]},C)),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(([C,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(M)})]},C))]})]})]})]},f.id)})})]},g.date?.toISOString()||"all"))})]})}function Td({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:l,onGoToEvent:c,onSpeedChange:p,className:s}){let m=[.5,1,1.5,2,3],i=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:P("history-replay-empty",s),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:P("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:i&&jr(i.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:i&&Vr(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:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,x)=>jsxRuntime.jsx("div",{className:P("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>c(x),title:Vr(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:l,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:P("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:P("history-replay-start",s),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 Ns(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 Ds(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 Nd(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 Dd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Sf(e,t,a,r,o,n=100){let l=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(l.map(p=>[p.id,p]));for(let p=0;p<n;p++){let s=1-p/n;l.forEach(m=>{let i=a/2,d=r/2;m.vx+=(i-m.x)*o.centerForce*s,m.vy+=(d-m.y)*o.centerForce*s,l.forEach(u=>{if(m.id===u.id)return;let x=m.x-u.x,v=m.y-u.y,h=Math.sqrt(x*x+v*v)||1,w=o.chargeStrength*s/(h*h);m.vx+=x/h*w,m.vy+=v/h*w;});}),t.forEach(m=>{let i=c.get(typeof m.source=="string"?m.source:m.source.id),d=c.get(typeof m.target=="string"?m.target:m.target.id);if(!i||!d)return;let u=d.x-i.x,x=d.y-i.y,v=Math.sqrt(u*u+x*x)||1,h=(v-o.linkDistance)/v*o.forceStrength*s;i.vx+=u*h,i.vy+=x*h,d.vx-=u*h,d.vy-=x*h;}),l.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 l}function Sd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:l,onInteraction:c,className:p}){let s=react.useRef(null),[m,i]=react.useState([]),[d,u]=react.useState(null),[x,v]=react.useState(null),[h,w]=react.useState(null),[g,f]=react.useState(1),[T,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let B=Sf(e,t,a.width,a.height,a,150);i(B);},[e,t,a]);let b=react.useCallback((B,$)=>{a.enableDragging&&($.stopPropagation(),u(B));},[a.enableDragging]),k=react.useCallback(B=>{if(!d||!s.current)return;let V=s.current.getBoundingClientRect(),ne=(B.clientX-V.left-T.x)/g,ce=(B.clientY-V.top-T.y)/g;i(Ae=>Ae.map(Me=>Me.id===d?{...Me,x:ne,y:ce,fx:ne,fy:ce}:Me));},[d,g,T]),C=react.useCallback(()=>{u(null);},[]),M=react.useCallback((B,$)=>{$.stopPropagation(),c?.({type:"node-click",node:B,position:{x:$.clientX,y:$.clientY}});},[c]),y=react.useCallback((B,$)=>{$.stopPropagation(),c?.({type:"edge-click",edge:B,position:{x:$.clientX,y:$.clientY}});},[c]),A=react.useCallback(B=>{let $=m.find(V=>V.id===B);return $?{x:$.x,y:$.y}:{x:0,y:0}},[m]),O=react.useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=B.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:P("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:P("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:l.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:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.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(B=>Math.min(B+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(g*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Ns(B)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Nd(B)," ",Ds(B)]})]},B))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${g})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let $=A(typeof B.source=="string"?B.source:B.source.id),V=A(typeof B.target=="string"?B.target:B.target.id),ne=Dd(B.type),ce=h===B.id,Ae=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:P("relationships-graph-edge",ce&&"hovered",Ae&&"critical"),onMouseEnter:()=>w(B.id),onMouseLeave:()=>w(null),onClick:Me=>y(B,Me),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:V.x,y2:V.y,stroke:Ns(B.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ce?1:.6,markerEnd:ne?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ce&&jsxRuntime.jsx("text",{x:($.x+V.x)/2,y:($.y+V.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ds(B.type)})]},B.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(B=>{let $=x===B.id,V=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:P("relationships-graph-node",$&&"hovered",V&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:ne=>b(B.id,ne),onMouseEnter:()=>v(B.id),onMouseLeave:()=>v(null),onClick:ne=>M(B,ne),children:[jsxRuntime.jsx("circle",{r:V?a.nodeSize*1.2:a.nodeSize,fill:O(B),stroke:V?"#fbbf24":"#ffffff",strokeWidth:V?3:2,opacity:$?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:B.card.title.length>20?B.card.title.substring(0,20)+"...":B.card.title})]},B.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 Md({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,l]=react.useState(""),[c,p]=react.useState(false),[s,m]=react.useState(null),[i,d]=react.useState(null),u=react.useRef(null),x=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&!x&&v();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,x]);let v=()=>{x||(l(""),m(null),d(null),t());},h=async()=>{if(!(!n.trim()||x)){p(true),m(null),d(null);try{let g=await r(n.trim());d(g);}catch(g){m(g instanceof Error?g.message:"Failed to generate plan");}finally{p(false);}}},w=()=>{i&&(a(i),v());};return e?jsxRuntime.jsxs(ze,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),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:g=>g.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:v,disabled:x,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((g,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:g.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((g,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:g.title}),g.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:g.description})]}),g.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${g.priority==="URGENT"?"bg-red-500/20 text-red-400":g.priority==="HIGH"?"bg-orange-500/20 text-orange-400":g.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:g.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:n,onChange:g=>l(g.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:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),s&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:s}),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((g,f)=>jsxRuntime.jsx("button",{onClick:()=>l(g),disabled:x,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:g},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&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:v,disabled:x,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: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 Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!n.trim()||x,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:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ss={"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=Ss[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Kr(e){return `$${e.toFixed(4)}`}var Es=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,d)=>i+d.cost,0),n=a.reduce((i,d)=>i+d.inputTokens,0),l=a.reduce((i,d)=>i+d.outputTokens,0),c=a.filter(i=>i.success),p=a.reduce((i,d)=>i+d.duration,0),s={},m={};return a.forEach(i=>{s[i.feature]=(s[i.feature]||0)+1,m[i.feature]=(m[i.feature]||0)+i.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:l,operationsByFeature:s,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],n=new Date,l=new Date;a==="month"?l.setMonth(n.getMonth()-1):l.setDate(n.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=l).length,p=Math.max(0,o-c),s=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:s,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)}},Qa=new Es;function Ld({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qa.getStats()),[n,l]=react.useState(Qa.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Qa.getStats()),l(Qa.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Qa.getRecentOperations(5);return jsxRuntime.jsxs(ze,{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:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Kr(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,s])=>{let m=r.costsByFeature[p]||0,i=r.totalOperations>0?s/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:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Kr(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:Kr(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 Rd({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[l,c]=react.useState(""),[p,s]=react.useState(""),[m,i]=react.useState(""),[d,u]=react.useState(false),[x,v]=react.useState(null),[h,w]=react.useState(null),[g,f]=react.useState(null),T=react.useRef(null),N=d||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let y=A=>{A.key==="Escape"&&!N&&b();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,N]);let b=()=>{N||(c(""),s(""),i(""),v(null),w(null),f(null),t());},k=async()=>{if(!(!l.trim()||N)){u(true),v(null),w(null),f(null);try{let y=await r({prompt:l.trim(),projectName:n||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});w(y.tasks.tasks),f({from_cache:y.from_cache,tokens_used:y.tokens_used,mock_mode:y.mock_mode,similarity:y.similarity,tokens_saved:y.tokens_saved});}catch(y){v(y instanceof Error?y.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{h&&(a(h),b());};if(!e)return null;let M=g?.similarity?((g.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ze,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("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:b,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[g?.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"}),g?.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:[g?.tokens_used||0," tokens"]}),g?.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:[g.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((y,A)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",A+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.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"})]}),y.start," \u2192 ",y.end]}),jsxRuntime.jsxs("span",{children:[y.duration," days"]}),y.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",y.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="high"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},y.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:l,onChange:y=>c(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:y=>s(y.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:y=>i(y.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,A)=>jsxRuntime.jsx("button",{onClick:()=>c(y),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},A))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!l.trim()||N,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:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Vo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&to(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,g,f)=>{console.warn(`Retry attempt ${g} after ${f}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),n=react.useCallback(async(h,w,g)=>{r(f=>{let T=f.cards.find(y=>y.id===h);if(!T)return f;let N=T.columnId,b={...T,columnId:w,position:g},k=f.cards.map(y=>y.id===h?b:y),C=f.columns.map(y=>{if(y.id===N)return {...y,cardIds:y.cardIds.filter(A=>A!==h)};if(y.id===w){let A=k.filter(O=>O.columnId===w).sort((O,B)=>O.position-B.position);return {...y,cardIds:A.map(O=>O.id)}}return y}),M={...f,cards:k,columns:C};return o(M),M});},[o]),l=react.useCallback(async(h,w)=>{r(g=>{let f=g.cards.map(N=>N.id===h?{...N,...w}:N),T={...g,cards:f};return o(T),T});},[o]),c=react.useCallback(async h=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:w},T=g.columns.map(b=>b.id===h.columnId?{...b,cardIds:[...b.cardIds,w]}:b),N={...g,cards:[...g.cards,f],columns:T};return o(N),N});},[o]),p=react.useCallback(async h=>{r(w=>{let g=w.cards.find(b=>b.id===h);if(!g)return w;let f=w.cards.filter(b=>b.id!==h),T=w.columns.map(b=>b.id===g.columnId?{...b,cardIds:b.cardIds.filter(k=>k!==h)}:b),N={...w,cards:f,columns:T};return o(N),N});},[o]),s=react.useCallback(async h=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:w,cardIds:[]},T={...g,columns:[...g.columns,f]};return o(T),T});},[o]),m=react.useCallback(async(h,w)=>{r(g=>{let f=g.columns.map(N=>N.id===h?{...N,...w}:N),T={...g,columns:f};return o(T),T});},[o]),i=react.useCallback(async h=>{r(w=>{let g=w.cards.filter(N=>N.columnId!==h),f=w.columns.filter(N=>N.id!==h),T={...w,cards:g,columns:f};return o(T),T});},[o]),d=react.useCallback(h=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),w},[c]),u=react.useCallback(h=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(h),w},[s]),x=react.useCallback(()=>{r(h=>{let w={...h,cards:[],columns:[]};return o(w),w});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:l,onCardCreate:c,onCardDelete:p,onColumnCreate:s,onColumnUpdate:m,onColumnDelete:i},setBoard:r,helpers:{addCard:d,addColumn:u,deleteCard:p,deleteColumn:i,clearBoard:x}}}function $d({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Vo({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(p,s,m={})=>{n.addCard({title:s,columnId:p,position:r.cards.filter(i=>i.columnId===p).length,...m});},addColumn:(p,s)=>{let m=r.columns.length>0?Math.max(...r.columns.map(i=>i.position)):0;n.addColumn({title:p,position:s??m+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var Yr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wd={by:"none",order:"asc"};function Ud({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Yr,...e}),[n,l]=react.useState({...Wd,...t}),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),p=react.useCallback(v=>{l(h=>({...h,...v}));},[]),s=react.useCallback(()=>{o(Yr),l(Wd);},[]),m=react.useCallback(()=>{a&&o({...Yr,assignees:[a]});},[a]),i=react.useCallback(()=>{o({...Yr,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{o({...Yr,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!==""||n.by!=="none",[r,n]),x=react.useCallback(v=>{let h=[...v];if(r.search){let w=r.search.toLowerCase();h=h.filter(g=>g.title.toLowerCase().includes(w)||g.description?.toLowerCase().includes(w));}if(r.dateFilter!=="all"){let w=new Date,g=w.getFullYear(),f=String(w.getMonth()+1).padStart(2,"0"),T=String(w.getDate()).padStart(2,"0"),N=`${g}-${f}-${T}`;h=h.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let k=b.endDate||b.dueDate;if(!k)return false;let C;if(typeof k=="string")C=k.split("T")[0]||k;else {let M=k.getUTCFullYear(),y=String(k.getUTCMonth()+1).padStart(2,"0"),A=String(k.getUTCDate()).padStart(2,"0");C=`${M}-${y}-${A}`;}switch(r.dateFilter){case "overdue":return C<N;case "today":return C===N;case "this-week":let M=new Date(N+"T00:00:00"),y=new Date(C+"T00:00:00"),A=new Date(M);return A.setDate(A.getDate()+7),y>=M&&y<=A;case "custom":if(r.dateRange){let O=typeof k=="string"?new Date(k):k;return O>=r.dateRange.start&&O<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(w=>w.priority&&r.priorities.includes(w.priority))),r.assignees.length>0&&(h=h.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(h=h.filter(w=>w.labels&&w.labels.some(g=>r.labels.includes(g)))),r.columns.length>0&&(h=h.filter(w=>r.columns.includes(w.columnId))),n.by!=="none"&&h.sort((w,g)=>{let f=0;switch(n.by){case "created":let T=w.createdAt?new Date(w.createdAt).getTime():0,N=g.createdAt?new Date(g.createdAt).getTime():0;f=T-N;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=b[w.priority||"LOW"],C=b[g.priority||"LOW"];f=k-C;break;case "dueDate":let M=w.endDate||w.dueDate,y=g.endDate||g.dueDate;if(!M)return 1;if(!y)return -1;let A=typeof M=="string"?new Date(M).getTime():M.getTime(),O=typeof y=="string"?new Date(y).getTime():y.getTime();f=A-O;break;case "title":f=w.title.localeCompare(g.title);break;case "estimate":let B=w.estimatedTime||0,$=g.estimatedTime||0;f=B-$;break;default:f=0;}return n.order==="asc"?f:-f}),h},[r,n]);return {filters:r,sort:n,setFilters:c,setSort:p,resetFilters:s,filterMyTasks:m,filterOverdue:i,filterHighPriority:d,applyFilters:x,hasActiveFilters:u}}var Hd,_d;if(typeof window<"u")try{let e=Zr("ai");Hd=e.generateObject,_d=e.generateText;}catch{}function Vd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(Hd&&_d&&e.apiKey),l=react.useCallback(async i=>{if(!n)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(d){let u=d instanceof Error?d:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[n]),c=react.useCallback(async i=>{if(!n)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(d){let u=d instanceof Error?d:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[n]),p=react.useCallback(async i=>{if(!n)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(d){let u=d instanceof Error?d:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[n]),s=react.useCallback(async i=>{if(!n)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(d){let u=d instanceof Error?d:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),m=react.useCallback(async i=>{if(!n)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(d){let u=d instanceof Error?d:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:s,onEstimateEffort:m,isAvailable:n,isLoading:t,error:r}}function Ms(){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 jd(e){let{cards:t}=e,[a,r]=Ms(),o=react.useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),n=react.useCallback((i,d)=>{if(!d){r({selectedCardIds:[i],lastSelectedCardId:i});return}let u=d.ctrlKey||d.metaKey,x=d.shiftKey;if(u)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(x&&a.lastSelectedCardId){let v=t.find(w=>w.id===i),h=t.find(w=>w.id===a.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let w=t.filter(C=>C.columnId===v.columnId).sort((C,M)=>C.position-M.position),g=w.findIndex(C=>C.id===a.lastSelectedCardId),f=w.findIndex(C=>C.id===i),[T,N]=g<f?[g,f]:[f,g],b=w.slice(T,N+1).map(C=>C.id),k=Array.from(new Set([...a.selectedCardIds,...b]));r({selectedCardIds:k,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),l=react.useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==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]),s=react.useCallback(i=>{a.selectedCardIds.includes(i)?l(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,l,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:n,deselectCard:l,clearSelection:c,selectAll:p,toggleCard:s,getSelectedCards:m}}var Kd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Yd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Kd,...a}),[a]),[n,l]=react.useState([]),c=react.useCallback((v,h,w,g,f)=>{if(h.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:v,cardIds:h,columnId:w,strategy:g,color:f,isExpanded:true,position:n.filter(N=>N.columnId===w).length,createdAt:new Date};l(N=>[...N,T]);},[o.minCardsPerStack,n]),p=react.useCallback(v=>{l(h=>h.filter(w=>w.id!==v));},[]),s=react.useCallback(v=>{l(h=>h.map(w=>w.id===v?{...w,isExpanded:!w.isExpanded}:w));},[]),m=react.useCallback((v,h)=>{l(w=>w.map(g=>g.id===v&&!g.cardIds.includes(h)?{...g,cardIds:[...g.cardIds,h]}:g));},[]),i=react.useCallback((v,h)=>{l(w=>w.map(g=>{if(g.id===v){let f=g.cardIds.filter(T=>T!==h);return f.length<o.minCardsPerStack?null:{...g,cardIds:f}}return g}).filter(g=>g!==null));},[o.minCardsPerStack]),d=react.useCallback(v=>n.filter(h=>h.columnId===v).sort((h,w)=>h.position-w.position),[n]),u=react.useCallback(async v=>{let h=t.filter(N=>N.columnId===v);if(h.length<o.minCardsPerStack*2)return [];let w=[],g=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(b=>{g.has(b)||g.set(b,[]),g.get(b).push(N);});}),g.forEach((N,b)=>{N.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:N.map(k=>k.id),columnId:v,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${b}"`,confidence:.85});});let f=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(N);});}),f.forEach((N,b)=>{N.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(h.forEach(N=>{N.priority&&(T.has(N.priority)||T.set(N.priority,[]),T.get(N.priority).push(N));}),T.forEach((N,b)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";w.push({stack:{title:`${k} ${b} Priority`,cardIds:N.map(C=>C.id),columnId:v,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${b} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let C=[N.id,...k.map(y=>y.card.id)],M=k.reduce((y,A)=>y+A.similarity,0)/k.length;w.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:M});}}return w.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,b)=>b.confidence-N.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(v=>{c(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let w=await u(h),g=w[0];w.length>0&&g&&g.confidence>=.9&&x(g);});},[]),{stacks:n,createStack:c,deleteStack:p,toggleStack:s,addToStack:m,removeFromStack:i,getStacksForColumn:d,getSuggestions:u,applySuggestion:x,config:o}}var qd=react.createContext(null);function Xd({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,l=new Map;t?.columns?.forEach(p=>{let{Column:s}=Zr("@libxai/core");n.set(p.id,new s(p));}),t?.cards?.forEach(p=>{let{Card:s}=Zr("@libxai/core");l.set(p.id,new s(p));});let c=null;if(t?.board){let{Board:p}=Zr("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:n,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(qd.Provider,{value:{store:o},children:e})}function jo(){let e=react.useContext(qd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xr(){let e=jo(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let c=react.useCallback(g=>{e.updateBoard(g);},[e]),p=react.useCallback(g=>{e.addColumn(g);},[e]),s=react.useCallback((g,f)=>{e.updateColumn(g,f);},[e]),m=react.useCallback(g=>{e.deleteColumn(g);},[e]),i=react.useCallback(g=>e.getColumn(g),[e]),d=react.useCallback(g=>{e.addCard(g);},[e]),u=react.useCallback((g,f)=>{e.updateCard(g,f);},[e]),x=react.useCallback(g=>{e.deleteCard(g);},[e]),v=react.useCallback((g,f,T)=>{e.moveCard(g,f,T);},[e]),h=react.useCallback(g=>e.getCard(g),[e]),w=react.useCallback(g=>e.getCardsByColumn(g),[e]);return {board:t,columns:r,cards:n,updateBoard:c,addColumn:p,updateColumn:s,deleteColumn:m,getColumn:i,addCard:d,updateCard:u,deleteCard:x,moveCard:v,getCard:h,getCardsByColumn:w}}function Zd(e){let{cards:t}=Xr();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 Qd(e="position",t="asc"){let{cards:a}=Xr();return react.useMemo(()=>[...a].sort((o,n)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(n.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,s=n.priority?c[n.priority]:0;l=p-s;break}case "createdAt":l=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":l=o.position-n.position;break}return t==="asc"?l:-l}),[a,e,t])}var Ko=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=oi.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let l=n[t];if(typeof l=="function")try{let c=await Promise.resolve(l.apply(n,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,c,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Yf=new Ko;function tc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:l=false,gap:c=0,getItemKey:p}){let s=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:l,gap:c}),i=m.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:d,className:o,children:jsxRuntime.jsx("div",{style:u,children:i.map(x=>{let v=e[x.index];if(!v)return null;let h=p?p(v,x.index):x.index,w={position:"absolute",top:l?0:x.start,left:l?x.start:0,width:l?x.size:"100%",height:l?"100%":x.size};return jsxRuntime.jsx("div",{style:w,"data-index":x.index,children:r(v,x.index)},h)})})})}function ac(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 oc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:l=3,gap:c=16,getItemKey:p,horizontal:s=true}){let m=react.useRef(null),i=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:c}),d=i.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:n,children:jsxRuntime.jsx("div",{style:x,children:d.map(v=>{let h=e[v.index];if(!h)return null;let w=p?p(h,v.index):v.index,g={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:g,"data-index":v.index,children:o(h,v.index)},w)})})})}function nc(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function sc(e,t=10){return e>t}var Fs={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Bs={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Rs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Os={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},$s={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},zs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ws={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Us={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)"},Gs={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)"},Hs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},_s={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}},Vs={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}},Yo={spacing:Fs,borderRadius:Bs,fontSize:Rs,fontWeight:Os,lineHeight:$s,zIndex:zs,duration:Ws,easing:Us,shadows:Gs,opacity:Hs,kanban:_s,gantt:Vs};function ic(e,t,a){return e[t]??a}function js(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?js(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Jf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ks(e="asakaa"){let t=js(Yo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,l=Jf(o);a.push(` ${n}: ${l};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function
|
|
326
|
+
}`}function Jr(e,t="asakaa"){let a=[],r=js(e);for(let[o,n]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${n};`);}return `:root {
|
|
327
327
|
${a.join(`
|
|
328
328
|
`)}
|
|
329
|
-
}`}var
|
|
329
|
+
}`}var qo={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"}},Ys={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"}},qs={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 Xs(e=qo,t="asakaa"){let a=Ks(t),r=Jr(e,t);return `${a}
|
|
330
330
|
|
|
331
|
-
${r}`}function
|
|
331
|
+
${r}`}function lc(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|
|
333
333
|
* Auto-generated from design-tokens.ts
|
|
334
334
|
* Do not edit this file directly
|
|
335
335
|
*/
|
|
336
336
|
|
|
337
|
-
${
|
|
337
|
+
${Xs(qo)}
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${
|
|
341
|
+
${Jr(Ys,"asakaa").split(`
|
|
342
342
|
`).slice(1,-1).join(`
|
|
343
343
|
`)}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/* Neutral theme */
|
|
347
347
|
[data-theme="neutral"] {
|
|
348
|
-
${
|
|
348
|
+
${Jr(qs,"asakaa").split(`
|
|
349
349
|
`).slice(1,-1).join(`
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
|
-
`}var
|
|
353
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=
|
|
352
|
+
`}var 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 dc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=ur();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([l,c])=>{let p=l,s=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${s?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":s,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=Ld;exports.AI_FEATURES=Mf;exports.AI_MODELS=Ss;exports.AddCardButton=fn;exports.AddColumnButton=gn;exports.AttachmentUploader=Fr;exports.BoardProvider=Xd;exports.BulkOperationsToolbar=mo;exports.BurnDownChart=Dn;exports.CalendarBoard=hd;exports.Card=Na;exports.CardDetailModal=xn;exports.CardDetailModalV2=Cn;exports.CardHistoryReplay=Td;exports.CardHistoryTimeline=wd;exports.CardRelationshipsGraph=Sd;exports.CardStack=kf;exports.CardTemplateSelector=Ln;exports.CircuitBreaker=Qo;exports.Column=lr;exports.ColumnManager=vo;exports.CommandPalette=vn;exports.ConfigMenu=On;exports.ContextMenu=br;exports.DEFAULT_SHORTCUTS=Rr;exports.DEFAULT_TEMPLATES=An;exports.DateRangePicker=Nr;exports.DependenciesSelector=Sr;exports.DependencyLine=No;exports.DistributionCharts=Sn;exports.EditableColumnTitle=ln;exports.ErrorBoundary=dr;exports.ExportImportModal=Bn;exports.FilterBar=Rn;exports.GANTT_AI_SYSTEM_PROMPT=Xl;exports.GanttAIAssistant=Io;exports.GanttBoard=ql;exports.GanttI18nContext=fr;exports.GanttMilestone=So;exports.GanttToolbar=ho;exports.GenerateGanttTasksDialog=Rd;exports.GeneratePlanModal=Md;exports.GroupBySelector=Mn;exports.KanbanBoard=La;exports.KanbanToolbar=mn;exports.KanbanViewAdapter=Ar;exports.KeyboardShortcutsHelp=In;exports.ListView=ld;exports.MenuIcons=et;exports.PluginManager=Ko;exports.PrioritySelector=Ha;exports.RATE_LIMITS=Pf;exports.SwimlaneBoardView=En;exports.TaskBar=wo;exports.TaskFormModal=Mo;exports.TaskGrid=ko;exports.ThemeModal=Un;exports.ThemeProvider=ll;exports.ThemeSwitcher=dc;exports.Timeline=Po;exports.UserAssignmentSelector=Va;exports.VelocityChart=Nn;exports.VirtualGrid=oc;exports.VirtualList=tc;exports.aiUsageTracker=Qa;exports.borderRadius=Bs;exports.calculatePosition=eo;exports.calendarDarkTheme=ws;exports.calendarEnTranslations=vs;exports.calendarEsTranslations=ys;exports.calendarLightTheme=Cs;exports.calendarNeutralTheme=Ts;exports.calendarThemes=Go;exports.calendarTranslations=$o;exports.cardToGanttTask=Lo;exports.cardsToGanttTasks=rd;exports.cn=P;exports.createKanbanView=Hi;exports.createRetryWrapper=Bc;exports.darkTheme=$n;exports.darkTokenTheme=qo;exports.defaultTheme=go;exports.designTokens=Yo;exports.duration=Ws;exports.easing=Us;exports.exportTokensToCSS=lc;exports.findTaskByName=Pa;exports.fontSize=Rs;exports.fontWeight=Os;exports.formatCost=Kr;exports.ganttEnTranslations=bo;exports.ganttEsTranslations=cl;exports.ganttTaskToCardUpdate=ad;exports.ganttThemes=Ie;exports.ganttTokens=Vs;exports.ganttTranslations=Gn;exports.ganttUtils=Y;exports.generateCSSVariables=Ks;exports.generateCompleteCSS=Xs;exports.generateInitialPositions=Ic;exports.generateTasksContext=Jl;exports.generateThemeVariables=Jr;exports.getCalendarTheme=vd;exports.getCalendarTranslations=Hr;exports.getListViewTheme=dd;exports.getListViewTranslations=gs;exports.getMonthNames=cd;exports.getToken=ic;exports.getTranslations=pl;exports.getWeekdayNames=pd;exports.kanbanTokens=_s;exports.lightTheme=zn;exports.lightTokenTheme=Ys;exports.lineHeight=$s;exports.listViewDarkTheme=fs;exports.listViewEnTranslations=ms;exports.listViewEsTranslations=us;exports.listViewLightTheme=bs;exports.listViewNeutralTheme=hs;exports.listViewThemes=Oo;exports.listViewTranslations=Fo;exports.mergeCalendarTranslations=zo;exports.mergeListViewTranslations=Bo;exports.mergeTranslations=Hn;exports.neutralTheme=Wn;exports.neutralTokenTheme=qs;exports.opacity=Hs;exports.parseLocalCommand=ed;exports.parseNaturalDate=ds;exports.parseNaturalDuration=cs;exports.parseProgress=ps;exports.parseStatus=Ql;exports.pluginManager=Yf;exports.retrySyncOperation=Fc;exports.retryWithBackoff=to;exports.shadows=Gs;exports.shouldVirtualizeGrid=sc;exports.spacing=Fs;exports.themes=qa;exports.useAI=Vd;exports.useBoard=$d;exports.useBoardCore=Xr;exports.useBoardStore=jo;exports.useCardStacking=Yd;exports.useDragState=cn;exports.useFilteredCards=Zd;exports.useFilters=Ud;exports.useGanttI18n=Or;exports.useKanbanState=Vo;exports.useKeyboardShortcuts=nl;exports.useMultiSelect=jd;exports.useSelectionState=Ms;exports.useSortedCards=Qd;exports.useTheme=ur;exports.useVirtualGrid=nc;exports.useVirtualList=ac;exports.validateAIResponse=td;exports.withErrorBoundary=bn;exports.wouldCreateCircularDependency=ro;exports.zIndex=zs;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|