@libxai/board 0.17.75 → 0.17.77

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 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'),$l=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Rm=require('react-markdown'),Om=require('remark-gfm'),Gm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var $l__default=/*#__PURE__*/_interopDefault($l);var Rm__default=/*#__PURE__*/_interopDefault(Rm);var Om__default=/*#__PURE__*/_interopDefault(Om);var Gm__default=/*#__PURE__*/_interopDefault(Gm);var qr=(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 Xr=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 [Xr.Translate.toString(e),Xr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function L(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Jr(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 kc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Yo(e,t){return e.length===0?1e3:t===0?Jr(null,e[0].position):t>=e.length?Jr(e[e.length-1].position,null):Jr(e[t-1].position,e[t].position)}function Js(e,t=100){return e>t}var wc=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 Cc(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 Zr(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:l=wc,onRetry:m}=t,d,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(s){if(d=s,p===a||!l(d,p))return {error:d,attempts:i,success:false};let u=Cc(p,r,o,n);if(m)try{m(d,p,u);}catch(k){console.error("Error in retry callback:",k);}await new Promise(k=>setTimeout(k,u));}}return {error:d||new Error("Unknown error"),attempts:i,success:false}}function Tc(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 Nc(e,t={}){return async(...a)=>Zr(()=>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 Zs=(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))(Zs||{}),Ua=class Ua{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...l}=t,m=`[${a}] [${r}] [${n}]`,d=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(m,o,d?l:"");break;case "INFO":console.info(m,o,d?l:"");break;case "WARN":console.warn(m,o,d?l:"");break;case "ERROR":console.error(m,o,d?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",...Ua.globalOptions};}static configure(t){Ua.globalOptions={...Ua.globalOptions,...t};}child(t){return new Ua({...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 Qr((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Qr(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Zs[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ua.globalOptions={};var Xo=Ua,Qr=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}},Qs=new Xo;function Sc(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 Ec(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(m=>m.id===n.columnId);return [n.id,Jo(n.title),Jo(n.description||""),Jo(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 Pc(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 $l__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=l.toDataURL("image/png"),d=297,i=210,p=l.width/l.height,s=d-20,c=s/p;c>i-20&&(c=i-20,s=c*p);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,d,15,"F"),u.text(e.title||"Kanban Board",10,10);let k=(d-s)/2;return u.addImage(m,"PNG",k,20,s,c),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 m=e.cards.filter(d=>d.columnId===l.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,n),n+=8,m.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):m.forEach(d=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(d.title,25,n),n+=6,d.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(d.description,160);o.text(p,25,n),n+=p.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let p=[];d.startDate&&p.push(`Start: ${d.startDate}`),d.endDate&&p.push(`End: ${d.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function Jo(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function ti(e,t,a,r){switch(t){case "json":return Sc(e,r);case "csv":return Ec(e);case "pdf":return await Pc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ai(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);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"},m=new Blob([e],{type:l[t]}),d=URL.createObjectURL(m),i=document.createElement("a");i.href=d,i.download=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);}function Mc(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 Ic(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=ri(t[0]),r=[],o=new Map,n=[];for(let l=1;l<t.length;l++)try{let m=ri(t[l]||"");if(m.length>a.length){n.push(`Line ${l+1}: Too many columns`);continue}if(a.length-m.length>3){n.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((u,k)=>{i[u]=m[k]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let s=o.get(p),c={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(c),s.cardIds.push(c.id);}catch(m){n.push(`Line ${l+1}: ${m instanceof Error?m.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 ri(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 oi(e,t){switch(t){case "json":return Mc(e);case "csv":return Ic(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ni(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 Zo=react.createContext(null);function si(){return react.useContext(Zo)}var ii=react.createContext(null);function li({children:e,themeName:t}){return jsxRuntime.jsx(ii.Provider,{value:{themeName:t},children:e})}function or(){return react.useContext(ii)}function Oe({children:e,container:t}){let[a,r]=react.useState(false),o=si(),n=or();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:m,themeName:d}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":d,"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 ui={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},zc="#BDC3C7",Uc=({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 $a({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState({top:0,left:0}),m=react.useRef(null),d=react.useRef(null),i=()=>{if(!d.current)return;let u=d.current.getBoundingClientRect(),k=window.innerHeight,w=window.innerWidth,h=160,y=220,f=4,g=u.right-h;g<10&&(g=u.left),g+h>w-10&&(g=w-h-10);let T=k-u.bottom,N=u.top,b;T>=y+f?b=u.bottom+f:N>=y+f?b=u.top-y-f:b=T>=N?u.bottom+f:Math.max(10,u.top-y-f),l({top:b,left:g}),o(true);};react.useEffect(()=>{let u=k=>{m.current&&!m.current.contains(k.target)&&!d.current?.contains(k.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},s=e?ui[e]:null,c=s?.color||zc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:d,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?`${c}10`:"transparent",boxShadow:e?`0 0 0 2px ${c}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:c,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:c,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsxs("div",{ref:m,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(ui).map(([u,k])=>jsxRuntime.jsxs("button",{onClick:()=>p(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:k.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(Uc,{color:k.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:k.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:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 $c=[{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 Cr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[l,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),c=(or()?.themeName||"dark")==="dark",u=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),T=window.innerHeight,N=window.innerWidth,b=320,x=380,v=4,S=g.left;S+b>N-10&&(S=N-b-10),S<10&&(S=10);let C=T-g.bottom,A=g.top,z;C>=x+v?z=g.bottom+v:A>=x+v?z=g.top-x-v:z=C>=A?g.bottom+v:Math.max(10,g.top-x-v),m({top:z,left:S}),n(true);};react.useEffect(()=>{let g=T=>{d.current&&!d.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 k=g=>{let T=new Date,N=S=>{let C=S.getFullYear(),A=String(S.getMonth()+1).padStart(2,"0"),z=String(S.getDate()).padStart(2,"0");return `${C}-${A}-${z}`},b=N(T),x=new Date(T);x.setDate(x.getDate()+g);let v=N(x);a(b,v),n(false);},w=()=>{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(z=>isNaN(z)))return null;let S=v[0],C=v[1],A=v[2];return S===void 0||C===void 0||A===void 0?null:new Date(S,C-1,A)},T=g(e),N=g(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,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?`${w()}`:"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:w()})]}),o&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsxs("div",{ref:d,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:c?"#1A1D25":"#FFFFFF",border:`1px solid ${c?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:c?"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:c?"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:c?"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:$c.map(g=>jsxRuntime.jsx("button",{onClick:()=>k(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:c?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${c?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=c?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${c?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${c?"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:c?"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:c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:c?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:c?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:c?"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:c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:c?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:c?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:c?"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 Ha({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,l]=react.useState(false),[m,d]=react.useState(""),[i,p]=react.useState({top:0,left:0}),s=react.useRef(null),c=react.useRef(null),u=()=>{if(!c.current)return;let f=c.current.getBoundingClientRect(),g=window.innerHeight,T=window.innerWidth,N=300,b=380,x=4,v=f.right-N;v<10&&(v=f.left),v+N>T-10&&(v=T-N-10);let S=g-f.bottom,C=f.top,A;S>=b+x?A=f.bottom+x:C>=b+x?A=f.top-b-x:A=S>=C?f.bottom+x:Math.max(10,f.top-b-x),p({top:A,left:v}),l(true);};react.useEffect(()=>{let f=g=>{s.current&&!s.current.contains(g.target)&&!c.current?.contains(g.target)&&(l(false),d(""));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=g=>{g.key==="Escape"&&(l(false),d(""));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n]);let k=f=>{let g=e.some(T=>T.id===f.id);a(g?e.filter(T=>T.id!==f.id):[...e,f]);},w=t.filter(f=>f.name.toLowerCase().includes(m.toLowerCase())),h=e.slice(0,o),y=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,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)),y>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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(Oe,{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:m,onChange:f=>d(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:w.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"}):w.map(f=>{let g=e.some(T=>T.id===f.id);return jsxRuntime.jsxs("button",{onClick:()=>k(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 eo(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(p=>{if(typeof p=="string")return p;let s=p;return s.taskId||s.targetId||""}).filter(Boolean);r.set(d.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,l=new Set,m=d=>{if(!n.has(d)){n.add(d),l.add(d);let i=r.get(d)||[];for(let p of i){if(!n.has(p)&&m(p))return true;if(l.has(p))return true}}return l.delete(d),false};return m(a)}function Nr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:l}){let[m,d]=react.useState(false),[i,p]=react.useState(""),[s,c]=react.useState(t.length>0),[u,k]=react.useState({top:0,left:0}),[w,h]=react.useState(null),y=react.useRef(null),f=react.useRef(null),g=()=>{if(!f.current)return;let v=f.current.getBoundingClientRect(),S=window.innerHeight,C=window.innerWidth,A=300,z=s?380:120,P=4,W=v.right-A;W<10&&(W=v.left),W+A>C-10&&(W=C-A-10);let E=S-v.bottom,$=v.top,V;E>=z+P?V=v.bottom+P:$>=z+P?V=v.top-z-P:V=E>=$?v.bottom+P:Math.max(10,v.top-z-P),k({top:V,left:W}),d(true);};react.useEffect(()=>{if(!m||!f.current)return;let v=f.current.getBoundingClientRect(),S=window.innerHeight,C=window.innerWidth,A=300,z=s?380:120,P=4,W=v.right-A;W<10&&(W=v.left),W+A>C-10&&(W=C-A-10);let E=S-v.bottom,$=v.top,V;E>=z+P?V=v.bottom+P:$>=z+P?V=v.top-z-P:V=E>=$?v.bottom+P:Math.max(10,v.top-z-P),k({top:V,left:W});},[s,m]),react.useEffect(()=>{let v=S=>{y.current&&!y.current.contains(S.target)&&!f.current?.contains(S.target)&&(d(false),p(""));};if(m)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[m]),react.useEffect(()=>{let v=S=>{S.key==="Escape"&&(d(false),p(""));};if(m)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[m]);let T=v=>{let S=t.includes(v),C=a.find(A=>A.id===v);if(h(null),S){let A=t.filter(z=>z!==v);r(A),A.length===0&&c(false);}else {if(n&&eo(a,v,e)){let z=`Cannot add "${C?.title||v}" as dependency - would create circular reference`;h(z),l?.(v,C?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),c(true);}},N=()=>{let v=!s;c(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:()=>m?d(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})]}),m&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsxs("div",{ref:y,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:[w&&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:w})]}),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: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=>p(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 S=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: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.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([]),c(false),d(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 wa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:l,availableUsers:m=[],allCards:d=[]})=>{let{attributes:i,listeners:p,setNodeRef:s,transform:c,transition:u,isDragging:k}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:Xr.Transform.toString(c),transition:u};if(t)return jsxRuntime.jsx("div",{ref:s,style:w,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=m.filter(g=>e.assignedUserIds?.includes(g.id)),y=e.progress===100,f={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:s,style:f,className:L("asakaa-card",k&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...i,...p,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:y?"line-through":"none",opacity:y?.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($a,{priority:e.priority,onChange:g=>l?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Cr,{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})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ha,{assignedUsers:h,availableUsers:m,onChange:g=>l?.(e.id,{assignedUserIds:g.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Nr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:d,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));wa.displayName="Card";var to={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Ci=({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 Ti({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[l,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),p=[...Object.entries(to).map(([h,y])=>({id:h,label:y.label,color:y.color,icon:y.icon})),...r.filter(h=>!Object.keys(to).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],s=()=>{let h=to[e];if(h)return {...h,id:e};let y=r.find(f=>f.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...to.todo,id:"todo"}},c=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),y=window.innerHeight,f=window.innerWidth,g=180,T=280,N=4,b=h.right-g;b<10&&(b=h.left),b+g>f-10&&(b=f-g-10);let x=y-h.bottom,v=h.top,S;x>=T+N?S=h.bottom+N:v>=T+N?S=h.top-T-N:S=x>=v?h.bottom+N:Math.max(10,h.top-T-N),m({top:S,left:b}),n(true);};react.useEffect(()=>{let h=y=>{d.current&&!d.current.contains(y.target)&&!i.current?.contains(y.target)&&n(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=y=>{y.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let u=h=>{t(h),n(false);},k=s(),w=k.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?n(false):c(),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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:k.label,children:jsxRuntime.jsx(Ci,{icon:k.icon,color:w})}),o&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsxs("div",{ref:d,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:p.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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ci,{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 Ni({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,l]=react.useState(false),[m,d]=react.useState(false),[i,p]=react.useState(e),[s,c]=react.useState({top:0,left:0}),u=react.useRef(null),k=react.useRef(null),w=react.useRef(null);react.useEffect(()=>{if(n&&k.current){let g=k.current.getBoundingClientRect();c({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[n]),react.useEffect(()=>{let g=T=>{u.current&&!u.current.contains(T.target)&&!k.current?.contains(T.target)&&(l(false),d(false));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=T=>{T.key==="Escape"&&(l(false),d(false),p(e));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n,e]),react.useEffect(()=>{m&&w.current&&(w.current.focus(),w.current.select());},[m]);let h=()=>{d(true),p(e);},y=()=>{let g=i.trim();g&&g!==e&&t(g),d(false),l(false),p(e);},f=g=>{g.key==="Enter"?y():g.key==="Escape"&&(d(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:k,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(Oe,{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:m?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:w,type:"text",value:i,onChange:g=>p(g.target.value),onKeyDown:f,onBlur:y,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 ir=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:l,onCardUpdate:m,availableUsers:d,allCards:i,enableVirtualization:p,cardHeight:s=120,isCollapsed:c,onToggleCollapse:u,onColumnRename:k,onColumnDelete:w,isDeletable:h=false,className:y})=>{let{setNodeRef:f,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),N=p??Js(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>s,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:f,className:y,children:a(e,t)});let v=(()=>{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}})(),S=v.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:f,className:L("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",S&&"ring-2 ring-asakaa-accent-red",y),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:L(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"})]})]}),(k||w)&&jsxRuntime.jsx(Ni,{columnTitle:e.title,onRename:A=>k?.(e.id,A),onDelete:w?()=>w(e.id):void 0,isDeletable:h}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":c?"Expand column":"Collapse column",children:c?"\u25B6":"\u25BC"})]})]}),!c&&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 z=t[A.index];return z?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${A.start}px)`},children:jsxRuntime.jsx(wa,{card:z,render:r,onClick:l,onUpdate:m,availableUsers:d,allCards:i})},z.id):null})}):t.map(A=>jsxRuntime.jsx(wa,{card:A,render:r,onClick:l,onUpdate:m,availableUsers:d,allCards:i},A.id))})})]})});ir.displayName="Column";function rn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let d=()=>{let p=n.trim();p&&p!==e?t(p):l(e),o(false);},i=p=>{p.key==="Enter"?d():p.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:n,onChange:p=>l(p.target.value),onBlur:d,onKeyDown:i,className:L("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:L("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function nn(){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 Aa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:l,style:m,isLoading:d,error:i,children:p}){let[s,c]=nn(),u=o?.theme||"dark",w=u==="dark"||u==="neutral"?"dark":"",h=react.useCallback((C,A)=>{t.onCardUpdate?.(C,A);},[t]),y=react.useCallback((C,A)=>{t.onColumnUpdate?.(C,{title:A});},[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})),N=react.useMemo(()=>{let C=new Map;return e.columns.forEach(A=>{let z=A.cardIds.map(P=>e.cards.find(W=>W.id===P)).filter(P=>P!==void 0).sort((P,W)=>P.position-W.position);C.set(A.id,z);}),C},[e.cards,e.columns]),b=react.useCallback(C=>{let{active:A}=C,z=e.cards.find(P=>P.id===A.id);z&&c({isDragging:true,draggedCardId:z.id,sourceColumnId:z.columnId,targetColumnId:z.columnId});},[e.cards,c]),x=react.useCallback(C=>{let{active:A,over:z}=C;if(!z||!e.cards.find(E=>E.id===A.id))return;let W=null;z.data.current?.type==="column"?W=z.id:z.data.current?.type==="card"&&(W=e.cards.find($=>$.id===z.id)?.columnId||null),W&&W!==s.targetColumnId&&c({...s,targetColumnId:W});},[e.cards,s,c]),v=react.useCallback(async C=>{let{active:A,over:z}=C;if(c({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!z)return;let P=e.cards.find(V=>V.id===A.id);if(!P)return;let W,E;if(z.data.current?.type==="column"){W=z.id;let V=N.get(W)||[];E=Yo(V,0);}else {let V=e.cards.find(Y=>Y.id===z.id);if(!V)return;W=V.columnId;let re=N.get(W)||[],se=re.findIndex(Y=>Y.id===z.id);E=Yo(re,se);}let $=e.columns.find(V=>V.id===W);if($&&$.wipLimit&&$.wipLimitType==="hard"){let V=N.get(W)||[];if(P.columnId!==W&&V.length>=$.wipLimit){t.onWipLimitExceeded?.($,P);return}}(P.columnId!==W||P.position!==E)&&await t.onCardMove?.(P.id,W,E);},[e.cards,e.columns,N,t,c]),S=react.useCallback(C=>{a?.(C);},[a]);return d?jsxRuntime.jsx("div",{className:L("asakaa-board",w,l),style:m,children:jsxRuntime.jsx(mm,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:L("asakaa-board",w,l),style:m,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(li,{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:L("asakaa-board",w,l),style:m,"data-theme":u,children:[e.columns.sort((C,A)=>C.position-A.position).map(C=>{let A=N.get(C.id)||[],z=!g.includes(C.id);return jsxRuntime.jsx(ir,{column:C,cards:A,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:S,onCardUpdate:h,onColumnRename:y,onColumnDelete:f,isDeletable:z,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:s.draggedCardId?jsxRuntime.jsx(wa,{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 mm({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 bm={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)"},hm={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)"},vm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},ym={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function xm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,l]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let i=p=>{m.current&&!m.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]);let d=i=>{t(i),l(false);};return jsxRuntime.jsxs("div",{ref:m,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,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function km({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,l]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let u=k=>{i.current&&!i.current.contains(k.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),c=async(u,k)=>{if(k){d(u);try{await k();}catch(w){console.error(`Export ${u} failed:`,w);}finally{d(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,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(u.id,u.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<s.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===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 wm({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 ln({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:l,onExportJSON:m,onExportExcel:d,translations:i}){let p=r==="dark"?bm:hm,s={...o==="es"?vm:ym,...i},c=l||m||d;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(km,{theme:p,t:s,onExportCSV:l,onExportJSON:m,onExportExcel:d}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(n?jsxRuntime.jsx(xm,{columns:e,onSelect:t,theme:p,t:s,createTaskLabel:a}):jsxRuntime.jsx(wm,{onClick:()=>t(),label:a||s.newTask}))]})})}function cn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,l]=react.useState(false),[m,d]=react.useState(""),i=react.useCallback(()=>{let c=m.trim();c&&(e(c),d(""),l(false));},[m,e]),p=react.useCallback(c=>{c.key==="Enter"?(c.preventDefault(),i()):c.key==="Escape"&&(d(""),l(false));},[i]),s=react.useCallback(()=>{setTimeout(()=>{m.trim()||l(false);},150);},[m]);return n?jsxRuntime.jsx("div",{className:L("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:m,onChange:c=>d(c.target.value),onKeyDown:p,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:!m.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:()=>{d(""),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:L("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 mn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:l=false,theme:m="dark",locale:d="es"}){let[i,p]=react.useState(false),[s,c]=react.useState(false),[u,k]=react.useState(""),[w,h]=react.useState([]),[y,f]=react.useState(""),[g,T]=react.useState(""),[N,b]=react.useState(""),[x,v]=react.useState(false),[S,C]=react.useState(false),[A,z]=react.useState(false),P=react.useRef(null),W=react.useRef(null),E={placeholder:o||(d==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(d==="es"?"Agregar Tarea":"Add Task"),save:d==="es"?"Guardar":"Save",addAssignee:d==="es"?"Agregar asignado":"Add assignee",addDates:d==="es"?"Agregar fechas":"Add dates",addPriority:d==="es"?"Agregar prioridad":"Add priority",startDate:d==="es"?"Inicio":"Start",endDate:d==="es"?"Fin":"End",low:d==="es"?"Baja":"Low",medium:d==="es"?"Media":"Medium",high:d==="es"?"Alta":"High",urgent:d==="es"?"Urgente":"Urgent"},$=react.useCallback(()=>{k(""),h([]),f(""),T(""),b(""),v(false),C(false),z(false),p(false);},[]);react.useEffect(()=>{i&&P.current&&P.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let R=O=>{W.current&&!W.current.contains(O.target)&&(u.trim()||$());};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[i,u,$]);let V=react.useCallback(async()=>{let R=u.trim();if(!(!R||s)){c(true);try{await t({name:R,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:y?new Date(y):void 0,endDate:g?new Date(g):void 0,priority:N||void 0}),k(""),h([]),f(""),T(""),b(""),v(!1),C(!1),z(!1),P.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{c(false);}}},[u,e,w,y,g,N,t,s]),re=react.useCallback(R=>{R.key==="Enter"&&!R.shiftKey?(R.preventDefault(),V()):R.key==="Escape"&&$();},[V,$]),se=react.useCallback(R=>{h(O=>O.includes(R)?O.filter(M=>M!==R):[...O,R]);},[]),Y=m==="dark";return i?jsxRuntime.jsxs("div",{ref:W,className:L("rounded-lg overflow-hidden shadow-lg",Y?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:P,type:"text",value:u,onChange:R=>k(R.target.value),onKeyDown:re,placeholder:E.placeholder,disabled:s,className:L("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Y?"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:L("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||w.length>0?"bg-emerald-500/20 text-emerald-400":Y?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.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"})]}),w.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:w.length})]}),jsxRuntime.jsx("button",{onClick:()=>C(!S),className:L("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",S||y||g?"bg-blue-500/20 text-blue-400":Y?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>z(!A),className:L("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":Y?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.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:V,disabled:!u.trim()||s,className:L("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"}):E.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:L("px-3 pb-3 pt-0","border-t",Y?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(R=>jsxRuntime.jsxs("button",{onClick:()=>se(R.id),className:L("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(R.id)?"bg-emerald-500 text-white":Y?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[R.avatar?jsxRuntime.jsx("img",{src:R.avatar,alt:R.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:L("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(R.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:R.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:R.name.split(" ")[0]})]},R.id))})}),S&&jsxRuntime.jsx("div",{className:L("px-3 pb-3 pt-0","border-t",Y?"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:L("block text-[10px] uppercase tracking-wide mb-1",Y?"text-gray-500":"text-gray-400"),children:E.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:R=>f(R.target.value),className:L("w-full px-2 py-1.5 rounded text-xs border",Y?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("block text-[10px] uppercase tracking-wide mb-1",Y?"text-gray-500":"text-gray-400"),children:E.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:R=>T(R.target.value),className:L("w-full px-2 py-1.5 rounded text-xs border",Y?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),A&&jsxRuntime.jsx("div",{className:L("px-3 pb-3 pt-0","border-t",Y?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(R=>jsxRuntime.jsx("button",{onClick:()=>b(N===R?"":R),className:L("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===R?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[R]} text-white`:Y?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:E[R]},R))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:l,className:L("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Y?"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:E.buttonLabel})]})}var Mr=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(Aa,{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 Mr(e)}var lr=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 pn(e,t){let a=r=>jsxRuntime.jsx(lr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function gn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:l,onPredictRisks:m,onOpenAIUsage:d,shortcut:i="k",className:p=""}){let[s,c]=react.useState(false),[u,k]=react.useState(""),[w,h]=react.useState("home"),[y,f]=react.useState(""),[g,T]=react.useState("");react.useEffect(()=>{let v=S=>{(S.metaKey||S.ctrlKey)&&S.key===i&&(S.preventDefault(),c(C=>!C)),S.key==="Escape"&&(c(false),h("home"),k(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{s||(h("home"),k(""),f(""),T(""));},[s]);let N=react.useCallback(()=>{c(false);},[]),b=react.useCallback(v=>{let[S,C]=v.split(":");switch(S){case "create-card":h("create-card");break;case "create-card-in":f(C||"");break;case "navigate":C?(a?.(C),N()):h("navigate");break;case "search":r?.(u),N();break;case "priority":h("priority");break;case "set-priority":g&&C&&(o?.(g,C),N());break;case "assign":h("assign");break;case "assign-user":g&&C&&(n?.(g,C),N());break;case "ai":h("ai");break;case "ai-generate-plan":l?.(),N();break;case "ai-predict-risks":m?.(),N();break;case "ai-usage":d?.(),N();break;case "back":h("home");break;}},[u,g,t,a,r,o,n,l,m,d,N]),x=react.useCallback(()=>{y&&u.trim()&&(t?.(y,u.trim()),N());},[y,u,t,N]);return s?jsxRuntime.jsx(Oe,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:k,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:w==="create-card"&&y?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&w==="create-card"&&y&&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."}),w==="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(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},v.id))})]}),w==="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))})]}),w==="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 S=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:S?.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)})})]}),w==="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 Pm(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 Mm(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 Im(e){return e.startsWith("image/")}function Ar({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[l,m]=react.useState(false),[d,i]=react.useState(false),[p,s]=react.useState(null),c=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(S=>{if(S.size/1048576>r){v.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(A=>S.type.match(A))){v.push(`${S.name} has invalid file type`);return}x.push(S);}),{valid:x,errors:v})},[e.length,n,r,o]),k=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(S){s(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>s(null),5e3);}finally{i(false);}}},[u,t]),w=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(true);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);},[]),y=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),f=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);let x=Array.from(b.dataTransfer.files);k(x);},[k]),g=react.useCallback(b=>{let x=b.target.files?Array.from(b.target.files):[];k(x),c.current&&(c.current.value="");},[k]),T=react.useCallback(()=>{c.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":""} ${d?"uploading":""}`,onDragEnter:w,onDragLeave:h,onDragOver:y,onDrop:f,onClick:T,children:[jsxRuntime.jsx("input",{ref:c,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:d?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"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Im(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:Mm(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:Pm(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 bn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:m=[],aiInsights:d=[],attachments:i=[],onAddComment:p,onDeleteComment:s,onUploadAttachments:c,onDeleteAttachment:u,onSuggestAssignee:k,onGenerateSubtasks:w,onEstimateEffort:h,currentUserId:y="user-1"}){let[f,g]=react.useState("details"),[T,N]=react.useState(false),[b,x]=react.useState({}),[v,S]=react.useState(""),[C,A]=react.useState(false),[z,P]=react.useState({});if(!t||!e)return null;let W=react.useCallback(()=>{N(false),x({}),g("details"),S(""),P({}),a();},[a]),E=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),x({}),N(false));},[e.id,b,r]),$=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),W());},[e.id,o,W]),V=react.useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),S(""));},[e.id,v,p]),re=react.useCallback(async()=>{if(k){A(true);try{let M=await k(e);P(ge=>({...ge,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{A(false);}}},[e,k]),se=react.useCallback(async()=>{if(w){A(true);try{let M=await w(e);P(ge=>({...ge,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{A(false);}}},[e,w]),Y=react.useCallback(async()=>{if(h){A(true);try{let M=await h(e);P(ge=>({...ge,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{A(false);}}},[e,h]),R={...e,...b},O=n.filter(M=>R.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Oe,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:W,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:R.priority==="URGENT"?"#EF4444":R.priority==="HIGH"?"#F59E0B":R.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:b.title??R.title,onChange:M=>x({...b,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:R.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),x({});},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:$,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:W,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",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.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??R.description??"",onChange:M=>x({...b,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:R.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??R.assignedUserIds??[],onChange:M=>{let ge=Array.from(M.target.selectedOptions,te=>te.value);x({...b,assignedUserIds:ge});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.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??R.priority??"",onChange:M=>x({...b,priority:M.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:R.priority==="URGENT"?"#EF4444":R.priority==="HIGH"?"#F59E0B":R.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:R.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:R.labels&&R.labels.length>0?R.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):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]:R.startDate?new Date(R.startDate).toISOString().split("T")[0]:"",onChange:M=>x({...b,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:R.startDate?new Date(R.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]:R.endDate?new Date(R.endDate).toISOString().split("T")[0]:"",onChange:M=>x({...b,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:R.endDate?new Date(R.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??R.estimatedTime??"",onChange:M=>x({...b,estimatedTime:M.target.value?parseFloat(M.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:R.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:R.dependencies&&R.dependencies.length>0?R.dependencies.map(M=>{let ge=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ge.slice(-4)]},ge)}):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:R.createdAt?new Date(R.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:M=>S(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:V,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(M=>{let ge=n.find(te=>te.id===M.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:[ge&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ge.color},children:ge.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ge?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),s&&jsxRuntime.jsx("button",{onClick:()=>s(M.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:M.content})]},M.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:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(M=>{let ge=n.find(te=>te.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:ge?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.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(Ar,{cardId:e.id,attachments:i,onUpload:c?M=>c(e.id,M):void 0,onDelete:u,currentUserId:y,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:re,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("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:se,disabled:C||!w,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Y,disabled: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"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((M,ge)=>{let te=n.find(Le=>Le.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[te&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:te?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},ge)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((M,ge)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},ge))]}),z.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&d.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 Lr({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:l=""}){let[m,d]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let s=e.current.getBoundingClientRect(),c=window.innerHeight,u=window.innerWidth,k=4,w=s.left;w+o>u-10&&(w=u-o-10),w<10&&(w=10);let h=c-s.bottom,y=s.top,f;return h>=n+k?f=s.bottom+k:y>=n+k?f=s.top-n-k:h>=y?f=s.bottom+k:f=Math.max(10,s.top-n-k),{top:f,left:w}},[e,o,n]);return react.useEffect(()=>{t&&d(p());},[t,p]),react.useEffect(()=>{if(!t)return;let s=u=>{let k=u.target;i.current&&!i.current.contains(k)&&e.current&&!e.current.contains(k)&&a();},c=setTimeout(()=>{document.addEventListener("mousedown",s);},0);return ()=>{clearTimeout(c),document.removeEventListener("mousedown",s);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let s=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),a());};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,a]),t?jsxRuntime.jsx(Oe,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${l}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.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 zm=["LOW","MEDIUM","HIGH","URGENT"],Um=["todo","in-progress","review","done"];function yn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:m=[],onAddComment:d,onDeleteComment:i,currentUser:p,onAIGenerateDescription:s,onAICreateSubtasks:c,onAIFindSimilar:u,availableColumns:k=[],availableLabels:w=[],onUploadCoverImage:h,unsplashAccessKey:y,theme:f,onSubtasksChange:g}){let T=or(),N=f||T?.themeName||"dark",[b,x]=react.useState(e),[v,S]=react.useState(false),[C,A]=react.useState(e?.subtasks||[]),[z,P]=react.useState(false),[W,E]=react.useState(""),[$,V]=react.useState(""),[re,se]=react.useState("all"),[Y,R]=react.useState(false),[O,M]=react.useState(false),[ge,te]=react.useState(false),[Le,Re]=react.useState(false),[tt,ve]=react.useState(false),[at,Bt]=react.useState(false),xt=react.useRef(null),xa=react.useRef(null),Xt=react.useRef(null),ua=react.useRef(null),jt=react.useRef(null),Et=react.useRef(null),Jt=react.useRef(null),ht=react.useRef(null),je=react.useRef(null),Ut=react.useRef(null),It=react.useRef(null),Sa=react.useRef(null);react.useEffect(()=>{e&&!b?(x({...e}),A(e.subtasks||[])):e&&b&&e.id!==b.id&&(x({...e}),A(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let I=J=>{let Ce=J.target;ua.current&&!ua.current.contains(Ce)&&R(false),jt.current&&!jt.current.contains(Ce)&&M(false),Et.current&&!Et.current.contains(Ce)&&te(false),Jt.current&&!Jt.current.contains(Ce)&&Re(false);};if(Y||O||ge||Le)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[Y,O,ge,Le]),react.useEffect(()=>{if(!t)return;let I=J=>{let Ce=J.target,lt=Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.isContentEditable;if(J.key==="Escape"){J.preventDefault(),Y||O||ge||Le||tt||at?(R(false),M(false),te(false),Re(false),ve(false),Bt(false)):lt||a();return}if(lt&&J.key!=="Escape")return;let ce=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),R(true);break;case "a":J.preventDefault(),te(true);break;case "p":J.preventDefault(),M(true);break;case "l":J.preventDefault(),Re(true);break;case "d":ce||(J.preventDefault(),ve(true),setTimeout(()=>ht.current?.focus(),0));break;case "e":ce||(J.preventDefault(),Bt(true));break;case "i":J.preventDefault(),S(true),setTimeout(()=>xa.current?.focus(),0);break;case "t":J.preventDefault(),P(true);break;case "c":J.preventDefault(),Xt.current?.focus();break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,a,Y,O,ge,Le,tt,at]);let ie=react.useCallback(I=>{let J=I.currentTarget.textContent?.trim()||"";if(b&&J!==b.title){let Ce={...b,title:J};x(Ce),r?.(b.id,{title:J});}},[b,r]),be=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]),Zt=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),S(false);},[b,e,r]),kt=react.useCallback(I=>{if(b){let J={...b,columnId:I};x(J),r?.(b.id,{columnId:I}),R(false);}},[b,r]),Qt=react.useCallback(I=>{if(b){let J={...b,priority:I};x(J),r?.(b.id,{priority:I}),M(false);}},[b,r]),ga=react.useCallback(I=>{if(b){let J=b.assignedUserIds||[],Ce=J.includes(I)?J.filter(ce=>ce!==I):[...J,I],lt={...b,assignedUserIds:Ce};x(lt),r?.(b.id,{assignedUserIds:Ce});}},[b,r]),ke=react.useCallback(I=>{if(b){let J=b.labels||[],Ce=J.includes(I)?J.filter(ce=>ce!==I):[...J,I],lt={...b,labels:Ce};x(lt),r?.(b.id,{labels:Ce});}},[b,r]),ye=react.useCallback(I=>{if(b){let J=I.target.value,Ce={...b,endDate:J};x(Ce),r?.(b.id,{endDate:J}),ve(false);}},[b,r]),Ea=react.useCallback(I=>{if(b){let J={...b,estimatedTime:parseFloat(I)||0};x(J),r?.(b.id,{estimatedTime:parseFloat(I)||0});}},[b,r]),j=react.useCallback(()=>{if(W.trim()&&b){let I={id:`subtask-${Date.now()}`,title:W.trim(),completed:false,createdAt:new Date},J=[...C,I];A(J),E(""),P(false),g?.(b.id,J);}},[W,C,b,g]),Se=react.useCallback(I=>{let J=C.map(Ce=>Ce.id===I?{...Ce,completed:!Ce.completed,updatedAt:new Date}:Ce);A(J),b&&g?.(b.id,J);},[C,b,g]),de=react.useCallback(I=>{let J=C.filter(Ce=>Ce.id!==I);A(J),b&&g?.(b.id,J);},[C,b,g]),B=react.useCallback(()=>{$.trim()&&b&&d&&(d(b.id,$.trim()),V(""));},[$,b,d]),H=react.useCallback(I=>{(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&(I.preventDefault(),B());},[B]),me=I=>jsxRuntime.jsx(Rm__default.default,{remarkPlugins:[Om__default.default],rehypePlugins:[Gm__default.default],components:{a:({node:J,...Ce})=>jsxRuntime.jsx("a",{...Ce,target:"_blank",rel:"noopener noreferrer"})},children:I}),le=m.filter(I=>re==="comments"?I.type.includes("COMMENT"):re==="history"?!I.type.includes("COMMENT"):true);if(!t||!e)return null;let K=b||e,we=n.filter(I=>K.assignedUserIds?.includes(I.id)),X=C.filter(I=>I.completed).length;return jsxRuntime.jsx(Oe,{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":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:xt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ie,onKeyDown:be,children:K.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:ua,children:[jsxRuntime.jsxs("button",{ref:je,className:"modal-v2-field",onClick:()=>R(!Y),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("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:K.columnId||"No status"})]}),jsxRuntime.jsx(Lr,{triggerRef:je,isOpen:Y,onClose:()=>R(false),width:250,estimatedHeight:200,children:(k.length>0?k:Um.map(I=>({id:I,title:I}))).map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${K.columnId===I.id?"active":""}`,onClick:()=>kt(I.id),children:I.title},I.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Et,children:[jsxRuntime.jsxs("button",{ref:Ut,className:"modal-v2-field",onClick:()=>te(!ge),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:we.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:we.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(Lr,{triggerRef:Ut,isOpen:ge,onClose:()=>te(false),width:280,estimatedHeight:300,children:n.map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${K.assignedUserIds?.includes(I.id)?"active":""}`,onClick:()=>ga(I.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:I.color},children:I.initials}),I.name,K.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:jt,children:[jsxRuntime.jsxs("button",{ref:It,className:"modal-v2-field",onClick:()=>M(!O),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:K.priority||"None"})]}),jsxRuntime.jsxs(Lr,{triggerRef:It,isOpen:O,onClose:()=>M(false),width:180,estimatedHeight:220,children:[zm.map(I=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${I.toLowerCase()} ${K.priority===I?"active":""}`,onClick:()=>Qt(I),children:I},I)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Qt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Jt,children:[jsxRuntime.jsxs("button",{ref:Sa,className:"modal-v2-field",onClick:()=>Re(!Le),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:K.labels&&K.labels.length>0?jsxRuntime.jsx("span",{children:K.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lr,{triggerRef:Sa,isOpen:Le,onClose:()=>Re(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(I=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${K.labels?.includes(I)?"active":""}`,onClick:()=>ke(I),children:[I,K.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:()=>{ve(!tt),setTimeout(()=>ht.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:K.endDate?new Date(K.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ht,type:"date",value:typeof K.endDate=="string"?K.endDate.split("T")[0]:K.endDate?(()=>{let I=new Date(K.endDate),J=I.getUTCFullYear(),Ce=String(I.getUTCMonth()+1).padStart(2,"0"),lt=String(I.getUTCDate()).padStart(2,"0");return `${J}-${Ce}-${lt}`})():"",onChange:ye,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Bt(!at),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:K.estimatedTime?`${K.estimatedTime}h`:"Not set"})]}),at&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:K.estimatedTime||"",onChange:I=>Ea(I.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Bt(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:K.description||"",onChange:I=>{if(b){let J={...b,description:I.target.value};x(J);}},onBlur:Zt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>S(true),children:K.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:me(K.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:[X,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>P(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:()=>Se(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:()=>de(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)),z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:W,onChange:I=>E(I.target.value),onKeyDown:I=>{I.key==="Enter"&&j(),I.key==="Escape"&&(P(false),E(""));},onBlur:j,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 ${re==="all"?"active":""}`,onClick:()=>se("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${re==="comments"?"active":""}`,onClick:()=>se("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${re==="history"?"active":""}`,onClick:()=>se("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Xt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:$,onChange:I=>V(I.target.value),onKeyDown:H,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:B,disabled:!$.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[le.map(I=>{let J=n.find(lt=>lt.id===I.userId);if(I.type.includes("COMMENT")){let lt=l.find(ce=>ce.id===I.metadata?.commentId);return lt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[J&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:J?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:lt.content})]})]},I.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:J?.name||"Unknown"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)}),le.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 qm({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 kn({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((m,d)=>m+d.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(qm,{})}),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,m)=>l+m.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,m)=>l+m.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,m)=>l+(m.planned||0),0)})]})]})]})}function op({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 wn({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,m=e[e.length-1]?.ideal||0,d=n>0?(n-l)/n*100:0,i=l<=m;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(op,{})}),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:d>=50?"#10B981":"#F59E0B"},children:[d.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 up={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Yi=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function gp({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let l=r+(o-r)*.5,m=e+l*Math.cos(-a*(Math.PI/180)),d=t+l*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:m,y:d,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function qi({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 Cn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((d,i)=>d+i.value,0),l=e.map(d=>({...d,totalValue:n,color:d.color||up[d.name]||Yi[e.indexOf(d)%Yi.length]})),m=l.map(d=>d.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?gp:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(qi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let p=i.payload,s=n>0?(p.value/n*100).toFixed(0):"0";return `${d} (${p.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(qi,{})}),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((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var lo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[l,m]=react.useState(false),[d,i]=react.useState(false),[p,s]=react.useState(false),[c,u]=react.useState(false);if(e.length===0)return null;let k=e.map(T=>T.id),w=T=>{r.onBulkUpdate?.(k,{priority:T}),m(false);},h=T=>{r.onBulkMove?.(k,T),i(false),a();},y=T=>{r.onBulkUpdate?.(k,{assignedUserIds:T}),s(false);},f=T=>{let N=new Set;e.forEach(x=>{x.labels?.forEach(v=>N.add(v));});let b=Array.from(new Set([...N,...T]));r.onBulkUpdate?.(k,{labels:b}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(k),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:()=>m(!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:()=>w(T),children:[jsxRuntime.jsx("span",{className:L("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(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&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(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([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(!c),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),c&&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"})})]})]})})});lo.displayName="BulkOperationsToolbar";function yp(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,l,m,d,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let k=a?.find(w=>w.id===u);l=`assignee-${u}`,m=k?.name||`User ${u}`,d=k?.color,i=k?.avatar,r.has(l)||r.set(l,{id:l,title:m,groupValue:u,cardIds:[],color:d,icon:i}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",m="Unassigned",d="#6b7280",i="\u{1F464}",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:d,icon:i}),r.get(l).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",l=`priority-${n}`;let c={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];m=c.title,d=c.color,r.has(l)||r.set(l,{id:l,title:m,groupValue:n,cardIds:[],color:d}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,m=u,d="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:u,cardIds:[],color:d}),r.get(l).cardIds.push(o.id);}):(l="label-none",m="No Labels",d="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:d}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Tn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,l]=react.useState(new Set),m=react.useMemo(()=>yp(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),d=react.useCallback(i=>{l(p=>{let s=new Set(p);return s.has(i)?s.delete(i):s.add(i),s});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Aa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:L("asakaa-swimlane-view",o),children:[m.map(i=>{let p=n.has(i.id),s=e.cards.filter(u=>i.cardIds.includes(u.id)),c={...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&&d(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Aa,{board:c,callbacks:r,availableUsers:a})})]},i.id)}),m.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 Nn=[{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 Dn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null),m=Nn.find(i=>i.value===e)||Nn[0];react.useEffect(()=>{function i(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:L("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:L("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:Nn.map(i=>jsxRuntime.jsxs("button",{onClick:()=>d(i.value),className:L("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 Fr=[{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 wp(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,m=o.alt?e.altKey:!e.altKey,d=o.meta?e.metaKey:true;return n&&l&&m&&d}function el(e={}){let{shortcuts:t=Fr,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(d=>{o.current=[...o.current,d];},[]),m=react.useCallback(d=>{o.current=o.current.filter(i=>i.action!==d);},[]);return react.useEffect(()=>{function d(i){if(!n.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let s of o.current)if(wp(i,s)){r&&i.preventDefault();let c=new CustomEvent("keyboard-action",{detail:s.action,bubbles:true,cancelable:true});window.dispatchEvent(c);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:l,unregisterShortcut:m,isEnabled:a}}function Tp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Np(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 Dp(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Np(e),r=t?Tp(t):"";return a?`${a} + ${r}`:r}function Sp(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 Sn({shortcuts:e=Fr,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function m(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let l=Sp(e);return jsxRuntime.jsxs("div",{className:L("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(([m,d])=>d.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"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:d.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:Dp(i)})]},i.action))})]},m))})}),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 En=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
1
+ 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),jl=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Gm=require('react-markdown'),Um=require('remark-gfm'),Hm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var jl__default=/*#__PURE__*/_interopDefault(jl);var Gm__default=/*#__PURE__*/_interopDefault(Gm);var Um__default=/*#__PURE__*/_interopDefault(Um);var Hm__default=/*#__PURE__*/_interopDefault(Hm);var Jr=(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 Zr=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 [Zr.Translate.toString(e),Zr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function L(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Qr(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 Nc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Xo(e,t){return e.length===0?1e3:t===0?Qr(null,e[0].position):t>=e.length?Qr(e[e.length-1].position,null):Qr(e[t-1].position,e[t].position)}function Qs(e,t=100){return e>t}var Sc=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 Ec(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 eo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:l=Sc,onRetry:m}=t,d,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(s){if(d=s,p===a||!l(d,p))return {error:d,attempts:i,success:false};let u=Ec(p,r,o,n);if(m)try{m(d,p,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:d||new Error("Unknown error"),attempts:i,success:false}}function Pc(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 Mc(e,t={}){return async(...a)=>eo(()=>e(...a),t)}var Jo=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 ei=(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))(ei||{}),Ua=class Ua{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...l}=t,m=`[${a}] [${r}] [${n}]`,d=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(m,o,d?l:"");break;case "INFO":console.info(m,o,d?l:"");break;case "WARN":console.warn(m,o,d?l:"");break;case "ERROR":console.error(m,o,d?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",...Ua.globalOptions};}static configure(t){Ua.globalOptions={...Ua.globalOptions,...t};}child(t){return new Ua({...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 to((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new to(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ei[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ua.globalOptions={};var Zo=Ua,to=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}},ti=new Zo;function Ac(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 Lc(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(m=>m.id===n.columnId);return [n.id,Qo(n.title),Qo(n.description||""),Qo(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 Fc(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 jl__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=l.toDataURL("image/png"),d=297,i=210,p=l.width/l.height,s=d-20,c=s/p;c>i-20&&(c=i-20,s=c*p);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,d,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(d-s)/2;return u.addImage(m,"PNG",v,20,s,c),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 m=e.cards.filter(d=>d.columnId===l.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,n),n+=8,m.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):m.forEach(d=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(d.title,25,n),n+=6,d.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(d.description,160);o.text(p,25,n),n+=p.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let p=[];d.startDate&&p.push(`Start: ${d.startDate}`),d.endDate&&p.push(`End: ${d.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function Qo(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function ri(e,t,a,r){switch(t){case "json":return Ac(e,r);case "csv":return Lc(e);case "pdf":return await Fc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function oi(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);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"},m=new Blob([e],{type:l[t]}),d=URL.createObjectURL(m),i=document.createElement("a");i.href=d,i.download=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);}function Bc(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 Rc(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=ni(t[0]),r=[],o=new Map,n=[];for(let l=1;l<t.length;l++)try{let m=ni(t[l]||"");if(m.length>a.length){n.push(`Line ${l+1}: Too many columns`);continue}if(a.length-m.length>3){n.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((u,v)=>{i[u]=m[v]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let s=o.get(p),c={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(c),s.cardIds.push(c.id);}catch(m){n.push(`Line ${l+1}: ${m instanceof Error?m.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 ni(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 si(e,t){switch(t){case "json":return Bc(e);case "csv":return Rc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ii(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 li(){return react.useContext(en)}var di=react.createContext(null);function ci({children:e,themeName:t}){return jsxRuntime.jsx(di.Provider,{value:{themeName:t},children:e})}function nr(){return react.useContext(di)}function Re({children:e,container:t}){let[a,r]=react.useState(false),o=li(),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:m,themeName:d}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":d,"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 fi={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}),m=react.useRef(null),d=react.useRef(null),i=()=>{if(!d.current)return;let u=d.current.getBoundingClientRect(),v=window.innerHeight,k=window.innerWidth,h=160,w=220,g=4,f=u.right-h;f<10&&(f=u.left),f+h>k-10&&(f=k-h-10);let D=v-u.bottom,T=u.top,b;D>=w+g?b=u.bottom+g:T>=w+g?b=u.top-w-g:b=D>=T?u.bottom+g:Math.max(10,u.top-w-g),l({top:b,left:f}),o(true);};react.useEffect(()=>{let u=v=>{m.current&&!m.current.contains(v.target)&&!d.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},s=e?fi[e]:null,c=s?.color||_c;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:d,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?`${c}10`:"transparent",boxShadow:e?`0 0 0 2px ${c}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:c,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:c,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Re,{children:jsxRuntime.jsxs("div",{ref:m,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(fi).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>p(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter: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:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Tr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[l,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),c=(nr()?.themeName||"dark")==="dark",u=()=>{if(!i.current)return;let f=i.current.getBoundingClientRect(),D=window.innerHeight,T=window.innerWidth,b=320,y=380,x=4,S=f.left;S+b>T-10&&(S=T-b-10),S<10&&(S=10);let C=D-f.bottom,P=f.top,O;C>=y+x?O=f.bottom+x:P>=y+x?O=f.top-y-x:O=C>=P?f.bottom+x:Math.max(10,f.top-y-x),m({top:O,left:S}),n(true);};react.useEffect(()=>{let f=D=>{d.current&&!d.current.contains(D.target)&&!i.current?.contains(D.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=D=>{D.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let v=f=>{let D=new Date,T=S=>{let C=S.getFullYear(),P=String(S.getMonth()+1).padStart(2,"0"),O=String(S.getDate()).padStart(2,"0");return `${C}-${P}-${O}`},b=T(D),y=new Date(D);y.setDate(y.getDate()+f);let x=T(y);a(b,x),n(false);},k=()=>{if(!e||!t)return "Set date";let f=y=>{if(y instanceof Date)return y;if(typeof y!="string"||!y.match(/^\d{4}-\d{2}-\d{2}$/))return null;let x=y.split("-").map(Number);if(x.length!==3||x.some(O=>isNaN(O)))return null;let S=x[0],C=x[1],P=x[2];return S===void 0||C===void 0||P===void 0?null:new Date(S,C-1,P)},D=f(e),T=f(t);if(!D||!T||isNaN(D.getTime())||isNaN(T.getTime()))return "Set date";let b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${b[D.getMonth()]} ${D.getDate()} \u2013 ${b[T.getMonth()]} ${T.getDate()}`},h=e&&t,g=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,D=new Date;return D.setHours(0,0,0,0),f<D})();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 ${g?"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(Re,{children:jsxRuntime.jsxs("div",{ref:d,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:c?"#1A1D25":"#FFFFFF",border:`1px solid ${c?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:c?"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:c?"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:c?"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:()=>v(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:c?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${c?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=c?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",D.currentTarget.style.border=`1px solid ${c?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor=c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",D.currentTarget.style.border=`1px solid ${c?"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:c?"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:c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:c?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:c?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:c?"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:c?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:c?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:c?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:c?"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),[m,d]=react.useState(""),[i,p]=react.useState({top:0,left:0}),s=react.useRef(null),c=react.useRef(null),u=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),f=window.innerHeight,D=window.innerWidth,T=300,b=380,y=4,x=g.right-T;x<10&&(x=g.left),x+T>D-10&&(x=D-T-10);let S=f-g.bottom,C=g.top,P;S>=b+y?P=g.bottom+y:C>=b+y?P=g.top-b-y:P=S>=C?g.bottom+y:Math.max(10,g.top-b-y),p({top:P,left:x}),l(true);};react.useEffect(()=>{let g=f=>{s.current&&!s.current.contains(f.target)&&!c.current?.contains(f.target)&&(l(false),d(""));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&(l(false),d(""));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let v=g=>{let f=e.some(D=>D.id===g.id);a(f?e.filter(D=>D.id!==g.id):[...e,g]);},k=t.filter(g=>g.name.toLowerCase().includes(m.toLowerCase())),h=e.slice(0,o),w=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,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(Re,{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:m,onChange:g=>d(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: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(g=>{let f=e.some(D=>D.id===g.id);return jsxRuntime.jsxs("button",{onClick:()=>v(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:D=>{D.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:D=>{D.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 ao(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(p=>{if(typeof p=="string")return p;let s=p;return s.taskId||s.targetId||""}).filter(Boolean);r.set(d.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,l=new Set,m=d=>{if(!n.has(d)){n.add(d),l.add(d);let i=r.get(d)||[];for(let p of i){if(!n.has(p)&&m(p))return true;if(l.has(p))return true}}return l.delete(d),false};return m(a)}function Nr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:l}){let[m,d]=react.useState(false),[i,p]=react.useState(""),[s,c]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[k,h]=react.useState(null),w=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let x=g.current.getBoundingClientRect(),S=window.innerHeight,C=window.innerWidth,P=300,O=s?380:120,A=4,U=x.right-P;U<10&&(U=x.left),U+P>C-10&&(U=C-P-10);let j=S-x.bottom,Z=x.top,pe;j>=O+A?pe=x.bottom+A:Z>=O+A?pe=x.top-O-A:pe=j>=Z?x.bottom+A:Math.max(10,x.top-O-A),v({top:pe,left:U}),d(true);};react.useEffect(()=>{if(!m||!g.current)return;let x=g.current.getBoundingClientRect(),S=window.innerHeight,C=window.innerWidth,P=300,O=s?380:120,A=4,U=x.right-P;U<10&&(U=x.left),U+P>C-10&&(U=C-P-10);let j=S-x.bottom,Z=x.top,pe;j>=O+A?pe=x.bottom+A:Z>=O+A?pe=x.top-O-A:pe=j>=Z?x.bottom+A:Math.max(10,x.top-O-A),v({top:pe,left:U});},[s,m]),react.useEffect(()=>{let x=S=>{w.current&&!w.current.contains(S.target)&&!g.current?.contains(S.target)&&(d(false),p(""));};if(m)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[m]),react.useEffect(()=>{let x=S=>{S.key==="Escape"&&(d(false),p(""));};if(m)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[m]);let D=x=>{let S=t.includes(x),C=a.find(P=>P.id===x);if(h(null),S){let P=t.filter(O=>O!==x);r(P),P.length===0&&c(false);}else {if(n&&ao(a,x,e)){let O=`Cannot add "${C?.title||x}" as dependency - would create circular reference`;h(O),l?.(x,C?.title||x),setTimeout(()=>h(null),3e3);return}r([...t,x]),c(true);}},T=()=>{let x=!s;c(x),x||r([]);},b=a.filter(x=>x.id!==e).filter(x=>x.title.toLowerCase().includes(i.toLowerCase())||x.id.toLowerCase().includes(i.toLowerCase())),y=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:g,onClick:()=>m?d(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:y,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:y},children:t.length})]}),m&&jsxRuntime.jsx(Re,{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:T,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:x=>p(x.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(x=>{let S=t.includes(x.id);return jsxRuntime.jsxs("button",{onClick:()=>D(x.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: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.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:x.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:x.id})]})]},x.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),c(false),d(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:m=[],allCards:d=[]})=>{let{attributes:i,listeners:p,setNodeRef:s,transform:c,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:Zr.Transform.toString(c),transition:u};if(t)return jsxRuntime.jsx("div",{ref:s,style:k,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=m.filter(f=>e.assignedUserIds?.includes(f.id)),w=e.progress===100,g={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:s,style:g,className:L("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...i,...p,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(Tr,{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,D)=>l?.(e.id,{startDate:f,endDate:D})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Va,{assignedUsers:h,availableUsers:m,onChange:f=>l?.(e.id,{assignedUserIds:f.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Nr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:d,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));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"}},Di=({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 Ni({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[l,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),p=[...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(g=>g.id===e);return w?{id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}:{...ro.todo,id:"todo"}},c=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),w=window.innerHeight,g=window.innerWidth,f=180,D=280,T=4,b=h.right-f;b<10&&(b=h.left),b+f>g-10&&(b=g-f-10);let y=w-h.bottom,x=h.top,S;y>=D+T?S=h.bottom+T:x>=D+T?S=h.top-D-T:S=y>=x?h.bottom+T:Math.max(10,h.top-D-T),m({top:S,left:b}),n(true);};react.useEffect(()=>{let h=w=>{d.current&&!d.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);},v=s(),k=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?n(false):c(),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:v.label,children:jsxRuntime.jsx(Di,{icon:v.icon,color:k})}),o&&jsxRuntime.jsx(Re,{children:jsxRuntime.jsxs("div",{ref:d,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:p.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(Di,{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 Si({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,l]=react.useState(false),[m,d]=react.useState(false),[i,p]=react.useState(e),[s,c]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(n&&v.current){let f=v.current.getBoundingClientRect();c({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=D=>{u.current&&!u.current.contains(D.target)&&!v.current?.contains(D.target)&&(l(false),d(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=D=>{D.key==="Escape"&&(l(false),d(false),p(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),react.useEffect(()=>{m&&k.current&&(k.current.focus(),k.current.select());},[m]);let h=()=>{d(true),p(e);},w=()=>{let f=i.trim();f&&f!==e&&t(f),d(false),l(false),p(e);},g=f=>{f.key==="Enter"?w():f.key==="Escape"&&(d(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,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(Re,{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:m?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:f=>p(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:m,availableUsers:d,allCards:i,enableVirtualization:p,cardHeight:s=120,isCollapsed:c,onToggleCollapse:u,onColumnRename:v,onColumnDelete:k,isDeletable:h=false,className:w})=>{let{setNodeRef:g,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),D=react.useRef(null),T=p??Qs(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>D.current,estimateSize:()=>s,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:g,className:w,children:a(e,t)});let x=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let P=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:P}:P>=80?{state:"warning",percentage:P}:P>=60?{state:"approaching",percentage:P}:{state:"ok",percentage:P}})(),S=x.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:g,className:L("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",S&&"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:L(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&x.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${x.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[x.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"})]}),x.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"})]}),x.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"})}),x.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||k)&&jsxRuntime.jsx(Si,{columnTitle:e.title,onRename:P=>v?.(e.id,P),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":c?"Expand column":"Collapse column",children:c?"\u25B6":"\u25BC"})]})]}),!c&&jsxRuntime.jsx("div",{ref:D,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(P=>P.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"})}):T?jsxRuntime.jsx("div",{style:{height:`${b.getTotalSize()}px`,position:"relative"},children:b.getVirtualItems().map(P=>{let O=t[P.index];return O?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${P.start}px)`},children:jsxRuntime.jsx(Da,{card:O,render:r,onClick:l,onUpdate:m,availableUsers:d,allCards:i})},O.id):null})}):t.map(P=>jsxRuntime.jsx(Da,{card:P,render:r,onClick:l,onUpdate:m,availableUsers:d,allCards:i},P.id))})})]})});lr.displayName="Column";function nn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let d=()=>{let p=n.trim();p&&p!==e?t(p):l(e),o(false);},i=p=>{p.key==="Enter"?d():p.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:n,onChange:p=>l(p.target.value),onBlur:d,onKeyDown:i,className:L("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:L("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:m,isLoading:d,error:i,children:p}){let[s,c]=ln(),u=o?.theme||"dark",k=u==="dark"||u==="neutral"?"dark":"",h=react.useCallback((C,P)=>{t.onCardUpdate?.(C,P);},[t]),w=react.useCallback((C,P)=>{t.onColumnUpdate?.(C,{title:P});},[t]),g=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),f=["todo","in-progress","completed"],D=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),T=react.useMemo(()=>{let C=new Map;return e.columns.forEach(P=>{let O=P.cardIds.map(A=>e.cards.find(U=>U.id===A)).filter(A=>A!==void 0).sort((A,U)=>A.position-U.position);C.set(P.id,O);}),C},[e.cards,e.columns]),b=react.useCallback(C=>{let{active:P}=C,O=e.cards.find(A=>A.id===P.id);O&&c({isDragging:true,draggedCardId:O.id,sourceColumnId:O.columnId,targetColumnId:O.columnId});},[e.cards,c]),y=react.useCallback(C=>{let{active:P,over:O}=C;if(!O||!e.cards.find(j=>j.id===P.id))return;let U=null;O.data.current?.type==="column"?U=O.id:O.data.current?.type==="card"&&(U=e.cards.find(Z=>Z.id===O.id)?.columnId||null),U&&U!==s.targetColumnId&&c({...s,targetColumnId:U});},[e.cards,s,c]),x=react.useCallback(async C=>{let{active:P,over:O}=C;if(c({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!O)return;let A=e.cards.find(pe=>pe.id===P.id);if(!A)return;let U,j;if(O.data.current?.type==="column"){U=O.id;let pe=T.get(U)||[];j=Xo(pe,0);}else {let pe=e.cards.find(_=>_.id===O.id);if(!pe)return;U=pe.columnId;let z=T.get(U)||[],V=z.findIndex(_=>_.id===O.id);j=Xo(z,V);}let Z=e.columns.find(pe=>pe.id===U);if(Z&&Z.wipLimit&&Z.wipLimitType==="hard"){let pe=T.get(U)||[];if(A.columnId!==U&&pe.length>=Z.wipLimit){t.onWipLimitExceeded?.(Z,A);return}}(A.columnId!==U||A.position!==j)&&await t.onCardMove?.(A.id,U,j);},[e.cards,e.columns,T,t,c]),S=react.useCallback(C=>{a?.(C);},[a]);return d?jsxRuntime.jsx("div",{className:L("asakaa-board",k,l),style:m,children:jsxRuntime.jsx(bm,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:L("asakaa-board",k,l),style:m,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(ci,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:D,collisionDetection:core$1.closestCorners,onDragStart:b,onDragOver:y,onDragEnd:x,children:[jsxRuntime.jsxs("div",{className:L("asakaa-board",k,l),style:m,"data-theme":u,children:[e.columns.sort((C,P)=>C.position-P.position).map(C=>{let P=T.get(C.id)||[],O=!f.includes(C.id);return jsxRuntime.jsx(lr,{column:C,cards:P,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:S,onCardUpdate:h,onColumnRename:w,onColumnDelete:g,isDeletable:O,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),p]}),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 bm({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 km={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)"},wm={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)"},Cm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Tm={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Dm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,l]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let i=p=>{m.current&&!m.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]);let d=i=>{t(i),l(false);};return jsxRuntime.jsxs("div",{ref:m,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,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Nm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,l]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let u=v=>{i.current&&!i.current.contains(v.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),c=async(u,v)=>{if(v){d(u);try{await v();}catch(k){console.error(`Export ${u} failed:`,k);}finally{d(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,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(u.id,u.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<s.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===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 Sm({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:m,onExportExcel:d,translations:i}){let p=r==="dark"?km:wm,s={...o==="es"?Cm:Tm,...i},c=l||m||d;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nm,{theme:p,t:s,onExportCSV:l,onExportJSON:m,onExportExcel:d}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(n?jsxRuntime.jsx(Dm,{columns:e,onSelect:t,theme:p,t:s,createTaskLabel:a}):jsxRuntime.jsx(Sm,{onClick:()=>t(),label:a||s.newTask}))]})})}function pn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,l]=react.useState(false),[m,d]=react.useState(""),i=react.useCallback(()=>{let c=m.trim();c&&(e(c),d(""),l(false));},[m,e]),p=react.useCallback(c=>{c.key==="Enter"?(c.preventDefault(),i()):c.key==="Escape"&&(d(""),l(false));},[i]),s=react.useCallback(()=>{setTimeout(()=>{m.trim()||l(false);},150);},[m]);return n?jsxRuntime.jsx("div",{className:L("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:m,onChange:c=>d(c.target.value),onKeyDown:p,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:!m.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:()=>{d(""),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:L("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:m="dark",locale:d="es"}){let[i,p]=react.useState(false),[s,c]=react.useState(false),[u,v]=react.useState(""),[k,h]=react.useState([]),[w,g]=react.useState(""),[f,D]=react.useState(""),[T,b]=react.useState(""),[y,x]=react.useState(false),[S,C]=react.useState(false),[P,O]=react.useState(false),A=react.useRef(null),U=react.useRef(null),j={placeholder:o||(d==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(d==="es"?"Agregar Tarea":"Add Task"),save:d==="es"?"Guardar":"Save",addAssignee:d==="es"?"Agregar asignado":"Add assignee",addDates:d==="es"?"Agregar fechas":"Add dates",addPriority:d==="es"?"Agregar prioridad":"Add priority",startDate:d==="es"?"Inicio":"Start",endDate:d==="es"?"Fin":"End",low:d==="es"?"Baja":"Low",medium:d==="es"?"Media":"Medium",high:d==="es"?"Alta":"High",urgent:d==="es"?"Urgente":"Urgent"},Z=react.useCallback(()=>{v(""),h([]),g(""),D(""),b(""),x(false),C(false),O(false),p(false);},[]);react.useEffect(()=>{i&&A.current&&A.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=B=>{U.current&&!U.current.contains(B.target)&&(u.trim()||Z());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,u,Z]);let pe=react.useCallback(async()=>{let F=u.trim();if(!(!F||s)){c(true);try{await t({name:F,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:w?new Date(w):void 0,endDate:f?new Date(f):void 0,priority:T||void 0}),v(""),h([]),g(""),D(""),b(""),x(!1),C(!1),O(!1),A.current?.focus();}catch(B){console.error("Error creating card:",B);}finally{c(false);}}},[u,e,k,w,f,T,t,s]),z=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),pe()):F.key==="Escape"&&Z();},[pe,Z]),V=react.useCallback(F=>{h(B=>B.includes(F)?B.filter(E=>E!==F):[...B,F]);},[]),_=m==="dark";return i?jsxRuntime.jsxs("div",{ref:U,className:L("rounded-lg overflow-hidden shadow-lg",_?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:A,type:"text",value:u,onChange:F=>v(F.target.value),onKeyDown:z,placeholder:j.placeholder,disabled:s,className:L("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",_?"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:()=>x(!y),className:L("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",y||k.length>0?"bg-emerald-500/20 text-emerald-400":_?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.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(!S),className:L("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",S||w||f?"bg-blue-500/20 text-blue-400":_?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.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(!P),className:L("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",P||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":_?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.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:L("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"}):j.save})]})]}),y&&a.length>0&&jsxRuntime.jsx("div",{className:L("px-3 pb-3 pt-0","border-t",_?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>V(F.id),className:L("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(F.id)?"bg-emerald-500 text-white":_?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:L("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),S&&jsxRuntime.jsx("div",{className:L("px-3 pb-3 pt-0","border-t",_?"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:L("block text-[10px] uppercase tracking-wide mb-1",_?"text-gray-500":"text-gray-400"),children:j.startDate}),jsxRuntime.jsx("input",{type:"date",value:w,onChange:F=>g(F.target.value),className:L("w-full px-2 py-1.5 rounded text-xs border",_?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("block text-[10px] uppercase tracking-wide mb-1",_?"text-gray-500":"text-gray-400"),children:j.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:F=>D(F.target.value),className:L("w-full px-2 py-1.5 rounded text-xs border",_?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),P&&jsxRuntime.jsx("div",{className:L("px-3 pb-3 pt-0","border-t",_?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>b(T===F?"":F),className:L("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:_?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:j[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:l,className:L("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",_?"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:j.buttonLabel})]})}var Ir=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 Wi(e={}){return new Ir(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:m,onOpenAIUsage:d,shortcut:i="k",className:p=""}){let[s,c]=react.useState(false),[u,v]=react.useState(""),[k,h]=react.useState("home"),[w,g]=react.useState(""),[f,D]=react.useState("");react.useEffect(()=>{let x=S=>{(S.metaKey||S.ctrlKey)&&S.key===i&&(S.preventDefault(),c(C=>!C)),S.key==="Escape"&&(c(false),h("home"),v(""));};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[i]),react.useEffect(()=>{s||(h("home"),v(""),g(""),D(""));},[s]);let T=react.useCallback(()=>{c(false);},[]),b=react.useCallback(x=>{let[S,C]=x.split(":");switch(S){case "create-card":h("create-card");break;case "create-card-in":g(C||"");break;case "navigate":C?(a?.(C),T()):h("navigate");break;case "search":r?.(u),T();break;case "priority":h("priority");break;case "set-priority":f&&C&&(o?.(f,C),T());break;case "assign":h("assign");break;case "assign-user":f&&C&&(n?.(f,C),T());break;case "ai":h("ai");break;case "ai-generate-plan":l?.(),T();break;case "ai-predict-risks":m?.(),T();break;case "ai-usage":d?.(),T();break;case "back":h("home");break;}},[u,f,t,a,r,o,n,l,m,d,T]),y=react.useCallback(()=>{w&&u.trim()&&(t?.(w,u.trim()),T());},[w,u,t,T]);return s?jsxRuntime.jsx(Re,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:x=>x.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder: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:x=>{x.key==="Enter"&&k==="create-card"&&w&&y();}}),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(x=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${x.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:x.priority==="URGENT"?"#EF4444":x.priority==="HIGH"?"#F59E0B":x.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:x.title}),x.labels&&x.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:x.labels.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},x.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(x=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${x.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:x.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[x.cardIds.length," cards"]})]},x.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(x=>{let S=e.columns.find(C=>C.id===x.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${x.id}`,onSelect:b,className:"command-palette-item",keywords:[x.title,x.description||"",...x.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:x.priority==="URGENT"?"#EF4444":x.priority==="HIGH"?"#F59E0B":x.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:x.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),x.labels&&x.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:x.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},x.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 Fm(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 Bm(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 Rm(e){return e.startsWith("image/")}function Lr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[l,m]=react.useState(false),[d,i]=react.useState(false),[p,s]=react.useState(null),c=react.useRef(null),u=react.useCallback(b=>{let y=[],x=[];return e.length+b.length>n?(x.push(`Maximum ${n} files allowed`),{valid:y,errors:x}):(b.forEach(S=>{if(S.size/1048576>r){x.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(P=>S.type.match(P))){x.push(`${S.name} has invalid file type`);return}y.push(S);}),{valid:y,errors:x})},[e.length,n,r,o]),v=react.useCallback(async b=>{let{valid:y,errors:x}=u(b);if(x.length>0){s(x.join(", ")),setTimeout(()=>s(null),5e3);return}if(y.length!==0){i(true),s(null);try{await t?.(y);}catch(S){s(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>s(null),5e3);}finally{i(false);}}},[u,t]),k=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(true);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);},[]),w=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),g=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);let y=Array.from(b.dataTransfer.files);v(y);},[v]),f=react.useCallback(b=>{let y=b.target.files?Array.from(b.target.files):[];v(y),c.current&&(c.current.value="");},[v]),D=react.useCallback(()=>{c.current?.click();},[]),T=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":""} ${d?"uploading":""}`,onDragEnter:k,onDragLeave:h,onDragOver:w,onDrop:g,onClick:D,children:[jsxRuntime.jsx("input",{ref:c,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:d?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"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Rm(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:Bm(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:Fm(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:()=>T(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:m=[],aiInsights:d=[],attachments:i=[],onAddComment:p,onDeleteComment:s,onUploadAttachments:c,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:k,onEstimateEffort:h,currentUserId:w="user-1"}){let[g,f]=react.useState("details"),[D,T]=react.useState(false),[b,y]=react.useState({}),[x,S]=react.useState(""),[C,P]=react.useState(false),[O,A]=react.useState({});if(!t||!e)return null;let U=react.useCallback(()=>{T(false),y({}),f("details"),S(""),A({}),a();},[a]),j=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),y({}),T(false));},[e.id,b,r]),Z=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),U());},[e.id,o,U]),pe=react.useCallback(()=>{p&&x.trim()&&(p(e.id,x.trim()),S(""));},[e.id,x,p]),z=react.useCallback(async()=>{if(v){P(true);try{let E=await v(e);A(Y=>({...Y,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{P(false);}}},[e,v]),V=react.useCallback(async()=>{if(k){P(true);try{let E=await k(e);A(Y=>({...Y,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{P(false);}}},[e,k]),_=react.useCallback(async()=>{if(h){P(true);try{let E=await h(e);A(Y=>({...Y,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{P(false);}}},[e,h]),F={...e,...b},B=n.filter(E=>F.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(Re,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:U,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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),D?jsxRuntime.jsx("input",{type:"text",value:b.title??F.title,onChange:E=>y({...b,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),y({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>T(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:Z,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:U,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",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.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",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.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"}),D?jsxRuntime.jsx("textarea",{value:b.description??F.description??"",onChange:E=>y({...b,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),D?jsxRuntime.jsx("select",{multiple:true,value:b.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let Y=Array.from(E.target.selectedOptions,le=>le.value);y({...b,assignedUserIds:Y});},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:B.length>0?B.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"}),D?jsxRuntime.jsxs("select",{value:b.priority??F.priority??"",onChange:E=>y({...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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.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:F.labels&&F.labels.length>0?F.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"}),D?jsxRuntime.jsx("input",{type:"date",value:b.startDate?new Date(b.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>y({...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:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),D?jsxRuntime.jsx("input",{type:"date",value:b.endDate?new Date(b.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>y({...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:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),D?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:b.estimatedTime??F.estimatedTime??"",onChange:E=>y({...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:F.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:F.dependencies&&F.dependencies.length>0?F.dependencies.map(E=>{let Y=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Y.slice(-4)]},Y)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.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:x,onChange:E=>S(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:pe,disabled:!x.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 Y=n.find(le=>le.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:[Y&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Y.color},children:Y.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Y?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(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"})]})})]}),g==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(E=>{let Y=n.find(le=>le.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:Y?.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"})]})}),g==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Lr,{cardId:e.id,attachments:i,onUpload:c?E=>c(e.id,E):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:z,disabled:C||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:V,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:_,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"]})]}),O.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),O.assignees.map((E,Y)=>{let le=n.find(se=>se.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[le&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:le.color},children:le.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:le?.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),"%"]})]})]},Y)})]}),O.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),O.subtasks.map((E,Y)=>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"]})]},Y))]}),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),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.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))]}),!O.assignees&&!O.subtasks&&!O.effort&&d.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 Fr({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:l=""}){let[m,d]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let s=e.current.getBoundingClientRect(),c=window.innerHeight,u=window.innerWidth,v=4,k=s.left;k+o>u-10&&(k=u-o-10),k<10&&(k=10);let h=c-s.bottom,w=s.top,g;return h>=n+v?g=s.bottom+v:w>=n+v?g=s.top-n-v:h>=w?g=s.bottom+v:g=Math.max(10,s.top-n-v),{top:g,left:k}},[e,o,n]);return react.useEffect(()=>{t&&d(p());},[t,p]),react.useEffect(()=>{if(!t)return;let s=u=>{let v=u.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},c=setTimeout(()=>{document.addEventListener("mousedown",s);},0);return ()=>{clearTimeout(c),document.removeEventListener("mousedown",s);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let s=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),a());};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,a]),t?jsxRuntime.jsx(Re,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${l}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.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 _m=["LOW","MEDIUM","HIGH","URGENT"],Vm=["todo","in-progress","review","done"];function kn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:m=[],onAddComment:d,onDeleteComment:i,currentUser:p,onAIGenerateDescription:s,onAICreateSubtasks:c,onAIFindSimilar:u,availableColumns:v=[],availableLabels:k=[],onUploadCoverImage:h,unsplashAccessKey:w,theme:g,onSubtasksChange:f}){let D=nr(),T=g||D?.themeName||"dark",[b,y]=react.useState(e),[x,S]=react.useState(false),[C,P]=react.useState(e?.subtasks||[]),[O,A]=react.useState(false),[U,j]=react.useState(""),[Z,pe]=react.useState(""),[z,V]=react.useState("all"),[_,F]=react.useState(false),[B,E]=react.useState(false),[Y,le]=react.useState(false),[se,Je]=react.useState(false),[Be,kt]=react.useState(false),[ge,wt]=react.useState(false),gt=react.useRef(null),pa=react.useRef(null),ua=react.useRef(null),Yt=react.useRef(null),Rt=react.useRef(null),qt=react.useRef(null),At=react.useRef(null),ga=react.useRef(null),dt=react.useRef(null),tt=react.useRef(null),Pt=react.useRef(null),Ca=react.useRef(null);react.useEffect(()=>{e&&!b?(y({...e}),P(e.subtasks||[])):e&&b&&e.id!==b.id&&(y({...e}),P(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let M=J=>{let Te=J.target;Yt.current&&!Yt.current.contains(Te)&&F(false),Rt.current&&!Rt.current.contains(Te)&&E(false),qt.current&&!qt.current.contains(Te)&&le(false),At.current&&!At.current.contains(Te)&&Je(false);};if(_||B||Y||se)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[_,B,Y,se]),react.useEffect(()=>{if(!t)return;let M=J=>{let Te=J.target,Ve=Te.tagName==="INPUT"||Te.tagName==="TEXTAREA"||Te.isContentEditable;if(J.key==="Escape"){J.preventDefault(),_||B||Y||se||Be||ge?(F(false),E(false),le(false),Je(false),kt(false),wt(false)):Ve||a();return}if(Ve&&J.key!=="Escape")return;let me=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),F(true);break;case "a":J.preventDefault(),le(true);break;case "p":J.preventDefault(),E(true);break;case "l":J.preventDefault(),Je(true);break;case "d":me||(J.preventDefault(),kt(true),setTimeout(()=>ga.current?.focus(),0));break;case "e":me||(J.preventDefault(),wt(true));break;case "i":J.preventDefault(),S(true),setTimeout(()=>pa.current?.focus(),0);break;case "t":J.preventDefault(),A(true);break;case "c":J.preventDefault(),ua.current?.focus();break}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,a,_,B,Y,se,Be,ge]);let ie=react.useCallback(M=>{let J=M.currentTarget.textContent?.trim()||"";if(b&&J!==b.title){let Te={...b,title:J};y(Te),r?.(b.id,{title:J});}},[b,r]),ve=react.useCallback(M=>{M.key==="Enter"&&(M.preventDefault(),M.currentTarget.blur()),M.key==="Escape"&&(M.preventDefault(),M.currentTarget.textContent=b?.title||"",M.currentTarget.blur());},[b]),Gt=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),S(false);},[b,e,r]),fa=react.useCallback(M=>{if(b){let J={...b,columnId:M};y(J),r?.(b.id,{columnId:M}),F(false);}},[b,r]),vt=react.useCallback(M=>{if(b){let J={...b,priority:M};y(J),r?.(b.id,{priority:M}),E(false);}},[b,r]),ba=react.useCallback(M=>{if(b){let J=b.assignedUserIds||[],Te=J.includes(M)?J.filter(me=>me!==M):[...J,M],Ve={...b,assignedUserIds:Te};y(Ve),r?.(b.id,{assignedUserIds:Te});}},[b,r]),ha=react.useCallback(M=>{if(b){let J=b.labels||[],Te=J.includes(M)?J.filter(me=>me!==M):[...J,M],Ve={...b,labels:Te};y(Ve),r?.(b.id,{labels:Te});}},[b,r]),ke=react.useCallback(M=>{if(b){let J=M.target.value,Te={...b,endDate:J};y(Te),r?.(b.id,{endDate:J}),kt(false);}},[b,r]),Ce=react.useCallback(M=>{if(b){let J={...b,estimatedTime:parseFloat(M)||0};y(J),r?.(b.id,{estimatedTime:parseFloat(M)||0});}},[b,r]),ct=react.useCallback(()=>{if(U.trim()&&b){let M={id:`subtask-${Date.now()}`,title:U.trim(),completed:false,createdAt:new Date},J=[...C,M];P(J),j(""),A(false),f?.(b.id,J);}},[U,C,b,f]),ae=react.useCallback(M=>{let J=C.map(Te=>Te.id===M?{...Te,completed:!Te.completed,updatedAt:new Date}:Te);P(J),b&&f?.(b.id,J);},[C,b,f]),ye=react.useCallback(M=>{let J=C.filter(Te=>Te.id!==M);P(J),b&&f?.(b.id,J);},[C,b,f]),I=react.useCallback(()=>{Z.trim()&&b&&d&&(d(b.id,Z.trim()),pe(""));},[Z,b,d]),W=react.useCallback(M=>{(M.metaKey||M.ctrlKey)&&M.key==="Enter"&&(M.preventDefault(),I());},[I]),de=M=>jsxRuntime.jsx(Gm__default.default,{remarkPlugins:[Um__default.default],rehypePlugins:[Hm__default.default],components:{a:({node:J,...Te})=>jsxRuntime.jsx("a",{...Te,target:"_blank",rel:"noopener noreferrer"})},children:M}),ue=m.filter(M=>z==="comments"?M.type.includes("COMMENT"):z==="history"?!M.type.includes("COMMENT"):true);if(!t||!e)return null;let q=b||e,ce=n.filter(M=>q.assignedUserIds?.includes(M.id)),X=C.filter(M=>M.completed).length;return jsxRuntime.jsx(Re,{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:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":T,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:gt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ie,onKeyDown:ve,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:Yt,children:[jsxRuntime.jsxs("button",{ref:dt,className:"modal-v2-field",onClick:()=>F(!_),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:q.columnId||"No status"})]}),jsxRuntime.jsx(Fr,{triggerRef:dt,isOpen:_,onClose:()=>F(false),width:250,estimatedHeight:200,children:(v.length>0?v:Vm.map(M=>({id:M,title:M}))).map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===M.id?"active":""}`,onClick:()=>fa(M.id),children:M.title},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:qt,children:[jsxRuntime.jsxs("button",{ref:tt,className:"modal-v2-field",onClick:()=>le(!Y),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ce.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ce.map(M=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:M.color},title:M.name,children:M.initials},M.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Fr,{triggerRef:tt,isOpen:Y,onClose:()=>le(false),width:280,estimatedHeight:300,children:n.map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(M.id)?"active":""}`,onClick:()=>ba(M.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:M.color},children:M.initials}),M.name,q.assignedUserIds?.includes(M.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"})})]},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Rt,children:[jsxRuntime.jsxs("button",{ref:Pt,className:"modal-v2-field",onClick:()=>E(!B),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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(Fr,{triggerRef:Pt,isOpen:B,onClose:()=>E(false),width:180,estimatedHeight:220,children:[_m.map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${M.toLowerCase()} ${q.priority===M?"active":""}`,onClick:()=>vt(M),children:M},M)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>vt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:At,children:[jsxRuntime.jsxs("button",{ref:Ca,className:"modal-v2-field",onClick:()=>Je(!se),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Fr,{triggerRef:Ca,isOpen:se,onClose:()=>Je(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(M)?"active":""}`,onClick:()=>ha(M),children:[M,q.labels?.includes(M)&&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"})})]},M))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{kt(!Be),setTimeout(()=>ga.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:ga,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let M=new Date(q.endDate),J=M.getUTCFullYear(),Te=String(M.getUTCMonth()+1).padStart(2,"0"),Ve=String(M.getUTCDate()).padStart(2,"0");return `${J}-${Te}-${Ve}`})():"",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:()=>wt(!ge),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"})]}),ge&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:M=>Ce(M.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>wt(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"})]}),x?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:M=>{if(b){let J={...b,description:M.target.value};y(J);}},onBlur:Gt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>S(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:de(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"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[X,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>A(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[C.map(M=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${M.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ae(M.id),children:M.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:M.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ye(M.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"})]})})]},M.id)),O&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:U,onChange:M=>j(M.target.value),onKeyDown:M=>{M.key==="Enter"&&ct(),M.key==="Escape"&&(A(false),j(""));},onBlur:ct,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 ${z==="all"?"active":""}`,onClick:()=>V("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>V("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>V("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ua,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Z,onChange:M=>pe(M.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:I,disabled:!Z.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ue.map(M=>{let J=n.find(Ve=>Ve.id===M.userId);if(M.type.includes("COMMENT")){let Ve=l.find(me=>me.id===M.metadata?.commentId);return Ve?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(M.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ve.content})]})]},M.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.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"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)}),ue.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 ep({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((m,d)=>m+d.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(ep,{})}),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,m)=>l+m.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,m)=>l+m.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,m)=>l+(m.planned||0),0)})]})]})]})}function dp({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,m=e[e.length-1]?.ideal||0,d=n>0?(n-l)/n*100:0,i=l<=m;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(dp,{})}),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:d>=50?"#10B981":"#F59E0B"},children:[d.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 vp={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Xi=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function yp({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let l=r+(o-r)*.5,m=e+l*Math.cos(-a*(Math.PI/180)),d=t+l*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:m,y:d,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function Ji({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((d,i)=>d+i.value,0),l=e.map(d=>({...d,totalValue:n,color:d.color||vp[d.name]||Xi[e.indexOf(d)%Xi.length]})),m=l.map(d=>d.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?yp:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ji,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let p=i.payload,s=n>0?(p.value/n*100).toFixed(0):"0";return `${d} (${p.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(Ji,{})}),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((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var mo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[l,m]=react.useState(false),[d,i]=react.useState(false),[p,s]=react.useState(false),[c,u]=react.useState(false);if(e.length===0)return null;let v=e.map(D=>D.id),k=D=>{r.onBulkUpdate?.(v,{priority:D}),m(false);},h=D=>{r.onBulkMove?.(v,D),i(false),a();},w=D=>{r.onBulkUpdate?.(v,{assignedUserIds:D}),s(false);},g=D=>{let T=new Set;e.forEach(y=>{y.labels?.forEach(x=>T.add(x));});let b=Array.from(new Set([...T,...D]));r.onBulkUpdate?.(v,{labels:b}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!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(D=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(D),children:[jsxRuntime.jsx("span",{className:L("asakaa-priority-dot",D==="LOW"&&"bg-asakaa-priority-low",D==="MEDIUM"&&"bg-asakaa-priority-medium",D==="HIGH"&&"bg-asakaa-priority-high",D==="URGENT"&&"bg-asakaa-priority-urgent")}),D]},D))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(D=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(D.id),children:D.title},D.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(D=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w([D.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:D.color},children:D.initials}),D.name]},D.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!c),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(D=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([D]),children:D},D))})]}),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 Tp(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,l,m,d,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let v=a?.find(k=>k.id===u);l=`assignee-${u}`,m=v?.name||`User ${u}`,d=v?.color,i=v?.avatar,r.has(l)||r.set(l,{id:l,title:m,groupValue:u,cardIds:[],color:d,icon:i}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",m="Unassigned",d="#6b7280",i="\u{1F464}",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:d,icon:i}),r.get(l).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",l=`priority-${n}`;let c={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];m=c.title,d=c.color,r.has(l)||r.set(l,{id:l,title:m,groupValue:n,cardIds:[],color:d}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,m=u,d="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:u,cardIds:[],color:d}),r.get(l).cardIds.push(o.id);}):(l="label-none",m="No Labels",d="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:d}),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),m=react.useMemo(()=>Tp(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),d=react.useCallback(i=>{l(p=>{let s=new Set(p);return s.has(i)?s.delete(i):s.add(i),s});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(La,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:L("asakaa-swimlane-view",o),children:[m.map(i=>{let p=n.has(i.id),s=e.cards.filter(u=>i.cardIds.includes(u.id)),c={...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&&d(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(La,{board:c,callbacks:r,availableUsers:a})})]},i.id)}),m.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),m=Sn.find(i=>i.value===e)||Sn[0];react.useEffect(()=>{function i(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:L("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:L("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:()=>d(i.value),className:L("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 Br=[{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 Sp(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,m=o.alt?e.altKey:!e.altKey,d=o.meta?e.metaKey:true;return n&&l&&m&&d}function al(e={}){let{shortcuts:t=Br,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(d=>{o.current=[...o.current,d];},[]),m=react.useCallback(d=>{o.current=o.current.filter(i=>i.action!==d);},[]);return react.useEffect(()=>{function d(i){if(!n.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let s of o.current)if(Sp(i,s)){r&&i.preventDefault();let c=new CustomEvent("keyboard-action",{detail:s.action,bubbles:true,cancelable:true});window.dispatchEvent(c);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:l,unregisterShortcut:m,isEnabled:a}}function Pp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Mp(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 Ip(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Mp(e),r=t?Pp(t):"";return a?`${a} + ${r}`:r}function Ap(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=Br,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function m(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let l=Ap(e);return jsxRuntime.jsxs("div",{className:L("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(([m,d])=>d.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"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:d.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:Ip(i)})]},i.action))})]},m))})}),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:**
6
6
  1.
7
7
 
8
8
  **Expected behavior:**
@@ -42,19 +42,19 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Pn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function i(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},d=e.reduce((i,p)=>{let s=p.category||"Other";return i[s]||(i[s]=[]),i[s].push(p),i},{});return jsxRuntime.jsxs("div",{className:L("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:L("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(d).map(([i,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:p.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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 In({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,m]=react.useState("export"),[d,i]=react.useState("json"),[p,s]=react.useState(null),c=react.useRef(null);if(!t)return null;let u=async()=>{let w=o?.current||void 0,h=await ti(e,d,w);ai(h,d);},k=async w=>{let h=w.target.files?.[0];if(h){try{let y=await ni(h),f=h.name.endsWith(".json")?"json":"csv",g=oi(y,f);s(g),g.success&&r&&r(g,y);}catch(y){s({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}c.current&&(c.current.value="");}};return jsxRuntime.jsxs("div",{className:L("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:()=>m("export"),className:L("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:()=>m("import"),className:L("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(w=>jsxRuntime.jsxs("button",{onClick:()=>i(w),className:L("p-4 rounded-lg border-2 transition-all text-center",d===w?"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:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),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:c,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>c.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:L("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((w,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},h))})]})]})]})]})]})}var Ap=["URGENT","HIGH","MEDIUM","LOW"],Lp=[{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"}],Fp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function An({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:m,availableUsers:d=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:s=true,compact:c=false,groupBy:u="none",onGroupByChange:k}){let[w,h]=react.useState(true),y=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]),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 ${c?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"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:w?"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)"]})]}),!w&&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"}),m&&jsxRuntime.jsx("button",{onClick:m,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:y,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"}),Ap.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),d.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"}),d.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:Lp.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"})]}),k&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>k(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fp.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 Ln({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:m,onExportGanttCSV:d}){let[i,p]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let u=k=>{s.current&&!s.current.contains(k.target)&&p(false);};return i&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[i]);let c=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:L("relative",r),ref:s,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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:()=>c(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:()=>c(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:()=>c(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:()=>c(async()=>await m?.()),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:()=>c(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>c(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:()=>c(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 Fn={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"}},Bn={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"}},Rn={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"}},Ka={dark:Fn,light:Bn,neutral:Rn},mo="dark";var po=react.createContext(void 0),_p="asakaa-theme";function rl({children:e,defaultTheme:t=mo,storageKey:a=_p}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,d=Ka[r];Object.entries(d.colors).forEach(([p,s])=>{s&&m.style.setProperty(`--theme-${Vp(p)}`,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(([p,s])=>{let c=d.colors[p];c&&m.style.setProperty(s,c);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:Ka};return jsxRuntime.jsx(po.Provider,{value:l,children:e})}function pr(){let e=react.useContext(po);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Vp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function On({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=pr();return e?jsxRuntime.jsxs("div",{className:L("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(Ka).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:L("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 Pe={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 ol(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Pe[e]||Pe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Pe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Pe[e].bgSecondary),bgGrid:r("--theme-bg-card",Pe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Pe[e].bgWeekend),border:r("--theme-border-primary",Pe[e].border),borderLight:r("--theme-border-subtle",Pe[e].borderLight),textPrimary:r("--theme-text-primary",Pe[e].textPrimary),textSecondary:r("--theme-text-secondary",Pe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Pe[e].textTertiary),accent:r("--theme-accent-primary",Pe[e].accent),accentHover:r("--theme-accent-hover",Pe[e].accentHover),accentLight:r("--theme-accent-primary",Pe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Pe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Pe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Pe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Pe[e].dependency),dependencyHover:r("--theme-border-secondary",Pe[e].dependencyHover),criticalPath:r("--theme-error",Pe[e].criticalPath),criticalPathLight:r("--theme-error",Pe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Pe[e].today):e==="neutral"?r("--theme-text-primary",Pe[e].today):r("--theme-error",Pe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Pe[e].todayLight):e==="neutral"?r("--theme-text-primary",Pe[e].todayLight):r("--theme-error",Pe[e].todayLight),milestone:r("--theme-warning",Pe[e].milestone),milestoneLight:r("--theme-warning",Pe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Pe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Pe[e].statusInProgress),statusCompleted:r("--theme-success",Pe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Pe[e].hoverBg),focusRing:r("--theme-accent-primary",Pe[e].focusRing)}}var uo={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"}},nl={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:uo,es:nl};function sl(e){return Gn[e]||Gn.en}function zn(e,t){let a=sl(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 gr=react.createContext(uo);function Br(){return react.useContext(gr)}function lu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[m,d]=react.useState(false),[i,p]=react.useState(null),s=react.useRef(null),c=Br();if(react.useEffect(()=>{let h=y=>{s.current&&!s.current.contains(y.target)&&d(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||n||l))return null;let k=[{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),w=async(h,y)=>{if(y){p(h);try{await y();}catch(f){console.error(`Export ${h} failed:`,f);}finally{p(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:c.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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:k.map((h,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(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:y<k.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: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 du({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 cu({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 mu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=Br();react.useEffect(()=>{let i=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],d=m.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"}: ${d}`,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:m.map((i,p)=>{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:p<m.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:p*.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 go({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:m,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:s,onCreateTask:c,onExportPNG:u,onExportPDF:k,onExportExcel:w,onExportCSV:h,onExportJSON:y,onExportMSProject:f}){let g=Br(),T=u||k||w||h||y||f,N=[{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(cu,{options:N,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(mu,{theme:e,value:m,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:c,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(lu,{theme:e,onExportPNG:u,onExportPDF:k,onExportExcel:w,onExportCSV:h,onExportJSON:y,onExportMSProject:f}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(du,{options:b,value:n,onChange:x=>l(x),theme:e})]})]})}function fo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=s=>{m.current&&!m.current.contains(s.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let p=d.current.getBoundingClientRect();l({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function fr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null),[m,d]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,s=r.length*36+8,c=8,u=window.innerWidth,k=window.innerHeight,w=t,h=a;t+p+c>u&&(w=t-p,w<c&&(w=c)),a+s+c>k&&(h=k-s-c,h<c&&(h=c)),d({x:w,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=c=>{l.current&&!l.current.contains(c.target)&&o();},s=c=>{c.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",s);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p: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:`${m.x}px`,top:`${m.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(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:s=>{p.disabled||(s.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.id))})})})}var Xe={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function yl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:m,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:s,enableKeyboard:c=true}){let u=react.useRef(false),k=react.useCallback(g=>{u.current=g;},[]),w=react.useCallback(g=>{let T=[],N=b=>{for(let x of b)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&N(x.subtasks);};return N(g),T},[]),h=react.useCallback(()=>{let g=w(e);for(let T of g)if(t.has(T.id))return T;return null},[e,t,w]),y=react.useCallback((g,T)=>{let N=w(e);if(N.length===0)return;let b=h();if(!b){a(N[0].id,false);return}let x=N.findIndex(C=>C.id===b.id);if(x===-1)return;let v=g==="up"?x-1:x+1;if(v<0||v>=N.length)return;let S=N[v];a(S.id,T);},[e,h,w,a]),f=react.useCallback(g=>{if(!c)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),S=h();if(g.key==="ArrowUp"){g.preventDefault(),y("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),y("down",g.shiftKey);return}if(S&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!S.isExpanded||g.key==="ArrowLeft"&&S.isExpanded)&&p(S.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(),m(v));return}if(g.key==="Tab"&&g.shiftKey){v.length>0&&(g.preventDefault(),d(v));return}if(g.key==="Enter"&&!g.shiftKey&&!x){S&&(g.preventDefault(),r(S.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!x){S&&(g.preventDefault(),r(S.id,"above"));return}if(g.key==="Enter"&&x){S&&(g.preventDefault(),s(S.id));return}if(g.key==="F2"){S&&(g.preventDefault(),i(S.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}},[c,t,h,y,r,o,n,l,m,d,i,p,s]);return react.useEffect(()=>{if(c)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[c,f]),{setIsEditing:k}}function kl(){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(c=>{let u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u}),r(s);},[]),l=react.useCallback((s,c)=>{if(!a){o(s);return}let u=c.indexOf(a),k=c.indexOf(s);if(u===-1||k===-1){o(s);return}let w=Math.min(u,k),h=Math.max(u,k),y=c.slice(w,h+1);t(new Set(y)),r(s);},[a,o]),m=react.useCallback((s,c,u,k)=>{k?l(s,c):u?n(s):o(s);},[o,n,l]),d=react.useCallback((s,c)=>{c?t(u=>{let k=new Set(u);return k.add(s),k}):o(s);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(s=>e.has(s),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:m,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:p}}function br(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let m={...r[l],parentId:o,level:n,position:l};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function wl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=wl(a.subtasks,t);if(r)return r}}return null}function Wn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Wn(a.subtasks,t);if(r)return r}return null}function Hn(e,t){if(t.length===0)return e;let a=br(e),r=t[0],o=a.findIndex(s=>s.id===r);if(o<=0)return e;let n=a[o-1],l=(s,c)=>{let u=[];return {tasks:s.filter(w=>{if(c.has(w.id))return u.push(w),false;if(w.subtasks){let h=l(w.subtasks,c);w.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},m=(s,c,u)=>s.map(k=>k.id===c?{...k,subtasks:[...k.subtasks||[],...u],isExpanded:true}:k.subtasks?{...k,subtasks:m(k.subtasks,c,u)}:k),d=new Set(t),{tasks:i,removed:p}=l(e,d);return m(i,n.id,p)}function _n(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Wn(a,r);if(!o)continue;let n=Wn(a,o.id),l=(i,p,s)=>{for(let c=0;c<i.length;c++){let u=i[c];if(u.id===p&&u.subtasks){let k=u.subtasks.findIndex(w=>w.id===s);if(k!==-1){let[w]=u.subtasks.splice(k,1);return w}}if(u.subtasks){let k=l(u.subtasks,p,s);if(k)return k}}return null},m=(i,p,s)=>{let c=i.findIndex(u=>u.id===p);if(c!==-1)return i.splice(c+1,0,s),i;for(let u of i)u.subtasks&&m(u.subtasks,p,s);return i},d=l(a,o.id,r);d&&(n&&n.subtasks?m(n.subtasks,o.id,d):m(a,o.id,d));}return a}function Vn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,m,d)=>{let i=l.findIndex(s=>s.id===m);if(i===-1){for(let s of l)if(s.subtasks&&n(s.subtasks,m,d))return true;return false}let p=d==="up"?i-1:i+1;return p<0||p>=l.length?false:([l[i],l[p]]=[l[p],l[i]],true)};return n(r,o,a),r}function jn(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 Kn(e,t){let a=[...e];for(let r of t){let o=l=>{let m=l.findIndex(p=>p.id===r);if(m===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let d=l[m],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?n(d.subtasks):void 0};return l.splice(m+1,0,i),true},n=l=>l.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function Cl(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"},m=d=>{let i=d.findIndex(s=>s.id===t);if(i===-1){for(let s of d)if(s.subtasks&&m(s.subtasks))return true;return false}let p=a==="above"?i:i+1;return d.splice(p,0,l),true};return m(r),{tasks:r,newTask:l}}function Yn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Yn(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 Xn(e,t){let a=p=>{for(let s of p){if(s.id===t)return s;if(s.subtasks){let c=a(s.subtasks);if(c)return c}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,m=r?.endDate||n,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(s=>{if(s.id===t){let c=s.subtasks||[];return {...s,subtasks:[...c,d],isExpanded:true}}return s.subtasks?{...s,subtasks:i(s.subtasks)}:s});return {tasks:i(e),newTask:d}}function Tl(e,t,a,r){if(t===a)return e;let o=wl(e,t);if(!o)return e;if(a){let m=(d,i)=>{if(!d.subtasks)return false;for(let p of d.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let n=m=>m.filter(d=>d.id!==t).map(d=>d.subtasks&&d.subtasks.length>0?{...d,subtasks:n(d.subtasks)}:d),l=n(e);if(a===null){let m=r!==void 0?r:l.length;l.splice(m,0,{...o,parentId:void 0});}else {let m=d=>d.map(i=>{if(i.id===a){let p=i.subtasks||[],s=r!==void 0?r:p.length,c=[...p];return c.splice(s,0,{...o,parentId:a}),{...i,subtasks:c,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});l=m(l);}return l}function vo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:m,onTaskToggle:d,scrollTop:i,columns:p,onToggleColumn:s,onColumnResize:c,onTaskUpdate:u,onTaskIndent:k,onTaskOutdent:w,onTaskMove:h,onMultiTaskDelete:y,onTaskDuplicate:f,onTaskCreate:g,onTaskRename:T,onCreateSubtask:N,onOpenTaskModal:b,onDeleteRequest:x,onTaskReparent:v}){let S=react.useContext(gr),[C,A]=react.useState(null),[z,P]=react.useState(false),[W,E]=react.useState(null),[$,V]=react.useState(""),re=react.useRef(null),se=react.useRef(null),[Y,R]=react.useState(null),[O,M]=react.useState(0),[ge,te]=react.useState(0),[Le,Re]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[tt,ve]=react.useState(null),[at,Bt]=react.useState(null),[xt,xa]=react.useState(null),Xt=react.useRef(0),ua=5,jt=react.useRef(false);react.useEffect(()=>{function B(H){re.current&&!re.current.contains(H.target)&&P(false);}if(z)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[z]),react.useEffect(()=>{W&&se.current&&(se.current.focus(),se.current.select());},[W]),react.useEffect(()=>{if(!Y)return;let B=me=>{let le=me.clientX-O,K=ge+le;c?.(Y,K);},H=()=>{R(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,O,ge,c]);let{selectedTaskIds:Et,handleTaskClick:Jt,isTaskSelected:ht}=kl(),{setIsEditing:je}=yl({tasks:e,selectedTaskIds:Et,onTaskSelect:(B,H)=>{let le=br(e).map(K=>K.id);Jt(B,le,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:B=>{let H=br(e).find(me=>me.id===B);H&&be(H);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:B=>{let H=br(e).find(me=>me.id===B);H&&b&&b(H);},enableKeyboard:true}),Ut=(B,H=0)=>{let me=[];for(let le of B)me.push({task:le,level:H}),le.subtasks&&le.subtasks.length>0&&le.isExpanded&&me.push(...Ut(le.subtasks,H+1));return me},It=Ut(e),Sa=48,ie=B=>!B.startDate||!B.endDate?"-":`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))}d`,be=B=>{E(B.id),V(B.name),je(true);},Zt=B=>{$.trim()&&$!==e.find(H=>H.id===B)?.name&&T?.(B,$.trim()),E(null),V(""),je(false);},kt=()=>{E(null),V(""),je(false);},Qt=(B,H)=>{H.stopPropagation(),N?.(B.id);},ga=(B,H)=>{H.preventDefault(),Xt.current=H.clientY,ve(B),jt.current=false;},ke=B=>{if(!tt||(Math.abs(B.clientY-Xt.current)>ua&&(jt.current=true),!jt.current))return;let me=document.querySelectorAll("[data-task-row]"),le=null,K=null;me.forEach(we=>{let X=we.getBoundingClientRect(),I=we.getAttribute("data-task-row");if(I&&I!==tt&&B.clientY>=X.top&&B.clientY<=X.bottom){le=I;let J=B.clientY-X.top,Ce=X.height;J<Ce*.25?K="above":J>Ce*.75?K="below":K="child";}}),Bt(le),xa(K);},ye=()=>{if(jt.current&&tt&&at&&xt){if(xt==="child")v?.(tt,at);else if(xt==="above"||xt==="below"){let B=(le,K,we=null)=>{for(let X of le){if(X.id===K)return we;if(X.subtasks){let I=B(X.subtasks,K,X.id);if(I!==void 0)return I}}},H=B(e,at,null),me=(le,K)=>{let we=le.findIndex(X=>X.id===K);return xt==="below"?we+1:we};if(H===null){let le=me(e,at);v?.(tt,null,le);}else {let le=It.find(K=>K.task.id===H)?.task;if(le?.subtasks){let K=me(le.subtasks,at);v?.(tt,H,K);}}}}ve(null),Bt(null),xa(null),jt.current=false;};react.useEffect(()=>{if(tt)return document.addEventListener("mousemove",ke),document.addEventListener("mouseup",ye),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",ye),document.body.style.cursor="",document.body.style.userSelect="";}},[tt,at,xt]);let Ea=(B,H,me)=>{switch(B.id){case "name":let le=W===H.id,K=C===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*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:K?1:.3},onMouseDown:ce=>ga(H.id,ce),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),d?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(H.subtasks&&H.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),le?jsxRuntime.jsx("input",{ref:se,type:"text",value:$,onChange:ce=>V(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"?Zt(H.id):ce.key==="Escape"&&kt();},onBlur:()=>Zt(H.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ce=>ce.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:H.name}),K&&!le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ce=>ce.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ce=>Qt(H,ce),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:ce=>{ce.stopPropagation(),be(H);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":let we=H.startDate?typeof H.startDate=="string"?H.startDate:H.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:we||"",onChange:ce=>{u?.(H.id,{startDate:ce.target.value?new Date(ce.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=H.endDate?typeof H.endDate=="string"?H.endDate:H.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:X||"",onChange:ce=>{u?.(H.id,{endDate:ce.target.value?new Date(ce.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:ie(H)})});case "assignees":let I=r.filter(ce=>H.assignees?.some(za=>za.name===ce.name||za.initials===ce.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Ha,{assignedUsers:I,availableUsers:r,onChange:ce=>{let za=ce.map(ar=>({id:ar.id,name:ar.name,initials:ar.initials,color:ar.color}));u?.(H.id,{assignees:za.length>0?za:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Ti,{status:H.status||"todo",onChange:ce=>{u?.(H.id,{status:ce,progress:ce==="completed"?100:H.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.progress}%`,backgroundColor:H.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[H.progress,"%"]})]});case "priority":let J={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ce={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},lt=J[H.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx($a,{priority:lt,onChange:ce=>{ce&&u?.(H.id,{priority:Ce[ce]||"medium"});}})});default:return null}},j=B=>[{id:"hide",label:"Hide Column",icon:Xe.Hide,onClick:()=>s(B),disabled:B==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Xe.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Xe.SortDesc,onClick:()=>{}}],Se=B=>B.subtasks&&B.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{N?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{x?x(B.id,B.name):y?.([B.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:Xe.Pencil,onClick:()=>{l?.(B);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{N?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xe.MarkIncomplete,onClick:()=>{u?.(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:Xe.SetInProgress,onClick:()=>{u?.(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:Xe.MarkComplete,onClick:()=>{u?.(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:Xe.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{x?x(B.id,B.name):y?.([B.id]);}}],de=p.filter(B=>B.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:`${Sa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[de.map((B,H)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B.id==="name"?"justify-between":"justify-center"}`,style:{...B.id==="name"?{flex:"1 1 auto",minWidth:`${B.minWidth??150}px`}:{width:`${B.width}px`,minWidth:`${B.minWidth??60}px`,maxWidth:`${B.maxWidth??2e3}px`,flexShrink:0},borderRight:H<de.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:me=>{me.preventDefault(),Re({isOpen:true,x:me.clientX,y:me.clientY,type:"header",columnId:B.id});},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:me=>{me.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:B.id==="name"?"1 1 auto":"none",minWidth:0},title:B.label,children:B.label}),B.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(fo,{columns:p,onToggleColumn:s,theme:t}),jsxRuntime.jsx("button",{onClick:()=>P(!z),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),B.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Y===B.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:me=>{me.preventDefault(),me.stopPropagation(),R(B.id),M(me.clientX),te(B.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"}})})]},B.id)),z&&jsxRuntime.jsxs("div",{ref:re,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:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:It.map(({task:B,level:H},me)=>{let le=ht(B.id),K=at===B.id,we={};return K&&xt&&(xt==="above"?(we.borderTopWidth="2px",we.borderTopStyle="solid",we.borderTopColor=t.accent):xt==="below"?(we.borderBottomWidth="2px",we.borderBottomStyle="solid",we.borderBottomColor=t.accent):xt==="child"&&(we.backgroundColor=t.accentLight,we.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":B.id,className:`flex items-center cursor-pointer group ${tt===B.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:le||K&&xt==="child"?t.accentLight:me%2===0?t.bgPrimary:t.bgGrid,...we},onMouseEnter:()=>A(B.id),onMouseLeave:()=>A(null),onClick:X=>{let J=br(e).map(ce=>ce.id),lt=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;Jt(B.id,J,lt,X.shiftKey),n?.(B);},onDoubleClick:X=>{X.stopPropagation(),l?.(B);},onContextMenu:X=>{X.preventDefault(),Re({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:B}),m?.(B,X);},whileHover:{backgroundColor:le?t.accentLight:t.hoverBg},children:de.map((X,I)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${X.id==="name"?"justify-start":"justify-center"} ${I<de.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:C===B.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ea(X,B,X.id==="name"?H:0)},`${B.id}-${X.id}`))},B.id)})}),jsxRuntime.jsx(fr,{isOpen:Le.isOpen,x:Le.x,y:Le.y,items:Le.type==="header"&&Le.columnId?j(Le.columnId):Le.type==="task"&&Le.task?Se(Le.task):[],onClose:()=>Re({...Le,isOpen:false}),theme:t})]})}function Nl(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,m]=react.useState(e),[d,i]=react.useState(t),[p,s]=react.useState(null),[c,u]=react.useState(null),[k,w]=react.useState(null),[h,y]=react.useState(null),[f,g]=react.useState(0),[T,N]=react.useState(0),[b,x]=react.useState(null),[v,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:m,ghostWidth:d,setGhostWidth:i,connectionLine:p,setConnectionLine:s,hoveredTaskId:c,setHoveredTaskId:u,activeZone:k,setActiveZone:w,draggedSegmentIndex:h,setDraggedSegmentIndex:y,draggedSegmentStartX:f,setDraggedSegmentStartX:g,segmentDragOffsetX:T,setSegmentDragOffsetX:N,hoveredSegmentIndex:b,setHoveredSegmentIndex:x,isHovered:v,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(W,E)=>{r("none"),s(null),u(null),m(W),i(E),N(0),y(null),g(0);}}}function yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:u=[],onDragMove:k}){let w=Nl(t,r),h=react.useRef(null),{dragMode:y,setDragMode:f,dragOffset:g,setDragOffset:T,ghostX:N,setGhostX:b,ghostWidth:x,setGhostWidth:v,connectionLine:S,setConnectionLine:C,hoveredTaskId:A,setHoveredTaskId:z,activeZone:P,setActiveZone:W,draggedSegmentIndex:E,setDraggedSegmentIndex:$,draggedSegmentStartX:V,setDraggedSegmentStartX:re,segmentDragOffsetX:se,setSegmentDragOffsetX:Y,hoveredSegmentIndex:R,setHoveredSegmentIndex:O,isHovered:M,setIsHovered:ge,isDragging:te,isResizing:Le,isConnecting:Re,resetDragState:tt}=w,ve=32,at=8,Bt=e.endDate&&e.endDate<new Date&&e.progress<100,xt=e.isCriticalPath,xa=o.name==="neutral"||o.today==="#1C1917",Xt=e.status==="completed"||e.progress===100,ua={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Et=e.isCriticalPath||Bt?"#DC2626":e.color?e.color:e.priority&&ua[e.priority]?ua[e.priority]:o.taskBarPrimary,ht=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),je=r<50,Ut=r<40,It=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Sa=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},ie=j=>Math.round(j/n)*n,be=j=>{let Se=Math.round(j/n),de=new Date(l);return de.setDate(de.getDate()+Se),de},Zt=(j,Se)=>{for(let de of u){if(de.id===e.id)continue;let B=5;if(j>=de.x-B&&j<=de.x+de.width+B&&Se>=de.y-B&&Se<=de.y+de.height+B)return de.id}return null},kt=react.useCallback((j,Se,de)=>{j.preventDefault(),j.stopPropagation();let B=h.current?.ownerSVGElement;if(!B)return;let H=B.createSVGPoint();H.x=j.clientX,H.y=j.clientY;let me=H.matrixTransform(B.getScreenCTM()?.inverse()),le=de!==void 0?de:t,K=Se;if(!K){let we=me.x-le;j.shiftKey?(K="connect",C({x:t+r,y:a+ve/2})):j.ctrlKey||j.metaKey?K="move":j.altKey?K=we<r/2?"resize-start":"resize-end":Ut?we<r/2?K="move":K="resize-end":je?we<=ht/2?K="resize-start":we>=r-ht/2?K="resize-end":K="move":we<=ht?K="resize-start":we>=r-ht?K="resize-end":K="move";}f(K),ge(false),W(null),K==="move"?T(me.x-le):K==="connect"?C({x:t+r,y:a+ve/2}):T(0),b(le),v(r);},[t,r,a,ve]),Qt=react.useCallback(j=>{if(y==="none")return;let Se=h.current?.ownerSVGElement;if(!Se)return;let de=Se.createSVGPoint();de.x=j.clientX,de.y=j.clientY;let B=de.matrixTransform(Se.getScreenCTM()?.inverse());if(y==="connect"){C({x:B.x,y:B.y});let H=Zt(B.x,B.y);z(H);}else if(y==="move"){let H=B.x-g,me=ie(H);b(me),v(r);let le=Math.round((me-t)/n);if(k?.(e.id,le,true),e.segments&&e.segments.length>0&&E!==null){let K=me-V;Y(K);}}else if(y==="resize-start"){let H=B.x,me=ie(H),le=t+r-me;le>=n&&(b(me),v(le));}else if(y==="resize-end"){let H=B.x,le=ie(H)-t;le>=n&&v(le);}},[y,t,r,n,g,e,ie,E,V,Zt,z,C,b,v,Y,k]),ga=react.useCallback(()=>{if(y!=="none"){if(y==="connect")A&&c&&c(e,A),C(null),z(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),Se,de,B=true;if(y==="move"){if(Se=be(N),de=new Date(Se.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let H=Math.round(se/n),me=e.segments.map((X,I)=>{if(I===E){let J=new Date(X.startDate),Ce=new Date(X.endDate);return J.setDate(J.getDate()+H),Ce.setDate(Ce.getDate()+H),{startDate:J,endDate:Ce}}return X}),le=me.flatMap(X=>[X.startDate,X.endDate]),K=new Date(Math.min(...le.map(X=>X.getTime()))),we=new Date(Math.max(...le.map(X=>X.getTime())));s?.({...e,segments:me},K,we),tt(t,r);return}}else y==="resize-start"?(Se=be(N),de=e.endDate,Se>=de&&(console.warn("Invalid date range: start date must be before end date"),B=false)):y==="resize-end"?(Se=e.startDate,de=be(N+x),de<=Se&&(console.warn("Invalid date range: end date must be after start date"),B=false)):B=false;B&&Se&&de&&(de.getTime()-Se.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):s?.(e,Se,de));}k?.(e.id,0,false),tt(t,r);}},[y,N,x,e,s,A,c,t,r,n,be,se,E,tt,k]);react.useEffect(()=>{if(y==="none")return;let j=de=>{Qt(de);},Se=()=>{ga();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Se),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Se);}},[y,Qt,ga]);let ke=te&&!Re?N:t,ye=te&&!Re?x:r,Ea=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!te&&ge(true),onMouseLeave:()=>{te||(ge(false),W(null));},onClick:()=>!te&&d?.(e),onDoubleClick:j=>{te||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),p?.(e,j);},children:[M&&!te&&!je&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ht,height:ve,fill:P==="resize-start"?o.accent:"transparent",opacity:P==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-start"),onMouseDown:j=>kt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ht,y:a,width:r-ht*2,height:ve,fill:P==="move"?o.accent:"transparent",opacity:P==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:j=>kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-ht,y:a,width:ht,height:ve,fill:P==="resize-end"?o.accent:"transparent",opacity:P==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:j=>kt(j,"resize-end")})]}),M&&!te&&Ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:P==="move"?o.accent:"transparent",opacity:P==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:j=>kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:P==="resize-end"?o.accent:"transparent",opacity:P==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:j=>kt(j,"resize-end")}),M&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),te&&!Re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:x,height:ve,rx:at,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:ye,height:ve,rx:at,fill:Et,"data-task-class":Ea,initial:{opacity:0,scale:.95},animate:{opacity:te&&!Re?.15:e.parentId?.6:M?.9:.8,scale:M&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>kt(j),style:{cursor:te?Re?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye*(e.progress/100),height:ve,rx:at,fill:Et,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,Se)=>{let de=(j.startDate.getTime()-l.getTime())/864e5*n,H=(j.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-de+n,me=te&&y==="move"&&E===Se,le=R===Se,K=me?de+se:de;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!te&&O(Se),onMouseLeave:()=>!te&&O(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:K,y:a,width:H,height:ve,rx:at,fill:Et,initial:{opacity:0,scale:.95},animate:{opacity:me||e.parentId?.6:le?.9:.8,scale:le&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:we=>{we.stopPropagation(),$(Se),re(de),kt(we,void 0,de);},style:{cursor:te?Re?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:K,y:a,width:H*(e.progress/100),height:ve,rx:at,fill:Et,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Se}`)}),xa&&(Bt||xt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[xt&&!Bt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye,height:ve,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Bt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye,height:ve,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ye>60&&!e.segments&&(()=>{let j=m.taskLabel(e),Se=typeof j=="string"?j:e.name,de=Se.length>Math.floor(ye/8)?`${Se.substring(0,Math.floor(ye/8))}...`:Se;return jsxRuntime.jsx("text",{x:ke+12,y:a+ve/2,dominantBaseline:"middle",fill:Xt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Xt?"line-through":"none"},children:de})})(),ye>100&&e.progress>0&&e.progress<100&&!te&&!e.segments&&jsxRuntime.jsxs("text",{x:ke+ye-12,y:a+ve/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&&ye>80&&!te&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ke+ye-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ke+ye-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(M||Le)&&!Re&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:je?ke-15:ke-10,y:a-5,width:je?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>kt(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je?ke-8:ke-3,y:a+6,width:je?8:6,height:je?ve-12:ve-16,rx:3,fill:y==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="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+ye-10,y:a-5,width:je?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>kt(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je?ke+ye:ke+ye-3,y:a+6,width:je?8:6,height:je?ve-12:ve-16,rx:3,fill:y==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!te&&!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+ve/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:j=>{j.stopPropagation(),kt(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ve/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Re&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:S.x,y2:S.y,stroke:A?o.statusCompleted:o.accent,strokeWidth:A?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:A?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:S.x,cy:S.y,r:A?8:6,fill:A?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),A&&jsxRuntime.jsx(framerMotion.motion.text,{x:S.x+15,y:S.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.x+15},transition:{duration:.2},children:"Connect"})]}),(M||te)&&!Re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke-2,y:a-2,width:ye+4,height:ve+4,rx:at+2,fill:"none",stroke:te?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:te?.6:.4,initial:{opacity:0},animate:{opacity:te?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+x,y1:0,x2:N+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!te&&!e.segments&&(()=>{let de=a<100,B=de?a+ve+13:a-82-13,H=de?`M ${ke+ye/2-6} ${a+ve+3} L ${ke+ye/2} ${a+ve+13} L ${ke+ye/2+6} ${a+ve+3}`:`M ${ke+ye/2-6} ${a-13} L ${ke+ye/2} ${a-3} L ${ke+ye/2+6} ${a-13}`,me=B+22,le=B+40,K=B+55,we=B+70,X=de?B+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:de?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:de?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:H,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ke+ye/2-120,y:B,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+ye/2,y:me,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+ye/2-110,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ke+ye/2-70,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.startDate)}),jsxRuntime.jsx("text",{x:ke+ye/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ke+ye/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.endDate)}),jsxRuntime.jsx("text",{x:ke+ye/2+10,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ke+ye/2+65,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Sa()}),jsxRuntime.jsx("text",{x:ke+ye/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ke+ye/2+65,y:K,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+ye/2-110,y:we,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ke+ye/2-50,y:we,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(I=>I.name).join(", ").substring(0,30),e.assignees.map(I=>I.name).join(", ").length>30?"...":""]})]}),!de&&jsxRuntime.jsx("text",{x:ke+ye/2,y:X,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ut?"Left: move \u2022 Right: resize":je?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function ko({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[l,m]=react.useState(false),d=a-e,i=r-t,p=e+d/2,s=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,c=6,u=Math.atan2(i,d),k=a-c*Math.cos(u-Math.PI/6),w=r-c*Math.sin(u-Math.PI/6),h=a-c*Math.cos(u+Math.PI/6),y=r-c*Math.sin(u+Math.PI/6),f=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:s,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:s,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:l?1:.6,strokeWidth:l?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${k} ${w} M ${a} ${r} L ${h} ${y}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:l?1:.6,scale:l?1.1:1,strokeWidth:l?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:l?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),l&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:g=>{g.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Co({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),m=16,d=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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:d(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 q={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,m=new Set,d=i=>{if(!l.has(i)){l.add(i),m.add(i);let p=r.get(i)||[];for(let s of p){if(!l.has(s)&&d(s))return true;if(m.has(s))return true}}return m.delete(i),false};return d(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=q.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=q.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=q.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=q.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=q.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=q.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)=>q.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=q.findTaskById(e,t);return !a||!a.dependencies?[]:q.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>q.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>q.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=q.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=>q.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=q.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"]],m=n.map(d=>{let i=d.startDate&&d.endDate?q.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?q.formatDate(d.startDate):"N/A",d.endDate?q.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});r(o,{head:l,body:m,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=q.flattenTasks(e).map(d=>{let i=d.startDate&&d.endDate?q.calculateDuration(d.startDate,d.endDate):0;return {"Task ID":d.id,"Task Name":d.name,"Start Date":d.startDate?q.formatDate(d.startDate):"","End Date":d.endDate?q.formatDate(d.endDate):"","Duration (days)":i>0?i:"","Progress (%)":d.progress,Status:d.status||"",Assignees:d.assignees?.map(p=>p.name).join(", ")||"",Dependencies:d.dependencies?.join(", ")||"","Is Milestone":d.isMilestone?"Yes":"No","Parent ID":d.parentId||"",Level:d.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 m=a.utils.book_new();a.utils.book_append_sheet(m,n,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=q.flattenTasks(e),o=new Map;r.forEach((c,u)=>{o.set(c.id,u+1);});let n=c=>c.toISOString().replace("Z",""),l=q.getEarliestStartDate(e)||new Date,m=q.getLatestEndDate(e)||new Date,d=r.map((c,u)=>{let k=o.get(c.id),w=c.startDate&&c.endDate?q.calculateDuration(c.startDate,c.endDate):0,h=(c.dependencies||[]).filter(y=>o.has(y)).map(y=>`
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(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},d=e.reduce((i,p)=>{let s=p.category||"Other";return i[s]||(i[s]=[]),i[s].push(p),i},{});return jsxRuntime.jsxs("div",{className:L("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:L("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(d).map(([i,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:p.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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,m]=react.useState("export"),[d,i]=react.useState("json"),[p,s]=react.useState(null),c=react.useRef(null);if(!t)return null;let u=async()=>{let k=o?.current||void 0,h=await ri(e,d,k);oi(h,d);},v=async k=>{let h=k.target.files?.[0];if(h){try{let w=await ii(h),g=h.name.endsWith(".json")?"json":"csv",f=si(w,g);s(f),f.success&&r&&r(f,w);}catch(w){s({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}c.current&&(c.current.value="");}};return jsxRuntime.jsxs("div",{className:L("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:()=>m("export"),className:L("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:()=>m("import"),className:L("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:L("p-4 rounded-lg border-2 transition-all text-center",d===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:c,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>c.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:L("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((k,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},h))})]})]})]})]})]})}var Op=["URGENT","HIGH","MEDIUM","LOW"],zp=[{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"}],$p=[{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:m,availableUsers:d=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:s=true,compact:c=false,groupBy:u="none",onGroupByChange:v}){let[k,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]),D=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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 ${c?"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"}),T&&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"}),m&&jsxRuntime.jsx("button",{onClick:m,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 y=b.target.value;a({priorities:y==="all"?[]:[y]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Op.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let y=b.target.value;a({assignees:y==="all"?[]:[y]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.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 y=b.target.value;a({labels:y==="all"?[]:[y]});},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:f,className:"filter-bar__select filter-bar__select--sm",children:zp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:D,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>v(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:$p.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),T&&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:m,onExportGanttCSV:d}){let[i,p]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let u=v=>{s.current&&!s.current.contains(v.target)&&p(false);};return i&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[i]);let c=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:L("relative",r),ref:s,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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:()=>c(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:()=>c(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:()=>c(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:()=>c(async()=>await m?.()),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:()=>c(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>c(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:()=>c(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"}},zn={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:zn},uo="dark";var go=react.createContext(void 0),qp="asakaa-theme";function nl({children:e,defaultTheme:t=uo,storageKey:a=qp}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,d=qa[r];Object.entries(d.colors).forEach(([p,s])=>{s&&m.style.setProperty(`--theme-${Xp(p)}`,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(([p,s])=>{let c=d.colors[p];c&&m.style.setProperty(s,c);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.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 Xp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function $n({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ur();return e?jsxRuntime.jsxs("div",{className:L("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:L("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 Pe={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 sl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Pe[e]||Pe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Pe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Pe[e].bgSecondary),bgGrid:r("--theme-bg-card",Pe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Pe[e].bgWeekend),border:r("--theme-border-primary",Pe[e].border),borderLight:r("--theme-border-subtle",Pe[e].borderLight),textPrimary:r("--theme-text-primary",Pe[e].textPrimary),textSecondary:r("--theme-text-secondary",Pe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Pe[e].textTertiary),accent:r("--theme-accent-primary",Pe[e].accent),accentHover:r("--theme-accent-hover",Pe[e].accentHover),accentLight:r("--theme-accent-primary",Pe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Pe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Pe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Pe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Pe[e].dependency),dependencyHover:r("--theme-border-secondary",Pe[e].dependencyHover),criticalPath:r("--theme-error",Pe[e].criticalPath),criticalPathLight:r("--theme-error",Pe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Pe[e].today):e==="neutral"?r("--theme-text-primary",Pe[e].today):r("--theme-error",Pe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Pe[e].todayLight):e==="neutral"?r("--theme-text-primary",Pe[e].todayLight):r("--theme-error",Pe[e].todayLight),milestone:r("--theme-warning",Pe[e].milestone),milestoneLight:r("--theme-warning",Pe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Pe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Pe[e].statusInProgress),statusCompleted:r("--theme-success",Pe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Pe[e].hoverBg),focusRing:r("--theme-accent-primary",Pe[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"}},il={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:il};function ll(e){return Wn[e]||Wn.en}function Gn(e,t){let a=ll(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 Rr(){return react.useContext(fr)}function uu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[m,d]=react.useState(false),[i,p]=react.useState(null),s=react.useRef(null),c=Rr();if(react.useEffect(()=>{let h=w=>{s.current&&!s.current.contains(w.target)&&d(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||n||l))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler: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){p(h);try{await w();}catch(g){console.error(`Export ${h} failed:`,g);}finally{p(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:c.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((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<v.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=Rr();react.useEffect(()=>{let i=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],d=m.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"}: ${d}`,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:m.map((i,p)=>{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:p<m.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:p*.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:m,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:s,onCreateTask:c,onExportPNG:u,onExportPDF:v,onExportExcel:k,onExportCSV:h,onExportJSON:w,onExportMSProject:g}){let f=Rr(),D=u||v||k||h||w||g,T=[{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(fu,{options:T,value:t,onChange:y=>a(y),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:m,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:c,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||f.toolbar.createTask})]}),(D||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(uu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:k,onExportCSV:h,onExportJSON:w,onExportMSProject:g}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(gu,{options:b,value:n,onChange:y=>l(y),theme:e})]})]})}function ho({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=s=>{m.current&&!m.current.contains(s.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let p=d.current.getBoundingClientRect();l({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Re,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function br({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null),[m,d]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,s=r.length*36+8,c=8,u=window.innerWidth,v=window.innerHeight,k=t,h=a;t+p+c>u&&(k=t-p,k<c&&(k=c)),a+s+c>v&&(h=v-s-c,h<c&&(h=c)),d({x:k,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=c=>{l.current&&!l.current.contains(c.target)&&o();},s=c=>{c.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",s);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p: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:`${m.x}px`,top:`${m.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(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:s=>{p.disabled||(s.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.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 kl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:m,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:s,enableKeyboard:c=true}){let u=react.useRef(false),v=react.useCallback(f=>{u.current=f;},[]),k=react.useCallback(f=>{let D=[],T=b=>{for(let y of b)D.push(y),y.subtasks&&y.subtasks.length>0&&y.isExpanded&&T(y.subtasks);};return T(f),D},[]),h=react.useCallback(()=>{let f=k(e);for(let D of f)if(t.has(D.id))return D;return null},[e,t,k]),w=react.useCallback((f,D)=>{let T=k(e);if(T.length===0)return;let b=h();if(!b){a(T[0].id,false);return}let y=T.findIndex(C=>C.id===b.id);if(y===-1)return;let x=f==="up"?y-1:y+1;if(x<0||x>=T.length)return;let S=T[x];a(S.id,D);},[e,h,k,a]),g=react.useCallback(f=>{if(!c)return;let D=f.target;if(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable||u.current){f.key==="Escape"&&(D.blur(),u.current=false);return}let y=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,x=Array.from(t),S=h();if(f.key==="ArrowUp"){f.preventDefault(),w("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),w("down",f.shiftKey);return}if(S&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!S.isExpanded||f.key==="ArrowLeft"&&S.isExpanded)&&p(S.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){x.length>0&&(f.preventDefault(),l(x,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){x.length>0&&(f.preventDefault(),m(x));return}if(f.key==="Tab"&&f.shiftKey){x.length>0&&(f.preventDefault(),d(x));return}if(f.key==="Enter"&&!f.shiftKey&&!y){S&&(f.preventDefault(),r(S.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!y){S&&(f.preventDefault(),r(S.id,"above"));return}if(f.key==="Enter"&&y){S&&(f.preventDefault(),s(S.id));return}if(f.key==="F2"){S&&(f.preventDefault(),i(S.id));return}if(f.key==="Delete"||f.key==="Backspace"&&y){x.length>0&&(f.preventDefault(),o(x));return}if(f.key==="d"&&y&&!f.shiftKey){x.length>0&&(f.preventDefault(),n(x));return}},[c,t,h,w,r,o,n,l,m,d,i,p,s]);return react.useEffect(()=>{if(c)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g);}},[c,g]),{setIsEditing:v}}function Cl(){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(c=>{let u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u}),r(s);},[]),l=react.useCallback((s,c)=>{if(!a){o(s);return}let u=c.indexOf(a),v=c.indexOf(s);if(u===-1||v===-1){o(s);return}let k=Math.min(u,v),h=Math.max(u,v),w=c.slice(k,h+1);t(new Set(w)),r(s);},[a,o]),m=react.useCallback((s,c,u,v)=>{v?l(s,c):u?n(s):o(s);},[o,n,l]),d=react.useCallback((s,c)=>{c?t(u=>{let v=new Set(u);return v.add(s),v}):o(s);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(s=>e.has(s),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:m,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:p}}function hr(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let m={...r[l],parentId:o,level:n,position:l};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function Tl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Tl(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,c)=>{let u=[];return {tasks:s.filter(k=>{if(c.has(k.id))return u.push(k),false;if(k.subtasks){let h=l(k.subtasks,c);k.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},m=(s,c,u)=>s.map(v=>v.id===c?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:m(v.subtasks,c,u)}:v),d=new Set(t),{tasks:i,removed:p}=l(e,d);return m(i,n.id,p)}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,p,s)=>{for(let c=0;c<i.length;c++){let u=i[c];if(u.id===p&&u.subtasks){let v=u.subtasks.findIndex(k=>k.id===s);if(v!==-1){let[k]=u.subtasks.splice(v,1);return k}}if(u.subtasks){let v=l(u.subtasks,p,s);if(v)return v}}return null},m=(i,p,s)=>{let c=i.findIndex(u=>u.id===p);if(c!==-1)return i.splice(c+1,0,s),i;for(let u of i)u.subtasks&&m(u.subtasks,p,s);return i},d=l(a,o.id,r);d&&(n&&n.subtasks?m(n.subtasks,o.id,d):m(a,o.id,d));}return a}function Kn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,m,d)=>{let i=l.findIndex(s=>s.id===m);if(i===-1){for(let s of l)if(s.subtasks&&n(s.subtasks,m,d))return true;return false}let p=d==="up"?i-1:i+1;return p<0||p>=l.length?false:([l[i],l[p]]=[l[p],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 m=l.findIndex(p=>p.id===r);if(m===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let d=l[m],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?n(d.subtasks):void 0};return l.splice(m+1,0,i),true},n=l=>l.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function Dl(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"},m=d=>{let i=d.findIndex(s=>s.id===t);if(i===-1){for(let s of d)if(s.subtasks&&m(s.subtasks))return true;return false}let p=a==="above"?i:i+1;return d.splice(p,0,l),true};return m(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=p=>{for(let s of p){if(s.id===t)return s;if(s.subtasks){let c=a(s.subtasks);if(c)return c}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,m=r?.endDate||n,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(s=>{if(s.id===t){let c=s.subtasks||[];return {...s,subtasks:[...c,d],isExpanded:true}}return s.subtasks?{...s,subtasks:i(s.subtasks)}:s});return {tasks:i(e),newTask:d}}function Nl(e,t,a,r){if(t===a)return e;let o=Tl(e,t);if(!o)return e;if(a){let m=(d,i)=>{if(!d.subtasks)return false;for(let p of d.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let n=m=>m.filter(d=>d.id!==t).map(d=>d.subtasks&&d.subtasks.length>0?{...d,subtasks:n(d.subtasks)}:d),l=n(e);if(a===null){let m=r!==void 0?r:l.length;l.splice(m,0,{...o,parentId:void 0});}else {let m=d=>d.map(i=>{if(i.id===a){let p=i.subtasks||[],s=r!==void 0?r:p.length,c=[...p];return c.splice(s,0,{...o,parentId:a}),{...i,subtasks:c,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});l=m(l);}return l}function xo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:m,onTaskToggle:d,scrollTop:i,columns:p,onToggleColumn:s,onColumnResize:c,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:k,onTaskMove:h,onMultiTaskDelete:w,onTaskDuplicate:g,onTaskCreate:f,onTaskRename:D,onCreateSubtask:T,onOpenTaskModal:b,onDeleteRequest:y,onTaskReparent:x}){let S=react.useContext(fr),[C,P]=react.useState(null),[O,A]=react.useState(false),[U,j]=react.useState(null),[Z,pe]=react.useState(""),z=react.useRef(null),V=react.useRef(null),[_,F]=react.useState(null),[B,E]=react.useState(0),[Y,le]=react.useState(0),[se,Je]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Be,kt]=react.useState(null),[ge,wt]=react.useState(null),[gt,pa]=react.useState(null),ua=react.useRef(0),Yt=5,Rt=react.useRef(false);react.useEffect(()=>{function I(W){z.current&&!z.current.contains(W.target)&&A(false);}if(O)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[O]),react.useEffect(()=>{U&&V.current&&(V.current.focus(),V.current.select());},[U]),react.useEffect(()=>{if(!_)return;let I=de=>{let ue=de.clientX-B,q=Y+ue;c?.(_,q);},W=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",I),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect="";}},[_,B,Y,c]);let{selectedTaskIds:qt,handleTaskClick:At,isTaskSelected:ga}=Cl(),{setIsEditing:dt}=kl({tasks:e,selectedTaskIds:qt,onTaskSelect:(I,W)=>{let ue=hr(e).map(q=>q.id);At(I,ue,W||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:g||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:I=>{let W=hr(e).find(de=>de.id===I);W&&ve(W);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:I=>{let W=hr(e).find(de=>de.id===I);W&&b&&b(W);},enableKeyboard:true}),tt=(I,W=0)=>{let de=[];for(let ue of I)de.push({task:ue,level:W}),ue.subtasks&&ue.subtasks.length>0&&ue.isExpanded&&de.push(...tt(ue.subtasks,W+1));return de},Pt=tt(e),Ca=48,ie=I=>!I.startDate||!I.endDate?"-":`${Math.ceil((I.endDate.getTime()-I.startDate.getTime())/(1e3*60*60*24))}d`,ve=I=>{j(I.id),pe(I.name),dt(true);},Gt=I=>{Z.trim()&&Z!==e.find(W=>W.id===I)?.name&&D?.(I,Z.trim()),j(null),pe(""),dt(false);},fa=()=>{j(null),pe(""),dt(false);},vt=(I,W)=>{W.stopPropagation(),T?.(I.id);},ba=(I,W)=>{W.preventDefault(),ua.current=W.clientY,kt(I),Rt.current=false;},ha=I=>{if(!Be||(Math.abs(I.clientY-ua.current)>Yt&&(Rt.current=true),!Rt.current))return;let de=document.querySelectorAll("[data-task-row]"),ue=null,q=null;de.forEach(ce=>{let X=ce.getBoundingClientRect(),M=ce.getAttribute("data-task-row");if(M&&M!==Be&&I.clientY>=X.top&&I.clientY<=X.bottom){ue=M;let J=I.clientY-X.top,Te=X.height;J<Te*.25?q="above":J>Te*.75?q="below":q="child";}}),wt(ue),pa(q);},ke=()=>{if(Rt.current&&Be&&ge&&gt){if(gt==="child")x?.(Be,ge);else if(gt==="above"||gt==="below"){let I=(ue,q,ce=null)=>{for(let X of ue){if(X.id===q)return ce;if(X.subtasks){let M=I(X.subtasks,q,X.id);if(M!==void 0)return M}}},W=I(e,ge,null),de=(ue,q)=>{let ce=ue.findIndex(X=>X.id===q);return gt==="below"?ce+1:ce};if(W===null){let ue=de(e,ge);x?.(Be,null,ue);}else {let ue=Pt.find(q=>q.task.id===W)?.task;if(ue?.subtasks){let q=de(ue.subtasks,ge);x?.(Be,W,q);}}}}kt(null),wt(null),pa(null),Rt.current=false;};react.useEffect(()=>{if(Be)return document.addEventListener("mousemove",ha),document.addEventListener("mouseup",ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ha),document.removeEventListener("mouseup",ke),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,ge,gt]);let Ce=(I,W,de)=>{switch(I.id){case "name":let ue=U===W.id,q=C===W.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${de*20}px`},children:[x&&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:me=>ba(W.id,me),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:me=>{me.stopPropagation(),d?.(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"}),ue?jsxRuntime.jsx("input",{ref:V,type:"text",value:Z,onChange:me=>pe(me.target.value),onKeyDown:me=>{me.key==="Enter"?Gt(W.id):me.key==="Escape"&&fa();},onBlur:()=>Gt(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:me=>me.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}),q&&!ue&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:me=>vt(W,me),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),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 ce=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:me=>me.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ce||"",onChange:me=>{u?.(W.id,{startDate:me.target.value?new Date(me.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=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:me=>me.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:X||"",onChange:me=>{u?.(W.id,{endDate:me.target.value?new Date(me.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:ie(W)})});case "assignees":let M=r.filter(me=>W.assignees?.some(Ga=>Ga.name===me.name||Ga.initials===me.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(Va,{assignedUsers:M,availableUsers:r,onChange:me=>{let Ga=me.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:me=>me.stopPropagation(),children:jsxRuntime.jsx(Ni,{status:W.status||"todo",onChange:me=>{u?.(W.id,{status:me,progress:me==="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 J={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Te={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ve=J[W.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(Ha,{priority:Ve,onChange:me=>{me&&u?.(W.id,{priority:Te[me]||"medium"});}})});default:return null}},ct=I=>[{id:"hide",label:"Hide Column",icon:qe.Hide,onClick:()=>s(I),disabled:I==="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:()=>{}}],ae=I=>I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:qe.Add,onClick:()=>{T?.(I.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:qe.Delete,onClick:()=>{y?y(I.id,I.name):w?.([I.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:qe.Pencil,onClick:()=>{l?.(I);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:qe.Add,onClick:()=>{T?.(I.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:qe.MarkIncomplete,onClick:()=>{u?.(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:qe.SetInProgress,onClick:()=>{u?.(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:qe.MarkComplete,onClick:()=>{u?.(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:qe.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:qe.Delete,onClick:()=>{y?y(I.id,I.name):w?.([I.id]);}}],ye=p.filter(I=>I.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((I,W)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${I.id==="name"?"justify-between":"justify-center"}`,style:{...I.id==="name"?{flex:"1 1 auto",minWidth:`${I.minWidth??150}px`}:{width:`${I.width}px`,minWidth:`${I.minWidth??60}px`,maxWidth:`${I.maxWidth??2e3}px`,flexShrink:0},borderRight:W<ye.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:de=>{de.preventDefault(),Je({isOpen:true,x:de.clientX,y:de.clientY,type:"header",columnId:I.id});},onMouseEnter:de=>{de.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:de=>{de.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:I.id==="name"?"1 1 auto":"none",minWidth:0},title:I.label,children:I.label}),I.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(ho,{columns:p,onToggleColumn:s,theme:t}),jsxRuntime.jsx("button",{onClick:()=>A(!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"})})]}),I.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_===I.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:de=>{de.preventDefault(),de.stopPropagation(),F(I.id),E(de.clientX),le(I.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"}})})]},I.id)),O&&jsxRuntime.jsxs("div",{ref:z,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:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>A(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:Pt.map(({task:I,level:W},de)=>{let ue=ga(I.id),q=ge===I.id,ce={};return q&&gt&&(gt==="above"?(ce.borderTopWidth="2px",ce.borderTopStyle="solid",ce.borderTopColor=t.accent):gt==="below"?(ce.borderBottomWidth="2px",ce.borderBottomStyle="solid",ce.borderBottomColor=t.accent):gt==="child"&&(ce.backgroundColor=t.accentLight,ce.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":I.id,className:`flex items-center cursor-pointer group ${Be===I.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ue||q&&gt==="child"?t.accentLight:de%2===0?t.bgPrimary:t.bgGrid,...ce},onMouseEnter:()=>P(I.id),onMouseLeave:()=>P(null),onClick:X=>{let J=hr(e).map(me=>me.id),Ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;At(I.id,J,Ve,X.shiftKey),n?.(I);},onDoubleClick:X=>{X.stopPropagation(),l?.(I);},onContextMenu:X=>{X.preventDefault(),Je({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:I}),m?.(I,X);},whileHover:{backgroundColor:ue?t.accentLight:t.hoverBg},children:ye.map((X,M)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${X.id==="name"?"justify-start":"justify-center"} ${M<ye.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:C===I.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ce(X,I,X.id==="name"?W:0)},`${I.id}-${X.id}`))},I.id)})}),jsxRuntime.jsx(br,{isOpen:se.isOpen,x:se.x,y:se.y,items:se.type==="header"&&se.columnId?ct(se.columnId):se.type==="task"&&se.task?ae(se.task):[],onClose:()=>Je({...se,isOpen:false}),theme:t})]})}function Sl(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,m]=react.useState(e),[d,i]=react.useState(t),[p,s]=react.useState(null),[c,u]=react.useState(null),[v,k]=react.useState(null),[h,w]=react.useState(null),[g,f]=react.useState(0),[D,T]=react.useState(0),[b,y]=react.useState(null),[x,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:m,ghostWidth:d,setGhostWidth:i,connectionLine:p,setConnectionLine:s,hoveredTaskId:c,setHoveredTaskId:u,activeZone:v,setActiveZone:k,draggedSegmentIndex:h,setDraggedSegmentIndex:w,draggedSegmentStartX:g,setDraggedSegmentStartX:f,segmentDragOffsetX:D,setSegmentDragOffsetX:T,hoveredSegmentIndex:b,setHoveredSegmentIndex:y,isHovered:x,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(U,j)=>{r("none"),s(null),u(null),m(U),i(j),T(0),w(null),f(0);}}}function ko({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:u=[],onDragMove:v,onHoverChange:k}){let h=Sl(t,r),w=react.useRef(null),{dragMode:g,setDragMode:f,dragOffset:D,setDragOffset:T,ghostX:b,setGhostX:y,ghostWidth:x,setGhostWidth:S,connectionLine:C,setConnectionLine:P,hoveredTaskId:O,setHoveredTaskId:A,activeZone:U,setActiveZone:j,draggedSegmentIndex:Z,setDraggedSegmentIndex:pe,draggedSegmentStartX:z,setDraggedSegmentStartX:V,segmentDragOffsetX:_,setSegmentDragOffsetX:F,hoveredSegmentIndex:B,setHoveredSegmentIndex:E,isHovered:Y,setIsHovered:le,isDragging:se,isResizing:Je,isConnecting:Be,resetDragState:kt}=h,ge=32,wt=8,gt=e.endDate&&e.endDate<new Date&&e.progress<100,pa=e.isCriticalPath,ua=o.name==="neutral"||o.today==="#1C1917",Yt=e.status==="completed"||e.progress===100,Rt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},At=e.isCriticalPath||gt?"#DC2626":e.color?e.color:e.priority&&Rt[e.priority]?Rt[e.priority]:o.taskBarPrimary,dt=(ae=>ae>=80?20:ae>=60?15:ae>=50?12:10)(r),tt=r<50,Pt=r<40;react.useEffect(()=>{if(k)if(Y&&!se&&!e.segments){let ae=a<100;k({task:e,x:t,y:a,width:r,height:ge,showBelow:ae});}else k(null);},[Y,se,e,t,a,r,ge,k]);let Ca=ae=>ae.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ie=()=>{let ae=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ae} day${ae!==1?"s":""}`},ve=ae=>Math.round(ae/n)*n,Gt=ae=>{let ye=Math.round(ae/n),I=new Date(l);return I.setDate(I.getDate()+ye),I},fa=(ae,ye)=>{for(let I of u){if(I.id===e.id)continue;let W=5;if(ae>=I.x-W&&ae<=I.x+I.width+W&&ye>=I.y-W&&ye<=I.y+I.height+W)return I.id}return null},vt=react.useCallback((ae,ye,I)=>{ae.preventDefault(),ae.stopPropagation();let W=w.current?.ownerSVGElement;if(!W)return;let de=W.createSVGPoint();de.x=ae.clientX,de.y=ae.clientY;let ue=de.matrixTransform(W.getScreenCTM()?.inverse()),q=I!==void 0?I:t,ce=ye;if(!ce){let X=ue.x-q;ae.shiftKey?(ce="connect",P({x:t+r,y:a+ge/2})):ae.ctrlKey||ae.metaKey?ce="move":ae.altKey?ce=X<r/2?"resize-start":"resize-end":Pt?X<r/2?ce="move":ce="resize-end":tt?X<=dt/2?ce="resize-start":X>=r-dt/2?ce="resize-end":ce="move":X<=dt?ce="resize-start":X>=r-dt?ce="resize-end":ce="move";}f(ce),le(false),j(null),ce==="move"?T(ue.x-q):ce==="connect"?P({x:t+r,y:a+ge/2}):T(0),y(q),S(r);},[t,r,a,ge]),ba=react.useCallback(ae=>{if(g==="none")return;let ye=w.current?.ownerSVGElement;if(!ye)return;let I=ye.createSVGPoint();I.x=ae.clientX,I.y=ae.clientY;let W=I.matrixTransform(ye.getScreenCTM()?.inverse());if(g==="connect"){P({x:W.x,y:W.y});let de=fa(W.x,W.y);A(de);}else if(g==="move"){let de=W.x-D,ue=ve(de);y(ue),S(r);let q=Math.round((ue-t)/n);if(v?.(e.id,q,true),e.segments&&e.segments.length>0&&Z!==null){let ce=ue-z;F(ce);}}else if(g==="resize-start"){let de=W.x,ue=ve(de),q=t+r-ue;q>=n&&(y(ue),S(q));}else if(g==="resize-end"){let de=W.x,q=ve(de)-t;q>=n&&S(q);}},[g,t,r,n,D,e,ve,Z,z,fa,A,P,y,S,F,v]),ha=react.useCallback(()=>{if(g!=="none"){if(g==="connect")O&&c&&c(e,O),P(null),A(null);else {let ae=e.endDate.getTime()-e.startDate.getTime(),ye,I,W=true;if(g==="move"){if(ye=Gt(b),I=new Date(ye.getTime()+ae),e.segments&&e.segments.length>0&&Z!==null){let de=Math.round(_/n),ue=e.segments.map((M,J)=>{if(J===Z){let Te=new Date(M.startDate),Ve=new Date(M.endDate);return Te.setDate(Te.getDate()+de),Ve.setDate(Ve.getDate()+de),{startDate:Te,endDate:Ve}}return M}),q=ue.flatMap(M=>[M.startDate,M.endDate]),ce=new Date(Math.min(...q.map(M=>M.getTime()))),X=new Date(Math.max(...q.map(M=>M.getTime())));s?.({...e,segments:ue},ce,X),kt(t,r);return}}else g==="resize-start"?(ye=Gt(b),I=e.endDate,ye>=I&&(console.warn("Invalid date range: start date must be before end date"),W=false)):g==="resize-end"?(ye=e.startDate,I=Gt(b+x),I<=ye&&(console.warn("Invalid date range: end date must be after start date"),W=false)):W=false;W&&ye&&I&&(I.getTime()-ye.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):s?.(e,ye,I));}v?.(e.id,0,false),kt(t,r);}},[g,b,x,e,s,O,c,t,r,n,Gt,_,Z,kt,v]);react.useEffect(()=>{if(g==="none")return;let ae=I=>{ba(I);},ye=()=>{ha();};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",ye),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",ye);}},[g,ba,ha]);let ke=se&&!Be?b:t,Ce=se&&!Be?x:r,ct=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:w,onMouseEnter:()=>!se&&le(true),onMouseLeave:()=>{se||(le(false),j(null));},onClick:()=>!se&&d?.(e),onDoubleClick:ae=>{se||(ae.stopPropagation(),i?.(e));},onContextMenu:ae=>{ae.preventDefault(),p?.(e,ae);},children:[Y&&!se&&!tt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:dt,height:ge,fill:U==="resize-start"?o.accent:"transparent",opacity:U==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-start"),onMouseDown:ae=>vt(ae,"resize-start")}),jsxRuntime.jsx("rect",{x:t+dt,y:a,width:r-dt*2,height:ge,fill:U==="move"?o.accent:"transparent",opacity:U==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>j("move"),onMouseDown:ae=>vt(ae,"move")}),jsxRuntime.jsx("rect",{x:t+r-dt,y:a,width:dt,height:ge,fill:U==="resize-end"?o.accent:"transparent",opacity:U==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-end"),onMouseDown:ae=>vt(ae,"resize-end")})]}),Y&&!se&&Pt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ge,fill:U==="move"?o.accent:"transparent",opacity:U==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>j("move"),onMouseDown:ae=>vt(ae,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ge,fill:U==="resize-end"?o.accent:"transparent",opacity:U==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-end"),onMouseDown:ae=>vt(ae,"resize-end")}),Y&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ge-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!Be&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:b,y:a,width:x,height:ge,rx:wt,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:ge,rx:wt,fill:At,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:se&&!Be?.15:e.parentId?.6:Y?.9:.8,scale:Y&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ae=>vt(ae),style:{cursor:se?Be?"crosshair":Je?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ke,y:a,width:Ce*(e.progress/100),height:ge,rx:wt,fill:At,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ae,ye)=>{let I=(ae.startDate.getTime()-l.getTime())/864e5*n,de=(ae.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-I+n,ue=se&&g==="move"&&Z===ye,q=B===ye,ce=ue?I+_:I;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!se&&E(ye),onMouseLeave:()=>!se&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ce,y:a,width:de,height:ge,rx:wt,fill:At,initial:{opacity:0,scale:.95},animate:{opacity:ue||e.parentId?.6:q?.9:.8,scale:q&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>{X.stopPropagation(),pe(ye),V(I),vt(X,void 0,I);},style:{cursor:se?Be?"crosshair":Je?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ce,y:a,width:de*(e.progress/100),height:ge,rx:wt,fill:At,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ye}`)}),ua&&(gt||pa)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[pa&&!gt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:Ce,height:ge,rx:wt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),gt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:Ce,height:ge,rx:wt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ce>60&&!e.segments&&(()=>{let ae=m.taskLabel(e),ye=typeof ae=="string"?ae:e.name,I=ye.length>Math.floor(Ce/8)?`${ye.substring(0,Math.floor(Ce/8))}...`:ye;return jsxRuntime.jsx("text",{x:ke+12,y:a+ge/2,dominantBaseline:"middle",fill:Yt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Yt?"line-through":"none"},children:I})})(),Ce>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxRuntime.jsxs("text",{x:ke+Ce-12,y:a+ge/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&&!se&&!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})]}),(Y||Je)&&!Be&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:tt?ke-15:ke-10,y:a-5,width:tt?25:20,height:ge+10,fill:"transparent",onMouseDown:ae=>vt(ae,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?ke-8:ke-3,y:a+6,width:tt?8:6,height:tt?ge-12:ge-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:ke+Ce-10,y:a-5,width:tt?25:20,height:ge+10,fill:"transparent",onMouseDown:ae=>vt(ae,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?ke+Ce:ke+Ce-3,y:a+6,width:tt?8:6,height:tt?ge-12:ge-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:Y&&!se&&!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+ge/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:ae=>{ae.stopPropagation(),vt(ae,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ge/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Be&&C&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ge/2,x2:C.x,y2:C.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:C.x,cy:C.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: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"})]}),(Y||se)&&!Be&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke-2,y:a-2,width:Ce+4,height:ge+4,rx:wt+2,fill:"none",stroke:se?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Je&&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+x,y1:0,x2:b+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&!se&&!e.segments&&!k&&(()=>{let I=a<100,W=I?a+ge+13:a-82-13,de=I?`M ${ke+Ce/2-6} ${a+ge+3} L ${ke+Ce/2} ${a+ge+13} L ${ke+Ce/2+6} ${a+ge+3}`:`M ${ke+Ce/2-6} ${a-13} L ${ke+Ce/2} ${a-3} L ${ke+Ce/2+6} ${a-13}`,ue=W+22,q=W+40,ce=W+55,X=W+70,M=I?W+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:I?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:I?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:de,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:ue,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:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ke+Ce/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.startDate)}),jsxRuntime.jsx("text",{x:ke+Ce/2-110,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ke+Ce/2-70,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.endDate)}),jsxRuntime.jsx("text",{x:ke+Ce/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ke+Ce/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ie()}),jsxRuntime.jsx("text",{x:ke+Ce/2+10,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ke+Ce/2+65,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:ke+Ce/2-110,y:X,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ke+Ce/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?"...":""]})]}),!I&&jsxRuntime.jsx("text",{x:ke+Ce/2,y:M,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Pt?"Left: move \u2022 Right: resize":tt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Ml({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:n,height:l,showBelow:m}=e,d=82,i=13,p=m?o+l+i:o-d-i,s=m?`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}`,c=p+22,u=p+40,v=p+55,k=p+70,h=m?p+d-5:o-18,w=T=>T.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),g=()=>{if(!a.startDate||!a.endDate)return "N/A";let T=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${T} day${T!==1?"s":""}`},f=n<50,D=n<40;return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-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:p,width:240,height:d,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:c,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:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:v,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:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+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(T=>T.name).join(", ").substring(0,30),a.assignees.map(T=>T.name).join(", ").length>30?"...":""]})]}),!m&&jsxRuntime.jsx("text",{x:r+n/2,y:h,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:D?"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 To({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[l,m]=react.useState(false),d=a-e,i=r-t,p=e+d/2,s=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,c=6,u=Math.atan2(i,d),v=a-c*Math.cos(u-Math.PI/6),k=r-c*Math.sin(u-Math.PI/6),h=a-c*Math.cos(u+Math.PI/6),w=r-c*Math.sin(u+Math.PI/6),g=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:s,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:s,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:l?1:.6,strokeWidth:l?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${v} ${k} M ${a} ${r} L ${h} ${w}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:l?1:.6,scale:l?1.1:1,strokeWidth:l?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:l?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),l&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-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),m=16,d=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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:d(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 K={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,m=new Set,d=i=>{if(!l.has(i)){l.add(i),m.add(i);let p=r.get(i)||[];for(let s of p){if(!l.has(s)&&d(s))return true;if(m.has(s))return true}}return m.delete(i),false};return d(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=K.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=K.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=K.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=K.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=K.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=K.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)=>K.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=K.findTaskById(e,t);return !a||!a.dependencies?[]:K.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>K.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>K.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=K.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=>K.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=K.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"]],m=n.map(d=>{let i=d.startDate&&d.endDate?K.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?K.formatDate(d.startDate):"N/A",d.endDate?K.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});r(o,{head:l,body:m,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=K.flattenTasks(e).map(d=>{let i=d.startDate&&d.endDate?K.calculateDuration(d.startDate,d.endDate):0;return {"Task ID":d.id,"Task Name":d.name,"Start Date":d.startDate?K.formatDate(d.startDate):"","End Date":d.endDate?K.formatDate(d.endDate):"","Duration (days)":i>0?i:"","Progress (%)":d.progress,Status:d.status||"",Assignees:d.assignees?.map(p=>p.name).join(", ")||"",Dependencies:d.dependencies?.join(", ")||"","Is Milestone":d.isMilestone?"Yes":"No","Parent ID":d.parentId||"",Level:d.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 m=a.utils.book_new();a.utils.book_append_sheet(m,n,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=K.flattenTasks(e),o=new Map;r.forEach((c,u)=>{o.set(c.id,u+1);});let n=c=>c.toISOString().replace("Z",""),l=K.getEarliestStartDate(e)||new Date,m=K.getLatestEndDate(e)||new Date,d=r.map((c,u)=>{let v=o.get(c.id),k=c.startDate&&c.endDate?K.calculateDuration(c.startDate,c.endDate):0,h=(c.dependencies||[]).filter(w=>o.has(w)).map(w=>`
47
47
  <PredecessorLink>
48
- <PredecessorUID>${o.get(y)}</PredecessorUID>
48
+ <PredecessorUID>${o.get(w)}</PredecessorUID>
49
49
  <Type>1</Type>
50
50
  <CrossProject>0</CrossProject>
51
51
  <LinkLag>0</LinkLag>
52
52
  <LagFormat>7</LagFormat>
53
53
  </PredecessorLink>`).join("");return `
54
54
  <Task>
55
- <UID>${k}</UID>
55
+ <UID>${v}</UID>
56
56
  <ID>${u+1}</ID>
57
- <Name>${c.name.replace(/[<>&'"]/g,y=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[y]||y)}</Name>
57
+ <Name>${c.name.replace(/[<>&'"]/g,w=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[w]||w)}</Name>
58
58
  <Type>0</Type>
59
59
  <IsNull>0</IsNull>
60
60
  <CreateDate>${n(new Date)}</CreateDate>
@@ -64,9 +64,9 @@
64
64
  <Priority>500</Priority>
65
65
  <Start>${c.startDate?n(c.startDate):""}</Start>
66
66
  <Finish>${c.endDate?n(c.endDate):""}</Finish>
67
- <Duration>PT${w*8}H0M0S</Duration>
67
+ <Duration>PT${k*8}H0M0S</Duration>
68
68
  <DurationFormat>7</DurationFormat>
69
- <Work>PT${w*8}H0M0S</Work>
69
+ <Work>PT${k*8}H0M0S</Work>
70
70
  <Stop>${c.endDate?n(c.endDate):""}</Stop>
71
71
  <Resume>${c.startDate?n(c.startDate):""}</Resume>
72
72
  <ResumeValid>0</ResumeValid>
@@ -98,15 +98,15 @@
98
98
  <OvertimeWork>PT0H0M0S</OvertimeWork>
99
99
  <ActualStart>${c.progress>0&&c.startDate?n(c.startDate):""}</ActualStart>
100
100
  <ActualFinish>${c.progress===100&&c.endDate?n(c.endDate):""}</ActualFinish>
101
- <ActualDuration>PT${Math.round(w*c.progress/100)*8}H0M0S</ActualDuration>
101
+ <ActualDuration>PT${Math.round(k*c.progress/100)*8}H0M0S</ActualDuration>
102
102
  <ActualCost>0</ActualCost>
103
103
  <ActualOvertimeCost>0</ActualOvertimeCost>
104
- <ActualWork>PT${Math.round(w*c.progress/100)*8}H0M0S</ActualWork>
104
+ <ActualWork>PT${Math.round(k*c.progress/100)*8}H0M0S</ActualWork>
105
105
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
106
- <RegularWork>PT${w*8}H0M0S</RegularWork>
107
- <RemainingDuration>PT${Math.round(w*(100-c.progress)/100)*8}H0M0S</RemainingDuration>
106
+ <RegularWork>PT${k*8}H0M0S</RegularWork>
107
+ <RemainingDuration>PT${Math.round(k*(100-c.progress)/100)*8}H0M0S</RemainingDuration>
108
108
  <RemainingCost>0</RemainingCost>
109
- <RemainingWork>PT${Math.round(w*(100-c.progress)/100)*8}H0M0S</RemainingWork>
109
+ <RemainingWork>PT${Math.round(k*(100-c.progress)/100)*8}H0M0S</RemainingWork>
110
110
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
111
111
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
112
112
  <ACWP>0</ACWP>
@@ -273,9 +273,9 @@
273
273
  </Calendars>
274
274
  <Tasks>${d}
275
275
  </Tasks>
276
- </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(p),s.download=a,s.click(),URL.revokeObjectURL(s.href);},calculateCriticalPath:e=>{let t=q.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,s=0;if(i.dependencies&&i.dependencies.length>0)for(let u of i.dependencies){let k=t.find(w=>w.id===u);if(k){o(k);let w=r.get(u)?.ef||0;s=Math.max(s,w);}}let c=s+p;r.set(i.id,{es:s,ef:c});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(i=>i.ef)),l=new Map,m=i=>{if(l.has(i.id))return;let p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,s=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),c=n;if(s.length>0)for(let k of s){m(k);let w=l.get(k.id)?.ls||0;c=Math.min(c,w);}let u=c-p;l.set(i.id,{ls:u,lf:c});};a.forEach(m);let d=[];for(let i of a){let p=r.get(i.id),s=l.get(i.id);if(p&&s){let c=s.ls-p.es;Math.abs(c)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let a=q.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(q.calculateCriticalPath(e).includes(t))return 0;let o=q.getDependentTasks(e,t);if(o.length===0){let m=q.getLatestEndDate(e);if(!m)return null;let d=q.calculateDuration(a.endDate,m);return Math.max(0,d)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,d)=>m-d)[0];if(!n)return null;let l=q.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>q.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=q.findTaskById(e,t);if(!r||!r.endDate)return e;let o=q.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let m=q.calculateDuration(l.startDate,l.endDate),d;a!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+a)):(d=new Date(r.endDate),d.setDate(d.getDate()+1));let i=q.calculateEndDate(d,m),p=s=>s.map(c=>c.id===l.id?{...c,startDate:d,endDate:i}:c.subtasks?{...c,subtasks:p(c.subtasks)}:c);n=p(n),n=q.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,m)=>{if(a===0)return [];let d=[],i=o.getTime(),p=1e3*60*60*24,s=q.findTaskById(e,t);if(!s||!s.endDate)return [];let c=(u,k,w=new Set)=>{if(w.has(u))return;w.add(u);let h=q.getDependentTasks(e,u);for(let y of h){if(!y.startDate||!y.endDate)continue;let f=r.findIndex(A=>A.id===y.id);if(f===-1)continue;let g=y.startDate.getTime(),N=(y.endDate.getTime()-g)/p,x=(g-i)/p*n,v=x+k*n,S=Math.max(N*n,n),C=m+f*l+12;d.push({taskId:y.id,taskName:y.name,originalX:x,previewX:v,width:S,y:C,rowIndex:f,daysDelta:k,color:y.color}),c(y.id,k,w);}};return c(t,a),d},splitTask:(e,t,a,r=3)=>{let o=q.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let d=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:m}],i=p=>p.map(s=>s.id===o.id?{...s,endDate:m,segments:d}:s.subtasks?{...s,subtasks:i(s.subtasks)}:s);return i(e)}};function Do({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:m,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:p,onTaskDateChange:s,onDependencyCreate:c,onDependencyDelete:u}){let[w,h]=react.useState([]),y=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),f=r==="day"?60:r==="week"?20:8,g=y*f*l,T=E=>{let $=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),V=$.getUTCDay()||7;$.setUTCDate($.getUTCDate()+4-V);let re=new Date(Date.UTC($.getUTCFullYear(),0,1));return Math.ceil((($.getTime()-re.getTime())/864e5+1)/7)},N=E=>{let $=E.getDay();return $===0||$===6},b=react.useCallback(E=>{let $=Math.round(E/(f*l)),V=new Date(o);return V.setDate(V.getDate()+$),V},[o,f,l]),x=react.useCallback((E,$)=>{if($.startDate&&$.endDate)return;let V=E.currentTarget.ownerSVGElement;if(!V)return;let re=V.createSVGPoint();re.x=E.clientX,re.y=E.clientY;let se=re.matrixTransform(V.getScreenCTM()?.inverse()),Y=b(se.x),R=new Date(Y);R.setDate(R.getDate()+1),s?.($,Y,R);},[b,s]),v=react.useMemo(()=>{let E=se=>se.map(Y=>{if(Y.subtasks&&Y.subtasks.length>0){let R=E(Y.subtasks),O=R.filter(M=>M.startDate&&M.endDate);if(O.length>0){let M=O.map(Re=>Re.startDate.getTime()),ge=O.map(Re=>Re.endDate.getTime()),te=new Date(Math.min(...M)),Le=new Date(Math.max(...ge));return {...Y,subtasks:R,startDate:te,endDate:Le}}return {...Y,subtasks:R}}return Y}),$=(se,Y=[])=>{for(let R of se)Y.push(R),R.subtasks&&R.subtasks.length>0&&(R.isExpanded===void 0||R.isExpanded)&&$(R.subtasks,Y);return Y},V=E(e);return $(V)},[e]),S=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let $=E.startDate.getTime(),V=E.endDate.getTime(),re=o.getTime(),se=($-re)/(1e3*60*60*24),Y=(V-$)/(1e3*60*60*24),R=se*f*l,O=Math.max(f*l,40),M=Math.max(Y*f*l,O);return {x:R,width:M}},[o,f,l]),C=react.useMemo(()=>v.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:$,width:V}=S(E),se=v.findIndex(Y=>Y.id===E.id)*a+12;return {id:E.id,x:$,y:se,width:V,height:32}}),[v,S]),A=react.useCallback((E,$,V)=>{if(!V||$===0){h([]);return}let re=q.calculateCascadePreview(e,E,$,v,o,f*l,a,48);h(re);},[e,v,o,f,l,a,48]),z=react.useMemo(()=>{let E=[],$=new Date(o);for(;$<=n;){let se=($.getTime()-o.getTime())/864e5*f*l;if(r==="day")E.push({date:new Date($),label:$.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:se}),$.setDate($.getDate()+1);else if(r==="week"){let Y=T($);E.push({date:new Date($),label:`Week ${Y}`,x:se}),$.setDate($.getDate()+7);}else E.push({date:new Date($),label:$.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:se}),$.setMonth($.getMonth()+1);}return E},[o,n,r,f,l]),P=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*f*l,[o,f,l]),W=Math.max(v.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(g,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(g,1e3),height:48,fill:t.bgGrid}),z.map((E,$)=>jsxRuntime.jsxs("g",{children:[$>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-${$}`)),P>=0&&P<=g&&jsxRuntime.jsx("circle",{cx:P,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(g,1e3),height:W,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(g,1e3),height:W,fill:t.bgPrimary}),z.map((E,$)=>{let V=z[$+1]?.x||g,re=N(E.date);return jsxRuntime.jsxs("g",{children:[re&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:V-E.x,height:v.length*a,fill:t.bgWeekend,opacity:1}),$>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:v.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},$)}),P>=0&&P<=g&&jsxRuntime.jsx("line",{x1:P,y1:0,x2:P,y2:v.length*a,stroke:t.today,strokeWidth:2,opacity:1}),v.map((E,$)=>{let V=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:g,height:a,fill:$%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:g,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:re=>x(re,E),onMouseEnter:re=>{re.currentTarget.setAttribute("fill",t.accentLight),re.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:re=>{re.currentTarget.setAttribute("fill","transparent"),re.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:P>0?P:100,y:$*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}`)}),v.map((E,$)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(V=>{let re=v.find(O=>O.id===V);if(!re||!re.startDate||!re.endDate)return null;let se=v.findIndex(O=>O.id===V),Y=S(re),R=S(E);return jsxRuntime.jsx(ko,{x1:Y.x+Y.width,y1:se*a+a/2,x2:R.x,y2:$*a+a/2,theme:t,onDelete:()=>u?.(E.id,V)},`dep-${V}-${E.id}`)})),v.map((E,$)=>{if(!E.startDate||!E.endDate)return null;let{x:V,width:re}=S(E),se=$*a+12,Y=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Co,{task:E,x:V+re/2,y:se+16,theme:t,onClick:d},E.id):Y?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),onContextMenu:R=>{R.preventDefault(),R.stopPropagation(),p?.(E,R);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:V,y:se,width:re,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:V,y1:se,x2:V+re,y2:se,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:se,x2:V,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V+re,y1:se,x2:V+re,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:se+32,x2:V+re,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),re>60&&jsxRuntime.jsx("text",{x:V+12,y:se+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(yo,{task:E,x:V,y:se,width:re,theme:t,dayWidth:f*l,startDate:o,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:C,onDragMove:A},E.id)}),w.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}`))]})]})}var Pl=[{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 Ml({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:Pl.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:Pl.find(r=>r.value===e)?.name||"Personalizado"})]})}var Fl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function So({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:m=a?"edit":"create",theme:d="dark",customStatuses:i=[]}){let p=[...Fl,...i.filter(x=>!Fl.some(v=>v.id===x.id))],s=Pe[d]||Pe.dark,[c,u]=react.useState(false),k={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},w={color:s.textSecondary},[h,y]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[f,g]=react.useState({});react.useEffect(()=>{a?(y({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)):(y({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},N=async x=>{if(x.preventDefault(),!!T())try{await n(h),t();}catch(v){console.error("Error submitting task:",v);}},b=(x,v)=>{y(S=>{let C={...S,[x]:v};if(x==="progress"){let A=typeof v=="number"?v:parseInt(v,10);A===100&&S.status!=="completed"?C.status="completed":A>0&&A<100&&S.status==="todo"?C.status="in-progress":A===0&&S.status!=="todo"&&(C.status="todo");}return C}),f[x]&&g(S=>{let C={...S};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:m==="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: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:w,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:k,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:w,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:k,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:k,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:w,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 S=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",S);},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:w,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:k,disabled:l,children:p.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:w,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:k,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:w,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:w,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ml,{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:w,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:k,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(!c),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:[c?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:c&&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:w,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 S=v.target.checked?[...h.dependencies||[],x.id]:(h.dependencies||[]).filter(C=>C!==x.id);b("dependencies",S);},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: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: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"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var bg=['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"'],Rl=()=>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"})]}),hg=()=>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"})}),vg=()=>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"})}),yg=()=>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"})}),xg=()=>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 Eo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:m,onDependencyDelete:d}){let[i,p]=react.useState(false),[s,c]=react.useState(false),[u,k]=react.useState([]),[w,h]=react.useState(""),[y,f]=react.useState(false),[g,T]=react.useState(true),N=react.useRef(null),b=react.useRef(null),x=react.useRef(null),{enabled:v=true,placeholder:S='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:A,suggestions:z=bg,maxHistory:P=50,persistHistory:W}=a,E=W?.storageKey||"gantt-ai-history",$=W?.maxMessages??5;react.useEffect(()=>{if(W?.enabled)try{let O=localStorage.getItem(E);if(O){let ge=JSON.parse(O).map(te=>({...te,timestamp:new Date(te.timestamp)}));k(ge.slice(-$));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[W?.enabled,E,$]),react.useEffect(()=>{if(W?.enabled&&u.length>0)try{let O=u.filter(M=>!M.isLoading).slice(-$);localStorage.setItem(E,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[u,W?.enabled,E,$]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{i&&!s&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,s]);let V=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&n?.(O.newTask);break;case "delete_task":O.taskId&&l?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&m?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&d?.(O.taskId,O.dependencyFrom);break}},[o,n,l,m,d]),re=react.useCallback(async O=>{if(!O.trim()||y)return;let M={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};k(te=>[...te.slice(-(P-1)),M]),h(""),T(false),f(true);let ge={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(te=>[...te,ge]);try{if(A){let te=await A(O,e);k(Le=>{let Re=Le.filter(ve=>!ve.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:te.message,timestamp:new Date,command:te};return [...Re,tt]}),V(te);}else k(te=>[...te.filter(Re=>!Re.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(te){k(Le=>[...Le.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${te instanceof Error?te.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[y,P,A,e,V]),se=O=>{O.preventDefault(),re(w);},Y=O=>{h(O),N.current?.focus();};if(react.useEffect(()=>{let O=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(ge=>!ge),i||c(false)),M.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=ge=>{let te=ge.target;x.current&&!x.current.contains(te)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",O);}},[i]),!v)return null;let R={"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(Oe,{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 ${R[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:()=>p(true),children:[jsxRuntime.jsx(Rl,{}),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 ${R[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(Rl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>c(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(yg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(vg,{})})]})]}),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:z.slice(0,4).map((O,M)=>jsxRuntime.jsx("button",{onClick:()=>Y(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},M))})]}),u.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(xg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:se,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:w,onChange:O=>h(O.target.value),placeholder:S,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(hg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ol(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((i,p=true)=>{r(s=>{let c=typeof i=="function"?i(s.present):i;if(o.current)return {...s,present:c};if(!p)return {...s,present:c};let u=[...s.past,s.present];return u.length>t&&u.shift(),{past:u,present:c,future:[]}});},[t]),l=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=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:p,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],s=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:s}});},[]),d=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Gl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=m?l.metaKey:l.ctrlKey;if(d&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!m&&d&&l.key==="y"){l.preventDefault(),t();return}if(m&&d&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Tg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${q.formatDate(e.startDate)} - ${q.formatDate(e.endDate)}`);let a=q.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=>q.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function zl(e){return {...Tg,...e}}var Ig=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Wl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:m="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:p=[],templates:s,enableAutoCriticalPath:c=true,aiAssistant:u,locale:k="en",customTranslations:w,showCreateTaskButton:h=false,createTaskLabel:y,onCreateTask:f,onThemeChange:g,onTaskClick:T,onTaskDblClick:N,onTaskContextMenu:b,onTaskUpdate:x,onProgressChange:v,onTaskEdit:S,onTaskAddSubtask:C,onTaskMarkIncomplete:A,onTaskSetInProgress:z,onDependencyCreate:P,onDependencyDelete:W,onBeforeTaskAdd:E,onAfterTaskAdd:$,onBeforeTaskUpdate:V,onAfterTaskUpdate:re,onBeforeTaskDelete:se,onAfterTaskDelete:Y}=a,O=react.useContext(po)?.theme,[M,ge]=react.useState(O||n||"dark"),[te,Le]=react.useState(l),[Re,tt]=react.useState(m),[ve,at]=react.useState(1),[Bt,xt]=react.useState(0),[xa,Xt]=react.useState(false),[ua,jt]=react.useState(null),[Et,Jt]=react.useState({isOpen:false,x:0,y:0,task:null}),[ht,je]=react.useState(null),[Ut,It]=react.useState(null);react.useEffect(()=>{O&&O!==M&&ge(O);},[O]),react.useEffect(()=>{n&&n!==M&&ge(n);},[n]);let Sa=react.useCallback(D=>{ge(D),g?.(D);},[g]),{state:ie,setState:be,undo:Zt,redo:kt,canUndo:Qt,canRedo:ga,clearHistory:ke}=Ol(t,50);react.useEffect(()=>{be(t);},[t,be]);let ye=react.useRef(t),Ea=react.useRef(true);react.useEffect(()=>{if(Ea.current){Ea.current=false,ye.current=ie;return}if(!r)return;let D=JSON.stringify(ye.current),F=JSON.stringify(ie);D!==F&&(ye.current=ie,r(ie));},[ie,r]);let j=react.useMemo(()=>zn(k,w),[k,w]),Se=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}],[]),[de,B]=react.useState(()=>Se(j));react.useEffect(()=>{B(D=>D.map(F=>({...F,label:j.columns[F.id==="name"?"taskName":F.id]||F.label})));},[j]);let H=react.useMemo(()=>de.filter(D=>D.visible).reduce((D,F)=>D+F.width,0)+60,[de]),me=Math.max(280,ua||H),le=react.useRef(null),K=react.useRef(null),we=react.useRef(null),X=react.useMemo(()=>ol(M),[M]),I=react.useMemo(()=>({theme:X,themeName:M}),[X,M]),J=react.useMemo(()=>zl(s),[s]),Ce=react.useMemo(()=>{if(!c)return ie;let D=q.calculateCriticalPath(ie),F=_=>_.map(Z=>({...Z,isCriticalPath:D.includes(Z.id),subtasks:Z.subtasks?F(Z.subtasks):void 0}));return F(ie)},[ie,c]),lt=Ig(Re);Gl({undo:Zt,redo:kt,canUndo:Qt,canRedo:ga,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>q.findTaskById(ie,D),addTask:(D,F)=>{be(_=>{if(!F)return [..._,{...D,level:0}];let Z=oe=>oe.map(pe=>pe.id===F?{...pe,subtasks:[...pe.subtasks||[],{...D,parentId:F,level:(pe.level||0)+1}],isExpanded:true}:pe.subtasks?{...pe,subtasks:Z(pe.subtasks)}:pe);return Z(_)});},updateTask:(D,F)=>{be(_=>{let Z=oe=>oe.map(pe=>pe.id===D?{...pe,...F}:pe.subtasks?{...pe,subtasks:Z(pe.subtasks)}:pe);return Z(_)});},deleteTask:D=>{be(F=>{let _=Z=>Z.filter(oe=>oe.id===D?false:(oe.subtasks&&(oe.subtasks=_(oe.subtasks)),true));return _(F)});},deleteTasks:D=>{be(F=>jn(F,D));},duplicateTask:D=>{be(F=>Kn(F,[D]));},splitTask:(D,F,_=3)=>{be(Z=>q.splitTask(Z,D,F,_));},calculateEndDate:q.calculateEndDate,calculateDuration:q.calculateDuration,validateDependency:(D,F)=>!q.validateDependencies(ie,D,F),getAllTasks:()=>q.flattenTasks(ie),getTasksByStatus:D=>q.flattenTasks(ie).filter(F=>F.status===D),getTasksByParent:D=>D?q.findTaskById(ie,D)?.subtasks||[]:ie.filter(_=>!_.parentId),getCriticalPath:()=>q.flattenTasks(ie).filter(D=>D.isCriticalPath),indentTask:D=>{be(F=>Hn(F,[D]));},outdentTask:D=>{be(F=>_n(F,[D]));},moveTask:(D,F)=>{be(_=>Vn(_,[D],F));},createSubtask:async D=>{let{tasks:F,newTask:_}=Xn(ie,D);if(E){let Z=E({..._,parentId:D});if((Z instanceof Promise?await Z:Z)===false)return}be(F),$&&$({..._,parentId:D});},scrollToTask:D=>{let _=q.flattenTasks(ie).findIndex(Z=>Z.id===D);if(_!==-1&&le.current){let Z=_*lt;le.current.scrollTo({top:Z,behavior:"smooth"}),K.current&&K.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(D,F=2e3)=>{},expandTask:D=>{be(F=>{let _=Z=>Z.map(oe=>oe.id===D?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe);return _(F)});},collapseTask:D=>{be(F=>{let _=Z=>Z.map(oe=>oe.id===D?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe);return _(F)});},expandAll:()=>{be(D=>{let F=_=>_.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?F(Z.subtasks):void 0}));return F(D)});},collapseAll:()=>{be(D=>{let F=_=>_.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?F(Z.subtasks):void 0}));return F(D)});},undo:Zt,redo:kt,canUndo:()=>Qt,canRedo:()=>ga,clearHistory:ke,exportToPNG:async()=>{if(!we.current)throw new Error("Gantt container not found");let D=await $l__default.default(we.current,{backgroundColor:X.bgPrimary,scale:2});return new Promise((F,_)=>{D.toBlob(Z=>{Z?F(Z):_(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await q.exportToPDF(ie,D);},exportToExcel:async D=>{await q.exportToExcel(ie,D);},exportToJSON:()=>q.exportToJSON(ie),exportToCSV:()=>q.exportToCSV(ie),importFromJSON:D=>{let F=q.importFromJSON(D);be(F);},getTasks:()=>ie,refresh:()=>{be(D=>[...D]);},clearAll:()=>{be([]);}}),[ie,Zt,kt,Qt,ga,ke,X,lt]);let ce=react.useCallback(D=>{B(F=>F.map(_=>_.id===D?{..._,visible:!_.visible}:_));},[]),za=react.useCallback((D,F)=>{B(_=>_.map(Z=>{if(Z.id!==D)return Z;let oe=Z.minWidth??100,pe=Z.maxWidth??800,mt=Math.max(oe,Math.min(pe,F));return {...Z,width:mt}}));},[]),ar=react.useCallback(D=>{be(F=>qn(F,D)),a.onTaskToggleExpand?.(D);},[a]),rr=react.useCallback((D,F)=>{if(V&&V(D,F)===false)return;let Z=q.findTaskById(ie,D)?.progress,oe=mt=>mt.map(Dt=>Dt.id===D?{...Dt,...F}:Dt.subtasks?{...Dt,subtasks:oe(Dt.subtasks)}:Dt);be(oe(ie));let pe=q.findTaskById(oe(ie),D);pe&&(x?.(pe),re?.(pe),F.progress!==void 0&&Z!==void 0&&F.progress!==Z&&v?.(D,Z,F.progress));},[ie,x,V,re,v]),ec=react.useCallback(D=>{D.length!==0&&(be(F=>Hn(F,D)),a.onTaskIndent?.(D[0]));},[a]),tc=react.useCallback(D=>{D.length!==0&&(be(F=>_n(F,D)),a.onTaskOutdent?.(D[0]));},[a]),ac=react.useCallback((D,F,_)=>{be(Z=>Tl(Z,D,F,_)),a.onTaskReparent?.(D,F,_);},[a]),rc=react.useCallback((D,F)=>{D.length!==0&&(be(_=>Vn(_,D,F)),a.onTaskMove?.(D[0],F));},[a]),jo=react.useCallback(async D=>{let F=[];for(let _ of D)se&&await Promise.resolve(se(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(be(_=>jn(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),Y&&F.forEach(_=>Y(_)));},[a,se,Y]),oc=react.useCallback(D=>{be(F=>Kn(F,D)),D.forEach(F=>a.onTaskDuplicate?.(F));},[a]),nc=react.useCallback((D,F)=>{be(_=>{let{tasks:Z,newTask:oe}=Cl(_,D,F);return E&&E(oe)===false?_:(a.onTaskCreate?.(oe.parentId,oe.position||0),$?.(oe),Z)});},[a,E,$]),sc=react.useCallback((D,F)=>{be(_=>Yn(_,D,F)),a.onTaskRename?.(D,F);},[a]),Ko=react.useCallback(D=>{be(F=>{let{tasks:_}=Xn(F,D);return a.onTaskCreate?.(D,0),_});},[a]),ic=react.useCallback((D,F,_)=>{let Z=D.startDate?Math.round((F.getTime()-D.startDate.getTime())/864e5):0,oe=Dt=>Dt.map(ea=>ea.id===D.id?{...ea,startDate:F,endDate:_,...D.segments&&{segments:D.segments}}:ea.subtasks?{...ea,subtasks:oe(ea.subtasks)}:ea),pe=oe(ie);pe=q.autoScheduleDependents(pe,D.id,Z),be(pe);let mt={...D,startDate:F,endDate:_};x?.(mt);},[ie,x]),lc=react.useCallback((D,F)=>{b?.(D,F),Jt({isOpen:true,x:F.clientX,y:F.clientY,task:D});},[b]),dc=react.useCallback((D,F)=>{let _=q.splitTask(ie,D.id,F);be(_),Jt({isOpen:false,x:0,y:0,task:null});},[ie]),Ks=react.useCallback(D=>{N?.(D),S||je(D);},[N,S]),Ys=react.useCallback((D,F,_)=>{let Z=new Map,oe=ta=>{ta.forEach(ka=>{ka.dependencies&&Z.set(ka.id,ka.dependencies),ka.subtasks&&oe(ka.subtasks);});};oe(_);let pe=Z.get(F)||[];Z.set(F,[...pe,D]);let mt=new Set,Dt=new Set,ea=ta=>{if(!mt.has(ta)){mt.add(ta),Dt.add(ta);let ka=Z.get(ta)||[];for(let wr of ka){if(!mt.has(wr)&&ea(wr))return true;if(Dt.has(wr))return true}}return Dt.delete(ta),false};return ea(F)},[]),qs=react.useCallback((D,F)=>{if(Ys(D.id,F,ie)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(p),s.download=a,s.click(),URL.revokeObjectURL(s.href);},calculateCriticalPath:e=>{let t=K.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,s=0;if(i.dependencies&&i.dependencies.length>0)for(let u of i.dependencies){let v=t.find(k=>k.id===u);if(v){o(v);let k=r.get(u)?.ef||0;s=Math.max(s,k);}}let c=s+p;r.set(i.id,{es:s,ef:c});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(i=>i.ef)),l=new Map,m=i=>{if(l.has(i.id))return;let p=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,s=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),c=n;if(s.length>0)for(let v of s){m(v);let k=l.get(v.id)?.ls||0;c=Math.min(c,k);}let u=c-p;l.set(i.id,{ls:u,lf:c});};a.forEach(m);let d=[];for(let i of a){let p=r.get(i.id),s=l.get(i.id);if(p&&s){let c=s.ls-p.es;Math.abs(c)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let a=K.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(K.calculateCriticalPath(e).includes(t))return 0;let o=K.getDependentTasks(e,t);if(o.length===0){let m=K.getLatestEndDate(e);if(!m)return null;let d=K.calculateDuration(a.endDate,m);return Math.max(0,d)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,d)=>m-d)[0];if(!n)return null;let l=K.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>K.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=K.findTaskById(e,t);if(!r||!r.endDate)return e;let o=K.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let m=K.calculateDuration(l.startDate,l.endDate),d;a!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+a)):(d=new Date(r.endDate),d.setDate(d.getDate()+1));let i=K.calculateEndDate(d,m),p=s=>s.map(c=>c.id===l.id?{...c,startDate:d,endDate:i}:c.subtasks?{...c,subtasks:p(c.subtasks)}:c);n=p(n),n=K.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,m)=>{if(a===0)return [];let d=[],i=o.getTime(),p=1e3*60*60*24,s=K.findTaskById(e,t);if(!s||!s.endDate)return [];let c=(u,v,k=new Set)=>{if(k.has(u))return;k.add(u);let h=K.getDependentTasks(e,u);for(let w of h){if(!w.startDate||!w.endDate)continue;let g=r.findIndex(P=>P.id===w.id);if(g===-1)continue;let f=w.startDate.getTime(),T=(w.endDate.getTime()-f)/p,y=(f-i)/p*n,x=y+v*n,S=Math.max(T*n,n),C=m+g*l+12;d.push({taskId:w.id,taskName:w.name,originalX:y,previewX:x,width:S,y:C,rowIndex:g,daysDelta:v,color:w.color}),c(w.id,v,k);}};return c(t,a),d},splitTask:(e,t,a,r=3)=>{let o=K.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let d=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:m}],i=p=>p.map(s=>s.id===o.id?{...s,endDate:m,segments:d}: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:m,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:p,onTaskDateChange:s,onDependencyCreate:c,onDependencyDelete:u}){let[k,h]=react.useState([]),[w,g]=react.useState(null),f=react.useCallback(z=>{g(z);},[]),D=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),T=r==="day"?60:r==="week"?20:8,b=D*T*l,y=z=>{let V=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),_=V.getUTCDay()||7;V.setUTCDate(V.getUTCDate()+4-_);let F=new Date(Date.UTC(V.getUTCFullYear(),0,1));return Math.ceil(((V.getTime()-F.getTime())/864e5+1)/7)},x=z=>{let V=z.getDay();return V===0||V===6},S=react.useCallback(z=>{let V=Math.round(z/(T*l)),_=new Date(o);return _.setDate(_.getDate()+V),_},[o,T,l]),C=react.useCallback((z,V)=>{if(V.startDate&&V.endDate)return;let _=z.currentTarget.ownerSVGElement;if(!_)return;let F=_.createSVGPoint();F.x=z.clientX,F.y=z.clientY;let B=F.matrixTransform(_.getScreenCTM()?.inverse()),E=S(B.x),Y=new Date(E);Y.setDate(Y.getDate()+1),s?.(V,E,Y);},[S,s]),P=react.useMemo(()=>{let z=B=>B.map(E=>{if(E.subtasks&&E.subtasks.length>0){let Y=z(E.subtasks),le=Y.filter(se=>se.startDate&&se.endDate);if(le.length>0){let se=le.map(ge=>ge.startDate.getTime()),Je=le.map(ge=>ge.endDate.getTime()),Be=new Date(Math.min(...se)),kt=new Date(Math.max(...Je));return {...E,subtasks:Y,startDate:Be,endDate:kt}}return {...E,subtasks:Y}}return E}),V=(B,E=[])=>{for(let Y of B)E.push(Y),Y.subtasks&&Y.subtasks.length>0&&(Y.isExpanded===void 0||Y.isExpanded)&&V(Y.subtasks,E);return E},_=z(e);return V(_)},[e]),O=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let V=z.startDate.getTime(),_=z.endDate.getTime(),F=o.getTime(),B=(V-F)/(1e3*60*60*24),E=(_-V)/(1e3*60*60*24),Y=B*T*l,le=Math.max(T*l,40),se=Math.max(E*T*l,le);return {x:Y,width:se}},[o,T,l]),A=react.useMemo(()=>P.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:V,width:_}=O(z),B=P.findIndex(E=>E.id===z.id)*a+12;return {id:z.id,x:V,y:B,width:_,height:32}}),[P,O]),U=react.useCallback((z,V,_)=>{if(!_||V===0){h([]);return}let F=K.calculateCascadePreview(e,z,V,P,o,T*l,a,48);h(F);},[e,P,o,T,l,a,48]),j=react.useMemo(()=>{let z=[],V=new Date(o);for(;V<=n;){let B=(V.getTime()-o.getTime())/864e5*T*l;if(r==="day")z.push({date:new Date(V),label:V.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:B}),V.setDate(V.getDate()+1);else if(r==="week"){let E=y(V);z.push({date:new Date(V),label:`Week ${E}`,x:B}),V.setDate(V.getDate()+7);}else z.push({date:new Date(V),label:V.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:B}),V.setMonth(V.getMonth()+1);}return z},[o,n,r,T,l]),Z=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*T*l,[o,T,l]),pe=Math.max(P.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(b,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(b,1e3),height:48,fill:t.bgGrid}),j.map((z,V)=>jsxRuntime.jsxs("g",{children:[V>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${V}`)),Z>=0&&Z<=b&&jsxRuntime.jsx("circle",{cx:Z,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(b,1e3),height:pe,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(b,1e3),height:pe,fill:t.bgPrimary}),j.map((z,V)=>{let _=j[V+1]?.x||b,F=x(z.date);return jsxRuntime.jsxs("g",{children:[F&&jsxRuntime.jsx("rect",{x:z.x,y:0,width:_-z.x,height:P.length*a,fill:t.bgWeekend,opacity:1}),V>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:P.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},V)}),Z>=0&&Z<=b&&jsxRuntime.jsx("line",{x1:Z,y1:0,x2:Z,y2:P.length*a,stroke:t.today,strokeWidth:2,opacity:1}),P.map((z,V)=>{let _=z.startDate&&z.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:V*a,width:b,height:a,fill:V%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${z.id}`),!_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:V*a,width:b,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:F=>C(F,z),onMouseEnter:F=>{F.currentTarget.setAttribute("fill",t.accentLight),F.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:F=>{F.currentTarget.setAttribute("fill","transparent"),F.currentTarget.setAttribute("opacity","1");}},`clickable-${z.id}`),jsxRuntime.jsx("text",{x:Z>0?Z:100,y:V*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-${z.id}`)]})]},`row-group-${z.id}`)}),P.map((z,V)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(_=>{let F=P.find(le=>le.id===_);if(!F||!F.startDate||!F.endDate)return null;let B=P.findIndex(le=>le.id===_),E=O(F),Y=O(z);return jsxRuntime.jsx(To,{x1:E.x+E.width,y1:B*a+a/2,x2:Y.x,y2:V*a+a/2,theme:t,onDelete:()=>u?.(z.id,_)},`dep-${_}-${z.id}`)})),P.map((z,V)=>{if(!z.startDate||!z.endDate)return null;let{x:_,width:F}=O(z),B=V*a+12,E=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;return z.isMilestone?jsxRuntime.jsx(No,{task:z,x:_+F/2,y:B+16,theme:t,onClick:d},z.id):E?jsxRuntime.jsxs("g",{onClick:()=>d?.(z),onContextMenu:Y=>{Y.preventDefault(),Y.stopPropagation(),p?.(z,Y);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:_,y:B,width:F,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:_,y1:B,x2:_+F,y2:B,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:_,y1:B,x2:_,y2:B+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:_+F,y1:B,x2:_+F,y2:B+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:_,y1:B+32,x2:_+F,y2:B+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),F>60&&jsxRuntime.jsx("text",{x:_+12,y:B+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:z.name})]},z.id):jsxRuntime.jsx(ko,{task:z,x:_,y:B,width:F,theme:t,dayWidth:T*l,startDate:o,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:A,onDragMove:U,onHoverChange:f},z.id)}),k.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:32,rx:8,fill:z.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),w&&jsxRuntime.jsx(Ml,{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 $l=[{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:m=a?"edit":"create",theme:d="dark",customStatuses:i=[]}){let p=[...$l,...i.filter(y=>!$l.some(x=>x.id===y.id))],s=Pe[d]||Pe.dark,[c,u]=react.useState(false),v={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:[]}),[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 D=()=>{let y={};return h.name.trim()||(y.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(y.endDate="La fecha de fin debe ser posterior a la de inicio"),f(y),Object.keys(y).length===0},T=async y=>{if(y.preventDefault(),!!D())try{await n(h),t();}catch(x){console.error("Error submitting task:",x);}},b=(y,x)=>{w(S=>{let C={...S,[y]:x};if(y==="progress"){let P=typeof x=="number"?x:parseInt(x,10);P===100&&S.status!=="completed"?C.status="completed":P>0&&P<100&&S.status==="todo"?C.status="in-progress":P===0&&S.status!=="todo"&&(C.status="todo");}return C}),g[y]&&f(S=>{let C={...S};return delete C[y],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:y=>y.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:m==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:y=>y.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:y=>y.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:T,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:y=>b("name",y.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:v,onFocus:y=>y.currentTarget.style.borderColor=s.accent,onBlur:y=>y.currentTarget.style.borderColor=s.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: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:y=>b("startDate",y.target.value?new Date(y.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:v,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:y=>b("endDate",y.target.value?new Date(y.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:v,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: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(y=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(x=>x.name===y.name),onChange:x=>{let S=x.target.checked?[...h.assignees||[],{id:y.id,name:y.name,avatar:y.avatar,initials:y.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(h.assignees||[]).filter(C=>C.name!==y.name);b("assignees",S);},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:y.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.textPrimary},children:y.name})]},y.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:y=>b("status",y.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:v,disabled:l,children:p.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.title},y.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:y=>b("priority",y.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:v,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:y=>b("progress",parseInt(y.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(y=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",y),disabled:l,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===y?y<30?"#EF4444":y<70?"#F59E0B":"#10B981":s.bgSecondary,color:h.progress===y?"#FFFFFF":s.textTertiary,border:`1px solid ${h.progress===y?"transparent":s.borderLight}`},children:[y,"%"]},y))})]})]}),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:y=>b("color",y),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:y=>b("description",y.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:v,onFocus:y=>y.currentTarget.style.borderColor=s.accent,onBlur:y=>y.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(!c),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:y=>y.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:y=>y.currentTarget.style.backgroundColor=s.bgSecondary,children:[c?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:c&&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:y=>b("isMilestone",y.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(y=>y.id!==a?.id).map(y=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(y.id),onChange:x=>{let S=x.target.checked?[...h.dependencies||[],y.id]:(h.dependencies||[]).filter(C=>C!==y.id);b("dependencies",S);},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:y.name})]},y.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:y=>{y.currentTarget.style.color=s.textPrimary,y.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:y=>{y.currentTarget.style.color=s.textSecondary,y.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:T,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:y=>!l&&(y.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:y=>!l&&(y.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"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var wg=['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"})]}),Cg=()=>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"})}),Tg=()=>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"})}),Dg=()=>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"})}),Ng=()=>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:m,onDependencyDelete:d}){let[i,p]=react.useState(false),[s,c]=react.useState(false),[u,v]=react.useState([]),[k,h]=react.useState(""),[w,g]=react.useState(false),[f,D]=react.useState(true),T=react.useRef(null),b=react.useRef(null),y=react.useRef(null),{enabled:x=true,placeholder:S='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:P,suggestions:O=wg,maxHistory:A=50,persistHistory:U}=a,j=U?.storageKey||"gantt-ai-history",Z=U?.maxMessages??5;react.useEffect(()=>{if(U?.enabled)try{let B=localStorage.getItem(j);if(B){let Y=JSON.parse(B).map(le=>({...le,timestamp:new Date(le.timestamp)}));v(Y.slice(-Z));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[U?.enabled,j,Z]),react.useEffect(()=>{if(U?.enabled&&u.length>0)try{let B=u.filter(E=>!E.isLoading).slice(-Z);localStorage.setItem(j,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[u,U?.enabled,j,Z]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{i&&!s&&T.current&&setTimeout(()=>T.current?.focus(),100);},[i,s]);let pe=react.useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&n?.(B.newTask);break;case "delete_task":B.taskId&&l?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&m?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&d?.(B.taskId,B.dependencyFrom);break}},[o,n,l,m,d]),z=react.useCallback(async B=>{if(!B.trim()||w)return;let E={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};v(le=>[...le.slice(-(A-1)),E]),h(""),D(false),g(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(le=>[...le,Y]);try{if(P){let le=await P(B,e);v(se=>{let Je=se.filter(kt=>!kt.isLoading),Be={id:`assistant-${Date.now()}`,role:"assistant",content:le.message,timestamp:new Date,command:le};return [...Je,Be]}),pe(le);}else v(le=>[...le.filter(Je=>!Je.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(le){v(se=>[...se.filter(Be=>!Be.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${le instanceof Error?le.message:"Unknown error"}`,timestamp:new Date}]);}finally{g(false);}},[w,A,P,e,pe]),V=B=>{B.preventDefault(),z(k);},_=B=>{h(B),T.current?.focus();};if(react.useEffect(()=>{let B=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),p(Y=>!Y),i||c(false)),E.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),react.useEffect(()=>{if(!i)return;let B=Y=>{let le=Y.target;y.current&&!y.current.contains(le)&&p(false);},E=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",B);}},[i]),!x)return null;let F={"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(Re,{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 ${F[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:()=>p(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:y,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 ${F[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:()=>c(B=>!B),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Dg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Tg,{})})]})]}),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&&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((B,E)=>jsxRuntime.jsx("button",{onClick:()=>_(B),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:B.length>30?B.slice(0,30)+"...":B},E))})]}),u.map(B=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:B.role==="user"?"white":t.textPrimary},children:[B.isLoading?jsxRuntime.jsx(Ng,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:B.command.success?"#10B981":"#EF4444"},children:[B.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:V,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:T,type:"text",value:k,onChange:B=>h(B.target.value),placeholder:S,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(Cg,{})})]}),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,p=true)=>{r(s=>{let c=typeof i=="function"?i(s.present):i;if(o.current)return {...s,present:c};if(!p)return {...s,present:c};let u=[...s.past,s.present];return u.length>t&&u.shift(),{past:u,present:c,future:[]}});},[t]),l=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=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:p,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],s=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:s}});},[]),d=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Hl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=m?l.metaKey:l.ctrlKey;if(d&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!m&&d&&l.key==="y"){l.preventDefault(),t();return}if(m&&d&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Mg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${K.formatDate(e.startDate)} - ${K.formatDate(e.endDate)}`);let a=K.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=>K.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function _l(e){return {...Mg,...e}}var Og=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:m="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:p=[],templates:s,enableAutoCriticalPath:c=true,aiAssistant:u,locale:v="en",customTranslations:k,showCreateTaskButton:h=false,createTaskLabel:w,onCreateTask:g,onThemeChange:f,onTaskClick:D,onTaskDblClick:T,onTaskContextMenu:b,onTaskUpdate:y,onProgressChange:x,onTaskEdit:S,onTaskAddSubtask:C,onTaskMarkIncomplete:P,onTaskSetInProgress:O,onDependencyCreate:A,onDependencyDelete:U,onBeforeTaskAdd:j,onAfterTaskAdd:Z,onBeforeTaskUpdate:pe,onAfterTaskUpdate:z,onBeforeTaskDelete:V,onAfterTaskDelete:_}=a,B=react.useContext(go)?.theme,[E,Y]=react.useState(B||n||"dark"),[le,se]=react.useState(l),[Je,Be]=react.useState(m),[kt,ge]=react.useState(1),[wt,gt]=react.useState(0),[pa,ua]=react.useState(false),[Yt,Rt]=react.useState(null),[qt,At]=react.useState({isOpen:false,x:0,y:0,task:null}),[ga,dt]=react.useState(null),[tt,Pt]=react.useState(null);react.useEffect(()=>{B&&B!==E&&Y(B);},[B]),react.useEffect(()=>{n&&n!==E&&Y(n);},[n]);let Ca=react.useCallback(N=>{Y(N),f?.(N);},[f]),{state:ie,setState:ve,undo:Gt,redo:fa,canUndo:vt,canRedo:ba,clearHistory:ha}=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=ie;return}if(!r)return;let N=JSON.stringify(ke.current),R=JSON.stringify(ie);N!==R&&(ke.current=ie,r(ie));},[ie,r]);let ct=react.useMemo(()=>Gn(v,k),[v,k]),ae=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,I]=react.useState(()=>ae(ct));react.useEffect(()=>{I(N=>N.map(R=>({...R,label:ct.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ct]);let W=react.useMemo(()=>ye.filter(N=>N.visible).reduce((N,R)=>N+R.width,0)+60,[ye]),de=react.useMemo(()=>Yt!==null?Math.max(280,Yt,W):Math.max(280,W),[Yt,W]),ue=react.useRef(null),q=react.useRef(null),ce=react.useRef(null),X=react.useMemo(()=>sl(E),[E]),M=react.useMemo(()=>({theme:X,themeName:E}),[X,E]),J=react.useMemo(()=>_l(s),[s]),Te=react.useMemo(()=>{if(!c)return ie;let N=K.calculateCriticalPath(ie),R=H=>H.map(Q=>({...Q,isCriticalPath:N.includes(Q.id),subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(ie)},[ie,c]),Ve=Og(Je);Hl({undo:Gt,redo:fa,canUndo:vt,canRedo:ba,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>K.findTaskById(ie,N),addTask:(N,R)=>{ve(H=>{if(!R)return [...H,{...N,level:0}];let Q=oe=>oe.map(fe=>fe.id===R?{...fe,subtasks:[...fe.subtasks||[],{...N,parentId:R,level:(fe.level||0)+1}],isExpanded:true}:fe.subtasks?{...fe,subtasks:Q(fe.subtasks)}:fe);return Q(H)});},updateTask:(N,R)=>{ve(H=>{let Q=oe=>oe.map(fe=>fe.id===N?{...fe,...R}:fe.subtasks?{...fe,subtasks:Q(fe.subtasks)}:fe);return Q(H)});},deleteTask:N=>{ve(R=>{let H=Q=>Q.filter(oe=>oe.id===N?false:(oe.subtasks&&(oe.subtasks=H(oe.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(Q=>K.splitTask(Q,N,R,H));},calculateEndDate:K.calculateEndDate,calculateDuration:K.calculateDuration,validateDependency:(N,R)=>!K.validateDependencies(ie,N,R),getAllTasks:()=>K.flattenTasks(ie),getTasksByStatus:N=>K.flattenTasks(ie).filter(R=>R.status===N),getTasksByParent:N=>N?K.findTaskById(ie,N)?.subtasks||[]:ie.filter(H=>!H.parentId),getCriticalPath:()=>K.flattenTasks(ie).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(ie,N);if(j){let Q=j({...H,parentId:N});if((Q instanceof Promise?await Q:Q)===false)return}ve(R),Z&&Z({...H,parentId:N});},scrollToTask:N=>{let H=K.flattenTasks(ie).findIndex(Q=>Q.id===N);if(H!==-1&&ue.current){let Q=H*Ve;ue.current.scrollTo({top:Q,behavior:"smooth"}),q.current&&q.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(N,R=2e3)=>{},expandTask:N=>{ve(R=>{let H=Q=>Q.map(oe=>oe.id===N?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:H(oe.subtasks)}:oe);return H(R)});},collapseTask:N=>{ve(R=>{let H=Q=>Q.map(oe=>oe.id===N?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:H(oe.subtasks)}:oe);return H(R)});},expandAll:()=>{ve(N=>{let R=H=>H.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(N)});},collapseAll:()=>{ve(N=>{let R=H=>H.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(N)});},undo:Gt,redo:fa,canUndo:()=>vt,canRedo:()=>ba,clearHistory:ha,exportToPNG:async()=>{if(!ce.current)throw new Error("Gantt container not found");let N=await jl__default.default(ce.current,{backgroundColor:X.bgPrimary,scale:2});return new Promise((R,H)=>{N.toBlob(Q=>{Q?R(Q):H(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await K.exportToPDF(ie,N);},exportToExcel:async N=>{await K.exportToExcel(ie,N);},exportToJSON:()=>K.exportToJSON(ie),exportToCSV:()=>K.exportToCSV(ie),importFromJSON:N=>{let R=K.importFromJSON(N);ve(R);},getTasks:()=>ie,refresh:()=>{ve(N=>[...N]);},clearAll:()=>{ve([]);}}),[ie,Gt,fa,vt,ba,ha,X,Ve]);let me=react.useCallback(N=>{I(R=>R.map(H=>H.id===N?{...H,visible:!H.visible}:H));},[]),Ga=react.useCallback((N,R)=>{I(H=>H.map(Q=>{if(Q.id!==N)return Q;let oe=Q.minWidth??100,fe=Q.maxWidth??800,mt=Math.max(oe,Math.min(fe,R));return {...Q,width:mt}}));},[]),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 Q=K.findTaskById(ie,N)?.progress,oe=mt=>mt.map(St=>St.id===N?{...St,...R}:St.subtasks?{...St,subtasks:oe(St.subtasks)}:St);ve(oe(ie));let fe=K.findTaskById(oe(ie),N);fe&&(y?.(fe),z?.(fe),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&x?.(N,Q,R.progress));},[ie,y,pe,z,x]),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(Q=>Nl(Q,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)V&&await Promise.resolve(V(H))===false||R.push(H);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ve(H=>Yn(H,R)),R.forEach(H=>a.onTaskDelete?.(H))),_&&R.forEach(H=>_(H)));},[a,V,_]),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:Q,newTask:oe}=Dl(H,N,R);return j&&j(oe)===false?H:(a.onTaskCreate?.(oe.parentId,oe.position||0),Z?.(oe),Q)});},[a,j,Z]),mc=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]),pc=react.useCallback((N,R,H)=>{let Q=N.startDate?Math.round((R.getTime()-N.startDate.getTime())/864e5):0,oe=St=>St.map(Qt=>Qt.id===N.id?{...Qt,startDate:R,endDate:H,...N.segments&&{segments:N.segments}}:Qt.subtasks?{...Qt,subtasks:oe(Qt.subtasks)}:Qt),fe=oe(ie);fe=K.autoScheduleDependents(fe,N.id,Q),ve(fe);let mt={...N,startDate:R,endDate:H};y?.(mt);},[ie,y]),uc=react.useCallback((N,R)=>{b?.(N,R),At({isOpen:true,x:R.clientX,y:R.clientY,task:N});},[b]),gc=react.useCallback((N,R)=>{let H=K.splitTask(ie,N.id,R);ve(H),At({isOpen:false,x:0,y:0,task:null});},[ie]),qs=react.useCallback(N=>{T?.(N),S||dt(N);},[T,S]),Xs=react.useCallback((N,R,H)=>{let Q=new Map,oe=ea=>{ea.forEach(Ta=>{Ta.dependencies&&Q.set(Ta.id,Ta.dependencies),Ta.subtasks&&oe(Ta.subtasks);});};oe(H);let fe=Q.get(R)||[];Q.set(R,[...fe,N]);let mt=new Set,St=new Set,Qt=ea=>{if(!mt.has(ea)){mt.add(ea),St.add(ea);let Ta=Q.get(ea)||[];for(let Cr of Ta){if(!mt.has(Cr)&&Qt(Cr))return true;if(St.has(Cr))return true}}return St.delete(ea),false};return Qt(R)},[]),Js=react.useCallback((N,R)=>{if(Xs(N.id,R,ie)){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 _=Z=>Z.map(oe=>{if(oe.id===F){let pe=oe.dependencies||[];if(!pe.includes(D.id))return {...oe,dependencies:[...pe,D.id]}}return oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe});be(_(ie)),P?.(D.id,F);},[ie,P,Ys]),Xs=react.useCallback((D,F)=>{let _=Z=>Z.map(oe=>{if(oe.id===D&&oe.dependencies){let pe=oe.dependencies.filter(mt=>mt!==F);return {...oe,dependencies:pe}}return oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe});be(_(ie)),W?.(D,F);},[ie,W]),{startDate:cc,endDate:mc}=react.useMemo(()=>{let D=ie.filter(pe=>pe.startDate&&pe.endDate);if(D.length===0){let pe=new Date,mt=new Date(pe);mt.setDate(mt.getDate()-30);let Dt=new Date(pe);return Dt.setDate(Dt.getDate()+60),{startDate:mt,endDate:Dt}}let F=D.flatMap(pe=>[pe.startDate,pe.endDate]).filter(pe=>pe!==void 0),_=new Date(Math.min(...F.map(pe=>pe.getTime()))),Z=new Date(Math.max(...F.map(pe=>pe.getTime()))),oe=te==="day"?7:te==="week"?14:30;return _.setDate(_.getDate()-oe),Z.setDate(Z.getDate()+oe),{startDate:_,endDate:Z}},[ie,te]),pc=react.useCallback(async()=>{if(!we.current)return;let D=await $l__default.default(we.current,{backgroundColor:X.bgPrimary,scale:2}),F=document.createElement("a");F.download="gantt-chart.png",F.href=D.toDataURL("image/png"),F.click();},[X]),uc=react.useCallback(async()=>{await q.exportToPDF(ie);},[ie]),gc=react.useCallback(async()=>{await q.exportToExcel(ie);},[ie]),fc=react.useCallback(()=>{let D=q.exportToCSV(ie),F=new Blob([D],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[ie]),bc=react.useCallback(()=>{let D=q.exportToJSON(ie),F=new Blob([D],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[ie]),hc=react.useCallback(()=>{q.exportToMSProject(ie,"Gantt Project","project.xml");},[ie]),vc=D=>{D.preventDefault(),Xt(true);};return react.useEffect(()=>{let D=K.current,F=le.current;if(!D||!F)return;let _=F.querySelector(".gantt-taskgrid-content"),Z=()=>{let mt=D.scrollTop;xt(mt),_&&(_.style.transform=`translateY(-${mt}px)`);},oe=mt=>{if(xa&&F){let ea=F.parentElement?.getBoundingClientRect()?.left||0,ta=mt.clientX-ea,ka=280,wr=Math.min(window.innerWidth-300,800);ta>=ka&&ta<=wr&&jt(ta);}},pe=()=>{Xt(false);};return D.addEventListener("scroll",Z),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",pe),()=>{D.removeEventListener("scroll",Z),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",pe);}},[xa]),jsxRuntime.jsx(gr.Provider,{value:j,children:jsxRuntime.jsx(Zo.Provider,{value:I,children:jsxRuntime.jsxs("div",{ref:we,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(go,{theme:X,timeScale:te,onTimeScaleChange:Le,zoom:ve,onZoomChange:at,currentTheme:M,onThemeChange:Sa,rowDensity:Re,onRowDensityChange:tt,showThemeSelector:d,showCreateTaskButton:h,createTaskLabel:y,onCreateTask:f,onExportPNG:i?pc:void 0,onExportPDF:i?uc:void 0,onExportExcel:i?gc:void 0,onExportCSV:i?fc:void 0,onExportJSON:i?bc:void 0,onExportMSProject:i?hc:void 0}),jsxRuntime.jsxs("div",{ref:le,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:me,overflow:"hidden"},children:jsxRuntime.jsx(vo,{tasks:Ce,theme:X,rowHeight:lt,availableUsers:p,templates:J,onTaskClick:T,onTaskDblClick:Ks,onTaskContextMenu:b,onTaskToggle:ar,scrollTop:Bt,columns:de,onToggleColumn:ce,onColumnResize:za,onTaskUpdate:rr,onTaskIndent:ec,onTaskOutdent:tc,onTaskMove:rc,onMultiTaskDelete:jo,onTaskDuplicate:oc,onTaskCreate:nc,onTaskRename:sc,onCreateSubtask:Ko,onOpenTaskModal:T?D=>T(D):void 0,onDeleteRequest:(D,F)=>It({taskId:D,taskName:F}),onTaskReparent:ac})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:vc}),jsxRuntime.jsx("div",{ref:K,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Do,{tasks:Ce,theme:X,rowHeight:lt,timeScale:te,startDate:cc,endDate:mc,zoom:ve,templates:J,onTaskClick:T,onTaskDblClick:Ks,onTaskContextMenu:lc,onTaskDateChange:ic,onDependencyCreate:qs,onDependencyDelete:Xs})})]}),Et.task&&jsxRuntime.jsx(fr,{isOpen:Et.isOpen,x:Et.x,y:Et.y,theme:X,onClose:()=>Jt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=Et.task;return D?D.subtasks&&D.subtasks.length>0?[{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{C?C(D):Ko(D.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{It({taskId:D.id,taskName:D.name});}}]:[{id:"edit",label:j.contextMenu?.editTask||"Edit Task",icon:Xe.Pencil,onClick:()=>{S?S(D):je(D);}},{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{C?C(D):Ko(D.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:j.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xe.MarkIncomplete,onClick:()=>{A?A(D):rr(D.id,{status:"todo",progress:0});},disabled:D.status==="todo"},{id:"setInProgress",label:j.contextMenu?.setInProgress||"Set In Progress",icon:Xe.SetInProgress,onClick:()=>{z?z(D):rr(D.id,{status:"in-progress"});},disabled:D.status==="in-progress"},{id:"markComplete",label:j.contextMenu?.markComplete||"Mark Complete",icon:Xe.MarkComplete,onClick:()=>{rr(D.id,{status:"completed",progress:100});},disabled:D.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:j.contextMenu?.splitTask||"Split Task",icon:Xe.Split,onClick:()=>{if(!D.startDate||!D.endDate){console.warn("Cannot split task without dates");return}let _=D.startDate.getTime(),Z=D.endDate.getTime(),oe=_+(Z-_)/2,pe=new Date(oe);dc(D,pe);},disabled:!D.startDate||!D.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{It({taskId:D.id,taskName:D.name});}}]:[]})()}),ht&&jsxRuntime.jsx(So,{isOpen:true,onClose:()=>je(null),task:ht,onSubmit:D=>{rr(ht.id,D),je(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ut&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>It(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:[j.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},children:k==="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:[k==="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:['"',Ut.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:()=>It(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:k==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{jo([Ut.taskId]),It(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"}),k==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Eo,{tasks:ie,theme:X,config:u,onTasksUpdate:be,onTaskUpdate:rr,onTaskCreate:D=>{be(F=>[...F,D]);},onTaskDelete:D=>{jo([D]);},onDependencyCreate:(D,F)=>{let _=q.findTaskById(ie,D);_&&qs(_,F);},onDependencyDelete:Xs})]})})})});var Hl=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
278
+ Task dependencies must flow in one direction only.`);return}let H=Q=>Q.map(oe=>{if(oe.id===R){let fe=oe.dependencies||[];if(!fe.includes(N.id))return {...oe,dependencies:[...fe,N.id]}}return oe.subtasks?{...oe,subtasks:H(oe.subtasks)}:oe});ve(H(ie)),A?.(N.id,R);},[ie,A,Xs]),Zs=react.useCallback((N,R)=>{let H=Q=>Q.map(oe=>{if(oe.id===N&&oe.dependencies){let fe=oe.dependencies.filter(mt=>mt!==R);return {...oe,dependencies:fe}}return oe.subtasks?{...oe,subtasks:H(oe.subtasks)}:oe});ve(H(ie)),U?.(N,R);},[ie,U]),{startDate:fc,endDate:bc}=react.useMemo(()=>{let N=ie.filter(fe=>fe.startDate&&fe.endDate);if(N.length===0){let fe=new Date,mt=new Date(fe);mt.setDate(mt.getDate()-30);let St=new Date(fe);return St.setDate(St.getDate()+60),{startDate:mt,endDate:St}}let R=N.flatMap(fe=>[fe.startDate,fe.endDate]).filter(fe=>fe!==void 0),H=new Date(Math.min(...R.map(fe=>fe.getTime()))),Q=new Date(Math.max(...R.map(fe=>fe.getTime()))),oe=le==="day"?7:le==="week"?14:30;return H.setDate(H.getDate()-oe),Q.setDate(Q.getDate()+oe),{startDate:H,endDate:Q}},[ie,le]),hc=react.useCallback(async()=>{if(!ce.current)return;let N=await jl__default.default(ce.current,{backgroundColor:X.bgPrimary,scale:2}),R=document.createElement("a");R.download="gantt-chart.png",R.href=N.toDataURL("image/png"),R.click();},[X]),vc=react.useCallback(async()=>{await K.exportToPDF(ie);},[ie]),yc=react.useCallback(async()=>{await K.exportToExcel(ie);},[ie]),xc=react.useCallback(()=>{let N=K.exportToCSV(ie),R=new Blob([N],{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);},[ie]),kc=react.useCallback(()=>{let N=K.exportToJSON(ie),R=new Blob([N],{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);},[ie]),wc=react.useCallback(()=>{K.exportToMSProject(ie,"Gantt Project","project.xml");},[ie]),Cc=N=>{N.preventDefault(),ua(true);};return react.useEffect(()=>{let N=q.current,R=ue.current;if(!N||!R)return;let H=R.querySelector(".gantt-taskgrid-content"),Q=()=>{let mt=N.scrollTop;gt(mt),H&&(H.style.transform=`translateY(-${mt}px)`);},oe=mt=>{if(pa&&R){let Qt=R.parentElement?.getBoundingClientRect()?.left||0,ea=mt.clientX-Qt,Ta=280,Cr=Math.min(window.innerWidth-300,800);ea>=Ta&&ea<=Cr&&Rt(ea);}},fe=()=>{ua(false);};return N.addEventListener("scroll",Q),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",fe),()=>{N.removeEventListener("scroll",Q),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",fe);}},[pa]),jsxRuntime.jsx(fr.Provider,{value:ct,children:jsxRuntime.jsx(en.Provider,{value:M,children:jsxRuntime.jsxs("div",{ref:ce,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(bo,{theme:X,timeScale:le,onTimeScaleChange:se,zoom:kt,onZoomChange:ge,currentTheme:E,onThemeChange:Ca,rowDensity:Je,onRowDensityChange:Be,showThemeSelector:d,showCreateTaskButton:h,createTaskLabel:w,onCreateTask:g,onExportPNG:i?hc:void 0,onExportPDF:i?vc:void 0,onExportExcel:i?yc:void 0,onExportCSV:i?xc:void 0,onExportJSON:i?kc:void 0,onExportMSProject:i?wc:void 0}),jsxRuntime.jsxs("div",{ref:ue,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:de,overflow:"hidden"},children:jsxRuntime.jsx(xo,{tasks:Te,theme:X,rowHeight:Ve,availableUsers:p,templates:J,onTaskClick:D,onTaskDblClick:qs,onTaskContextMenu:b,onTaskToggle:rr,scrollTop:wt,columns:ye,onToggleColumn:me,onColumnResize:Ga,onTaskUpdate:or,onTaskIndent:nc,onTaskOutdent:sc,onTaskMove:lc,onMultiTaskDelete:Yo,onTaskDuplicate:dc,onTaskCreate:cc,onTaskRename:mc,onCreateSubtask:qo,onOpenTaskModal:D?N=>D(N):void 0,onDeleteRequest:(N,R)=>Pt({taskId:N,taskName:R}),onTaskReparent:ic})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Cc}),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(Eo,{tasks:Te,theme:X,rowHeight:Ve,timeScale:le,startDate:fc,endDate:bc,zoom:kt,templates:J,onTaskClick:D,onTaskDblClick:qs,onTaskContextMenu:uc,onTaskDateChange:pc,onDependencyCreate:Js,onDependencyDelete:Zs})})]}),qt.task&&jsxRuntime.jsx(br,{isOpen:qt.isOpen,x:qt.x,y:qt.y,theme:X,onClose:()=>At({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=qt.task;return N?N.subtasks&&N.subtasks.length>0?[{id:"addSubtask",label:ct.contextMenu?.addSubtask||"Add Subtask",icon:qe.Add,onClick:()=>{C?C(N):qo(N.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ct.contextMenu?.deleteTask||"Delete Task",icon:qe.Delete,onClick:()=>{Pt({taskId:N.id,taskName:N.name});}}]:[{id:"edit",label:ct.contextMenu?.editTask||"Edit Task",icon:qe.Pencil,onClick:()=>{S?S(N):dt(N);}},{id:"addSubtask",label:ct.contextMenu?.addSubtask||"Add Subtask",icon:qe.Add,onClick:()=>{C?C(N):qo(N.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ct.contextMenu?.markIncomplete||"Mark Incomplete",icon:qe.MarkIncomplete,onClick:()=>{P?P(N):or(N.id,{status:"todo",progress:0});},disabled:N.status==="todo"},{id:"setInProgress",label:ct.contextMenu?.setInProgress||"Set In Progress",icon:qe.SetInProgress,onClick:()=>{O?O(N):or(N.id,{status:"in-progress"});},disabled:N.status==="in-progress"},{id:"markComplete",label:ct.contextMenu?.markComplete||"Mark Complete",icon:qe.MarkComplete,onClick:()=>{or(N.id,{status:"completed",progress:100});},disabled:N.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ct.contextMenu?.splitTask||"Split Task",icon:qe.Split,onClick:()=>{if(!N.startDate||!N.endDate){console.warn("Cannot split task without dates");return}let H=N.startDate.getTime(),Q=N.endDate.getTime(),oe=H+(Q-H)/2,fe=new Date(oe);gc(N,fe);},disabled:!N.startDate||!N.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ct.contextMenu?.deleteTask||"Delete Task",icon:qe.Delete,onClick:()=>{Pt({taskId:N.id,taskName:N.name});}}]:[]})()}),ga&&jsxRuntime.jsx(Po,{isOpen:true,onClose:()=>dt(null),task:ga,onSubmit:N=>{or(ga.id,N),dt(null);},mode:"edit",theme:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Pt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:N=>N.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor: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:[ct.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:X.textPrimary},children:['"',tt.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:()=>Pt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=X.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Yo([tt.taskId]),Pt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Mo,{tasks:ie,theme:X,config:u,onTasksUpdate:ve,onTaskUpdate:or,onTaskCreate:N=>{ve(R=>[...R,N]);},onTaskDelete:N=>{Yo([N]);},onDependencyCreate:(N,R)=>{let H=K.findTaskById(ie,N);H&&Js(H,R);},onDependencyDelete:Zs})]})})})});var Yl=`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 _l(e){return `CURRENT TASKS:
320
- ${Vl(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(`
319
+ If ambiguous, ask for clarification in the message field.`;function ql(e){return `CURRENT TASKS:
320
+ ${Xl(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 Vl(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Da(e,t){let a=Vl(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let n=a.find(m=>m.name.toLowerCase().includes(r));if(n)return n;let l=r.split(/\s+/);return a.find(m=>{let d=m.name.toLowerCase();return l.every(i=>d.includes(i))})}function os(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 c=new Date(r);return c.setDate(c.getDate()+1),c}if(a==="yesterday"||a==="ayer"){let c=new Date(r);return c.setDate(c.getDate()-1),c}if(a==="next week"||a==="la pr\xF3xima semana"){let c=new Date(r);return c.setDate(c.getDate()+7),c}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 k=new Date(r),w=k.getDay(),h=u-w;return h<=0&&(h+=7),k.setDate(k.getDate()+h),k}}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 c=parseInt(n[1],10),u=n[2].toLowerCase(),k=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?k.setDate(k.getDate()+c):u==="week"||u==="semana"||u==="semanas"?k.setDate(k.getDate()+c*7):(u==="month"||u==="mes"||u==="meses")&&k.setMonth(k.getMonth()+c),k}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let c=parseInt(m[1],10),u=parseInt(m[2],10)-1,k=parseInt(m[3],10);return new Date(k,u,c)}let d={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 c=parseInt(i[1],10),u=d[i[2].toLowerCase()],k=i[3]?parseInt(i[3],10):r.getFullYear();if(u!==void 0)return new Date(k,u,c)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 c=p[s[1].toLowerCase()],u=parseInt(s[2],10),k=s[3]?parseInt(s[3],10):r.getFullYear();if(c!==void 0)return new Date(k,c,u)}return null}function ns(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 ss(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 Kl(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),p=r[2].trim(),s=Da(t,i),c=os(p);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(!c)return {type:"move_task",taskId:s.id,taskName:s.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=s.startDate&&s.endDate?Math.round((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24)):1,k=new Date(c);return k.setDate(k.getDate()+u),{type:"move_task",taskId:s.id,taskName:s.name,updates:{startDate:c,endDate:k},message:`Moved "${s.name}" to ${c.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),s=Da(t,i),c=ns(p);if(!s)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!c||!s.endDate)return {type:"resize_task",taskId:s.id,taskName:s.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(s.endDate);return u.setDate(u.getDate()+c),{type:"resize_task",taskId:s.id,taskName:s.name,updates:{endDate:u},message:`Extended "${s.name}" by ${c} 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(),p=n[2].trim(),s=Da(t,i),c=ss(p);return s?c===null?{type:"set_progress",taskId:s.id,taskName:s.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:s.id,taskName:s.name,updates:{progress:c},message:`Set "${s.name}" progress to ${c}%.`,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(),p=l[2].trim(),s=Da(t,i);return s?{type:"rename_task",taskId:s.id,taskName:s.name,updates:{name:p},message:`Renamed "${s.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),p=m[2].trim(),s=Da(t,i),c=Da(t,p);return s?c?{type:"link_tasks",taskId:c.id,taskName:c.name,dependencyFrom:s.id,dependencyTo:c.id,message:`Linked "${s.name}" \u2192 "${c.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),p=Da(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Yl(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 Ag(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 Lg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Mo(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let s=a.find(c=>c.id===p);return s?{name:s.name,initials:s.initials,color:s.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Mo(p,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let l=p=>{if(p)return typeof p=="string"?new Date(p):p},m=l(e.startDate),d=l(e.endDate),i=e.metadata?.isMilestone===true||m&&d&&Math.abs(d.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:d,progress:e.progress||0,status:Ag(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 ql(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:Lg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Xl(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Mo(r,e,t))}var is={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"}},ls={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"}},Io={en:is,es:ls};function ds(e){return Io[e]||Io.en}function Ao(e,t){let a=ds(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 ed(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(...ed(r.subtasks,t+1));return a}function _g({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 td({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:l}){let{theme:m="dark",locale:d="en",customTranslations:i,showSearch:p=true,showHierarchy:s=true}=t,c=Ao(d,i),u=m==="dark",[k,w]=react.useState(new Set),[h,y]=react.useState("startDate"),[f,g]=react.useState("asc"),[T,N]=react.useState("");react.useMemo(()=>{let C=new Set;function A(z){for(let P of z)P.subtasks?.length&&(C.add(P.id),A(P.subtasks));}A(e),w(C);},[e]);let b=react.useCallback(C=>{w(A=>{let z=new Set(A);return z.has(C)?z.delete(C):z.add(C),z}),a.onTaskToggleExpand?.(C);},[a]),x=react.useCallback(C=>{h===C?g(A=>A==="asc"?"desc":"asc"):(y(C),g("asc")),a.onSortChange?.({column:C,direction:f==="asc"?"desc":"asc"});},[h,f,a]),v=react.useMemo(()=>{let C=ed(e);if(T.trim()){let z=T.toLowerCase();C=C.filter(P=>P.name.toLowerCase().includes(z));}let A=[];for(let z of C){let P=z.level===0;z.level>0&&(P=true),(P||T.trim())&&A.push(z);}return T.trim()&&A.sort((z,P)=>{let W,E;switch(h){case "name":W=z.name.toLowerCase(),E=P.name.toLowerCase();break;case "startDate":W=z.startDate?.getTime()||0,E=P.startDate?.getTime()||0;break;case "endDate":W=z.endDate?.getTime()||0,E=P.endDate?.getTime()||0;break;case "progress":W=z.progress||0,E=P.progress||0;break;case "status":W=z.status||"todo",E=P.status||"todo";break;default:return 0}return W<E?f==="asc"?-1:1:W>E?f==="asc"?1:-1:0}),A},[e,T,h,f]),S=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:L("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:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[c.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:L("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:L("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:L("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:L("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:c.empty.noTasks}),jsxRuntime.jsx("p",{className:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:L("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:L("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:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:L("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=>N(C.target.value),placeholder:c.toolbar.searchPlaceholder,className:L("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:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[v.length," ",c.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:L("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:[c.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:[c.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:[c.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:[c.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,A)=>{let z=k.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:A*.02},className:L("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:P=>{P.stopPropagation(),b(C.id);},className:L("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:L("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),s&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(_g,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:L("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:L("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"?c.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?c.status.inProgress:c.status.todo})}),jsxRuntime.jsxs("div",{className:L("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"}),S(C.startDate)]}),jsxRuntime.jsxs("div",{className:L("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"}),S(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:L("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:L("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:L("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:L("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:L(u?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.noResults})]})})]})]})}var cs={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"},ms={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"},ps={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"},Fo={dark:cs,light:ms,neutral:ps};function ad(e){return Fo[e]||Fo.dark}var us={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},gs={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Bo={en:us,es:gs};function $r(e){return Bo[e]||Bo.en}function Ro(e,t){let a=$r(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function rd(e){let t=$r(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function od(e,t=0,a=true){let r=$r(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 Qg(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 bs(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 ef({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 id({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:l,style:m}){let{theme:d="dark",locale:i="en",customTranslations:p}=t,s=Ro(i,p),c=d==="dark",[u,k]=react.useState(r||new Date),[w,h]=react.useState(null),y=react.useCallback(()=>{k(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),f=react.useCallback(()=>{k(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),g=react.useCallback(()=>{k(new Date);},[]),T=react.useMemo(()=>{let v=u.getFullYear(),S=u.getMonth(),C=new Date(v,S,1),A=new Date(v,S+1,0),z=C.getDay(),P=A.getDate(),W=Qg(e),E=new Date;E.setHours(0,0,0,0);let $=[],V=z,re=new Date(v,S,0).getDate();for(let Y=V-1;Y>=0;Y--){let R=new Date(v,S-1,re-Y);$.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:W.filter(O=>bs(R,O)).map(O=>({id:O.id,title:O.name,start:O.startDate,end:O.endDate,task:O}))});}for(let Y=1;Y<=P;Y++){let R=new Date(v,S,Y),O=R.getTime()===E.getTime();$.push({date:R,isCurrentMonth:true,isToday:O,isWeekend:R.getDay()===0||R.getDay()===6,events:W.filter(M=>bs(R,M)).map(M=>({id:M.id,title:M.name,start:M.startDate,end:M.endDate,task:M}))});}let se=42-$.length;for(let Y=1;Y<=se;Y++){let R=new Date(v,S+1,Y);$.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:W.filter(O=>bs(R,O)).map(O=>({id:O.id,title:O.name,start:O.startDate,end:O.endDate,task:O}))});}return $},[u,e]),N=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 S=v.progress===100?0:100,C=S===100?"completed":"todo";a.onTaskUpdate?.({...v,status:C,progress:S});},[a]);return o?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",l),style:m,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:L("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[s.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",l),style:m,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:L("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",l),style:m,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:L("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:s.labels.noEvents}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:s.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:L("flex-1 flex flex-col w-full h-full overflow-hidden",c?"bg-[#0F1117]":"bg-white",l),style:m,children:[jsxRuntime.jsx("div",{className:L("flex-shrink-0 px-6 py-4 border-b",c?"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:L("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:b}),jsxRuntime.jsx("button",{onClick:g,className:L("px-3 py-1.5 text-sm rounded-lg transition-colors",c?"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:y,className:L("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:L("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:f,className:L("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-5 h-5",c?"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:N.map(v=>jsxRuntime.jsx("div",{className:L("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:v},v))}),jsxRuntime.jsx("div",{className:L("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",c?"bg-white/5":"bg-gray-200"),children:T.map((v,S)=>jsxRuntime.jsxs("div",{className:L("min-h-[100px] p-2 transition-colors",c?"bg-[#0F1117]":"bg-white",!v.isCurrentMonth&&(c?"bg-[#0F1117]/50":"bg-gray-50"),v.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:L("text-sm font-medium mb-1",v.isToday?"text-[#3B82F6]":v.isCurrentMonth?c?"text-white":"text-gray-900":c?"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:L("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",C.task.progress===100?c?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":c?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(ef,{task:C.task}),jsxRuntime.jsx("span",{className:"truncate",children:C.title})]},C.id)),v.events.length>3&&jsxRuntime.jsxs("div",{className:L("text-xs px-1.5",c?"text-[#6B7280]":"text-gray-400"),children:["+",v.events.length-3," ",i==="es"?"m\xE1s":"more"]})]})]},S))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:L("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",c?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:L("p-4 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold",c?"text-white":"text-gray-900"),children:i==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:L("p-1 rounded",c?"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:L("text-xs uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:L("font-medium",c?"text-white":"text-gray-900"),children:w.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-white":"text-gray-900"),children:w.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-white":"text-gray-900"),children:w.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase mb-2 block",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:L("flex-1 h-2 rounded-full overflow-hidden",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:L("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:L("text-sm font-medium w-10",c?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{x(w),h(null);},className:L("w-full py-2 rounded-lg font-medium transition-colors",w.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:w.progress===100?i==="es"?"Marcar como pendiente":"Mark as pending":i==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&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 hs={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"},vs={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"},ys={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:hs,light:vs,neutral:ys};function ld(e){return Go[e]||Go.dark}function af({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:l,className:m}){let[d,i]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),s=react.useMemo(()=>{let u=p.length,k=new Set(p.flatMap(y=>y.assignedUserIds||[])).size,w=p.map(y=>y.priority).filter(Boolean),h=new Set(p.flatMap(y=>y.labels||[])).size;return {totalCards:u,uniqueAssignees:k,priorities:w,labels:h}},[p]),c=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:L("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:c,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:L("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"]})]}),d&&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:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(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:k=>{k.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 cd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Wr(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 Hr(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 md(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 pd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:l,className:m}){let d=react.useMemo(()=>({...cd,...l}),[l]),[i,p]=react.useState(new Set),s=react.useRef(null),c=react.useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let f=new Map;return e.forEach(g=>{let T=g.timestamp.toISOString().split("T")[0],N=f.get(T);N?N.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((N,b)=>b.timestamp.getTime()-N.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:u,uniqueTypes:k}=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]),w=f=>{p(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(),N=Math.floor(T/6e4),b=Math.floor(T/36e5),x=Math.floor(T/864e5);return N<1?"just now":N<60?`${N}m ago`:b<24?`${b}h ago`:x<7?`${x}d ago`:f.toLocaleDateString()},y=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:L("history-timeline-empty",m),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:L("history-timeline",d.compact&&"compact",m),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"}),k.map(f=>jsxRuntime.jsxs("option",{value:f,children:[Hr(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})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:s,children:c.map(f=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[d.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 N=i.has(g.id),b=n===g.id,x=md(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:L("history-timeline-event",N&&"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:d.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Hr(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:[d.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:Wr(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:d.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(),w(g.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([v,S])=>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(S.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.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,S])=>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(S)})]},v))]})]})]})]},g.id)})})]},f.date?.toISOString()||"all"))})]})}function gd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:l,onGoToEvent:m,onSpeedChange:d,className:i}){let p=[.5,1,1.5,2,3],s=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),c=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:L("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:L("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:s&&Hr(s.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:s&&Wr(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=>m(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${c}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,k)=>jsxRuntime.jsx("div",{className:L("history-replay-progress-marker",k===e.currentIndex&&"active"),style:{left:`${k/(e.totalEvents-1)*100}%`},onClick:()=>m(k),title:Wr(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:p.map(u=>jsxRuntime.jsxs("button",{className:L("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>d(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:L("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 xs(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 ks(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 fd(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 bd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function df(e,t,a,r,o,n=100){let l=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(l.map(d=>[d.id,d]));for(let d=0;d<n;d++){let i=1-d/n;l.forEach(p=>{let s=a/2,c=r/2;p.vx+=(s-p.x)*o.centerForce*i,p.vy+=(c-p.y)*o.centerForce*i,l.forEach(u=>{if(p.id===u.id)return;let k=p.x-u.x,w=p.y-u.y,h=Math.sqrt(k*k+w*w)||1,y=o.chargeStrength*i/(h*h);p.vx+=k/h*y,p.vy+=w/h*y;});}),t.forEach(p=>{let s=m.get(typeof p.source=="string"?p.source:p.source.id),c=m.get(typeof p.target=="string"?p.target:p.target.id);if(!s||!c)return;let u=c.x-s.x,k=c.y-s.y,w=Math.sqrt(u*u+k*k)||1,h=(w-o.linkDistance)/w*o.forceStrength*i;s.vx+=u*h,s.vy+=k*h,c.vx-=u*h,c.vy-=k*h;}),l.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return l}function hd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:l,onInteraction:m,className:d}){let i=react.useRef(null),[p,s]=react.useState([]),[c,u]=react.useState(null),[k,w]=react.useState(null),[h,y]=react.useState(null),[f,g]=react.useState(1),[T,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let P=df(e,t,a.width,a.height,a,150);s(P);},[e,t,a]);let b=react.useCallback((P,W)=>{a.enableDragging&&(W.stopPropagation(),u(P));},[a.enableDragging]),x=react.useCallback(P=>{if(!c||!i.current)return;let E=i.current.getBoundingClientRect(),$=(P.clientX-E.left-T.x)/f,V=(P.clientY-E.top-T.y)/f;s(re=>re.map(se=>se.id===c?{...se,x:$,y:V,fx:$,fy:V}:se));},[c,f,T]),v=react.useCallback(()=>{u(null);},[]),S=react.useCallback((P,W)=>{W.stopPropagation(),m?.({type:"node-click",node:P,position:{x:W.clientX,y:W.clientY}});},[m]),C=react.useCallback((P,W)=>{W.stopPropagation(),m?.({type:"edge-click",edge:P,position:{x:W.clientX,y:W.clientY}});},[m]),A=react.useCallback(P=>{let W=p.find(E=>E.id===P);return W?{x:W.x,y:W.y}:{x:0,y:0}},[p]),z=react.useCallback(P=>{if(P.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return P.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let W=P.card.priority;return W==="URGENT"?"#ef4444":W==="HIGH"?"#f59e0b":W==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return P.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:L("relationships-graph-empty",d),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:L("relationships-graph",d),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(P=>Math.min(P+.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(P=>Math.max(P-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(P=>P.type))).map(P=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:xs(P)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[fd(P)," ",ks(P)]})]},P))}),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(P=>{let W=A(typeof P.source=="string"?P.source:P.source.id),E=A(typeof P.target=="string"?P.target:P.target.id),$=bd(P.type),V=h===P.id,re=P.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-edge",V&&"hovered",re&&"critical"),onMouseEnter:()=>y(P.id),onMouseLeave:()=>y(null),onClick:se=>C(P,se),children:[jsxRuntime.jsx("line",{x1:W.x,y1:W.y,x2:E.x,y2:E.y,stroke:xs(P.type),strokeWidth:re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:V?1:.6,markerEnd:$?"url(#arrowhead)":void 0}),a.showEdgeLabels&&V&&jsxRuntime.jsx("text",{x:(W.x+E.x)/2,y:(W.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ks(P.type)})]},P.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(P=>{let W=k===P.id,E=P.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-node",W&&"hovered",E&&"critical"),transform:`translate(${P.x}, ${P.y})`,onMouseDown:$=>b(P.id,$),onMouseEnter:()=>w(P.id),onMouseLeave:()=>w(null),onClick:$=>S(P,$),children:[jsxRuntime.jsx("circle",{r:E?a.nodeSize*1.2:a.nodeSize,fill:z(P),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:W?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:P.card.title.length>20?P.card.title.substring(0,20)+"...":P.card.title})]},P.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 xd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,l]=react.useState(""),[m,d]=react.useState(false),[i,p]=react.useState(null),[s,c]=react.useState(null),u=react.useRef(null),k=m||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let f=g=>{g.key==="Escape"&&!k&&w();};if(e)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,k]);let w=()=>{k||(l(""),p(null),c(null),t());},h=async()=>{if(!(!n.trim()||k)){d(true),p(null),c(null);try{let f=await r(n.trim());c(f);}catch(f){p(f instanceof Error?f.message:"Failed to generate plan");}finally{d(false);}}},y=()=>{s&&(a(s),w());};return e?jsxRuntime.jsxs(Oe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),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:w,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children: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:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:w,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),s?jsxRuntime.jsx("button",{onClick:y,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()||k,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:k?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ws={"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 mf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},pf={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 uf(e,t,a){let r=ws[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function _r(e){return `$${e.toFixed(4)}`}var Cs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=uf(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,c)=>s+c.cost,0),n=a.reduce((s,c)=>s+c.inputTokens,0),l=a.reduce((s,c)=>s+c.outputTokens,0),m=a.filter(s=>s.success),d=a.reduce((s,c)=>s+c.duration,0),i={},p={};return a.forEach(s=>{i[s.feature]=(i[s.feature]||0)+1,p[s.feature]=(p[s.feature]||0)+s.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:l,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?d/r:0,successRate:r>0?m.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 m=this.operations.filter(p=>p.timestamp>=l).length,d=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:d,percentUsed:i,isExceeded:m>=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)}},Za=new Cs;function Cd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Za.getStats()),[n,l]=react.useState(Za.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let d=setInterval(()=>{o(Za.getStats()),l(Za.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),react.useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let m=Za.getRecentOperations(5);return jsxRuntime.jsxs(Oe,{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:d=>d.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:_r(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(([d,i])=>{let p=r.costsByFeature[d]||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:d.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:_r(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${s}%`}})})]},d)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:_r(d.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 Dd({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[l,m]=react.useState(""),[d,i]=react.useState(""),[p,s]=react.useState(""),[c,u]=react.useState(false),[k,w]=react.useState(null),[h,y]=react.useState(null),[f,g]=react.useState(null),T=react.useRef(null),N=c||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let C=A=>{A.key==="Escape"&&!N&&b();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,N]);let b=()=>{N||(m(""),i(""),s(""),w(null),y(null),g(null),t());},x=async()=>{if(!(!l.trim()||N)){u(true),w(null),y(null),g(null);try{let C=await r({prompt:l.trim(),projectName:n||"Mi Proyecto",startDate:d||void 0,endDate:p||void 0});y(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){w(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},v=()=>{h&&(a(h),b());};if(!e)return null;let S=f?.similarity?((f.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Oe,{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: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:[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 (",S,"% 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,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: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=>m(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: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:d,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:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange: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:N})]})]}),k&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:k}),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,A)=>jsxRuntime.jsx("button",{onClick:()=>m(C),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:C},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: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()||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 $o({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Zr(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,f,g)=>{console.warn(`Retry attempt ${f} after ${g}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),n=react.useCallback(async(h,y,f)=>{r(g=>{let T=g.cards.find(C=>C.id===h);if(!T)return g;let N=T.columnId,b={...T,columnId:y,position:f},x=g.cards.map(C=>C.id===h?b:C),v=g.columns.map(C=>{if(C.id===N)return {...C,cardIds:C.cardIds.filter(A=>A!==h)};if(C.id===y){let A=x.filter(z=>z.columnId===y).sort((z,P)=>z.position-P.position);return {...C,cardIds:A.map(z=>z.id)}}return C}),S={...g,cards:x,columns:v};return o(S),S});},[o]),l=react.useCallback(async(h,y)=>{r(f=>{let g=f.cards.map(N=>N.id===h?{...N,...y}:N),T={...f,cards:g};return o(T),T});},[o]),m=react.useCallback(async h=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let g={...h,id:y},T=f.columns.map(b=>b.id===h.columnId?{...b,cardIds:[...b.cardIds,y]}:b),N={...f,cards:[...f.cards,g],columns:T};return o(N),N});},[o]),d=react.useCallback(async h=>{r(y=>{let f=y.cards.find(b=>b.id===h);if(!f)return y;let g=y.cards.filter(b=>b.id!==h),T=y.columns.map(b=>b.id===f.columnId?{...b,cardIds:b.cardIds.filter(x=>x!==h)}:b),N={...y,cards:g,columns:T};return o(N),N});},[o]),i=react.useCallback(async h=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let g={...h,id:y,cardIds:[]},T={...f,columns:[...f.columns,g]};return o(T),T});},[o]),p=react.useCallback(async(h,y)=>{r(f=>{let g=f.columns.map(N=>N.id===h?{...N,...y}:N),T={...f,columns:g};return o(T),T});},[o]),s=react.useCallback(async h=>{r(y=>{let f=y.cards.filter(N=>N.columnId!==h),g=y.columns.filter(N=>N.id!==h),T={...y,cards:f,columns:g};return o(T),T});},[o]),c=react.useCallback(h=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(h),y},[m]),u=react.useCallback(h=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),y},[i]),k=react.useCallback(()=>{r(h=>{let y={...h,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:l,onCardCreate:m,onCardDelete:d,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:s},setBoard:r,helpers:{addCard:c,addColumn:u,deleteCard:d,deleteColumn:s,clearBoard:k}}}function Ed({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=$o({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(d,i,p={})=>{n.addCard({title:i,columnId:d,position:r.cards.filter(s=>s.columnId===d).length,...p});},addColumn:(d,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(s=>s.position)):0;n.addColumn({title:d,position:i??p+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 Vr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Md={by:"none",order:"asc"};function Id({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Vr,...e}),[n,l]=react.useState({...Md,...t}),m=react.useCallback(w=>{o(h=>({...h,...w}));},[]),d=react.useCallback(w=>{l(h=>({...h,...w}));},[]),i=react.useCallback(()=>{o(Vr),l(Md);},[]),p=react.useCallback(()=>{a&&o({...Vr,assignees:[a]});},[a]),s=react.useCallback(()=>{o({...Vr,dateFilter:"overdue"});},[]),c=react.useCallback(()=>{o({...Vr,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]),k=react.useCallback(w=>{let h=[...w];if(r.search){let y=r.search.toLowerCase();h=h.filter(f=>f.title.toLowerCase().includes(y)||f.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,f=y.getFullYear(),g=String(y.getMonth()+1).padStart(2,"0"),T=String(y.getDate()).padStart(2,"0"),N=`${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 S=x.getUTCFullYear(),C=String(x.getUTCMonth()+1).padStart(2,"0"),A=String(x.getUTCDate()).padStart(2,"0");v=`${S}-${C}-${A}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let S=new Date(N+"T00:00:00"),C=new Date(v+"T00:00:00"),A=new Date(S);return A.setDate(A.getDate()+7),C>=S&&C<=A;case "custom":if(r.dateRange){let z=typeof x=="string"?new Date(x):x;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(h=h.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(h=h.filter(y=>y.labels&&y.labels.some(f=>r.labels.includes(f)))),r.columns.length>0&&(h=h.filter(y=>r.columns.includes(y.columnId))),n.by!=="none"&&h.sort((y,f)=>{let g=0;switch(n.by){case "created":let T=y.createdAt?new Date(y.createdAt).getTime():0,N=f.createdAt?new Date(f.createdAt).getTime():0;g=T-N;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=b[y.priority||"LOW"],v=b[f.priority||"LOW"];g=x-v;break;case "dueDate":let S=y.endDate||y.dueDate,C=f.endDate||f.dueDate;if(!S)return 1;if(!C)return -1;let A=typeof S=="string"?new Date(S).getTime():S.getTime(),z=typeof C=="string"?new Date(C).getTime():C.getTime();g=A-z;break;case "title":g=y.title.localeCompare(f.title);break;case "estimate":let P=y.estimatedTime||0,W=f.estimatedTime||0;g=P-W;break;default:g=0;}return n.order==="asc"?g:-g}),h},[r,n]);return {filters:r,sort:n,setFilters:m,setSort:d,resetFilters:i,filterMyTasks:p,filterOverdue:s,filterHighPriority:c,applyFilters:k,hasActiveFilters:u}}var Ld,Fd;if(typeof window<"u")try{let e=qr("ai");Ld=e.generateObject,Fd=e.generateText;}catch{}function Bd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(Ld&&Fd&&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(c){let u=c instanceof Error?c:new Error("Failed to generate plan");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("Suggesting assignee for:",s.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(c){let u=c instanceof Error?c:new Error("Failed to suggest assignee");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("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(c){let u=c instanceof Error?c: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(c){let u=c instanceof Error?c:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),p=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(c){let u=c instanceof Error?c:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:l,onSuggestAssignee:m,onPredictRisks:d,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function Ns(){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 Rd(e){let{cards:t}=e,[a,r]=Ns(),o=react.useCallback(s=>a.selectedCardIds.includes(s),[a.selectedCardIds]),n=react.useCallback((s,c)=>{if(!c){r({selectedCardIds:[s],lastSelectedCardId:s});return}let u=c.ctrlKey||c.metaKey,k=c.shiftKey;if(u)a.selectedCardIds.includes(s)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==s),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,s],lastSelectedCardId:s});else if(k&&a.lastSelectedCardId){let w=t.find(y=>y.id===s),h=t.find(y=>y.id===a.lastSelectedCardId);if(w&&h&&w.columnId===h.columnId){let y=t.filter(v=>v.columnId===w.columnId).sort((v,S)=>v.position-S.position),f=y.findIndex(v=>v.id===a.lastSelectedCardId),g=y.findIndex(v=>v.id===s),[T,N]=f<g?[f,g]:[g,f],b=y.slice(T,N+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(c=>c!==s),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=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]),p=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:m,selectAll:d,toggleCard:i,getSelectedCards:p}}var Od={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Gd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Od,...a}),[a]),[n,l]=react.useState([]),m=react.useCallback((w,h,y,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:w,cardIds:h,columnId:y,strategy:f,color:g,isExpanded:true,position:n.filter(N=>N.columnId===y).length,createdAt:new Date};l(N=>[...N,T]);},[o.minCardsPerStack,n]),d=react.useCallback(w=>{l(h=>h.filter(y=>y.id!==w));},[]),i=react.useCallback(w=>{l(h=>h.map(y=>y.id===w?{...y,isExpanded:!y.isExpanded}:y));},[]),p=react.useCallback((w,h)=>{l(y=>y.map(f=>f.id===w&&!f.cardIds.includes(h)?{...f,cardIds:[...f.cardIds,h]}:f));},[]),s=react.useCallback((w,h)=>{l(y=>y.map(f=>{if(f.id===w){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]),c=react.useCallback(w=>n.filter(h=>h.columnId===w).sort((h,y)=>h.position-y.position),[n]),u=react.useCallback(async w=>{let h=t.filter(N=>N.columnId===w);if(h.length<o.minCardsPerStack*2)return [];let y=[],f=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(N);});}),f.forEach((N,b)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:N.map(x=>x.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${b}"`,confidence:.85});});let g=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(b=>{g.has(b)||g.set(b,[]),g.get(b).push(N);});}),g.forEach((N,b)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:N.map(x=>x.id),columnId:w,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 x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";y.push({stack:{title:`${x} ${b} Priority`,cardIds:N.map(v=>v.id),columnId:w,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 x=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let v=[N.id,...x.map(C=>C.card.id)],S=x.reduce((C,A)=>C+A.similarity,0)/x.length;y.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:S});}}return y.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,b)=>b.confidence-N.confidence).slice(0,5)},[t,o,r]),k=react.useCallback(w=>{m(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let y=await u(h),f=y[0];y.length>0&&f&&f.confidence>=.9&&k(f);});},[]),{stacks:n,createStack:m,deleteStack:d,toggleStack:i,addToStack:p,removeFromStack:s,getStacksForColumn:c,getSuggestions:u,applySuggestion:k,config:o}}var zd=react.createContext(null);function Ud({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,l=new Map;t?.columns?.forEach(d=>{let{Column:i}=qr("@libxai/core");n.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=qr("@libxai/core");l.set(d.id,new i(d));});let m=null;if(t?.board){let{Board:d}=qr("@libxai/core");m=new d(t.board);}r.current=new core.BoardStore({board:m,columns:n,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(zd.Provider,{value:{store:o},children:e})}function Wo(){let e=react.useContext(zd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Kr(){let e=Wo(),[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 m=react.useCallback(f=>{e.updateBoard(f);},[e]),d=react.useCallback(f=>{e.addColumn(f);},[e]),i=react.useCallback((f,g)=>{e.updateColumn(f,g);},[e]),p=react.useCallback(f=>{e.deleteColumn(f);},[e]),s=react.useCallback(f=>e.getColumn(f),[e]),c=react.useCallback(f=>{e.addCard(f);},[e]),u=react.useCallback((f,g)=>{e.updateCard(f,g);},[e]),k=react.useCallback(f=>{e.deleteCard(f);},[e]),w=react.useCallback((f,g,T)=>{e.moveCard(f,g,T);},[e]),h=react.useCallback(f=>e.getCard(f),[e]),y=react.useCallback(f=>e.getCardsByColumn(f),[e]);return {board:t,columns:r,cards:n,updateBoard:m,addColumn:d,updateColumn:i,deleteColumn:p,getColumn:s,addCard:c,updateCard:u,deleteCard:k,moveCard:w,getCard:h,getCardsByColumn:y}}function Wd(e){let{cards:t}=Kr();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 Hd(e="position",t="asc"){let{cards:a}=Kr();return react.useMemo(()=>[...a].sort((o,n)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(n.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},d=o.priority?m[o.priority]:0,i=n.priority?m[n.priority]:0;l=d-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 Ho=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Qs.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 m=await Promise.resolve(l.apply(n,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,m,{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);}},Mf=new Ho;function Vd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:l=false,gap:m=0,getItemKey:d}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:n,horizontal:l,gap:m}),s=p.getVirtualItems(),c={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:c,className:o,children:jsxRuntime.jsx("div",{style:u,children:s.map(k=>{let w=e[k.index];if(!w)return null;let h=d?d(w,k.index):k.index,y={position:"absolute",top:l?0:k.start,left:l?k.start:0,width:l?k.size:"100%",height:l?"100%":k.size};return jsxRuntime.jsx("div",{style:y,"data-index":k.index,children:r(w,k.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 Yd({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:l=3,gap:m=16,getItemKey:d,horizontal:i=true}){let p=react.useRef(null),s=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:l,gap:m}),c=s.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},k={width:`${s.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:n,children:jsxRuntime.jsx("div",{style:k,children:c.map(w=>{let h=e[w.index];if(!h)return null;let y=d?d(h,w.index):w.index,f={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsxRuntime.jsx("div",{style:f,"data-index":w.index,children:o(h,w.index)},y)})})})}function qd(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 Xd(e,t=10){return e>t}var Ps={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ms={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Is={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},As={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ls={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Fs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Bs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Rs={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)"},Os={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},zs={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}},Us={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}},_o={spacing:Ps,borderRadius:Ms,fontSize:Is,fontWeight:As,lineHeight:Ls,zIndex:Fs,duration:Bs,easing:Rs,shadows:Os,opacity:Gs,kanban:zs,gantt:Us};function Jd(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 Lf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ws(e="asakaa"){let t=$s(_o),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,l=Lf(o);a.push(` ${n}: ${l};`);}return `:root {
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(m=>m.name.toLowerCase()===r);if(o)return o;let n=a.find(m=>m.name.toLowerCase().includes(r));if(n)return n;let l=r.split(/\s+/);return a.find(m=>{let d=m.name.toLowerCase();return l.every(i=>d.includes(i))})}function ss(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 c=new Date(r);return c.setDate(c.getDate()+1),c}if(a==="yesterday"||a==="ayer"){let c=new Date(r);return c.setDate(c.getDate()-1),c}if(a==="next week"||a==="la pr\xF3xima semana"){let c=new Date(r);return c.setDate(c.getDate()+7),c}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let v=new Date(r),k=v.getDay(),h=u-k;return h<=0&&(h+=7),v.setDate(v.getDate()+h),v}}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 c=parseInt(n[1],10),u=n[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+c):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+c*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+c),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let c=parseInt(m[1],10),u=parseInt(m[2],10)-1,v=parseInt(m[3],10);return new Date(v,u,c)}let d={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 c=parseInt(i[1],10),u=d[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,c)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 c=p[s[1].toLowerCase()],u=parseInt(s[2],10),v=s[3]?parseInt(s[3],10):r.getFullYear();if(c!==void 0)return new Date(v,c,u)}return null}function is(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 ls(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(),p=r[2].trim(),s=Pa(t,i),c=ss(p);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(!c)return {type:"move_task",taskId:s.id,taskName:s.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=s.startDate&&s.endDate?Math.round((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(c);return v.setDate(v.getDate()+u),{type:"move_task",taskId:s.id,taskName:s.name,updates:{startDate:c,endDate:v},message:`Moved "${s.name}" to ${c.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),s=Pa(t,i),c=is(p);if(!s)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!c||!s.endDate)return {type:"resize_task",taskId:s.id,taskName:s.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(s.endDate);return u.setDate(u.getDate()+c),{type:"resize_task",taskId:s.id,taskName:s.name,updates:{endDate:u},message:`Extended "${s.name}" by ${c} 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(),p=n[2].trim(),s=Pa(t,i),c=ls(p);return s?c===null?{type:"set_progress",taskId:s.id,taskName:s.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:s.id,taskName:s.name,updates:{progress:c},message:`Set "${s.name}" progress to ${c}%.`,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(),p=l[2].trim(),s=Pa(t,i);return s?{type:"rename_task",taskId:s.id,taskName:s.name,updates:{name:p},message:`Renamed "${s.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),p=m[2].trim(),s=Pa(t,i),c=Pa(t,p);return s?c?{type:"link_tasks",taskId:c.id,taskName:c.name,dependencyFrom:s.id,dependencyTo:c.id,message:`Linked "${s.name}" \u2192 "${c.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),p=Pa(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function 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 zg(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 $g(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(p=>{let s=a.find(c=>c.id===p);return s?{name:s.name,initials:s.initials,color:s.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ao(p,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let l=p=>{if(p)return typeof p=="string"?new Date(p):p},m=l(e.startDate),d=l(e.endDate),i=e.metadata?.isMilestone===true||m&&d&&Math.abs(d.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:d,progress:e.progress||0,status:zg(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:$g(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 ds={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"}},cs={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:ds,es:cs};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 Xg({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:m="dark",locale:d="en",customTranslations:i,showSearch:p=true,showHierarchy:s=true}=t,c=Fo(d,i),u=m==="dark",[v,k]=react.useState(new Set),[h,w]=react.useState("startDate"),[g,f]=react.useState("asc"),[D,T]=react.useState("");react.useMemo(()=>{let C=new Set;function P(O){for(let A of O)A.subtasks?.length&&(C.add(A.id),P(A.subtasks));}P(e),k(C);},[e]);let b=react.useCallback(C=>{k(P=>{let O=new Set(P);return O.has(C)?O.delete(C):O.add(C),O}),a.onTaskToggleExpand?.(C);},[a]),y=react.useCallback(C=>{h===C?f(P=>P==="asc"?"desc":"asc"):(w(C),f("asc")),a.onSortChange?.({column:C,direction:g==="asc"?"desc":"asc"});},[h,g,a]),x=react.useMemo(()=>{let C=nd(e);if(D.trim()){let O=D.toLowerCase();C=C.filter(A=>A.name.toLowerCase().includes(O));}let P=[];for(let O of C){let A=O.level===0;O.level>0&&(A=true),(A||D.trim())&&P.push(O);}return D.trim()&&P.sort((O,A)=>{let U,j;switch(h){case "name":U=O.name.toLowerCase(),j=A.name.toLowerCase();break;case "startDate":U=O.startDate?.getTime()||0,j=A.startDate?.getTime()||0;break;case "endDate":U=O.endDate?.getTime()||0,j=A.endDate?.getTime()||0;break;case "progress":U=O.progress||0,j=A.progress||0;break;case "status":U=O.status||"todo",j=A.status||"todo";break;default:return 0}return U<j?g==="asc"?-1:1:U>j?g==="asc"?1:-1:0}),P},[e,D,h,g]),S=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:L("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:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[c.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:L("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:L("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:L("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:L("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:c.empty.noTasks}),jsxRuntime.jsx("p",{className:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:L("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:L("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:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:L("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:D,onChange:C=>T(C.target.value),placeholder:c.toolbar.searchPlaceholder,className:L("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:L("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[x.length," ",c.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:L("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:()=>y("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[c.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:()=>y("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[c.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:()=>y("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[c.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:()=>y("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[c.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:()=>y("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:x.map((C,P)=>{let O=v.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:P*.02},className:L("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:A=>{A.stopPropagation(),b(C.id);},className:L("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:O?jsxRuntime.jsx(lucideReact.ChevronDown,{className:L("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),s&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:A=>{A.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Xg,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:L("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:L("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"?c.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?c.status.inProgress:c.status.todo})}),jsxRuntime.jsxs("div",{className:L("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"}),S(C.startDate)]}),jsxRuntime.jsxs("div",{className:L("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"}),S(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:L("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:L("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:L("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[C.progress||0,"%"]})]})})]},C.id)})}),x.length===0&&D&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:L("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:L(u?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.noResults})]})})]})]})}var ps={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},us={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},gs={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:ps,light:us,neutral:gs};function id(e){return Ro[e]||Ro.dark}var fs={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"}},bs={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:fs,es:bs};function Hr(e){return Oo[e]||Oo.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 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 nf(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function vs(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 sf({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 pd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:l,style:m}){let{theme:d="dark",locale:i="en",customTranslations:p}=t,s=zo(i,p),c=d==="dark",[u,v]=react.useState(r||new Date),[k,h]=react.useState(null),w=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),g=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),f=react.useCallback(()=>{v(new Date);},[]),D=react.useMemo(()=>{let x=u.getFullYear(),S=u.getMonth(),C=new Date(x,S,1),P=new Date(x,S+1,0),O=C.getDay(),A=P.getDate(),U=nf(e),j=new Date;j.setHours(0,0,0,0);let Z=[],pe=O,z=new Date(x,S,0).getDate();for(let _=pe-1;_>=0;_--){let F=new Date(x,S-1,z-_);Z.push({date:F,isCurrentMonth:false,isToday:false,isWeekend:F.getDay()===0||F.getDay()===6,events:U.filter(B=>vs(F,B)).map(B=>({id:B.id,title:B.name,start:B.startDate,end:B.endDate,task:B}))});}for(let _=1;_<=A;_++){let F=new Date(x,S,_),B=F.getTime()===j.getTime();Z.push({date:F,isCurrentMonth:true,isToday:B,isWeekend:F.getDay()===0||F.getDay()===6,events:U.filter(E=>vs(F,E)).map(E=>({id:E.id,title:E.name,start:E.startDate,end:E.endDate,task:E}))});}let V=42-Z.length;for(let _=1;_<=V;_++){let F=new Date(x,S+1,_);Z.push({date:F,isCurrentMonth:false,isToday:false,isWeekend:F.getDay()===0||F.getDay()===6,events:U.filter(B=>vs(F,B)).map(B=>({id:B.id,title:B.name,start:B.startDate,end:B.endDate,task:B}))});}return Z},[u,e]),T=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"}),y=react.useCallback(x=>{let S=x.progress===100?0:100,C=S===100?"completed":"todo";a.onTaskUpdate?.({...x,status:C,progress:S});},[a]);return o?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",l),style:m,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:L("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[s.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",l),style:m,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:L("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",l),style:m,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:L("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:s.labels.noEvents}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:s.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:L("flex-1 flex flex-col w-full h-full overflow-hidden",c?"bg-[#0F1117]":"bg-white",l),style:m,children:[jsxRuntime.jsx("div",{className:L("flex-shrink-0 px-6 py-4 border-b",c?"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:L("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:b}),jsxRuntime.jsx("button",{onClick:f,className:L("px-3 py-1.5 text-sm rounded-lg transition-colors",c?"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:L("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:L("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:g,className:L("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-5 h-5",c?"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:T.map(x=>jsxRuntime.jsx("div",{className:L("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:x},x))}),jsxRuntime.jsx("div",{className:L("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",c?"bg-white/5":"bg-gray-200"),children:D.map((x,S)=>jsxRuntime.jsxs("div",{className:L("min-h-[100px] p-2 transition-colors",c?"bg-[#0F1117]":"bg-white",!x.isCurrentMonth&&(c?"bg-[#0F1117]/50":"bg-gray-50"),x.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:L("text-sm font-medium mb-1",x.isToday?"text-[#3B82F6]":x.isCurrentMonth?c?"text-white":"text-gray-900":c?"text-[#6B7280]":"text-gray-400"),children:x.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[x.events.slice(0,3).map(C=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(C.task),a.onEventClick?.(C);},whileHover:{scale:1.02},className:L("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",C.task.progress===100?c?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":c?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(sf,{task:C.task}),jsxRuntime.jsx("span",{className:"truncate",children:C.title})]},C.id)),x.events.length>3&&jsxRuntime.jsxs("div",{className:L("text-xs px-1.5",c?"text-[#6B7280]":"text-gray-400"),children:["+",x.events.length-3," ",i==="es"?"m\xE1s":"more"]})]})]},S))})]})}),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:L("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",c?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:L("p-4 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold",c?"text-white":"text-gray-900"),children:i==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:L("p-1 rounded",c?"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:L("text-xs uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:L("font-medium",c?"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:L("text-xs uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-white":"text-gray-900"),children:k.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:L("text-sm",c?"text-white":"text-gray-900"),children:k.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase mb-2 block",c?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:L("flex-1 h-2 rounded-full overflow-hidden",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:L("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:L("text-sm font-medium w-10",c?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{y(k),h(null);},className:L("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 ys={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},xs={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"},ks={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:ys,light:xs,neutral:ks};function ud(e){return Wo[e]||Wo.dark}function df({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:l,className:m}){let[d,i]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),s=react.useMemo(()=>{let u=p.length,v=new Set(p.flatMap(w=>w.assignedUserIds||[])).size,k=p.map(w=>w.priority).filter(Boolean),h=new Set(p.flatMap(w=>w.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:k,labels:h}},[p]),c=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:L("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:c,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:L("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"]})]}),d&&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:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),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:m}){let d=react.useMemo(()=>({...fd,...l}),[l]),[i,p]=react.useState(new Set),s=react.useRef(null),c=react.useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let g=new Map;return e.forEach(f=>{let D=f.timestamp.toISOString().split("T")[0],T=g.get(D);T?T.push(f):g.set(D,[f]);}),Array.from(g.entries()).sort((f,D)=>D[0].localeCompare(f[0])).map(([f,D])=>({date:new Date(f),events:D.sort((T,b)=>b.timestamp.getTime()-T.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let g=new Set,f=new Set;return e.forEach(D=>{g.add(D.userId),f.add(D.type);}),{uniqueUsers:Array.from(g),uniqueTypes:Array.from(f)}},[e]),k=g=>{p(f=>{let D=new Set(f);return D.has(g)?D.delete(g):D.add(g),D});},h=g=>{let D=new Date().getTime()-g.getTime(),T=Math.floor(D/6e4),b=Math.floor(D/36e5),y=Math.floor(D/864e5);return T<1?"just now":T<60?`${T}m ago`:b<24?`${b}h ago`:y<7?`${y}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&&s.current){let g=s.current.querySelector(`[data-event-id="${n}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:L("history-timeline-empty",m),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:L("history-timeline",d.compact&&"compact",m),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"}),v.map(g=>jsxRuntime.jsxs("option",{value:g,children:[Vr(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:s,children:c.map(g=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[d.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,D)=>{let T=i.has(f.id),b=n===f.id,y=bd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:L("history-timeline-event",T&&"expanded",b&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:y},children:d.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Vr(f.type)})}),D<g.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:y}})]}),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:[d.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:_r(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:x=>{x.stopPropagation(),k(f.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([x,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[x,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},x)),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(([x,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[x,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},x))]})]})]})]},f.id)})})]},g.date?.toISOString()||"all"))})]})}function yd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:l,onGoToEvent:m,onSpeedChange:d,className:i}){let p=[.5,1,1.5,2,3],s=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),c=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:L("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:L("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=>m(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${c}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:L("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>m(v),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:p.map(u=>jsxRuntime.jsxs("button",{className:L("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>d(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:L("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 ws(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 Cs(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 ff(e,t,a,r,o,n=100){let l=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(l.map(d=>[d.id,d]));for(let d=0;d<n;d++){let i=1-d/n;l.forEach(p=>{let s=a/2,c=r/2;p.vx+=(s-p.x)*o.centerForce*i,p.vy+=(c-p.y)*o.centerForce*i,l.forEach(u=>{if(p.id===u.id)return;let v=p.x-u.x,k=p.y-u.y,h=Math.sqrt(v*v+k*k)||1,w=o.chargeStrength*i/(h*h);p.vx+=v/h*w,p.vy+=k/h*w;});}),t.forEach(p=>{let s=m.get(typeof p.source=="string"?p.source:p.source.id),c=m.get(typeof p.target=="string"?p.target:p.target.id);if(!s||!c)return;let u=c.x-s.x,v=c.y-s.y,k=Math.sqrt(u*u+v*v)||1,h=(k-o.linkDistance)/k*o.forceStrength*i;s.vx+=u*h,s.vy+=v*h,c.vx-=u*h,c.vy-=v*h;}),l.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return l}function wd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:l,onInteraction:m,className:d}){let i=react.useRef(null),[p,s]=react.useState([]),[c,u]=react.useState(null),[v,k]=react.useState(null),[h,w]=react.useState(null),[g,f]=react.useState(1),[D,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let A=ff(e,t,a.width,a.height,a,150);s(A);},[e,t,a]);let b=react.useCallback((A,U)=>{a.enableDragging&&(U.stopPropagation(),u(A));},[a.enableDragging]),y=react.useCallback(A=>{if(!c||!i.current)return;let j=i.current.getBoundingClientRect(),Z=(A.clientX-j.left-D.x)/g,pe=(A.clientY-j.top-D.y)/g;s(z=>z.map(V=>V.id===c?{...V,x:Z,y:pe,fx:Z,fy:pe}:V));},[c,g,D]),x=react.useCallback(()=>{u(null);},[]),S=react.useCallback((A,U)=>{U.stopPropagation(),m?.({type:"node-click",node:A,position:{x:U.clientX,y:U.clientY}});},[m]),C=react.useCallback((A,U)=>{U.stopPropagation(),m?.({type:"edge-click",edge:A,position:{x:U.clientX,y:U.clientY}});},[m]),P=react.useCallback(A=>{let U=p.find(j=>j.id===A);return U?{x:U.x,y:U.y}:{x:0,y:0}},[p]),O=react.useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let U=A.card.priority;return U==="URGENT"?"#ef4444":U==="HIGH"?"#f59e0b":U==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:L("relationships-graph-empty",d),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:L("relationships-graph",d),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(A=>Math.min(A+.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(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),T({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(A=>A.type))).map(A=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:ws(A)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[xd(A)," ",Cs(A)]})]},A))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:y,onMouseUp:x,onMouseLeave:x,children:[jsxRuntime.jsxs("g",{transform:`translate(${D.x}, ${D.y}) scale(${g})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let U=P(typeof A.source=="string"?A.source:A.source.id),j=P(typeof A.target=="string"?A.target:A.target.id),Z=kd(A.type),pe=h===A.id,z=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-edge",pe&&"hovered",z&&"critical"),onMouseEnter:()=>w(A.id),onMouseLeave:()=>w(null),onClick:V=>C(A,V),children:[jsxRuntime.jsx("line",{x1:U.x,y1:U.y,x2:j.x,y2:j.y,stroke:ws(A.type),strokeWidth:z?a.edgeWidth*2:a.edgeWidth,strokeOpacity:pe?1:.6,markerEnd:Z?"url(#arrowhead)":void 0}),a.showEdgeLabels&&pe&&jsxRuntime.jsx("text",{x:(U.x+j.x)/2,y:(U.y+j.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Cs(A.type)})]},A.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(A=>{let U=v===A.id,j=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-node",U&&"hovered",j&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:Z=>b(A.id,Z),onMouseEnter:()=>k(A.id),onMouseLeave:()=>k(null),onClick:Z=>S(A,Z),children:[jsxRuntime.jsx("circle",{r:j?a.nodeSize*1.2:a.nodeSize,fill:O(A),stroke:j?"#fbbf24":"#ffffff",strokeWidth:j?3:2,opacity:U?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:A.card.title.length>20?A.card.title.substring(0,20)+"...":A.card.title})]},A.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Dd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,l]=react.useState(""),[m,d]=react.useState(false),[i,p]=react.useState(null),[s,c]=react.useState(null),u=react.useRef(null),v=m||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&!v&&k();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,v]);let k=()=>{v||(l(""),p(null),c(null),t());},h=async()=>{if(!(!n.trim()||v)){d(true),p(null),c(null);try{let g=await r(n.trim());c(g);}catch(g){p(g instanceof Error?g.message:"Failed to generate plan");}finally{d(false);}}},w=()=>{s&&(a(s),k());};return e?jsxRuntime.jsxs(Re,{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: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:k,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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((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 (",s.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[s.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)),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: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:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((g,f)=>jsxRuntime.jsx("button",{onClick:()=>l(g),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children: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:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:k,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),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()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ts={"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 hf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},vf={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 yf(e,t,a){let r=Ts[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 Ds=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=yf(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,c)=>s+c.cost,0),n=a.reduce((s,c)=>s+c.inputTokens,0),l=a.reduce((s,c)=>s+c.outputTokens,0),m=a.filter(s=>s.success),d=a.reduce((s,c)=>s+c.duration,0),i={},p={};return a.forEach(s=>{i[s.feature]=(i[s.feature]||0)+1,p[s.feature]=(p[s.feature]||0)+s.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:l,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?d/r:0,successRate:r>0?m.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 m=this.operations.filter(p=>p.timestamp>=l).length,d=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:d,percentUsed:i,isExceeded:m>=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 Ds;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 d=setInterval(()=>{o(Qa.getStats()),l(Qa.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),react.useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let m=Qa.getRecentOperations(5);return jsxRuntime.jsxs(Re,{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:d=>d.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(([d,i])=>{let p=r.costsByFeature[d]||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:d.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(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${s}%`}})})]},d)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:jr(d.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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,m]=react.useState(""),[d,i]=react.useState(""),[p,s]=react.useState(""),[c,u]=react.useState(false),[v,k]=react.useState(null),[h,w]=react.useState(null),[g,f]=react.useState(null),D=react.useRef(null),T=c||o;react.useEffect(()=>{e&&D.current&&D.current.focus();},[e]),react.useEffect(()=>{let C=P=>{P.key==="Escape"&&!T&&b();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,T]);let b=()=>{T||(m(""),i(""),s(""),k(null),w(null),f(null),t());},y=async()=>{if(!(!l.trim()||T)){u(true),k(null),w(null),f(null);try{let C=await r({prompt:l.trim(),projectName:n||"Mi Proyecto",startDate:d||void 0,endDate:p||void 0});w(C.tasks.tasks),f({from_cache:C.from_cache,tokens_used:C.tokens_used,mock_mode:C.mock_mode,similarity:C.similarity,tokens_saved:C.tokens_saved});}catch(C){k(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},x=()=>{h&&(a(h),b());};if(!e)return null;let S=g?.similarity?((g.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Re,{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:T,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 (",S,"% 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((C,P)=>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:["#",P+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:D,value:l,onChange:C=>m(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:T}),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:d,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:T})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange: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:T})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((C,P)=>jsxRuntime.jsx("button",{onClick:()=>m(C),disabled:T,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},P))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&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:T,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:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:y,disabled:!l.trim()||T,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:T?"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,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 D=f.cards.find(C=>C.id===h);if(!D)return f;let T=D.columnId,b={...D,columnId:w,position:g},y=f.cards.map(C=>C.id===h?b:C),x=f.columns.map(C=>{if(C.id===T)return {...C,cardIds:C.cardIds.filter(P=>P!==h)};if(C.id===w){let P=y.filter(O=>O.columnId===w).sort((O,A)=>O.position-A.position);return {...C,cardIds:P.map(O=>O.id)}}return C}),S={...f,cards:y,columns:x};return o(S),S});},[o]),l=react.useCallback(async(h,w)=>{r(g=>{let f=g.cards.map(T=>T.id===h?{...T,...w}:T),D={...g,cards:f};return o(D),D});},[o]),m=react.useCallback(async h=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:w},D=g.columns.map(b=>b.id===h.columnId?{...b,cardIds:[...b.cardIds,w]}:b),T={...g,cards:[...g.cards,f],columns:D};return o(T),T});},[o]),d=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),D=w.columns.map(b=>b.id===g.columnId?{...b,cardIds:b.cardIds.filter(y=>y!==h)}:b),T={...w,cards:f,columns:D};return o(T),T});},[o]),i=react.useCallback(async h=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:w,cardIds:[]},D={...g,columns:[...g.columns,f]};return o(D),D});},[o]),p=react.useCallback(async(h,w)=>{r(g=>{let f=g.columns.map(T=>T.id===h?{...T,...w}:T),D={...g,columns:f};return o(D),D});},[o]),s=react.useCallback(async h=>{r(w=>{let g=w.cards.filter(T=>T.columnId!==h),f=w.columns.filter(T=>T.id!==h),D={...w,cards:g,columns:f};return o(D),D});},[o]),c=react.useCallback(h=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(h),w},[m]),u=react.useCallback(h=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),w},[i]),v=react.useCallback(()=>{r(h=>{let w={...h,cards:[],columns:[]};return o(w),w});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:l,onCardCreate:m,onCardDelete:d,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:s},setBoard:r,helpers:{addCard:c,addColumn:u,deleteCard:d,deleteColumn:s,clearBoard:v}}}function Ld({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Ho({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(d,i,p={})=>{n.addCard({title:i,columnId:d,position:r.cards.filter(s=>s.columnId===d).length,...p});},addColumn:(d,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(s=>s.position)):0;n.addColumn({title:d,position:i??p+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}),m=react.useCallback(k=>{o(h=>({...h,...k}));},[]),d=react.useCallback(k=>{l(h=>({...h,...k}));},[]),i=react.useCallback(()=>{o(Kr),l(Bd);},[]),p=react.useCallback(()=>{a&&o({...Kr,assignees:[a]});},[a]),s=react.useCallback(()=>{o({...Kr,dateFilter:"overdue"});},[]),c=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]),v=react.useCallback(k=>{let h=[...k];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"),D=String(w.getDate()).padStart(2,"0"),T=`${g}-${f}-${D}`;h=h.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let y=b.endDate||b.dueDate;if(!y)return false;let x;if(typeof y=="string")x=y.split("T")[0]||y;else {let S=y.getUTCFullYear(),C=String(y.getUTCMonth()+1).padStart(2,"0"),P=String(y.getUTCDate()).padStart(2,"0");x=`${S}-${C}-${P}`;}switch(r.dateFilter){case "overdue":return x<T;case "today":return x===T;case "this-week":let S=new Date(T+"T00:00:00"),C=new Date(x+"T00:00:00"),P=new Date(S);return P.setDate(P.getDate()+7),C>=S&&C<=P;case "custom":if(r.dateRange){let O=typeof y=="string"?new Date(y):y;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 D=w.createdAt?new Date(w.createdAt).getTime():0,T=g.createdAt?new Date(g.createdAt).getTime():0;f=D-T;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},y=b[w.priority||"LOW"],x=b[g.priority||"LOW"];f=y-x;break;case "dueDate":let S=w.endDate||w.dueDate,C=g.endDate||g.dueDate;if(!S)return 1;if(!C)return -1;let P=typeof S=="string"?new Date(S).getTime():S.getTime(),O=typeof C=="string"?new Date(C).getTime():C.getTime();f=P-O;break;case "title":f=w.title.localeCompare(g.title);break;case "estimate":let A=w.estimatedTime||0,U=g.estimatedTime||0;f=A-U;break;default:f=0;}return n.order==="asc"?f:-f}),h},[r,n]);return {filters:r,sort:n,setFilters:m,setSort:d,resetFilters:i,filterMyTasks:p,filterOverdue:s,filterHighPriority:c,applyFilters:v,hasActiveFilters:u}}var zd,$d;if(typeof window<"u")try{let e=Jr("ai");zd=e.generateObject,$d=e.generateText;}catch{}function Wd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(zd&&$d&&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(c){let u=c instanceof Error?c:new Error("Failed to generate plan");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("Suggesting assignee for:",s.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(c){let u=c instanceof Error?c:new Error("Failed to suggest assignee");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("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(c){let u=c instanceof Error?c: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(c){let u=c instanceof Error?c:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),p=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(c){let u=c instanceof Error?c:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:l,onSuggestAssignee:m,onPredictRisks:d,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function Ss(){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]=Ss(),o=react.useCallback(s=>a.selectedCardIds.includes(s),[a.selectedCardIds]),n=react.useCallback((s,c)=>{if(!c){r({selectedCardIds:[s],lastSelectedCardId:s});return}let u=c.ctrlKey||c.metaKey,v=c.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(v&&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(x=>x.columnId===k.columnId).sort((x,S)=>x.position-S.position),g=w.findIndex(x=>x.id===a.lastSelectedCardId),f=w.findIndex(x=>x.id===s),[D,T]=g<f?[g,f]:[f,g],b=w.slice(D,T+1).map(x=>x.id),y=Array.from(new Set([...a.selectedCardIds,...b]));r({selectedCardIds:y,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(c=>c!==s),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=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]),p=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:m,selectAll:d,toggleCard:i,getSelectedCards:p}}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([]),m=react.useCallback((k,h,w,g,f)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let D={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:h,columnId:w,strategy:g,color:f,isExpanded:true,position:n.filter(T=>T.columnId===w).length,createdAt:new Date};l(T=>[...T,D]);},[o.minCardsPerStack,n]),d=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));},[]),p=react.useCallback((k,h)=>{l(w=>w.map(g=>g.id===k&&!g.cardIds.includes(h)?{...g,cardIds:[...g.cardIds,h]}:g));},[]),s=react.useCallback((k,h)=>{l(w=>w.map(g=>{if(g.id===k){let f=g.cardIds.filter(D=>D!==h);return f.length<o.minCardsPerStack?null:{...g,cardIds:f}}return g}).filter(g=>g!==null));},[o.minCardsPerStack]),c=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(T=>T.columnId===k);if(h.length<o.minCardsPerStack*2)return [];let w=[],g=new Map;h.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(b=>{g.has(b)||g.set(b,[]),g.get(b).push(T);});}),g.forEach((T,b)=>{T.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:T.map(y=>y.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${b}"`,confidence:.85});});let f=new Map;h.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(T);});}),f.forEach((T,b)=>{T.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:T.map(y=>y.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let D=new Map;if(h.forEach(T=>{T.priority&&(D.has(T.priority)||D.set(T.priority,[]),D.get(T.priority).push(T));}),D.forEach((T,b)=>{if(T.length>=o.minCardsPerStack){let y={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";w.push({stack:{title:`${y} ${b} Priority`,cardIds:T.map(x=>x.id),columnId:k,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${b} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of h){let y=(await r.findSimilar(T,h)).filter(x=>x.similarity>=o.autoStackConfidenceThreshold);if(y.length>=o.minCardsPerStack-1){let x=[T.id,...y.map(C=>C.card.id)],S=y.reduce((C,P)=>C+P.similarity,0)/y.length;w.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:x,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${y.length+1} similar tasks`,confidence:S});}}return w.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,b)=>b.confidence-T.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(k=>{m(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[m]);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&&v(g);});},[]),{stacks:n,createStack:m,deleteStack:d,toggleStack:i,addToStack:p,removeFromStack:s,getStacksForColumn:c,getSuggestions:u,applySuggestion:v,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(d=>{let{Column:i}=Jr("@libxai/core");n.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=Jr("@libxai/core");l.set(d.id,new i(d));});let m=null;if(t?.board){let{Board:d}=Jr("@libxai/core");m=new d(t.board);}r.current=new core.BoardStore({board:m,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 m=react.useCallback(g=>{e.updateBoard(g);},[e]),d=react.useCallback(g=>{e.addColumn(g);},[e]),i=react.useCallback((g,f)=>{e.updateColumn(g,f);},[e]),p=react.useCallback(g=>{e.deleteColumn(g);},[e]),s=react.useCallback(g=>e.getColumn(g),[e]),c=react.useCallback(g=>{e.addCard(g);},[e]),u=react.useCallback((g,f)=>{e.updateCard(g,f);},[e]),v=react.useCallback(g=>{e.deleteCard(g);},[e]),k=react.useCallback((g,f,D)=>{e.moveCard(g,f,D);},[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:m,addColumn:d,updateColumn:i,deleteColumn:p,getColumn:s,addCard:c,updateCard:u,deleteCard:v,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 m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},d=o.priority?m[o.priority]:0,i=n.priority?m[n.priority]:0;l=d-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=ti.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 m=await Promise.resolve(l.apply(n,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,m,{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);}},Rf=new Vo;function Xd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:l=false,gap:m=0,getItemKey:d}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:n,horizontal:l,gap:m}),s=p.getVirtualItems(),c={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:c,className:o,children:jsxRuntime.jsx("div",{style:u,children:s.map(v=>{let k=e[v.index];if(!k)return null;let h=d?d(k,v.index):v.index,w={position:"absolute",top:l?0:v.start,left:l?v.start:0,width:l?v.size:"100%",height:l?"100%":v.size};return jsxRuntime.jsx("div",{style:w,"data-index":v.index,children:r(k,v.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:m=16,getItemKey:d,horizontal:i=true}){let p=react.useRef(null),s=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:l,gap:m}),c=s.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${s.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:n,children:jsxRuntime.jsx("div",{style:v,children:c.map(k=>{let h=e[k.index];if(!h)return null;let w=d?d(h,k.index):k.index,g={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:g,"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 Is={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},As={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ls={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fs={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Bs={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Rs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Os={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)"},$s={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},Ws={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Gs={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}},Us={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:Is,borderRadius:As,fontSize:Ls,fontWeight:Fs,lineHeight:Bs,zIndex:Rs,duration:Os,easing:zs,shadows:$s,opacity:Ws,kanban:Gs,gantt:Us};function ac(e,t,a){return e[t]??a}function Hs(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)?Hs(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function $f(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function _s(e="asakaa"){let t=Hs(jo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,l=$f(o);a.push(` ${n}: ${l};`);}return `:root {
324
324
  ${a.join(`
325
325
  `)}
326
- }`}function Yr(e,t="asakaa"){let a=[],r=$s(e);for(let[o,n]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${n};`);}return `:root {
326
+ }`}function Xr(e,t="asakaa"){let a=[],r=Hs(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 Vo={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"}},Hs={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"}},_s={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 Vs(e=Vo,t="asakaa"){let a=Ws(t),r=Yr(e,t);return `${a}
329
+ }`}var Ko={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"}},Vs={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"}},js={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 Ks(e=Ko,t="asakaa"){let a=_s(t),r=Xr(e,t);return `${a}
330
330
 
331
- ${r}`}function Zd(){return `/**
331
+ ${r}`}function rc(){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
- ${Vs(Vo)}
337
+ ${Ks(Ko)}
338
338
 
339
339
  /* Light theme */
340
340
  [data-theme="light"] {
341
- ${Yr(Hs,"asakaa").split(`
341
+ ${Xr(Vs,"asakaa").split(`
342
342
  `).slice(1,-1).join(`
343
343
  `)}
344
344
  }
345
345
 
346
346
  /* Neutral theme */
347
347
  [data-theme="neutral"] {
348
- ${Yr(_s,"asakaa").split(`
348
+ ${Xr(js,"asakaa").split(`
349
349
  `).slice(1,-1).join(`
350
350
  `)}
351
351
  }
352
- `}var Ff=({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 Qd({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=pr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([l,m])=>{let d=l,i=d===r;return jsxRuntime.jsxs("button",{onClick:()=>o(d),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":i,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Ff,{theme:d})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},d)})})}
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=Cd;exports.AI_FEATURES=pf;exports.AI_MODELS=ws;exports.AddCardButton=mn;exports.AddColumnButton=cn;exports.AttachmentUploader=Ar;exports.BoardProvider=Ud;exports.BulkOperationsToolbar=lo;exports.BurnDownChart=wn;exports.CalendarBoard=id;exports.Card=wa;exports.CardDetailModal=bn;exports.CardDetailModalV2=yn;exports.CardHistoryReplay=gd;exports.CardHistoryTimeline=pd;exports.CardRelationshipsGraph=hd;exports.CardStack=af;exports.CardTemplateSelector=Pn;exports.CircuitBreaker=qo;exports.Column=ir;exports.ColumnManager=fo;exports.CommandPalette=gn;exports.ConfigMenu=Ln;exports.ContextMenu=fr;exports.DEFAULT_SHORTCUTS=Fr;exports.DEFAULT_TEMPLATES=En;exports.DateRangePicker=Cr;exports.DependenciesSelector=Nr;exports.DependencyLine=ko;exports.DistributionCharts=Cn;exports.EditableColumnTitle=rn;exports.ErrorBoundary=lr;exports.ExportImportModal=In;exports.FilterBar=An;exports.GANTT_AI_SYSTEM_PROMPT=Hl;exports.GanttAIAssistant=Eo;exports.GanttBoard=Wl;exports.GanttI18nContext=gr;exports.GanttMilestone=Co;exports.GanttToolbar=go;exports.GenerateGanttTasksDialog=Dd;exports.GeneratePlanModal=xd;exports.GroupBySelector=Dn;exports.KanbanBoard=Aa;exports.KanbanToolbar=ln;exports.KanbanViewAdapter=Mr;exports.KeyboardShortcutsHelp=Sn;exports.ListView=td;exports.MenuIcons=Xe;exports.PluginManager=Ho;exports.PrioritySelector=$a;exports.RATE_LIMITS=mf;exports.SwimlaneBoardView=Tn;exports.TaskBar=yo;exports.TaskFormModal=So;exports.TaskGrid=vo;exports.ThemeModal=On;exports.ThemeProvider=rl;exports.ThemeSwitcher=Qd;exports.Timeline=Do;exports.UserAssignmentSelector=Ha;exports.VelocityChart=kn;exports.VirtualGrid=Yd;exports.VirtualList=Vd;exports.aiUsageTracker=Za;exports.borderRadius=Ms;exports.calculatePosition=Jr;exports.calendarDarkTheme=hs;exports.calendarEnTranslations=us;exports.calendarEsTranslations=gs;exports.calendarLightTheme=vs;exports.calendarNeutralTheme=ys;exports.calendarThemes=Go;exports.calendarTranslations=Bo;exports.cardToGanttTask=Mo;exports.cardsToGanttTasks=Xl;exports.cn=L;exports.createKanbanView=Gi;exports.createRetryWrapper=Nc;exports.darkTheme=Fn;exports.darkTokenTheme=Vo;exports.defaultTheme=mo;exports.designTokens=_o;exports.duration=Bs;exports.easing=Rs;exports.exportTokensToCSS=Zd;exports.findTaskByName=Da;exports.fontSize=Is;exports.fontWeight=As;exports.formatCost=_r;exports.ganttEnTranslations=uo;exports.ganttEsTranslations=nl;exports.ganttTaskToCardUpdate=ql;exports.ganttThemes=Pe;exports.ganttTokens=Us;exports.ganttTranslations=Gn;exports.ganttUtils=q;exports.generateCSSVariables=Ws;exports.generateCompleteCSS=Vs;exports.generateInitialPositions=kc;exports.generateTasksContext=_l;exports.generateThemeVariables=Yr;exports.getCalendarTheme=ld;exports.getCalendarTranslations=$r;exports.getListViewTheme=ad;exports.getListViewTranslations=ds;exports.getMonthNames=rd;exports.getToken=Jd;exports.getTranslations=sl;exports.getWeekdayNames=od;exports.kanbanTokens=zs;exports.lightTheme=Bn;exports.lightTokenTheme=Hs;exports.lineHeight=Ls;exports.listViewDarkTheme=cs;exports.listViewEnTranslations=is;exports.listViewEsTranslations=ls;exports.listViewLightTheme=ms;exports.listViewNeutralTheme=ps;exports.listViewThemes=Fo;exports.listViewTranslations=Io;exports.mergeCalendarTranslations=Ro;exports.mergeListViewTranslations=Ao;exports.mergeTranslations=zn;exports.neutralTheme=Rn;exports.neutralTokenTheme=_s;exports.opacity=Gs;exports.parseLocalCommand=Kl;exports.parseNaturalDate=os;exports.parseNaturalDuration=ns;exports.parseProgress=ss;exports.parseStatus=jl;exports.pluginManager=Mf;exports.retrySyncOperation=Tc;exports.retryWithBackoff=Zr;exports.shadows=Os;exports.shouldVirtualizeGrid=Xd;exports.spacing=Ps;exports.themes=Ka;exports.useAI=Bd;exports.useBoard=Ed;exports.useBoardCore=Kr;exports.useBoardStore=Wo;exports.useCardStacking=Gd;exports.useDragState=nn;exports.useFilteredCards=Wd;exports.useFilters=Id;exports.useGanttI18n=Br;exports.useKanbanState=$o;exports.useKeyboardShortcuts=el;exports.useMultiSelect=Rd;exports.useSelectionState=Ns;exports.useSortedCards=Hd;exports.useTheme=pr;exports.useVirtualGrid=qd;exports.useVirtualList=jd;exports.validateAIResponse=Yl;exports.withErrorBoundary=pn;exports.wouldCreateCircularDependency=eo;exports.zIndex=Fs;//# sourceMappingURL=index.cjs.map
352
+ `}var Wf=({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 oc({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,m])=>{let d=l,i=d===r;return jsxRuntime.jsxs("button",{onClick:()=>o(d),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":i,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Wf,{theme:d})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},d)})})}
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=Ed;exports.AI_FEATURES=vf;exports.AI_MODELS=Ts;exports.AddCardButton=un;exports.AddColumnButton=pn;exports.AttachmentUploader=Lr;exports.BoardProvider=Vd;exports.BulkOperationsToolbar=mo;exports.BurnDownChart=Tn;exports.CalendarBoard=pd;exports.Card=Da;exports.CardDetailModal=vn;exports.CardDetailModalV2=kn;exports.CardHistoryReplay=yd;exports.CardHistoryTimeline=hd;exports.CardRelationshipsGraph=wd;exports.CardStack=df;exports.CardTemplateSelector=In;exports.CircuitBreaker=Jo;exports.Column=lr;exports.ColumnManager=ho;exports.CommandPalette=bn;exports.ConfigMenu=Bn;exports.ContextMenu=br;exports.DEFAULT_SHORTCUTS=Br;exports.DEFAULT_TEMPLATES=Mn;exports.DateRangePicker=Tr;exports.DependenciesSelector=Nr;exports.DependencyLine=To;exports.DistributionCharts=Dn;exports.EditableColumnTitle=nn;exports.ErrorBoundary=dr;exports.ExportImportModal=Ln;exports.FilterBar=Fn;exports.GANTT_AI_SYSTEM_PROMPT=Yl;exports.GanttAIAssistant=Mo;exports.GanttBoard=Kl;exports.GanttI18nContext=fr;exports.GanttMilestone=No;exports.GanttToolbar=bo;exports.GenerateGanttTasksDialog=Id;exports.GeneratePlanModal=Dd;exports.GroupBySelector=En;exports.KanbanBoard=La;exports.KanbanToolbar=cn;exports.KanbanViewAdapter=Ir;exports.KeyboardShortcutsHelp=Pn;exports.ListView=sd;exports.MenuIcons=qe;exports.PluginManager=Vo;exports.PrioritySelector=Ha;exports.RATE_LIMITS=hf;exports.SwimlaneBoardView=Nn;exports.TaskBar=ko;exports.TaskFormModal=Po;exports.TaskGrid=xo;exports.ThemeModal=$n;exports.ThemeProvider=nl;exports.ThemeSwitcher=oc;exports.Timeline=Eo;exports.UserAssignmentSelector=Va;exports.VelocityChart=Cn;exports.VirtualGrid=Qd;exports.VirtualList=Xd;exports.aiUsageTracker=Qa;exports.borderRadius=As;exports.calculatePosition=Qr;exports.calendarDarkTheme=ys;exports.calendarEnTranslations=fs;exports.calendarEsTranslations=bs;exports.calendarLightTheme=xs;exports.calendarNeutralTheme=ks;exports.calendarThemes=Wo;exports.calendarTranslations=Oo;exports.cardToGanttTask=Ao;exports.cardsToGanttTasks=td;exports.cn=L;exports.createKanbanView=Wi;exports.createRetryWrapper=Mc;exports.darkTheme=Rn;exports.darkTokenTheme=Ko;exports.defaultTheme=uo;exports.designTokens=jo;exports.duration=Os;exports.easing=zs;exports.exportTokensToCSS=rc;exports.findTaskByName=Pa;exports.fontSize=Ls;exports.fontWeight=Fs;exports.formatCost=jr;exports.ganttEnTranslations=fo;exports.ganttEsTranslations=il;exports.ganttTaskToCardUpdate=ed;exports.ganttThemes=Pe;exports.ganttTokens=Us;exports.ganttTranslations=Wn;exports.ganttUtils=K;exports.generateCSSVariables=_s;exports.generateCompleteCSS=Ks;exports.generateInitialPositions=Nc;exports.generateTasksContext=ql;exports.generateThemeVariables=Xr;exports.getCalendarTheme=ud;exports.getCalendarTranslations=Hr;exports.getListViewTheme=id;exports.getListViewTranslations=ms;exports.getMonthNames=ld;exports.getToken=ac;exports.getTranslations=ll;exports.getWeekdayNames=dd;exports.kanbanTokens=Gs;exports.lightTheme=On;exports.lightTokenTheme=Vs;exports.lineHeight=Bs;exports.listViewDarkTheme=ps;exports.listViewEnTranslations=ds;exports.listViewEsTranslations=cs;exports.listViewLightTheme=us;exports.listViewNeutralTheme=gs;exports.listViewThemes=Ro;exports.listViewTranslations=Lo;exports.mergeCalendarTranslations=zo;exports.mergeListViewTranslations=Fo;exports.mergeTranslations=Gn;exports.neutralTheme=zn;exports.neutralTokenTheme=js;exports.opacity=Ws;exports.parseLocalCommand=Zl;exports.parseNaturalDate=ss;exports.parseNaturalDuration=is;exports.parseProgress=ls;exports.parseStatus=Jl;exports.pluginManager=Rf;exports.retrySyncOperation=Pc;exports.retryWithBackoff=eo;exports.shadows=$s;exports.shouldVirtualizeGrid=tc;exports.spacing=Is;exports.themes=qa;exports.useAI=Wd;exports.useBoard=Ld;exports.useBoardCore=qr;exports.useBoardStore=_o;exports.useCardStacking=Hd;exports.useDragState=ln;exports.useFilteredCards=Kd;exports.useFilters=Rd;exports.useGanttI18n=Rr;exports.useKanbanState=Ho;exports.useKeyboardShortcuts=al;exports.useMultiSelect=Gd;exports.useSelectionState=Ss;exports.useSortedCards=Yd;exports.useTheme=ur;exports.useVirtualGrid=ec;exports.useVirtualList=Jd;exports.validateAIResponse=Ql;exports.withErrorBoundary=gn;exports.wouldCreateCircularDependency=ao;exports.zIndex=Rs;//# sourceMappingURL=index.cjs.map
354
354
  //# sourceMappingURL=index.cjs.map