@libxai/board 0.17.250 → 0.17.252

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'),uc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Lu=require('react-markdown'),Bu=require('remark-gfm'),Ru=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var uc__default=/*#__PURE__*/_interopDefault(uc);var Lu__default=/*#__PURE__*/_interopDefault(Lu);var Bu__default=/*#__PURE__*/_interopDefault(Bu);var Ru__default=/*#__PURE__*/_interopDefault(Ru);var Yo=(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 qo=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 [qo.Translate.toString(e),qo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function y(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Xo(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 jp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Qn(e,t){return e.length===0?1e3:t===0?Xo(null,e[0].position):t>=e.length?Xo(e[e.length-1].position,null):Xo(e[t-1].position,e[t].position)}function hl(e,t=100){return e>t}var Kp=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 Yp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Jo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Kp,onRetry:c}=t,m,l=0;for(let g=1;g<=a;g++){l=g;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(m=d,g===a||!n(m,g))return {error:m,attempts:l,success:false};let h=Yp(g,r,o,s);if(c)try{c(m,g,h);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,h));}}return {error:m||new Error("Unknown error"),attempts:l,success:false}}function qp(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 Xp(e,t={}){return async(...a)=>Jo(()=>e(...a),t)}var es=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 bl=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(bl||{}),Ar=class Ar{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,c=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(c,o,m?n:"");break;case "INFO":console.info(c,o,m?n:"");break;case "WARN":console.warn(c,o,m?n:"");break;case "ERROR":console.error(c,o,m?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Ar.globalOptions};}static configure(t){Ar.globalOptions={...Ar.globalOptions,...t};}child(t){return new Ar({...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 Zo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Zo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:bl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ar.globalOptions={};var ts=Ar,Zo=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}},yl=new ts;function Zp(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 Qp(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(c=>c.id===s.columnId);return [s.id,as(s.title),as(s.description||""),as(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function em(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await uc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=n.toDataURL("image/png"),m=297,l=210,g=n.width/n.height,d=m-20,i=d/g;i>l-20&&(i=l-20,d=i*g);let h=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});h.setFontSize(16),h.setTextColor(255,255,255),h.setFillColor(10,10,10),h.rect(0,0,m,15,"F"),h.text(e.title||"Kanban Board",10,10);let b=(m-d)/2;return h.addImage(c,"PNG",b,20,d,i),h}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let c=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let g=o.splitTextToSize(m.description,160);o.text(g,25,s),s+=g.length*5;}let l=[];if(m.priority&&l.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&l.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&l.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let g=[];m.startDate&&g.push(`Start: ${m.startDate}`),m.endDate&&g.push(`End: ${m.endDate}`),l.push(g.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function as(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function xl(e,t,a,r){switch(t){case "json":return Zp(e,r);case "csv":return Qp(e);case "pdf":return await em(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function kl(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let g=`${r}.pdf`;e.save(g);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:n[t]}),m=URL.createObjectURL(c),l=document.createElement("a");l.href=m,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(m);}function tm(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 am(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=wl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let c=wl(t[n]||"");if(c.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let l={};a.forEach((h,b)=>{l[h]=c[b]||"";});let g=l.Column||"Unnamed";o.has(g)||o.set(g,{id:`col-${o.size+1}`,title:g,position:o.size+1,cardIds:[]});let d=o.get(g),i={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(c){s.push(`Line ${n+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function wl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Cl(e,t){switch(t){case "json":return tm(e);case "csv":return am(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Tl(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 rs=react.createContext(null);function Nl(){return react.useContext(rs)}var Dl=react.createContext(null);function Sl({children:e,themeName:t}){return jsxRuntime.jsx(Dl.Provider,{value:{themeName:t},children:e})}function Zr(){return react.useContext(Dl)}function dt({children:e,container:t}){let[a,r]=react.useState(false),o=Nl(),s=Zr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:c,themeName:m}=o,l={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:l,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var Fl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},cm="#BDC3C7",pm=({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 Fr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null),l=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),b=window.innerHeight,p=window.innerWidth,v=160,w=220,u=4,f=h.right-v;f<10&&(f=h.left),f+v>p-10&&(f=p-v-10);let x=b-h.bottom,D=h.top,S;x>=w+u?S=h.bottom+u:D>=w+u?S=h.top-w-u:S=x>=D?h.bottom+u:Math.max(10,h.top-w-u),n({top:S,left:f}),o(true);};react.useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!m.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let g=h=>{t(h),o(false);},d=e?Fl[e]:null,i=d?.color||cm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Fl).map(([h,b])=>jsxRuntime.jsxs("button",{onClick:()=>g(h),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:b.color,background:"transparent"},onMouseEnter:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(pm,{color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:b.label}),e===h&&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)),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:()=>g(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:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.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 mm=[{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 vo({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),m=react.useRef(null),l=react.useRef(null),i=(Zr()?.themeName||"dark")==="dark",h=()=>{if(!l.current)return;let f=l.current.getBoundingClientRect(),x=window.innerHeight,D=window.innerWidth,S=320,L=380,k=4,U=f.left;U+S>D-10&&(U=D-S-10),U<10&&(U=10);let P=x-f.bottom,C=f.top,H;P>=L+k?H=f.bottom+k:C>=L+k?H=f.top-L-k:H=P>=C?f.bottom+k:Math.max(10,f.top-L-k),c({top:H,left:U}),s(true);};react.useEffect(()=>{let f=x=>{m.current&&!m.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let b=f=>{let x=new Date,D=U=>{let P=U.getFullYear(),C=String(U.getMonth()+1).padStart(2,"0"),H=String(U.getDate()).padStart(2,"0");return `${P}-${C}-${H}`},S=D(x),L=new Date(x);L.setDate(L.getDate()+f);let k=D(L);a(S,k),s(false);},p=()=>{if(!e||!t)return "Set date";let f=L=>{if(L instanceof Date)return L;if(typeof L!="string"||!L.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=L.split("-").map(Number);if(k.length!==3||k.some(H=>isNaN(H)))return null;let U=k[0],P=k[1],C=k[2];return U===void 0||P===void 0||C===void 0?null:new Date(U,P-1,C)},x=f(e),D=f(t);if(!x||!D||isNaN(x.getTime())||isNaN(D.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[x.getMonth()]} ${x.getDate()} \u2013 ${S[D.getMonth()]} ${D.getDate()}`},v=e&&t,u=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),f<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${u?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${p()}`:"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:p()})]}),o&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:mm.map(f=>jsxRuntime.jsx("button",{onClick:()=>b(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${i?"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:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange: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:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange: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:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter: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 Lr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[c,m]=react.useState(""),[l,g]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),h=()=>{if(!i.current)return;let u=i.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,D=300,S=380,L=4,k=u.right-D;k<10&&(k=u.left),k+D>x-10&&(k=x-D-10);let U=f-u.bottom,P=u.top,C;U>=S+L?C=u.bottom+L:P>=S+L?C=u.top-S-L:C=U>=P?u.bottom+L:Math.max(10,u.top-S-L),g({top:C,left:k}),n(true);};react.useEffect(()=>{let u=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),react.useEffect(()=>{let u=f=>{f.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s]);let b=u=>{let f=e.some(x=>x.id===u.id);a(f?e.filter(x=>x.id!==u.id):[...e,u]);},p=t.filter(u=>u.name.toLowerCase().includes(c.toLowerCase())),v=e.slice(0,o),w=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?n(false):h(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.map(u=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:u.name,children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"asakaa-avatar-img"}):u.initials},u.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"})]})})}),s&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:u=>m(u.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:p.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"}):p.map(u=>{let f=e.some(x=>x.id===u.id);return jsxRuntime.jsxs("button",{onClick:()=>b(u),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:u.color,color:"#fff"},children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"w-full h-full rounded-full object-cover"}):u.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:u.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:f?"#3b82f6":"transparent"},children:f?"\u2713":""})]},u.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Qo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let l=m.dependencies.map(g=>{if(typeof g=="string")return g;let d=g;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,c=m=>{if(!s.has(m)){s.add(m),n.add(m);let l=r.get(m)||[];for(let g of l){if(!s.has(g)&&c(g))return true;if(n.has(g))return true}}return n.delete(m),false};return c(a)}function ko({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[c,m]=react.useState(false),[l,g]=react.useState(""),[d,i]=react.useState(t.length>0),[h,b]=react.useState({top:0,left:0}),[p,v]=react.useState(null),w=react.useRef(null),u=react.useRef(null),f=()=>{if(!u.current)return;let k=u.current.getBoundingClientRect(),U=window.innerHeight,P=window.innerWidth,C=300,H=d?380:120,R=4,J=k.right-C;J<10&&(J=k.left),J+C>P-10&&(J=P-C-10);let re=U-k.bottom,Ce=k.top,Se;re>=H+R?Se=k.bottom+R:Ce>=H+R?Se=k.top-H-R:Se=re>=Ce?k.bottom+R:Math.max(10,k.top-H-R),b({top:Se,left:J}),m(true);};react.useEffect(()=>{if(!c||!u.current)return;let k=u.current.getBoundingClientRect(),U=window.innerHeight,P=window.innerWidth,C=300,H=d?380:120,R=4,J=k.right-C;J<10&&(J=k.left),J+C>P-10&&(J=P-C-10);let re=U-k.bottom,Ce=k.top,Se;re>=H+R?Se=k.bottom+R:Ce>=H+R?Se=k.top-H-R:Se=re>=Ce?k.bottom+R:Math.max(10,k.top-H-R),b({top:Se,left:J});},[d,c]),react.useEffect(()=>{let k=U=>{w.current&&!w.current.contains(U.target)&&!u.current?.contains(U.target)&&(m(false),g(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),react.useEffect(()=>{let k=U=>{U.key==="Escape"&&(m(false),g(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let x=k=>{let U=t.includes(k),P=a.find(C=>C.id===k);if(v(null),U){let C=t.filter(H=>H!==k);r(C),C.length===0&&i(false);}else {if(s&&Qo(a,k,e)){let H=`Cannot add "${P?.title||k}" as dependency - would create circular reference`;v(H),n?.(k,P?.title||k),setTimeout(()=>v(null),3e3);return}r([...t,k]),i(true);}},D=()=>{let k=!d;i(k),k||r([]);},S=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(l.toLowerCase())||k.id.toLowerCase().includes(l.toLowerCase())),L=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:u,onClick:()=>c?m(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:L,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:L},children:t.length})]}),c&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:w,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.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:[p&&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:p})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:k=>g(k.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:S.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"}):S.map(k=>{let U=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.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:U?"#3b82f6":"transparent",borderColor:U?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:U&&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:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(false),m(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 sr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:c=[],allCards:m=[]})=>{let{attributes:l,listeners:g,setNodeRef:d,transform:i,transition:h,isDragging:b}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),p={transform:qo.Transform.toString(i),transition:h};if(t)return jsxRuntime.jsx("div",{ref:d,style:p,...l,...g,onClick:()=>a?.(e),children:t(e)});let v=c.filter(x=>e.assignedUserIds?.includes(x.id)),w=e.progress===100,u=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),f={...p,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:f,className:y("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...g,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),u.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:u.length===1&&u[0]?jsxRuntime.jsx("img",{src:u[0].url,alt:u[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:u.slice(0,4).map((x,D)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),D===3&&u.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",u.length-4]})})]},x.id))})}),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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Fr,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(vo,{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:(x,D)=>n?.(e.id,{startDate:x,endDate:D})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Lr,{assignedUsers:v,availableUsers:c,onChange:x=>n?.(e.id,{assignedUserIds:x.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(ko,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),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)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));sr.displayName="Card";var en={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"}},Hl=({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 Gl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),m=react.useRef(null),l=react.useRef(null),g=[...Object.entries(en).map(([v,w])=>({id:v,label:w.label,color:w.color,icon:w.icon})),...r.filter(v=>!Object.keys(en).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=en[e];if(v)return {...v,id:e};let w=r.find(u=>u.id===e);return w?{id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}:{...en.todo,id:"todo"}},i=()=>{if(!l.current)return;let v=l.current.getBoundingClientRect(),w=window.innerHeight,u=window.innerWidth,f=180,x=280,D=4,S=v.right-f;S<10&&(S=v.left),S+f>u-10&&(S=u-f-10);let L=w-v.bottom,k=v.top,U;L>=x+D?U=v.bottom+D:k>=x+D?U=v.top-x-D:U=L>=k?v.bottom+D:Math.max(10,v.top-x-D),c({top:U,left:S}),s(true);};react.useEffect(()=>{let v=w=>{m.current&&!m.current.contains(w.target)&&!l.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let h=v=>{t(v),s(false);},b=d(),p=b.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${p}10`,boxShadow:`0 0 0 2px ${p}30 inset`},title:b.label,children:jsxRuntime.jsx(Hl,{icon:b.icon,color:p})}),o&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:g.map(v=>jsxRuntime.jsxs("button",{onClick:()=>h(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter: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(Hl,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}function _l({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[c,m]=react.useState(false),[l,g]=react.useState(e),[d,i]=react.useState({top:0,left:0}),h=react.useRef(null),b=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(s&&b.current){let f=b.current.getBoundingClientRect();i({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=x=>{h.current&&!h.current.contains(x.target)&&!b.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=x=>{x.key==="Escape"&&(n(false),m(false),g(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{c&&p.current&&(p.current.focus(),p.current.select());},[c]);let v=()=>{m(true),g(e);},w=()=>{let f=l.trim();f&&f!==e&&t(f),m(false),n(false),g(e);},u=f=>{f.key==="Enter"?w():f.key==="Escape"&&(m(false),g(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:b,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:p,type:"text",value:l,onChange:f=>g(f.target.value),onKeyDown:u,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:v,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var to=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:c,availableUsers:m,allCards:l,enableVirtualization:g,cardHeight:d=120,isCollapsed:i,onToggleCollapse:h,onColumnRename:b,onColumnDelete:p,isDeletable:v=false,className:w})=>{let{setNodeRef:u,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),D=g??hl(t.length),S=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:u,className:w,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),U=k.state==="exceeded",P=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:u,className:y("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",U&&"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:y(P()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.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"})]}),k.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"})]}),k.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"})}),k.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"})]})]}),(b||p)&&jsxRuntime.jsx(_l,{columnTitle:e.title,onRename:C=>b?.(e.id,C),onDelete:p?()=>p(e.id):void 0,isDeletable:v}),h&&jsxRuntime.jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(C=>C.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(C=>{let H=t[C.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsxRuntime.jsx(sr,{card:H,render:r,onClick:n,onUpdate:c,availableUsers:m,allCards:l})},H.id):null})}):t.map(C=>jsxRuntime.jsx(sr,{card:C,render:r,onClick:n,onUpdate:c,availableUsers:m,allCards:l},C.id))})})]})});to.displayName="Column";function ls({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let g=s.trim();g&&g!==e?t(g):n(e),o(false);},l=g=>{g.key==="Enter"?m():g.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:g=>n(g.target.value),onBlur:m,onKeyDown:l,className:y("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:y("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var on=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Qa({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[c,m]=react.useState(false),[l,g]=react.useState(""),[d,i]=react.useState(false),[h,b]=react.useState(on[10]||"#3B82F6"),[p,v]=react.useState({top:0,left:0}),w=react.useRef(null),u=react.useRef(null),f=react.useRef(null),x=react.useRef(null),D=t.filter(C=>C.name.toLowerCase().includes(l.toLowerCase())),S=t.some(C=>C.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(c&&u.current){let C=u.current.getBoundingClientRect();v({top:C.bottom+6,left:C.left});}},[c]),react.useEffect(()=>{let C=H=>{let R=H.target,J=w.current?.contains(R),re=f.current?.contains(R);!J&&!re&&(m(false),g(""),i(false));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{c&&x.current&&x.current.focus();},[c]);let L=C=>{let H=e.some(R=>R.id===C.id);a(H?e.filter(R=>R.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!l.trim())){i(true);try{let C=await r(l.trim(),h);C&&(a([...e,C]),g(""),b(on[Math.floor(Math.random()*on.length)]||"#3B82F6"));}finally{i(false);}}},U=(C,H)=>{H.stopPropagation(),a(e.filter(R=>R.id!==C));},P={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:w,className:"relative",children:[jsxRuntime.jsxs("button",{ref:u,type:"button",onClick:()=>!s&&m(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:f,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:p.top,left:p.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:l,onChange:C=>g(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&l.trim()&&!S&&r&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:H=>U(C.id,H),children:[C.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},C.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(C=>{let H=e.some(R=>R.id===C.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{H||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{H||(R.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):l.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!S&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:on.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>b(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:h===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:h,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function cs({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Yl({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(cs,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var er=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Jl(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function Qm(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds}}function Or({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:c=[],availableTags:m=[],onCreateTag:l,attachments:g=[],onUploadAttachments:d,onDeleteAttachment:i,availableTasks:h=[]}){let b=s==="dark",p={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},v=e&&"title"in e&&!("name"in e),w=e,[u,f]=react.useState(e?Jl(e,c):null),[x,D]=react.useState(false),[S,L]=react.useState(false),[k,U]=react.useState(false),[P,C]=react.useState(null),[H,R]=react.useState(new Date),[J,re]=react.useState(false),[Ce,Se]=react.useState(false),[Fe,se]=react.useState(""),[O,B]=react.useState(false),[$,F]=react.useState(false),[q,Z]=react.useState(false);react.useEffect(()=>{e&&f(Jl(e,c));},[e?.id,c]);let z=react.useCallback(T=>{f(T),v&&o&&w?o(Qm(T,w)):r&&r(T);},[v,w,o,r]),ve=react.useCallback(()=>{D(false),L(false),U(false),C(null),Se(false),se(""),B(false);},[]),we=react.useCallback((T,V)=>{if(!u)return;let te={...u,[T]:V};z(te);},[u,z]),Me=react.useCallback(T=>{if(!u)return;let V=u.progress||0;T==="completed"?V=100:T==="in-progress"&&V===0?V=10:T==="todo"&&(V=0);let te={...u,status:T,progress:V};z(te),D(false);},[u,z]),ge=react.useCallback((T,V)=>{if(!u)return;let te={...u,startDate:T,endDate:V};z(te);},[u,z]),ot=react.useCallback(()=>{let T=H.getFullYear(),V=H.getMonth(),te=new Date(T,V,1),Le=new Date(T,V+1,0).getDate(),nt=te.getDay(),Ne=[],de=new Date(T,V,0).getDate();for(let it=nt-1;it>=0;it--)Ne.push({date:new Date(T,V-1,de-it),isCurrentMonth:false});for(let it=1;it<=Le;it++)Ne.push({date:new Date(T,V,it),isCurrentMonth:true});let xe=42-Ne.length;for(let it=1;it<=xe;it++)Ne.push({date:new Date(T,V+1,it),isCurrentMonth:false});return Ne},[H]),Ae=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),F(false),!u||!d)return;let V=Array.from(T.dataTransfer.files);if(V.length!==0){Z(true);try{await d(u.id,V);}finally{Z(false);}}},[u,d]),pt=react.useCallback(async T=>{if(!u||!d||!T.target.files)return;let V=Array.from(T.target.files);if(V.length!==0){Z(true);try{await d(u.id,V);}finally{Z(false);}T.target.value="";}},[u,d]),mt=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),F(true);},[]),gt=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),F(false);},[]),Je=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),W=react.useCallback(T=>T.startsWith("image/")?lucideReact.Image:T.includes("pdf")||T.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!u?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:y("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:y("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:u.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:y("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=u.progress===100?0:100,te={...u,progress:T,status:T===100?"completed":"todo"};z(te);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",u.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:u.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:y("text-xl font-semibold flex-1",u.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:u.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ve(),D(!x);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",u.progress===100||u.status==="completed"?"bg-green-500/20 text-green-400":u.progress&&u.progress>0||u.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:u.progress===100||u.status==="completed"?n==="es"?"COMPLETADO":"DONE":u.progress&&u.progress>0||u.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(T=>jsxRuntime.jsxs("button",{onClick:()=>Me(T.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",u.status===T.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{ve(),U(!k);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[u.assignees&&u.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[u.assignees.slice(0,3).map((T,V)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},V)),u.assignees.length>3&&jsxRuntime.jsxs("span",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",u.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:y("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>U(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(T=>{let V=u.assignees?.some(te=>te.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let te=u.assignees||[],ue;V?ue=te.filter(Le=>Le.name!==T.name):ue=[...te,T],we("assignees",ue);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",V&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:y("flex-1",b?"text-white":"text-gray-900"),children:T.name}),V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsxRuntime.jsx("div",{className:y("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{C(P?null:"start"),R(u.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[u.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:y("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),u.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>C(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:y("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let te=new Date(T);te.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let ue=new Date(T);ue.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let Le=new Date(T);Le.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let nt=new Date(T);nt.setDate(T.getDate()+14);let Ne=new Date(T);return Ne.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:te,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ue,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Le,display:Le.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:nt,display:nt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ne,display:Ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((xe,it)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(P==="start"){let lt=u.endDate&&xe.date>u.endDate?xe.date:u.endDate;ge(xe.date,lt),C("end");}else {let lt=u.startDate&&xe.date<u.startDate?xe.date:u.startDate;ge(lt,xe.date),C(null);}},children:[jsxRuntime.jsx("span",{children:xe.label}),jsxRuntime.jsx("span",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:xe.display})]},it))})(),jsxRuntime.jsx("div",{className:y("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ge(void 0,void 0),C(null);},className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:y("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:P==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:y("font-medium",b?"text-white":"text-gray-900"),children:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>R(new Date),className:y("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>R(new Date(H.getFullYear(),H.getMonth()-1)),className:y("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>R(new Date(H.getFullYear(),H.getMonth()+1)),className:y("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsxRuntime.jsx("div",{className:y("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ot().map((T,V)=>{let te=T.date.toDateString()===new Date().toDateString(),ue=u.startDate?.toDateString()===T.date.toDateString(),Le=u.endDate?.toDateString()===T.date.toDateString(),nt=ue||Le,Ne=u.startDate&&u.endDate&&T.date>=u.startDate&&T.date<=u.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let de=new Date(T.date);if(P==="start"){let xe=u.endDate&&de>u.endDate?de:u.endDate;ge(de,xe),C("end");}else {let xe=u.startDate&&de<u.startDate?de:u.startDate;ge(xe,de),C(null);}},className:y("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(b?"text-white":"text-gray-900"),te&&"ring-2 ring-[#3B82F6]",ue&&"bg-[#3B82F6] text-white",Le&&!ue&&"bg-[#7C3AED] text-white",Ne&&!nt&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!nt&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ve(),L(!S);},className:y("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",u.priority==="high"||u.priority==="urgent"?"bg-red-500/20 text-red-400":u.priority==="medium"?"bg-yellow-500/20 text-yellow-400":u.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:u.priority?u.priority==="high"||u.priority==="urgent"?n==="es"?"Alta":"High":u.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(T=>jsxRuntime.jsxs("button",{onClick:()=>{we("priority",T.id),L(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",u.priority===T.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:y("text-sm",b?"text-white":"text-gray-900"),children:u.startDate&&u.endDate?`${Math.ceil((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[J?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:u.progress||0,onChange:T=>{let V=parseInt(T.target.value),te=u.status;V===100?te="completed":V>0?te="in-progress":te="todo";let ue={...u,progress:V,status:te};z(ue);},onBlur:()=>re(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>re(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",u.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${u.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[u.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Qa,{selectedTags:u.tags||[],availableTags:m,onChange:T=>{we("tags",T);},onCreateTag:l,theme:p})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:y("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[u.dependencies&&u.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:u.dependencies.map(T=>{let V=h.find(te=>te.id===T);return jsxRuntime.jsxs("span",{className:y("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[V?.name||T.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let te=(u.dependencies||[]).filter(ue=>ue!==T);we("dependencies",te);},className:y("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{ve(),Se(!Ce);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:y("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Se(false),se("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:y("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Fe,onChange:T=>se(T.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:y("w-full px-3 py-2 rounded-md text-sm outline-none",b?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:h.length>0?h.filter(T=>T.id!==u.id).filter(T=>Fe===""||T.name.toLowerCase().includes(Fe.toLowerCase())).map(T=>{let V=u.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let te=u.dependencies||[],ue;V?ue=te.filter(Le=>Le!==T.id):ue=[...te,T.id],we("dependencies",ue);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",V&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",V?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:y("block truncate",b?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.jsx("div",{className:y("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{ve(),B(!O);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:u.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:y("text-sm",b?"text-white":"text-gray-900"),children:er.find(T=>T.value===u.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>B(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:er.map(T=>{let V=u.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{we("color",T.value),B(false);},className:y("w-7 h-7 rounded-full flex items-center justify-center transition-all",V&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:V?T.value:void 0},title:T.name,children:V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:u.isMilestone||false,onChange:T=>we("isMilestone",T.target.checked),className:y("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",u.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:y("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:u.description||"",onChange:T=>we("description",T.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),u.subtasks&&u.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:u.subtasks.map(T=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",T.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:y("text-sm",T.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:T.name})]},T.id))}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:y("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:y("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",g.length>0&&jsxRuntime.jsxs("span",{className:y("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",g.length,")"]})]}),g.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:g.map(T=>{let V=W(T.type),te=T.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[te&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(V,{className:y("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Je(T.size)})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(T.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:mt,onDragLeave:gt,onDrop:Ae,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",$?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",q&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:pt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||q}),q?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:y("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:y("w-6 h-6 mx-auto mb-2",$?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:$?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:y("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:y("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:y("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:y("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:y("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:y("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})})]})]})]})})}function fs(){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 vr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:c,isLoading:m,error:l,children:g,availableTags:d=[],onCreateTag:i,attachmentsByCard:h,onUploadAttachments:b,onDeleteAttachment:p}){let[v,w]=fs(),[u,f]=react.useState(null),x=o?.theme||"dark",D=x==="dark"||x==="neutral",S=D?"dark":"",L=react.useCallback((se,O)=>{t.onCardUpdate?.(se,O);},[t]),k=react.useCallback((se,O)=>{t.onColumnUpdate?.(se,{title:O});},[t]),U=react.useCallback(se=>{t.onColumnDelete?.(se);},[t]),P=["todo","in-progress","completed"],C=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),H=react.useMemo(()=>{let se=new Map;return e.columns.forEach(O=>{let B=O.cardIds.map($=>e.cards.find(F=>F.id===$)).filter($=>$!==void 0).sort(($,F)=>$.position-F.position);se.set(O.id,B);}),se},[e.cards,e.columns]),R=react.useMemo(()=>e.cards.map(se=>({id:se.id,name:se.title,startDate:se.startDate?new Date(se.startDate):void 0,endDate:se.endDate?new Date(se.endDate):void 0,progress:se.progress||0,status:se.columnId,priority:se.priority?.toLowerCase(),dependencies:Array.isArray(se.dependencies)?se.dependencies.map(O=>typeof O=="string"?O:O.taskId):[]})),[e.cards]),J=react.useCallback(se=>{let{active:O}=se,B=e.cards.find($=>$.id===O.id);B&&w({isDragging:true,draggedCardId:B.id,sourceColumnId:B.columnId,targetColumnId:B.columnId});},[e.cards,w]),re=react.useCallback(se=>{let{active:O,over:B}=se;if(!B||!e.cards.find(q=>q.id===O.id))return;let F=null;B.data.current?.type==="column"?F=B.id:B.data.current?.type==="card"&&(F=e.cards.find(Z=>Z.id===B.id)?.columnId||null),F&&F!==v.targetColumnId&&w({...v,targetColumnId:F});},[e.cards,v,w]),Ce=react.useCallback(async se=>{let{active:O,over:B}=se;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!B)return;let $=e.cards.find(z=>z.id===O.id);if(!$)return;let F,q;if(B.data.current?.type==="column"){F=B.id;let z=H.get(F)||[];q=Qn(z,0);}else {let z=e.cards.find(Me=>Me.id===B.id);if(!z)return;F=z.columnId;let ve=H.get(F)||[],we=ve.findIndex(Me=>Me.id===B.id);q=Qn(ve,we);}let Z=e.columns.find(z=>z.id===F);if(Z&&Z.wipLimit&&Z.wipLimitType==="hard"){let z=H.get(F)||[];if($.columnId!==F&&z.length>=Z.wipLimit){t.onWipLimitExceeded?.(Z,$);return}}($.columnId!==F||$.position!==q)&&await t.onCardMove?.($.id,F,q);},[e.cards,e.columns,H,t,w]),Se=react.useCallback(se=>{f(se),a?.(se);},[a]),Fe=react.useCallback(se=>{t.onCardUpdate?.(se.id,se),f(se);},[t]);return m?jsxRuntime.jsx("div",{className:y("asakaa-board",S,n),style:c,children:jsxRuntime.jsx(pu,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:y("asakaa-board",S,n),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(Sl,{themeName:x,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:C,collisionDetection:core$1.closestCorners,onDragStart:J,onDragOver:re,onDragEnd:Ce,children:[jsxRuntime.jsxs("div",{className:y("asakaa-board",S,n),style:c,"data-theme":x,children:[e.columns.sort((se,O)=>se.position-O.position).map(se=>{let O=H.get(se.id)||[],B=!P.includes(se.id);return jsxRuntime.jsx(to,{column:se,cards:O,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Se,onCardUpdate:L,onColumnRename:k,onColumnDelete:U,isDeletable:B,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},se.id)}),g]}),jsxRuntime.jsx(core$1.DragOverlay,{children:v.draggedCardId?jsxRuntime.jsx(sr,{card:e.cards.find(se=>se.id===v.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Or,{task:u,isOpen:!!u,onClose:()=>f(null),onCardUpdate:Fe,theme:D?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:i,attachments:u?h?.get(u.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:p,availableTasks:R})]})}function pu({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 hu={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)"},bu={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)"},yu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},vu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function xu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let l=g=>{c.current&&!c.current.contains(g.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let m=l=>{t(l),n(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,g)=>l.position-g.position).map((l,g)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:g<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.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:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function ku({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[c,m]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let h=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),i=async(h,b)=>{if(b){m(h);try{await b();}catch(p){console.error(`Export ${h} failed:`,p);}finally{m(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((h,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(h.id,h.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===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 wu({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 bs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:c,onExportExcel:m,translations:l}){let g=r==="dark"?hu:bu,d={...o==="es"?yu:vu,...l},i=n||c||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:g.bgGrid,borderColor:g.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ku,{theme:g,t:d,onExportCSV:n,onExportJSON:c,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:g.borderLight}})]}),t&&(s?jsxRuntime.jsx(xu,{columns:e,onSelect:t,theme:g,t:d,createTaskLabel:a}):jsxRuntime.jsx(wu,{onClick:()=>t(),label:a||d.newTask}))]})})}function vs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[c,m]=react.useState(""),l=react.useCallback(()=>{let i=c.trim();i&&(e(i),m(""),n(false));},[c,e]),g=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),l()):i.key==="Escape"&&(m(""),n(false));},[l]),d=react.useCallback(()=>{setTimeout(()=>{c.trim()||n(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:y("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>m(i.target.value),onKeyDown:g,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:y("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function xs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:c="dark",locale:m="es"}){let[l,g]=react.useState(false),[d,i]=react.useState(false),[h,b]=react.useState(""),[p,v]=react.useState([]),[w,u]=react.useState(""),[f,x]=react.useState(""),[D,S]=react.useState(""),[L,k]=react.useState(false),[U,P]=react.useState(false),[C,H]=react.useState(false),R=react.useRef(null),J=react.useRef(null),re={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},Ce=react.useCallback(()=>{b(""),v([]),u(""),x(""),S(""),k(false),P(false),H(false),g(false);},[]);react.useEffect(()=>{l&&R.current&&R.current.focus();},[l]),react.useEffect(()=>{if(!l)return;let B=$=>{J.current&&!J.current.contains($.target)&&(h.trim()||Ce());};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[l,h,Ce]);let Se=react.useCallback(async()=>{let B=h.trim();if(!(!B||d)){i(true);try{await t({name:B,columnId:e,assigneeIds:p.length>0?p:void 0,startDate:w?new Date(w):void 0,endDate:f?new Date(f):void 0,priority:D||void 0}),b(""),v([]),u(""),x(""),S(""),k(!1),P(!1),H(!1),R.current?.focus();}catch($){console.error("Error creating card:",$);}finally{i(false);}}},[h,e,p,w,f,D,t,d]),Fe=react.useCallback(B=>{B.key==="Enter"&&!B.shiftKey?(B.preventDefault(),Se()):B.key==="Escape"&&Ce();},[Se,Ce]),se=react.useCallback(B=>{v($=>$.includes(B)?$.filter(F=>F!==B):[...$,B]);},[]),O=c==="dark";return l?jsxRuntime.jsxs("div",{ref:J,className:y("rounded-lg overflow-hidden shadow-lg",O?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:h,onChange:B=>b(B.target.value),onKeyDown:Fe,placeholder:re.placeholder,disabled:d,className:y("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",O?"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:()=>k(!L),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||p.length>0?"bg-emerald-500/20 text-emerald-400":O?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:re.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),p.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:p.length})]}),jsxRuntime.jsx("button",{onClick:()=>P(!U),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",U||w||f?"bg-blue-500/20 text-blue-400":O?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:re.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!C),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":O?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:re.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:Se,disabled:!h.trim()||d,className:y("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:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):re.save})]})]}),L&&a.length>0&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",O?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(B=>jsxRuntime.jsxs("button",{onClick:()=>se(B.id),className:y("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",p.includes(B.id)?"bg-emerald-500 text-white":O?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[B.avatar?jsxRuntime.jsx("img",{src:B.avatar,alt:B.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",p.includes(B.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:B.name.split(" ")[0]})]},B.id))})}),U&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",O?"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:y("block text-[10px] uppercase tracking-wide mb-1",O?"text-gray-500":"text-gray-400"),children:re.startDate}),jsxRuntime.jsx("input",{type:"date",value:w,onChange:B=>u(B.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",O?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",O?"text-gray-500":"text-gray-400"),children:re.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:B=>x(B.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",O?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",O?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(B=>jsxRuntime.jsx("button",{onClick:()=>S(D===B?"":B),className:y("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===B?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[B]} text-white`:O?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:re[B]},B))})})]}):jsxRuntime.jsxs("button",{onClick:()=>g(true),disabled:n,className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",O?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:re.buttonLabel})]})}var No=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(vr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function dd(e={}){return new No(e)}var ro=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ks(e,t){let a=r=>jsxRuntime.jsx(ro,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Cs({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:c,onOpenAIUsage:m,shortcut:l="k",className:g=""}){let[d,i]=react.useState(false),[h,b]=react.useState(""),[p,v]=react.useState("home"),[w,u]=react.useState(""),[f,x]=react.useState("");react.useEffect(()=>{let k=U=>{(U.metaKey||U.ctrlKey)&&U.key===l&&(U.preventDefault(),i(P=>!P)),U.key==="Escape"&&(i(false),v("home"),b(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]),react.useEffect(()=>{d||(v("home"),b(""),u(""),x(""));},[d]);let D=react.useCallback(()=>{i(false);},[]),S=react.useCallback(k=>{let[U,P]=k.split(":");switch(U){case "create-card":v("create-card");break;case "create-card-in":u(P||"");break;case "navigate":P?(a?.(P),D()):v("navigate");break;case "search":r?.(h),D();break;case "priority":v("priority");break;case "set-priority":f&&P&&(o?.(f,P),D());break;case "assign":v("assign");break;case "assign-user":f&&P&&(s?.(f,P),D());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":m?.(),D();break;case "back":v("home");break;}},[h,f,t,a,r,o,s,n,c,m,D]),L=react.useCallback(()=>{w&&h.trim()&&(t?.(w,h.trim()),D());},[w,h,t,D]);return d?jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${g}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:h,onValueChange:b,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:p==="create-card"&&w?"Type card title and press Enter...":p==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&p==="create-card"&&w&&L();}}),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."}),p==="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:S,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:S,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:S,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:S,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(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(U=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:U},U))})]},k.id))})]}),p==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:S,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:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),p==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(k=>{let U=e.columns.find(P=>P.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:S,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:U?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},k.id)})})]}),p==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 md(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
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'),gc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Bu=require('react-markdown'),Ru=require('remark-gfm'),Ou=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var gc__default=/*#__PURE__*/_interopDefault(gc);var Bu__default=/*#__PURE__*/_interopDefault(Bu);var Ru__default=/*#__PURE__*/_interopDefault(Ru);var Ou__default=/*#__PURE__*/_interopDefault(Ou);var Yo=(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 qo=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 [qo.Translate.toString(e),qo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function b(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Xo(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 Kp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Qn(e,t){return e.length===0?1e3:t===0?Xo(null,e[0].position):t>=e.length?Xo(e[e.length-1].position,null):Xo(e[t-1].position,e[t].position)}function hl(e,t=100){return e>t}var Yp=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 qp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Jo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Yp,onRetry:c}=t,m,l=0;for(let u=1;u<=a;u++){l=u;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(m=d,u===a||!n(m,u))return {error:m,attempts:l,success:false};let h=qp(u,r,o,s);if(c)try{c(m,u,h);}catch(C){console.error("Error in retry callback:",C);}await new Promise(C=>setTimeout(C,h));}}return {error:m||new Error("Unknown error"),attempts:l,success:false}}function Xp(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 Jp(e,t={}){return async(...a)=>Jo(()=>e(...a),t)}var es=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 bl=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(bl||{}),Ar=class Ar{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,c=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(c,o,m?n:"");break;case "INFO":console.info(c,o,m?n:"");break;case "WARN":console.warn(c,o,m?n:"");break;case "ERROR":console.error(c,o,m?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Ar.globalOptions};}static configure(t){Ar.globalOptions={...Ar.globalOptions,...t};}child(t){return new Ar({...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 Zo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Zo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:bl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ar.globalOptions={};var ts=Ar,Zo=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}},yl=new ts;function Qp(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 em(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(c=>c.id===s.columnId);return [s.id,as(s.title),as(s.description||""),as(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
+ `)}async function tm(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await gc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=n.toDataURL("image/png"),m=297,l=210,u=n.width/n.height,d=m-20,i=d/u;i>l-20&&(i=l-20,d=i*u);let h=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});h.setFontSize(16),h.setTextColor(255,255,255),h.setFillColor(10,10,10),h.rect(0,0,m,15,"F"),h.text(e.title||"Kanban Board",10,10);let C=(m-d)/2;return h.addImage(c,"PNG",C,20,d,i),h}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let c=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(m.description,160);o.text(u,25,s),s+=u.length*5;}let l=[];if(m.priority&&l.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&l.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&l.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let u=[];m.startDate&&u.push(`Start: ${m.startDate}`),m.endDate&&u.push(`End: ${m.endDate}`),l.push(u.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function as(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function xl(e,t,a,r){switch(t){case "json":return Qp(e,r);case "csv":return em(e);case "pdf":return await tm(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function kl(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:n[t]}),m=URL.createObjectURL(c),l=document.createElement("a");l.href=m,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(m);}function am(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 rm(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=wl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let c=wl(t[n]||"");if(c.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let l={};a.forEach((h,C)=>{l[h]=c[C]||"";});let u=l.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),i={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(c){s.push(`Line ${n+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function wl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Cl(e,t){switch(t){case "json":return am(e);case "csv":return rm(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Tl(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 rs=react.createContext(null);function Nl(){return react.useContext(rs)}var Dl=react.createContext(null);function Sl({children:e,themeName:t}){return jsxRuntime.jsx(Dl.Provider,{value:{themeName:t},children:e})}function Zr(){return react.useContext(Dl)}function ct({children:e,container:t}){let[a,r]=react.useState(false),o=Nl(),s=Zr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:c,themeName:m}=o,l={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:l,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var Fl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},pm="#BDC3C7",mm=({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 Fr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null),l=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),C=window.innerHeight,p=window.innerWidth,y=160,f=220,v=4,g=h.right-y;g<10&&(g=h.left),g+y>p-10&&(g=p-y-10);let k=C-h.bottom,x=h.top,D;k>=f+v?D=h.bottom+v:x>=f+v?D=h.top-f-v:D=k>=x?h.bottom+v:Math.max(10,h.top-f-v),n({top:D,left:g}),o(true);};react.useEffect(()=>{let h=C=>{c.current&&!c.current.contains(C.target)&&!m.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),react.useEffect(()=>{let h=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let u=h=>{t(h),o(false);},d=e?Fl[e]:null,i=d?.color||pm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Fl).map(([h,C])=>jsxRuntime.jsxs("button",{onClick:()=>u(h),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:C.color,background:"transparent"},onMouseEnter:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(mm,{color:C.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:C.label}),e===h&&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)),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:()=>u(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:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.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 um=[{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 vo({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),m=react.useRef(null),l=react.useRef(null),i=(Zr()?.themeName||"dark")==="dark",h=()=>{if(!l.current)return;let g=l.current.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth,D=320,B=380,w=4,z=g.left;z+D>x-10&&(z=x-D-10),z<10&&(z=10);let P=k-g.bottom,T=g.top,G;P>=B+w?G=g.bottom+w:T>=B+w?G=g.top-B-w:G=P>=T?g.bottom+w:Math.max(10,g.top-B-w),c({top:G,left:z}),s(true);};react.useEffect(()=>{let g=k=>{m.current&&!m.current.contains(k.target)&&!l.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let C=g=>{let k=new Date,x=z=>{let P=z.getFullYear(),T=String(z.getMonth()+1).padStart(2,"0"),G=String(z.getDate()).padStart(2,"0");return `${P}-${T}-${G}`},D=x(k),B=new Date(k);B.setDate(B.getDate()+g);let w=x(B);a(D,w),s(false);},p=()=>{if(!e||!t)return "Set date";let g=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=B.split("-").map(Number);if(w.length!==3||w.some(G=>isNaN(G)))return null;let z=w[0],P=w[1],T=w[2];return z===void 0||P===void 0||T===void 0?null:new Date(z,P-1,T)},k=g(e),x=g(t);if(!k||!x||isNaN(k.getTime())||isNaN(x.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[k.getMonth()]} ${k.getDate()} \u2013 ${D[x.getMonth()]} ${x.getDate()}`},y=e&&t,v=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),g<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${v?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${p()}`:"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:p()})]}),o&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:um.map(g=>jsxRuntime.jsx("button",{onClick:()=>C(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Lr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[c,m]=react.useState(""),[l,u]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),h=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),g=window.innerHeight,k=window.innerWidth,x=300,D=380,B=4,w=v.right-x;w<10&&(w=v.left),w+x>k-10&&(w=k-x-10);let z=g-v.bottom,P=v.top,T;z>=D+B?T=v.bottom+B:P>=D+B?T=v.top-D-B:T=z>=P?v.bottom+B:Math.max(10,v.top-D-B),u({top:T,left:w}),n(true);};react.useEffect(()=>{let v=g=>{d.current&&!d.current.contains(g.target)&&!i.current?.contains(g.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),react.useEffect(()=>{let v=g=>{g.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]);let C=v=>{let g=e.some(k=>k.id===v.id);a(g?e.filter(k=>k.id!==v.id):[...e,v]);},p=t.filter(v=>v.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?n(false):h(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[y.map(v=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:v.name,children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"asakaa-avatar-img"}):v.initials},v.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:v=>m(v.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:p.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"}):p.map(v=>{let g=e.some(k=>k.id===v.id);return jsxRuntime.jsxs("button",{onClick:()=>C(v),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:v.color,color:"#fff"},children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:v.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},v.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Qo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let l=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,c=m=>{if(!s.has(m)){s.add(m),n.add(m);let l=r.get(m)||[];for(let u of l){if(!s.has(u)&&c(u))return true;if(n.has(u))return true}}return n.delete(m),false};return c(a)}function ko({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[c,m]=react.useState(false),[l,u]=react.useState(""),[d,i]=react.useState(t.length>0),[h,C]=react.useState({top:0,left:0}),[p,y]=react.useState(null),f=react.useRef(null),v=react.useRef(null),g=()=>{if(!v.current)return;let w=v.current.getBoundingClientRect(),z=window.innerHeight,P=window.innerWidth,T=300,G=d?380:120,R=4,Y=w.right-T;Y<10&&(Y=w.left),Y+T>P-10&&(Y=P-T-10);let te=z-w.bottom,ve=w.top,Ie;te>=G+R?Ie=w.bottom+R:ve>=G+R?Ie=w.top-G-R:Ie=te>=ve?w.bottom+R:Math.max(10,w.top-G-R),C({top:Ie,left:Y}),m(true);};react.useEffect(()=>{if(!c||!v.current)return;let w=v.current.getBoundingClientRect(),z=window.innerHeight,P=window.innerWidth,T=300,G=d?380:120,R=4,Y=w.right-T;Y<10&&(Y=w.left),Y+T>P-10&&(Y=P-T-10);let te=z-w.bottom,ve=w.top,Ie;te>=G+R?Ie=w.bottom+R:ve>=G+R?Ie=w.top-G-R:Ie=te>=ve?w.bottom+R:Math.max(10,w.top-G-R),C({top:Ie,left:Y});},[d,c]),react.useEffect(()=>{let w=z=>{f.current&&!f.current.contains(z.target)&&!v.current?.contains(z.target)&&(m(false),u(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=z=>{z.key==="Escape"&&(m(false),u(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let k=w=>{let z=t.includes(w),P=a.find(T=>T.id===w);if(y(null),z){let T=t.filter(G=>G!==w);r(T),T.length===0&&i(false);}else {if(s&&Qo(a,w,e)){let G=`Cannot add "${P?.title||w}" as dependency - would create circular reference`;y(G),n?.(w,P?.title||w),setTimeout(()=>y(null),3e3);return}r([...t,w]),i(true);}},x=()=>{let w=!d;i(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(l.toLowerCase())||w.id.toLowerCase().includes(l.toLowerCase())),B=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:v,onClick:()=>c?m(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:B,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:B},children:t.length})]}),c&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.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:[p&&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:p})]}),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:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:w=>u(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.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"}):D.map(w=>{let z=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>k(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.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:z?"#3b82f6":"transparent",borderColor:z?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:z&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(false),m(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 sr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:c=[],allCards:m=[]})=>{let{attributes:l,listeners:u,setNodeRef:d,transform:i,transition:h,isDragging:C}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),p={transform:qo.Transform.toString(i),transition:h};if(t)return jsxRuntime.jsx("div",{ref:d,style:p,...l,...u,onClick:()=>a?.(e),children:t(e)});let y=c.filter(k=>e.assignedUserIds?.includes(k.id)),f=e.progress===100,v=(e.attachments||[]).filter(k=>k.type.startsWith("image/")),g={...p,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:g,className:b("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...u,onClick:k=>{k.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:k=>{k.currentTarget.style.display="none";}})}),v.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:v.length===1&&v[0]?jsxRuntime.jsx("img",{src:v[0].url,alt:v[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:v.slice(0,4).map((k,x)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:k.url,alt:k.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),x===3&&v.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",v.length-4]})})]},k.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Fr,{priority:e.priority,onChange:k=>n?.(e.id,{priority:k})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(vo,{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:(k,x)=>n?.(e.id,{startDate:k,endDate:x})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Lr,{assignedUsers:y,availableUsers:c,onChange:k=>n?.(e.id,{assignedUserIds:k.map(x=>x.id)})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(ko,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(k=>typeof k=="string"?k:k.taskId):[],availableTasks:m,onChange:k=>n?.(e.id,{dependencies:k})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(k=>jsxRuntime.jsx("span",{className:"asakaa-label",children:k},k))}),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)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));sr.displayName="Card";var en={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"}},Wl=({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 Gl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),m=react.useRef(null),l=react.useRef(null),u=[...Object.entries(en).map(([y,f])=>({id:y,label:f.label,color:f.color,icon:f.icon})),...r.filter(y=>!Object.keys(en).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let y=en[e];if(y)return {...y,id:e};let f=r.find(v=>v.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...en.todo,id:"todo"}},i=()=>{if(!l.current)return;let y=l.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,g=180,k=280,x=4,D=y.right-g;D<10&&(D=y.left),D+g>v-10&&(D=v-g-10);let B=f-y.bottom,w=y.top,z;B>=k+x?z=y.bottom+x:w>=k+x?z=y.top-k-x:z=B>=w?y.bottom+x:Math.max(10,y.top-k-x),c({top:z,left:D}),s(true);};react.useEffect(()=>{let y=f=>{m.current&&!m.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let h=y=>{t(y),s(false);},C=d(),p=C.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${p}10`,boxShadow:`0 0 0 2px ${p}30 inset`},title:C.label,children:jsxRuntime.jsx(Wl,{icon:C.icon,color:p})}),o&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(y=>jsxRuntime.jsxs("button",{onClick:()=>h(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Wl,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function _l({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[c,m]=react.useState(false),[l,u]=react.useState(e),[d,i]=react.useState({top:0,left:0}),h=react.useRef(null),C=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(s&&C.current){let g=C.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=k=>{h.current&&!h.current.contains(k.target)&&!C.current?.contains(k.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&(n(false),m(false),u(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{c&&p.current&&(p.current.focus(),p.current.select());},[c]);let y=()=>{m(true),u(e);},f=()=>{let g=l.trim();g&&g!==e&&t(g),m(false),n(false),u(e);},v=g=>{g.key==="Enter"?f():g.key==="Escape"&&(m(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:C,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:p,type:"text",value:l,onChange:g=>u(g.target.value),onKeyDown:v,onBlur:f,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var to=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:c,availableUsers:m,allCards:l,enableVirtualization:u,cardHeight:d=120,isCollapsed:i,onToggleCollapse:h,onColumnRename:C,onColumnDelete:p,isDeletable:y=false,className:f})=>{let{setNodeRef:v,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),x=u??hl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:x});if(a)return jsxRuntime.jsx("div",{ref:v,className:f,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),z=w.state==="exceeded",P=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:b("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",z&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:b(P()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(C||p)&&jsxRuntime.jsx(_l,{columnTitle:e.title,onRename:T=>C?.(e.id,T),onDelete:p?()=>p(e.id):void 0,isDeletable:y}),h&&jsxRuntime.jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:x?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(T=>T.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):x?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(T=>{let G=t[T.index];return G?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsxRuntime.jsx(sr,{card:G,render:r,onClick:n,onUpdate:c,availableUsers:m,allCards:l})},G.id):null})}):t.map(T=>jsxRuntime.jsx(sr,{card:T,render:r,onClick:n,onUpdate:c,availableUsers:m,allCards:l},T.id))})})]})});to.displayName="Column";function ls({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},l=u=>{u.key==="Enter"?m():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:m,onKeyDown:l,className:b("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:b("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var on=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Qa({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[c,m]=react.useState(false),[l,u]=react.useState(""),[d,i]=react.useState(false),[h,C]=react.useState(on[10]||"#3B82F6"),[p,y]=react.useState({top:0,left:0}),f=react.useRef(null),v=react.useRef(null),g=react.useRef(null),k=react.useRef(null),x=t.filter(T=>T.name.toLowerCase().includes(l.toLowerCase())),D=t.some(T=>T.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(c&&v.current){let T=v.current.getBoundingClientRect();y({top:T.bottom+6,left:T.left});}},[c]),react.useEffect(()=>{let T=G=>{let R=G.target,Y=f.current?.contains(R),te=g.current?.contains(R);!Y&&!te&&(m(false),u(""),i(false));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),react.useEffect(()=>{c&&k.current&&k.current.focus();},[c]);let B=T=>{let G=e.some(R=>R.id===T.id);a(G?e.filter(R=>R.id!==T.id):[...e,T]);},w=async()=>{if(!(!r||!l.trim())){i(true);try{let T=await r(l.trim(),h);T&&(a([...e,T]),u(""),C(on[Math.floor(Math.random()*on.length)]||"#3B82F6"));}finally{i(false);}}},z=(T,G)=>{G.stopPropagation(),a(e.filter(R=>R.id!==T));},P={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:v,type:"button",onClick:()=>!s&&m(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:p.top,left:p.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:k,type:"text",value:l,onChange:T=>u(T.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:T=>{T.key==="Enter"&&l.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(T=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:G=>z(T.id,G),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(T=>{let G=e.some(R=>R.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{G||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{G||(R.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),G&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):l.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:on.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:h===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:h,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function cs({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Yl({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(cs,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var er=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Zl(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function eu(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds}}function Or({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:c=[],availableTags:m=[],onCreateTag:l,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:i,availableTasks:h=[],comments:C=[],onAddComment:p,currentUser:y}){let f=s==="dark",v={textTertiary:f?"#6B7280":"#9CA3AF",textSecondary:f?"#9CA3AF":"#6B7280",textPrimary:f?"#FFFFFF":"#111827",borderLight:f?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:f?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:f?"#1A1D25":"#FFFFFF",bgSecondary:f?"#0F1117":"#F9FAFB",hoverBg:f?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},g=e&&"title"in e&&!("name"in e),k=e,[x,D]=react.useState(e?Zl(e,c):null),[B,w]=react.useState(false),[z,P]=react.useState(false),[T,G]=react.useState(false),[R,Y]=react.useState(null),[te,ve]=react.useState(new Date),[Ie,Ue]=react.useState(false),[le,O]=react.useState(false),[L,H]=react.useState(""),[F,q]=react.useState(false),[J,U]=react.useState(false),[xe,Te]=react.useState(false),[Le,ye]=react.useState(""),tt=react.useRef(null),[Ee,dt]=react.useState(""),[it,ut]=react.useState(false);react.useEffect(()=>{if(e){let E=Zl(e,c);D(E),ye(E.description||"");}},[e?.id,c]),react.useEffect(()=>()=>{tt.current&&clearTimeout(tt.current);},[]);let _e=react.useCallback(E=>{D(E),g&&o&&k?o(eu(E,k)):r&&r(E);},[g,k,o,r]),$=react.useCallback(()=>{w(false),P(false),G(false),Y(null),O(false),H(""),q(false);},[]),ae=react.useCallback((E,ee)=>{if(!x)return;let $e={...x,[E]:ee};_e($e);},[x,_e]),ce=react.useCallback(E=>{ye(E),tt.current&&clearTimeout(tt.current),tt.current=setTimeout(()=>{if(x){let ee={...x,description:E};_e(ee);}},800);},[x,_e]),Ce=react.useCallback(async()=>{if(!(!x||!Ee.trim()||!p)){ut(true);try{await p(x.id,Ee.trim()),dt("");}finally{ut(false);}}},[x,Ee,p]),Pe=react.useCallback(E=>{let ee=typeof E=="string"?new Date(E):E,re=new Date().getTime()-ee.getTime(),De=Math.floor(re/6e4),we=Math.floor(re/36e5),Se=Math.floor(re/864e5);return De<1?n==="es"?"Ahora":"Just now":De<60?n==="es"?`Hace ${De} min`:`${De}m ago`:we<24?n==="es"?`Hace ${we}h`:`${we}h ago`:Se<7?n==="es"?`Hace ${Se}d`:`${Se}d ago`:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),at=react.useCallback(E=>{if(!x)return;let ee=x.progress||0;E==="completed"?ee=100:E==="in-progress"&&ee===0?ee=10:E==="todo"&&(ee=0);let $e={...x,status:E,progress:ee};_e($e),w(false);},[x,_e]),mt=react.useCallback((E,ee)=>{if(!x)return;let $e={...x,startDate:E,endDate:ee};_e($e);},[x,_e]),Be=react.useCallback(()=>{let E=te.getFullYear(),ee=te.getMonth(),$e=new Date(E,ee,1),De=new Date(E,ee+1,0).getDate(),we=$e.getDay(),Se=[],Oe=new Date(E,ee,0).getDate();for(let Re=we-1;Re>=0;Re--)Se.push({date:new Date(E,ee-1,Oe-Re),isCurrentMonth:false});for(let Re=1;Re<=De;Re++)Se.push({date:new Date(E,ee,Re),isCurrentMonth:true});let Ve=42-Se.length;for(let Re=1;Re<=Ve;Re++)Se.push({date:new Date(E,ee+1,Re),isCurrentMonth:false});return Se},[te]),fe=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),U(false),!x||!d)return;let ee=Array.from(E.dataTransfer.files);if(ee.length!==0){Te(true);try{await d(x.id,ee);}finally{Te(false);}}},[x,d]),Me=react.useCallback(async E=>{if(!x||!d||!E.target.files)return;let ee=Array.from(E.target.files);if(ee.length!==0){Te(true);try{await d(x.id,ee);}finally{Te(false);}E.target.value="";}},[x,d]),_t=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),U(true);},[]),gt=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),U(false);},[]),aa=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),ia=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!x?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",f?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",f?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:b("text-xs font-mono",f?"text-[#6B7280]":"text-gray-400"),children:x.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",f?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:b("p-1.5 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:b("p-1.5 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:b("p-1.5 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=x.progress===100?0:100,$e={...x,progress:E,status:E===100?"completed":"todo"};_e($e);},className:b("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",x.progress===100?"bg-green-500 border-green-500":f?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:x.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:b("text-xl font-semibold flex-1",x.progress===100?"line-through text-[#6B7280]":f?"text-white":"text-gray-900"),children:x.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{$(),w(!B);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",x.progress===100||x.status==="completed"?"bg-green-500/20 text-green-400":x.progress&&x.progress>0||x.status==="in-progress"?"bg-blue-500/20 text-blue-400":f?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:x.progress===100||x.status==="completed"?n==="es"?"COMPLETADO":"DONE":x.progress&&x.progress>0||x.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>at(E.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",x.status===E.id&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:f?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{$(),G(!T);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[x.assignees&&x.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[x.assignees.slice(0,3).map((E,ee)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},ee)),x.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:["+",x.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",f?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",f?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(E=>{let ee=x.assignees?.some($e=>$e.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let $e=x.assignees||[],re;ee?re=$e.filter(De=>De.name!==E.name):re=[...$e,E],ae("assignees",re);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",ee&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:b("flex-1",f?"text-white":"text-gray-900"),children:E.name}),ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.name)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",f?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Y(R?null:"start"),ve(x.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[x.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",f?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),x.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Y(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:b("w-44 py-2 border-r",f?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,ee=new Date(E);ee.setDate(E.getDate()+1);let $e=new Date(E);$e.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let re=new Date(E);re.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let De=new Date(E);De.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let we=new Date(E);we.setDate(E.getDate()+14);let Se=new Date(E);return Se.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:$e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:re,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:De,display:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:we,display:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Se,display:Se.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ve,Re)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",f?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(R==="start"){let Ze=x.endDate&&Ve.date>x.endDate?Ve.date:x.endDate;mt(Ve.date,Ze),Y("end");}else {let Ze=x.startDate&&Ve.date<x.startDate?Ve.date:x.startDate;mt(Ze,Ve.date),Y(null);}},children:[jsxRuntime.jsx("span",{children:Ve.label}),jsxRuntime.jsx("span",{className:b("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:Ve.display})]},Re))})(),jsxRuntime.jsx("div",{className:b("border-t mt-2 pt-2",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{mt(void 0,void 0),Y(null);},className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",f?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:b("text-xs mb-3 px-2 py-1 rounded",f?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:R==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:b("font-medium",f?"text-white":"text-gray-900"),children:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>ve(new Date),className:b("p-1 rounded text-sm transition-colors",f?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ve(new Date(te.getFullYear(),te.getMonth()-1)),className:b("p-1 rounded",f?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>ve(new Date(te.getFullYear(),te.getMonth()+1)),className:b("p-1 rounded",f?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",f?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Be().map((E,ee)=>{let $e=E.date.toDateString()===new Date().toDateString(),re=x.startDate?.toDateString()===E.date.toDateString(),De=x.endDate?.toDateString()===E.date.toDateString(),we=re||De,Se=x.startDate&&x.endDate&&E.date>=x.startDate&&E.date<=x.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Oe=new Date(E.date);if(R==="start"){let Ve=x.endDate&&Oe>x.endDate?Oe:x.endDate;mt(Oe,Ve),Y("end");}else {let Ve=x.startDate&&Oe<x.startDate?Oe:x.startDate;mt(Ve,Oe),Y(null);}},className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(f?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(f?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#3B82F6]",re&&"bg-[#3B82F6] text-white",De&&!re&&"bg-[#7C3AED] text-white",Se&&!we&&(f?"bg-[#7C3AED]/20":"bg-purple-100"),!we&&(f?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},ee)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{$(),P(!z);},className:b("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",x.priority==="high"||x.priority==="urgent"?"bg-red-500/20 text-red-400":x.priority==="medium"?"bg-yellow-500/20 text-yellow-400":x.priority==="low"?"bg-green-500/20 text-green-400":f?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:x.priority?x.priority==="high"||x.priority==="urgent"?n==="es"?"Alta":"High":x.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>P(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{ae("priority",E.id),P(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",x.priority===E.id&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:f?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",f?"text-white":"text-gray-900"),children:x.startDate&&x.endDate?`${Math.ceil((x.endDate.getTime()-x.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full border-2",f?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ie?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:x.progress||0,onChange:E=>{let ee=parseInt(E.target.value),$e=x.status;ee===100?$e="completed":ee>0?$e="in-progress":$e="todo";let re={...x,progress:ee,status:$e};_e(re);},onBlur:()=>Ue(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",f?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Ue(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",x.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${x.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",f?"text-white":"text-gray-900"),children:[x.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Qa,{selectedTags:x.tags||[],availableTags:m,onChange:E=>{ae("tags",E);},onCreateTag:l,theme:v})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4 mt-1.5",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24 mt-1",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[x.dependencies&&x.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:x.dependencies.map(E=>{let ee=h.find($e=>$e.id===E);return jsxRuntime.jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",f?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ee?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let $e=(x.dependencies||[]).filter(re=>re!==E);ae("dependencies",$e);},className:b("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{$(),O(!le);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),H("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:b("p-2 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:L,onChange:E=>H(E.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:b("w-full px-3 py-2 rounded-md text-sm outline-none",f?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:h.length>0?h.filter(E=>E.id!==x.id).filter(E=>L===""||E.name.toLowerCase().includes(L.toLowerCase())).map(E=>{let ee=x.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let $e=x.dependencies||[],re;ee?re=$e.filter(De=>De!==E.id):re=[...$e,E.id],ae("dependencies",re);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",ee&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ee?"bg-blue-500 border-blue-500":f?"border-white/30":"border-gray-300"),children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:b("block truncate",f?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:b("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",f?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{$(),q(!F);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:x.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:b("text-sm",f?"text-white":"text-gray-900"),children:er.find(E=>E.value===x.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",f?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:er.map(E=>{let ee=x.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{ae("color",E.value),q(false);},className:b("w-7 h-7 rounded-full flex items-center justify-center transition-all",ee&&"ring-2 ring-offset-2",f?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:ee?E.value:void 0},title:E.name,children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:x.isMilestone||false,onChange:E=>ae("isMilestone",E.target.checked),className:b("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",x.isMilestone?"bg-purple-500 border-purple-500":f?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:b("text-sm",f?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:b("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",f?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Le,onChange:E=>ce(E.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:b("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",f?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm mt-2 transition-colors",f?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",f?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",f?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),x.subtasks&&x.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:x.subtasks.map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":f?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm",E.progress===100?"line-through text-[#6B7280]":f?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",f?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:b("p-1 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:b("text-sm font-semibold mb-3",f?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:b("ml-2 text-xs font-normal",f?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(E=>{let ee=ia(E.type),$e=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg group transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[$e&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:b("w-10 h-10 rounded flex items-center justify-center",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ee,{className:b("w-5 h-5",f?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:b("text-sm font-medium truncate block hover:underline",f?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:b("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:aa(E.size)})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(E.id),className:b("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",f?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:_t,onDragLeave:gt,onDrop:fe,className:b("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",J?f?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":f?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",xe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Me,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||xe}),xe?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",J?"text-blue-500":f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-500"),children:J?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:b("text-xs mt-1",f?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-80 border-l flex flex-col",f?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:b("text-sm font-semibold",f?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxRuntime.jsxs("span",{className:b("ml-2 text-xs font-normal",f?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:C.map(E=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:E.user?.color||"#8B5CF6"},children:E.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:b("text-sm font-medium",f?"text-white":"text-gray-900"),children:E.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:b("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:Pe(E.createdAt)})]}),jsxRuntime.jsx("p",{className:b("text-sm break-words",f?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:b("w-10 h-10 mb-3",f?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:b("p-4 border-t",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[y&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:y.color||"#8B5CF6"},children:y.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:b("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",f?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:E=>dt(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),Ce());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:it||!p,className:b("flex-1 bg-transparent text-sm outline-none",f?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(it||!p)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:Ce,disabled:it||!Ee.trim()||!p,className:b("p-1.5 rounded transition-colors",Ee.trim()&&p?"bg-blue-500 text-white hover:bg-blue-600":f?"text-[#6B7280]":"text-gray-400",it&&"opacity-50 cursor-not-allowed"),children:it?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})})}function fs(){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 vr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:c,isLoading:m,error:l,children:u,availableTags:d=[],onCreateTag:i,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:p}){let[y,f]=fs(),[v,g]=react.useState(null),k=o?.theme||"dark",x=k==="dark"||k==="neutral",D=x?"dark":"",B=react.useCallback((le,O)=>{t.onCardUpdate?.(le,O);},[t]),w=react.useCallback((le,O)=>{t.onColumnUpdate?.(le,{title:O});},[t]),z=react.useCallback(le=>{t.onColumnDelete?.(le);},[t]),P=["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})),G=react.useMemo(()=>{let le=new Map;return e.columns.forEach(O=>{let L=O.cardIds.map(H=>e.cards.find(F=>F.id===H)).filter(H=>H!==void 0).sort((H,F)=>H.position-F.position);le.set(O.id,L);}),le},[e.cards,e.columns]),R=react.useMemo(()=>e.cards.map(le=>({id:le.id,name:le.title,startDate:le.startDate?new Date(le.startDate):void 0,endDate:le.endDate?new Date(le.endDate):void 0,progress:le.progress||0,status:le.columnId,priority:le.priority?.toLowerCase(),dependencies:Array.isArray(le.dependencies)?le.dependencies.map(O=>typeof O=="string"?O:O.taskId):[]})),[e.cards]),Y=react.useCallback(le=>{let{active:O}=le,L=e.cards.find(H=>H.id===O.id);L&&f({isDragging:true,draggedCardId:L.id,sourceColumnId:L.columnId,targetColumnId:L.columnId});},[e.cards,f]),te=react.useCallback(le=>{let{active:O,over:L}=le;if(!L||!e.cards.find(q=>q.id===O.id))return;let F=null;L.data.current?.type==="column"?F=L.id:L.data.current?.type==="card"&&(F=e.cards.find(J=>J.id===L.id)?.columnId||null),F&&F!==y.targetColumnId&&f({...y,targetColumnId:F});},[e.cards,y,f]),ve=react.useCallback(async le=>{let{active:O,over:L}=le;if(f({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!L)return;let H=e.cards.find(U=>U.id===O.id);if(!H)return;let F,q;if(L.data.current?.type==="column"){F=L.id;let U=G.get(F)||[];q=Qn(U,0);}else {let U=e.cards.find(Le=>Le.id===L.id);if(!U)return;F=U.columnId;let xe=G.get(F)||[],Te=xe.findIndex(Le=>Le.id===L.id);q=Qn(xe,Te);}let J=e.columns.find(U=>U.id===F);if(J&&J.wipLimit&&J.wipLimitType==="hard"){let U=G.get(F)||[];if(H.columnId!==F&&U.length>=J.wipLimit){t.onWipLimitExceeded?.(J,H);return}}(H.columnId!==F||H.position!==q)&&await t.onCardMove?.(H.id,F,q);},[e.cards,e.columns,G,t,f]),Ie=react.useCallback(le=>{g(le),a?.(le);},[a]),Ue=react.useCallback(le=>{t.onCardUpdate?.(le.id,le),g(le);},[t]);return m?jsxRuntime.jsx("div",{className:b("asakaa-board",D,n),style:c,children:jsxRuntime.jsx(mu,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:b("asakaa-board",D,n),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(Sl,{themeName:k,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:Y,onDragOver:te,onDragEnd:ve,children:[jsxRuntime.jsxs("div",{className:b("asakaa-board",D,n),style:c,"data-theme":k,children:[e.columns.sort((le,O)=>le.position-O.position).map(le=>{let O=G.get(le.id)||[],L=!P.includes(le.id);return jsxRuntime.jsx(to,{column:le,cards:O,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Ie,onCardUpdate:B,onColumnRename:w,onColumnDelete:z,isDeletable:L,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},le.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:y.draggedCardId?jsxRuntime.jsx(sr,{card:e.cards.find(le=>le.id===y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Or,{task:v,isOpen:!!v,onClose:()=>g(null),onCardUpdate:Ue,theme:x?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:i,attachments:v?h?.get(v.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:p,availableTasks:R})]})}function mu({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 bu={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)"},yu={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)"},vu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},xu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function ku({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let l=u=>{c.current&&!c.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let m=l=>{t(l),n(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,u)=>l.position-u.position).map((l,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.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:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function wu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[c,m]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let h=C=>{l.current&&!l.current.contains(C.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),i=async(h,C)=>{if(C){m(h);try{await C();}catch(p){console.error(`Export ${h} failed:`,p);}finally{m(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((h,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(h.id,h.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===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 Cu({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 bs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:c,onExportExcel:m,translations:l}){let u=r==="dark"?bu:yu,d={...o==="es"?vu:xu,...l},i=n||c||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wu,{theme:u,t:d,onExportCSV:n,onExportJSON:c,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(ku,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(Cu,{onClick:()=>t(),label:a||d.newTask}))]})})}function vs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[c,m]=react.useState(""),l=react.useCallback(()=>{let i=c.trim();i&&(e(i),m(""),n(false));},[c,e]),u=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),l()):i.key==="Escape"&&(m(""),n(false));},[l]),d=react.useCallback(()=>{setTimeout(()=>{c.trim()||n(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:b("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>m(i.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:b("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function xs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:c="dark",locale:m="es"}){let[l,u]=react.useState(false),[d,i]=react.useState(false),[h,C]=react.useState(""),[p,y]=react.useState([]),[f,v]=react.useState(""),[g,k]=react.useState(""),[x,D]=react.useState(""),[B,w]=react.useState(false),[z,P]=react.useState(false),[T,G]=react.useState(false),R=react.useRef(null),Y=react.useRef(null),te={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ve=react.useCallback(()=>{C(""),y([]),v(""),k(""),D(""),w(false),P(false),G(false),u(false);},[]);react.useEffect(()=>{l&&R.current&&R.current.focus();},[l]),react.useEffect(()=>{if(!l)return;let L=H=>{Y.current&&!Y.current.contains(H.target)&&(h.trim()||ve());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[l,h,ve]);let Ie=react.useCallback(async()=>{let L=h.trim();if(!(!L||d)){i(true);try{await t({name:L,columnId:e,assigneeIds:p.length>0?p:void 0,startDate:f?new Date(f):void 0,endDate:g?new Date(g):void 0,priority:x||void 0}),C(""),y([]),v(""),k(""),D(""),w(!1),P(!1),G(!1),R.current?.focus();}catch(H){console.error("Error creating card:",H);}finally{i(false);}}},[h,e,p,f,g,x,t,d]),Ue=react.useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),Ie()):L.key==="Escape"&&ve();},[Ie,ve]),le=react.useCallback(L=>{y(H=>H.includes(L)?H.filter(F=>F!==L):[...H,L]);},[]),O=c==="dark";return l?jsxRuntime.jsxs("div",{ref:Y,className:b("rounded-lg overflow-hidden shadow-lg",O?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:h,onChange:L=>C(L.target.value),onKeyDown:Ue,placeholder:te.placeholder,disabled:d,className:b("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",O?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!B),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||p.length>0?"bg-emerald-500/20 text-emerald-400":O?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.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"})]}),p.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:p.length})]}),jsxRuntime.jsx("button",{onClick:()=>P(!z),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",z||f||g?"bg-blue-500/20 text-blue-400":O?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.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:()=>G(!T),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":O?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.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:Ie,disabled:!h.trim()||d,className:b("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),B&&a.length>0&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",O?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxRuntime.jsxs("button",{onClick:()=>le(L.id),className:b("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",p.includes(L.id)?"bg-emerald-500 text-white":O?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsxRuntime.jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",p.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),z&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",O?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",O?"text-gray-500":"text-gray-400"),children:te.startDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:L=>v(L.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",O?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",O?"text-gray-500":"text-gray-400"),children:te.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:L=>k(L.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",O?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",O?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsxRuntime.jsx("button",{onClick:()=>D(x===L?"":L),className:b("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:O?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[L]},L))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",O?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"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:te.buttonLabel})]})}var No=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(vr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function cd(e={}){return new No(e)}var ro=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ks(e,t){let a=r=>jsxRuntime.jsx(ro,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Cs({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:c,onOpenAIUsage:m,shortcut:l="k",className:u=""}){let[d,i]=react.useState(false),[h,C]=react.useState(""),[p,y]=react.useState("home"),[f,v]=react.useState(""),[g,k]=react.useState("");react.useEffect(()=>{let w=z=>{(z.metaKey||z.ctrlKey)&&z.key===l&&(z.preventDefault(),i(P=>!P)),z.key==="Escape"&&(i(false),y("home"),C(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]),react.useEffect(()=>{d||(y("home"),C(""),v(""),k(""));},[d]);let x=react.useCallback(()=>{i(false);},[]),D=react.useCallback(w=>{let[z,P]=w.split(":");switch(z){case "create-card":y("create-card");break;case "create-card-in":v(P||"");break;case "navigate":P?(a?.(P),x()):y("navigate");break;case "search":r?.(h),x();break;case "priority":y("priority");break;case "set-priority":g&&P&&(o?.(g,P),x());break;case "assign":y("assign");break;case "assign-user":g&&P&&(s?.(g,P),x());break;case "ai":y("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":c?.(),x();break;case "ai-usage":m?.(),x();break;case "back":y("home");break;}},[h,g,t,a,r,o,s,n,c,m,x]),B=react.useCallback(()=>{f&&h.trim()&&(t?.(f,h.trim()),x());},[f,h,t,x]);return d?jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:x,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:h,onValueChange:C,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:p==="create-card"&&f?"Type card title and press Enter...":p==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&p==="create-card"&&f&&B();}}),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."}),p==="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:D,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:D,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:D,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:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(z=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:z},z))})]},w.id))})]}),p==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),p==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let z=e.columns.find(P=>P.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:z?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},w.id)})})]}),p==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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:D,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:D,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 ud(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
6
6
  position: fixed !important;
7
7
  inset: 0 !important;
8
8
  z-index: 2147483647 !important;
@@ -24,7 +24,7 @@
24
24
  font-size: 12px !important;
25
25
  color: rgba(255, 255, 255, 0.4) !important;
26
26
  pointer-events: none !important;
27
- `;let l=()=>{n.remove(),document.removeEventListener("keydown",g);},g=d=>{if(d.key==="Escape")l();else if(d.key==="ArrowLeft"&&a.length>1){let i=r>0?r-1:a.length-1;l(),o(i);}else if(d.key==="ArrowRight"&&a.length>1){let i=r<a.length-1?r+1:0;l(),o(i);}};if(n.onclick=l,document.addEventListener("keydown",g),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
27
+ `;let l=()=>{n.remove(),document.removeEventListener("keydown",u);},u=d=>{if(d.key==="Escape")l();else if(d.key==="ArrowLeft"&&a.length>1){let i=r>0?r-1:a.length-1;l(),o(i);}else if(d.key==="ArrowRight"&&a.length>1){let i=r<a.length-1?r+1:0;l(),o(i);}};if(n.onclick=l,document.addEventListener("keydown",u),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
28
28
  position: absolute !important;
29
29
  bottom: 48px !important;
30
30
  left: 50% !important;
@@ -34,7 +34,7 @@
34
34
  padding: 8px 12px !important;
35
35
  background: rgba(0, 0, 0, 0.4) !important;
36
36
  border-radius: 20px !important;
37
- `,d.onclick=b=>b.stopPropagation(),a.forEach((b,p)=>{let v=document.createElement("button");v.className=`attachment-lightbox-dot ${p===r?"active":""}`,v.style.cssText=`
37
+ `,d.onclick=C=>C.stopPropagation(),a.forEach((C,p)=>{let y=document.createElement("button");y.className=`attachment-lightbox-dot ${p===r?"active":""}`,y.style.cssText=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !important;
@@ -42,7 +42,7 @@
42
42
  border: none !important;
43
43
  padding: 0 !important;
44
44
  cursor: pointer !important;
45
- `,v.onclick=w=>{w.stopPropagation(),l(),o(p);},d.appendChild(v);});let i=document.createElement("button");i.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",i.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',i.style.cssText=`
45
+ `,y.onclick=f=>{f.stopPropagation(),l(),o(p);},d.appendChild(y);});let i=document.createElement("button");i.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",i.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',i.style.cssText=`
46
46
  position: absolute !important;
47
47
  left: 0 !important;
48
48
  top: 0 !important;
@@ -55,7 +55,7 @@
55
55
  border: none !important;
56
56
  cursor: pointer !important;
57
57
  opacity: 0.5 !important;
58
- `,i.onmouseenter=()=>{i.style.opacity="1";},i.onmouseleave=()=>{i.style.opacity="0.5";},i.onclick=b=>{b.stopPropagation();let p=r>0?r-1:a.length-1;l(),o(p);};let h=document.createElement("button");h.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",h.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',h.style.cssText=`
58
+ `,i.onmouseenter=()=>{i.style.opacity="1";},i.onmouseleave=()=>{i.style.opacity="0.5";},i.onclick=C=>{C.stopPropagation();let p=r>0?r-1:a.length-1;l(),o(p);};let h=document.createElement("button");h.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",h.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',h.style.cssText=`
59
59
  position: absolute !important;
60
60
  right: 0 !important;
61
61
  top: 0 !important;
@@ -68,7 +68,7 @@
68
68
  border: none !important;
69
69
  cursor: pointer !important;
70
70
  opacity: 0.5 !important;
71
- `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=b=>{b.stopPropagation();let p=r<a.length-1?r+1:0;l(),o(p);},n.appendChild(d),n.appendChild(i),n.appendChild(h);}n.appendChild(c),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Eu(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 Pu(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 Ns(e){return e.startsWith("image/")}function rr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,c]=react.useState(false),[m,l]=react.useState(false),[g,d]=react.useState(null),i=react.useRef(null),h=react.useRef(e);h.current=e;let b=react.useCallback((k,U)=>{U.preventDefault(),U.stopPropagation();let P=h.current.filter(R=>Ns(R.type)),C=P.findIndex(R=>R.id===k.id),H=R=>{let J=h.current.filter(Ce=>Ns(Ce.type)),re=J[R];re&&md(re.url,re.name,J,R,H);};md(k.url,k.name,P,C,H);},[]),p=react.useCallback(k=>{let U=[],P=[];return e.length+k.length>s?(P.push(`Maximum ${s} files allowed`),{valid:U,errors:P}):(k.forEach(C=>{if(C.size/1048576>r){P.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>C.type.match(R))){P.push(`${C.name} has invalid file type`);return}U.push(C);}),{valid:U,errors:P})},[e.length,s,r,o]),v=react.useCallback(async k=>{let{valid:U,errors:P}=p(k);if(P.length>0){d(P.join(", ")),setTimeout(()=>d(null),5e3);return}if(U.length!==0){l(true),d(null);try{await t?.(U);}catch(C){d(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[p,t]),w=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),u=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),f=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let U=Array.from(k.dataTransfer.files);v(U);},[v]),D=react.useCallback(k=>{let U=k.target.files?Array.from(k.target.files):[];v(U),i.current&&(i.current.value="");},[v]),S=react.useCallback(()=>{i.current?.click();},[]),L=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:w,onDragLeave:u,onDragOver:f,onDrop:x,onClick:S,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),g&&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:g})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ns(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:U=>b(k,U),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Pu(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Eu(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>L(k.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"})})})]},k.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],aiInsights:m=[],attachments:l=[],onAddComment:g,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:h,onSuggestAssignee:b,onGenerateSubtasks:p,onEstimateEffort:v,currentUserId:w="user-1"}){let[u,f]=react.useState("details"),[x,D]=react.useState(false),[S,L]=react.useState({}),[k,U]=react.useState(""),[P,C]=react.useState(false),[H,R]=react.useState({});if(!t||!e)return null;let J=react.useCallback(()=>{D(false),L({}),f("details"),U(""),R({}),a();},[a]),re=react.useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),L({}),D(false));},[e.id,S,r]),Ce=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),J());},[e.id,o,J]),Se=react.useCallback(()=>{g&&k.trim()&&(g(e.id,k.trim()),U(""));},[e.id,k,g]),Fe=react.useCallback(async()=>{if(b){C(true);try{let F=await b(e);R(q=>({...q,assignees:F}));}catch(F){console.error("Failed to suggest assignee:",F);}finally{C(false);}}},[e,b]),se=react.useCallback(async()=>{if(p){C(true);try{let F=await p(e);R(q=>({...q,subtasks:F}));}catch(F){console.error("Failed to generate subtasks:",F);}finally{C(false);}}},[e,p]),O=react.useCallback(async()=>{if(v){C(true);try{let F=await v(e);R(q=>({...q,effort:F}));}catch(F){console.error("Failed to estimate effort:",F);}finally{C(false);}}},[e,v]),B={...e,...S},$=s.filter(F=>B.assignedUserIds?.includes(F.id));return jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:J,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:F=>F.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:S.title??B.title,onChange:F=>L({...S,title:F.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:B.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:re,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),L({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:Ce,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:J,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 ${u==="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 ${u==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${u==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${u==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${u==="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:[u==="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"}),x?jsxRuntime.jsx("textarea",{value:S.description??B.description??"",onChange:F=>L({...S,description:F.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:B.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:S.assignedUserIds??B.assignedUserIds??[],onChange:F=>{let q=Array.from(F.target.selectedOptions,Z=>Z.value);L({...S,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(F=>jsxRuntime.jsx("option",{value:F.id,children:F.name},F.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:$.length>0?$.map(F=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:F.color},children:F.initials}),jsxRuntime.jsx("span",{children:F.name})]},F.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"}),x?jsxRuntime.jsxs("select",{value:S.priority??B.priority??"",onChange:F=>L({...S,priority:F.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:B.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:B.labels&&B.labels.length>0?B.labels.map(F=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:F},F)):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"}),x?jsxRuntime.jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:B.startDate?new Date(B.startDate).toISOString().split("T")[0]:"",onChange:F=>L({...S,startDate:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.startDate?new Date(B.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:B.endDate?new Date(B.endDate).toISOString().split("T")[0]:"",onChange:F=>L({...S,endDate:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??B.estimatedTime??"",onChange:F=>L({...S,estimatedTime:F.target.value?parseFloat(F.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:B.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:B.dependencies&&B.dependencies.length>0?B.dependencies.map(F=>{let q=typeof F=="string"?F:F.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:B.createdAt?new Date(B.createdAt).toLocaleString():"Unknown"})]})]}),u==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:F=>U(F.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Se,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(F=>{let q=s.find(Z=>Z.id===F.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(F.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(F.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:F.content})]},F.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"})]})})]}),u==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(F=>{let q=s.find(Z=>Z.id===F.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[F.type.includes("CREATED")&&"\u2795",F.type.includes("UPDATED")&&"\u270F\uFE0F",F.type.includes("MOVED")&&"\u27A1\uFE0F",F.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",F.type.includes("COMMENT")&&"\u{1F4AC}",F.type.includes("ASSIGNED")&&"\u{1F464}",F.type.includes("PRIORITY")&&"\u{1F3AF}",F.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",F.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:q?.name||"Unknown"})," ",F.type.replace(/_/g," ").toLowerCase(),F.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:F.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(F.timestamp).toLocaleString()})]})]},F.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"})]})}),u==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(rr,{cardId:e.id,attachments:l,onUpload:i?F=>i(e.id,F):void 0,onDelete:h,currentUserId:w,maxSizeMB:10,maxFiles:20})}),u==="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:Fe,disabled:P||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:P||!p,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:O,disabled:P||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((F,q)=>{let Z=s.find(z=>z.id===F.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Z?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:F.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(F.confidence*100).toFixed(0),"%"]})]})]},q)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((F,q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:F.title}),F.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:F.description}),F.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",F.estimatedTime,"h"]})]},q))]}),H.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:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(F=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${F.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:F.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:F.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:F.description}),F.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",F.suggestedAction]})]},F.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&m.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 So({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[c,m]=react.useState({top:0,left:0}),l=react.useRef(null),g=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,h=window.innerWidth,b=4,p=d.left;p+o>h-10&&(p=h-o-10),p<10&&(p=10);let v=i-d.bottom,w=d.top,u;return v>=s+b?u=d.bottom+b:w>=s+b?u=d.top-s-b:v>=w?u=d.bottom+b:u=Math.max(10,d.top-s-b),{top:u,left:p}},[e,o,s]);return react.useEffect(()=>{t&&m(g());},[t,g]),react.useEffect(()=>{if(!t)return;let d=h=>{let b=h.target;l.current&&!l.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Ve={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:"#D21E24",todayLight:"rgba(210, 30, 36, 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:"#D21E24",todayLight:"rgba(210, 30, 36, 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"}};var Ou=["LOW","MEDIUM","HIGH","URGENT"],zu=["todo","in-progress","review","done"];function Ps({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],onAddComment:m,onDeleteComment:l,currentUser:g,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:h,availableColumns:b=[],availableLabels:p=[],availableTags:v=[],onCreateTag:w,onUploadCoverImage:u,unsplashAccessKey:f,theme:x,onSubtasksChange:D,attachments:S=[],onUploadAttachments:L,onDeleteAttachment:k}){let U=Zr(),P=x||U?.themeName||"dark",[C,H]=react.useState(e),[R,J]=react.useState(false),[re,Ce]=react.useState(e?.subtasks||[]),[Se,Fe]=react.useState(false),[se,O]=react.useState(""),[B,$]=react.useState(""),[F,q]=react.useState("all"),[Z,z]=react.useState(false),[ve,we]=react.useState(false),[Me,ge]=react.useState(false),[ot,Ae]=react.useState(false),[pt,mt]=react.useState(false),[gt,Je]=react.useState(false),W=react.useRef(null),T=react.useRef(null),V=react.useRef(null),te=react.useRef(null),ue=react.useRef(null),Le=react.useRef(null),nt=react.useRef(null),Ne=react.useRef(null),de=react.useRef(null),xe=react.useRef(null),it=react.useRef(null),lt=react.useRef(null);react.useEffect(()=>{e&&!C?(H({...e}),Ce(e.subtasks||[])):e&&C&&e.id!==C.id&&(H({...e}),Ce(e.subtasks||[]));},[e,C]),react.useEffect(()=>{let M=_=>{let ce=_.target;te.current&&!te.current.contains(ce)&&z(false),ue.current&&!ue.current.contains(ce)&&we(false),Le.current&&!Le.current.contains(ce)&&ge(false),nt.current&&!nt.current.contains(ce)&&Ae(false);};if(Z||ve||Me||ot)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[Z,ve,Me,ot]),react.useEffect(()=>{if(!t)return;let M=_=>{let ce=_.target,_e=ce.tagName==="INPUT"||ce.tagName==="TEXTAREA"||ce.isContentEditable;if(_.key==="Escape"){_.preventDefault(),Z||ve||Me||ot||pt||gt?(z(false),we(false),ge(false),Ae(false),mt(false),Je(false)):_e||a();return}if(_e&&_.key!=="Escape")return;let X=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),z(true);break;case "a":_.preventDefault(),ge(true);break;case "p":_.preventDefault(),we(true);break;case "l":_.preventDefault(),Ae(true);break;case "d":X||(_.preventDefault(),mt(true),setTimeout(()=>Ne.current?.focus(),0));break;case "e":X||(_.preventDefault(),Je(true));break;case "i":_.preventDefault(),J(true),setTimeout(()=>T.current?.focus(),0);break;case "t":_.preventDefault(),Fe(true);break;case "c":_.preventDefault(),V.current?.focus();break}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,a,Z,ve,Me,ot,pt,gt]);let sa=react.useCallback(M=>{let _=M.currentTarget.textContent?.trim()||"";if(C&&_!==C.title){let ce={...C,title:_};H(ce),r?.(C.id,{title:_});}},[C,r]),ca=react.useCallback(M=>{M.key==="Enter"&&(M.preventDefault(),M.currentTarget.blur()),M.key==="Escape"&&(M.preventDefault(),M.currentTarget.textContent=C?.title||"",M.currentTarget.blur());},[C]),He=react.useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),J(false);},[C,e,r]),ze=react.useCallback(M=>{if(C){let _={...C,columnId:M};H(_),r?.(C.id,{columnId:M}),z(false);}},[C,r]),pa=react.useCallback(M=>{if(C){let _={...C,priority:M};H(_),r?.(C.id,{priority:M}),we(false);}},[C,r]),fe=react.useCallback(M=>{if(C){let _=C.assignedUserIds||[],ce=_.includes(M)?_.filter(X=>X!==M):[..._,M],_e={...C,assignedUserIds:ce};H(_e),r?.(C.id,{assignedUserIds:ce});}},[C,r]),Ge=react.useCallback(M=>{if(C){let _=C.labels||[],ce=_.includes(M)?_.filter(X=>X!==M):[..._,M],_e={...C,labels:ce};H(_e),r?.(C.id,{labels:ce});}},[C,r]),Ee=react.useCallback(M=>{if(C){let _={...C,tags:M};H(_),r?.(C.id,{tags:M});}},[C,r]),Ue=react.useCallback(M=>{if(C){let _=M.target.value,ce={...C,endDate:_};H(ce),r?.(C.id,{endDate:_}),mt(false);}},[C,r]),Ye=react.useCallback(M=>{if(C){let _={...C,estimatedTime:parseFloat(M)||0};H(_),r?.(C.id,{estimatedTime:parseFloat(M)||0});}},[C,r]),ft=react.useCallback(()=>{if(se.trim()&&C){let M={id:`subtask-${Date.now()}`,title:se.trim(),completed:false,createdAt:new Date},_=[...re,M];Ce(_),O(""),Fe(false),D?.(C.id,_);}},[se,re,C,D]),Ze=react.useCallback(M=>{let _=re.map(ce=>ce.id===M?{...ce,completed:!ce.completed,updatedAt:new Date}:ce);Ce(_),C&&D?.(C.id,_);},[re,C,D]),tt=react.useCallback(M=>{let _=re.filter(ce=>ce.id!==M);Ce(_),C&&D?.(C.id,_);},[re,C,D]),ht=react.useCallback(()=>{B.trim()&&C&&m&&(m(C.id,B.trim()),$(""));},[B,C,m]),jt=react.useCallback(M=>{(M.metaKey||M.ctrlKey)&&M.key==="Enter"&&(M.preventDefault(),ht());},[ht]),Q=M=>jsxRuntime.jsx(Lu__default.default,{remarkPlugins:[Bu__default.default],rehypePlugins:[Ru__default.default],components:{a:({node:_,...ce})=>jsxRuntime.jsx("a",{...ce,target:"_blank",rel:"noopener noreferrer"})},children:M}),oe=c.filter(M=>F==="comments"?M.type.includes("COMMENT"):F==="history"?!M.type.includes("COMMENT"):true);if(!t||!e)return null;let De=C||e,Re=s.filter(M=>De.assignedUserIds?.includes(M.id)),N=re.filter(M=>M.completed).length;return jsxRuntime.jsx(dt,{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":P,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:W,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:ca,children:De.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:te,children:[jsxRuntime.jsxs("button",{ref:de,className:"modal-v2-field",onClick:()=>z(!Z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:De.columnId||"No status"})]}),jsxRuntime.jsx(So,{triggerRef:de,isOpen:Z,onClose:()=>z(false),width:250,estimatedHeight:200,children:(b.length>0?b:zu.map(M=>({id:M,title:M}))).map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${De.columnId===M.id?"active":""}`,onClick:()=>ze(M.id),children:M.title},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Le,children:[jsxRuntime.jsxs("button",{ref:xe,className:"modal-v2-field",onClick:()=>ge(!Me),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Re.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Re.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(So,{triggerRef:xe,isOpen:Me,onClose:()=>ge(false),width:280,estimatedHeight:300,children:s.map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${De.assignedUserIds?.includes(M.id)?"active":""}`,onClick:()=>fe(M.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:M.color},children:M.initials}),M.name,De.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:ue,children:[jsxRuntime.jsxs("button",{ref:it,className:"modal-v2-field",onClick:()=>we(!ve),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:De.priority||"None"})]}),jsxRuntime.jsxs(So,{triggerRef:it,isOpen:ve,onClose:()=>we(false),width:180,estimatedHeight:220,children:[Ou.map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${M.toLowerCase()} ${De.priority===M?"active":""}`,onClick:()=>pa(M),children:M},M)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>pa(""),children:"None"})]})]}),v.length>0||w?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Qa,{selectedTags:De.tags||[],availableTags:v,onChange:Ee,onCreateTag:w,theme:Ve[P]||Ve.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:nt,children:[jsxRuntime.jsxs("button",{ref:lt,className:"modal-v2-field",onClick:()=>Ae(!ot),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:De.labels&&De.labels.length>0?jsxRuntime.jsx("span",{children:De.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(So,{triggerRef:lt,isOpen:ot,onClose:()=>Ae(false),width:220,estimatedHeight:200,children:(p.length>0?p:["Bug","Feature","Enhancement","Documentation"]).map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${De.labels?.includes(M)?"active":""}`,onClick:()=>Ge(M),children:[M,De.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:()=>{mt(!pt),setTimeout(()=>Ne.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:De.endDate?new Date(De.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ne,type:"date",value:typeof De.endDate=="string"?De.endDate.split("T")[0]:De.endDate?(()=>{let M=new Date(De.endDate),_=M.getUTCFullYear(),ce=String(M.getUTCMonth()+1).padStart(2,"0"),_e=String(M.getUTCDate()).padStart(2,"0");return `${_}-${ce}-${_e}`})():"",onChange:Ue,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Je(!gt),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:De.estimatedTime?`${De.estimatedTime}h`:"Not set"})]}),gt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:De.estimatedTime||"",onChange:M=>Ye(M.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Je(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"})]}),R?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:De.description||"",onChange:M=>{if(C){let _={...C,description:M.target.value};H(_);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>J(true),children:De.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Q(De.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"}),re.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[N,"/",re.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Fe(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:[re.map(M=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${M.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ze(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:()=>tt(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)),Se&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:se,onChange:M=>O(M.target.value),onKeyDown:M=>{M.key==="Enter"&&ft(),M.key==="Escape"&&(Fe(false),O(""));},onBlur:ft,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(L||S.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),S.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:S.length})]}),jsxRuntime.jsx(rr,{cardId:De.id,attachments:S,onUpload:L?M=>L(De.id,M):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[g&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:g.color},children:g.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:V,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:B,onChange:M=>$(M.target.value),onKeyDown:jt,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:ht,disabled:!B.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[oe.map(M=>{let _=s.find(_e=>_e.id===M.userId);if(M.type.includes("COMMENT")){let _e=n.find(X=>X.id===M.metadata?.commentId);return _e?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.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:_e.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:_?.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)}),oe.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 Ku({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 As({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((c,m)=>c+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ku,{})}),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((n,c)=>n+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,c)=>n+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,c)=>n+(c.planned||0),0)})]})]})]})}function ag({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 Fs({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,l=n<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ag,{})}),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:l?"#10B981":"#EF4444",fill:l?"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:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#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:m>=50?"#10B981":"#F59E0B"},children:[m.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:l?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var pg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},kd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function mg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,c=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function wd({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 Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,l)=>m+l.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||pg[m.name]||kd[e.indexOf(m)%kd.length]})),c=n.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?mg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,l)=>jsxRuntime.jsx(recharts.Cell,{fill:c[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,l)=>{let g=l.payload,d=s>0?(g.value/s*100).toFixed(0):"0";return `${m} (${g.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,l)=>jsxRuntime.jsx(recharts.Cell,{fill:c[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,l)=>l.value>m.value?l:m).name})]})]})]})}var pn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,c]=react.useState(false),[m,l]=react.useState(false),[g,d]=react.useState(false),[i,h]=react.useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),p=x=>{r.onBulkUpdate?.(b,{priority:x}),c(false);},v=x=>{r.onBulkMove?.(b,x),l(false),a();},w=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},u=x=>{let D=new Set;e.forEach(L=>{L.labels?.forEach(k=>D.add(k));});let S=Array.from(new Set([...D,...x]));r.onBulkUpdate?.(b,{labels:S}),h(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>p(x),children:[jsxRuntime.jsx("span",{className:y("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!g),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>u([x]),children:x},x))})]}),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"})})]})]})})});pn.displayName="BulkOperationsToolbar";function bg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,c,m,l;switch(t){case "assignee":let g=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);g.length>0?g.forEach(h=>{let b=a?.find(p=>p.id===h);n=`assignee-${h}`,c=b?.name||`User ${h}`,m=b?.color,l=b?.avatar,r.has(n)||r.set(n,{id:n,title:c,groupValue:h,cardIds:[],color:m,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",c="Unassigned",m="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:m,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,m=i.color,r.has(n)||r.set(n,{id:n,title:c,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,c=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",c="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ls({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),c=react.useMemo(()=>bg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(l=>{n(g=>{let d=new Set(g);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(vr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:y("asakaa-swimlane-view",o),children:[c.map(l=>{let g=s.has(l.id),d=e.cards.filter(h=>l.cardIds.includes(h.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":g?"Expand lane":"Collapse lane",children:g?"\u25B6":"\u25BC"})]}),!g&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(vr,{board:i,callbacks:r,availableUsers:a})})]},l.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Bs=[{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 Rs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),c=Bs.find(l=>l.value===e)||Bs[0];react.useEffect(()=>{function l(g){s.current&&!s.current.contains(g.target)&&n.current&&!n.current.contains(g.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let m=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:y("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:y("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Bs.map(l=>jsxRuntime.jsxs("button",{onClick:()=>m(l.value),className:y("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.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:l.label}),e===l.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:l.description})]})]},l.value))})]})]})}var Eo=[{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 xg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&c&&m}function Sd(e={}){let{shortcuts:t=Eo,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(l=>l.action!==m);},[]);return react.useEffect(()=>{function m(l){if(!s.current)return;let g=l.target;if(!((g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(xg(l,d)){r&&l.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:c,isEnabled:a}}function wg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Cg(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 Tg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Cg(e),r=t?wg(t):"";return a?`${a} + ${r}`:r}function Ng(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 Os({shortcuts:e=Eo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let n=Ng(e);return jsxRuntime.jsxs("div",{className:y("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(n).map(([c,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(l=>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:l.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:Tg(l)})]},l.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var zs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
71
+ `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=C=>{C.stopPropagation();let p=r<a.length-1?r+1:0;l(),o(p);},n.appendChild(d),n.appendChild(i),n.appendChild(h);}n.appendChild(c),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Pu(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 Mu(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 Ns(e){return e.startsWith("image/")}function rr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,c]=react.useState(false),[m,l]=react.useState(false),[u,d]=react.useState(null),i=react.useRef(null),h=react.useRef(e);h.current=e;let C=react.useCallback((w,z)=>{z.preventDefault(),z.stopPropagation();let P=h.current.filter(R=>Ns(R.type)),T=P.findIndex(R=>R.id===w.id),G=R=>{let Y=h.current.filter(ve=>Ns(ve.type)),te=Y[R];te&&ud(te.url,te.name,Y,R,G);};ud(w.url,w.name,P,T,G);},[]),p=react.useCallback(w=>{let z=[],P=[];return e.length+w.length>s?(P.push(`Maximum ${s} files allowed`),{valid:z,errors:P}):(w.forEach(T=>{if(T.size/1048576>r){P.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>T.type.match(R))){P.push(`${T.name} has invalid file type`);return}z.push(T);}),{valid:z,errors:P})},[e.length,s,r,o]),y=react.useCallback(async w=>{let{valid:z,errors:P}=p(w);if(P.length>0){d(P.join(", ")),setTimeout(()=>d(null),5e3);return}if(z.length!==0){l(true),d(null);try{await t?.(z);}catch(T){d(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[p,t]),f=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),c(true);},[]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),c(false);},[]),g=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),k=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),c(false);let z=Array.from(w.dataTransfer.files);y(z);},[y]),x=react.useCallback(w=>{let z=w.target.files?Array.from(w.target.files):[];y(z),i.current&&(i.current.value="");},[y]),D=react.useCallback(()=>{i.current?.click();},[]),B=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:f,onDragLeave:v,onDragOver:g,onDrop:k,onClick:D,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:x,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&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:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ns(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:z=>C(w,z),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Mu(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Pu(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>B(w.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"})})})]},w.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],aiInsights:m=[],attachments:l=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:p,onEstimateEffort:y,currentUserId:f="user-1"}){let[v,g]=react.useState("details"),[k,x]=react.useState(false),[D,B]=react.useState({}),[w,z]=react.useState(""),[P,T]=react.useState(false),[G,R]=react.useState({});if(!t||!e)return null;let Y=react.useCallback(()=>{x(false),B({}),g("details"),z(""),R({}),a();},[a]),te=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),B({}),x(false));},[e.id,D,r]),ve=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Y());},[e.id,o,Y]),Ie=react.useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),z(""));},[e.id,w,u]),Ue=react.useCallback(async()=>{if(C){T(true);try{let F=await C(e);R(q=>({...q,assignees:F}));}catch(F){console.error("Failed to suggest assignee:",F);}finally{T(false);}}},[e,C]),le=react.useCallback(async()=>{if(p){T(true);try{let F=await p(e);R(q=>({...q,subtasks:F}));}catch(F){console.error("Failed to generate subtasks:",F);}finally{T(false);}}},[e,p]),O=react.useCallback(async()=>{if(y){T(true);try{let F=await y(e);R(q=>({...q,effort:F}));}catch(F){console.error("Failed to estimate effort:",F);}finally{T(false);}}},[e,y]),L={...e,...D},H=s.filter(F=>L.assignedUserIds?.includes(F.id));return jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:Y,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:D.title??L.title,onChange:F=>B({...D,title:F.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{x(false),B({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>x(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:ve,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:Y,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 ${v==="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 ${v==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${v==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${v==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${v==="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:[v==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),k?jsxRuntime.jsx("textarea",{value:D.description??L.description??"",onChange:F=>B({...D,description:F.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??L.assignedUserIds??[],onChange:F=>{let q=Array.from(F.target.selectedOptions,J=>J.value);B({...D,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(F=>jsxRuntime.jsx("option",{value:F.id,children:F.name},F.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:H.length>0?H.map(F=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:F.color},children:F.initials}),jsxRuntime.jsx("span",{children:F.name})]},F.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxRuntime.jsxs("select",{value:D.priority??L.priority??"",onChange:F=>B({...D,priority:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:L.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(F=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:F},F)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:F=>B({...D,startDate:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:F=>B({...D,endDate:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??L.estimatedTime??"",onChange:F=>B({...D,estimatedTime:F.target.value?parseFloat(F.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:L.dependencies&&L.dependencies.length>0?L.dependencies.map(F=>{let q=typeof F=="string"?F:F.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:F=>z(F.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Ie,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(F=>{let q=s.find(J=>J.id===F.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(F.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(F.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:F.content})]},F.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"})]})})]}),v==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(F=>{let q=s.find(J=>J.id===F.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[F.type.includes("CREATED")&&"\u2795",F.type.includes("UPDATED")&&"\u270F\uFE0F",F.type.includes("MOVED")&&"\u27A1\uFE0F",F.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",F.type.includes("COMMENT")&&"\u{1F4AC}",F.type.includes("ASSIGNED")&&"\u{1F464}",F.type.includes("PRIORITY")&&"\u{1F3AF}",F.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",F.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:q?.name||"Unknown"})," ",F.type.replace(/_/g," ").toLowerCase(),F.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:F.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(F.timestamp).toLocaleString()})]})]},F.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"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(rr,{cardId:e.id,attachments:l,onUpload:i?F=>i(e.id,F):void 0,onDelete:h,currentUserId:f,maxSizeMB:10,maxFiles:20})}),v==="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:Ue,disabled:P||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:le,disabled:P||!p,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:O,disabled:P||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),G.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((F,q)=>{let J=s.find(U=>U.id===F.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:F.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(F.confidence*100).toFixed(0),"%"]})]})]},q)})]}),G.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((F,q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:F.title}),F.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:F.description}),F.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",F.estimatedTime,"h"]})]},q))]}),G.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:[G.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(F=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${F.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:F.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:F.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:F.description}),F.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",F.suggestedAction]})]},F.id))]}),!G.assignees&&!G.subtasks&&!G.effort&&m.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 So({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[c,m]=react.useState({top:0,left:0}),l=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,h=window.innerWidth,C=4,p=d.left;p+o>h-10&&(p=h-o-10),p<10&&(p=10);let y=i-d.bottom,f=d.top,v;return y>=s+C?v=d.bottom+C:f>=s+C?v=d.top-s-C:y>=f?v=d.bottom+C:v=Math.max(10,d.top-s-C),{top:v,left:p}},[e,o,s]);return react.useEffect(()=>{t&&m(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;l.current&&!l.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var qe={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:"#D21E24",todayLight:"rgba(210, 30, 36, 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:"#D21E24",todayLight:"rgba(210, 30, 36, 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"}};var zu=["LOW","MEDIUM","HIGH","URGENT"],Uu=["todo","in-progress","review","done"];function Ps({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],onAddComment:m,onDeleteComment:l,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:h,availableColumns:C=[],availableLabels:p=[],availableTags:y=[],onCreateTag:f,onUploadCoverImage:v,unsplashAccessKey:g,theme:k,onSubtasksChange:x,attachments:D=[],onUploadAttachments:B,onDeleteAttachment:w}){let z=Zr(),P=k||z?.themeName||"dark",[T,G]=react.useState(e),[R,Y]=react.useState(false),[te,ve]=react.useState(e?.subtasks||[]),[Ie,Ue]=react.useState(false),[le,O]=react.useState(""),[L,H]=react.useState(""),[F,q]=react.useState("all"),[J,U]=react.useState(false),[xe,Te]=react.useState(false),[Le,ye]=react.useState(false),[tt,Ee]=react.useState(false),[dt,it]=react.useState(false),[ut,_e]=react.useState(false),$=react.useRef(null),ae=react.useRef(null),ce=react.useRef(null),Ce=react.useRef(null),Pe=react.useRef(null),at=react.useRef(null),mt=react.useRef(null),Be=react.useRef(null),fe=react.useRef(null),Me=react.useRef(null),_t=react.useRef(null),gt=react.useRef(null);react.useEffect(()=>{e&&!T?(G({...e}),ve(e.subtasks||[])):e&&T&&e.id!==T.id&&(G({...e}),ve(e.subtasks||[]));},[e,T]),react.useEffect(()=>{let M=_=>{let pe=_.target;Ce.current&&!Ce.current.contains(pe)&&U(false),Pe.current&&!Pe.current.contains(pe)&&Te(false),at.current&&!at.current.contains(pe)&&ye(false),mt.current&&!mt.current.contains(pe)&&Ee(false);};if(J||xe||Le||tt)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[J,xe,Le,tt]),react.useEffect(()=>{if(!t)return;let M=_=>{let pe=_.target,Ye=pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable;if(_.key==="Escape"){_.preventDefault(),J||xe||Le||tt||dt||ut?(U(false),Te(false),ye(false),Ee(false),it(false),_e(false)):Ye||a();return}if(Ye&&_.key!=="Escape")return;let X=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),U(true);break;case "a":_.preventDefault(),ye(true);break;case "p":_.preventDefault(),Te(true);break;case "l":_.preventDefault(),Ee(true);break;case "d":X||(_.preventDefault(),it(true),setTimeout(()=>Be.current?.focus(),0));break;case "e":X||(_.preventDefault(),_e(true));break;case "i":_.preventDefault(),Y(true),setTimeout(()=>ae.current?.focus(),0);break;case "t":_.preventDefault(),Ue(true);break;case "c":_.preventDefault(),ce.current?.focus();break}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,a,J,xe,Le,tt,dt,ut]);let aa=react.useCallback(M=>{let _=M.currentTarget.textContent?.trim()||"";if(T&&_!==T.title){let pe={...T,title:_};G(pe),r?.(T.id,{title:_});}},[T,r]),ia=react.useCallback(M=>{M.key==="Enter"&&(M.preventDefault(),M.currentTarget.blur()),M.key==="Escape"&&(M.preventDefault(),M.currentTarget.textContent=T?.title||"",M.currentTarget.blur());},[T]),E=react.useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),Y(false);},[T,e,r]),ee=react.useCallback(M=>{if(T){let _={...T,columnId:M};G(_),r?.(T.id,{columnId:M}),U(false);}},[T,r]),$e=react.useCallback(M=>{if(T){let _={...T,priority:M};G(_),r?.(T.id,{priority:M}),Te(false);}},[T,r]),re=react.useCallback(M=>{if(T){let _=T.assignedUserIds||[],pe=_.includes(M)?_.filter(X=>X!==M):[..._,M],Ye={...T,assignedUserIds:pe};G(Ye),r?.(T.id,{assignedUserIds:pe});}},[T,r]),De=react.useCallback(M=>{if(T){let _=T.labels||[],pe=_.includes(M)?_.filter(X=>X!==M):[..._,M],Ye={...T,labels:pe};G(Ye),r?.(T.id,{labels:pe});}},[T,r]),we=react.useCallback(M=>{if(T){let _={...T,tags:M};G(_),r?.(T.id,{tags:M});}},[T,r]),Se=react.useCallback(M=>{if(T){let _=M.target.value,pe={...T,endDate:_};G(pe),r?.(T.id,{endDate:_}),it(false);}},[T,r]),Oe=react.useCallback(M=>{if(T){let _={...T,estimatedTime:parseFloat(M)||0};G(_),r?.(T.id,{estimatedTime:parseFloat(M)||0});}},[T,r]),Ve=react.useCallback(()=>{if(le.trim()&&T){let M={id:`subtask-${Date.now()}`,title:le.trim(),completed:false,createdAt:new Date},_=[...te,M];ve(_),O(""),Ue(false),x?.(T.id,_);}},[le,te,T,x]),Re=react.useCallback(M=>{let _=te.map(pe=>pe.id===M?{...pe,completed:!pe.completed,updatedAt:new Date}:pe);ve(_),T&&x?.(T.id,_);},[te,T,x]),Ze=react.useCallback(M=>{let _=te.filter(pe=>pe.id!==M);ve(_),T&&x?.(T.id,_);},[te,T,x]),ht=react.useCallback(()=>{L.trim()&&T&&m&&(m(T.id,L.trim()),H(""));},[L,T,m]),Kt=react.useCallback(M=>{(M.metaKey||M.ctrlKey)&&M.key==="Enter"&&(M.preventDefault(),ht());},[ht]),Z=M=>jsxRuntime.jsx(Bu__default.default,{remarkPlugins:[Ru__default.default],rehypePlugins:[Ou__default.default],components:{a:({node:_,...pe})=>jsxRuntime.jsx("a",{...pe,target:"_blank",rel:"noopener noreferrer"})},children:M}),ne=c.filter(M=>F==="comments"?M.type.includes("COMMENT"):F==="history"?!M.type.includes("COMMENT"):true);if(!t||!e)return null;let Ae=T||e,We=s.filter(M=>Ae.assignedUserIds?.includes(M.id)),N=te.filter(M=>M.completed).length;return jsxRuntime.jsx(ct,{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":P,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:$,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:aa,onKeyDown:ia,children:Ae.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:Ce,children:[jsxRuntime.jsxs("button",{ref:fe,className:"modal-v2-field",onClick:()=>U(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Ae.columnId||"No status"})]}),jsxRuntime.jsx(So,{triggerRef:fe,isOpen:J,onClose:()=>U(false),width:250,estimatedHeight:200,children:(C.length>0?C:Uu.map(M=>({id:M,title:M}))).map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Ae.columnId===M.id?"active":""}`,onClick:()=>ee(M.id),children:M.title},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:at,children:[jsxRuntime.jsxs("button",{ref:Me,className:"modal-v2-field",onClick:()=>ye(!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 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(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(So,{triggerRef:Me,isOpen:Le,onClose:()=>ye(false),width:280,estimatedHeight:300,children:s.map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Ae.assignedUserIds?.includes(M.id)?"active":""}`,onClick:()=>re(M.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:M.color},children:M.initials}),M.name,Ae.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:Pe,children:[jsxRuntime.jsxs("button",{ref:_t,className:"modal-v2-field",onClick:()=>Te(!xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Ae.priority||"None"})]}),jsxRuntime.jsxs(So,{triggerRef:_t,isOpen:xe,onClose:()=>Te(false),width:180,estimatedHeight:220,children:[zu.map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${M.toLowerCase()} ${Ae.priority===M?"active":""}`,onClick:()=>$e(M),children:M},M)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>$e(""),children:"None"})]})]}),y.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Qa,{selectedTags:Ae.tags||[],availableTags:y,onChange:we,onCreateTag:f,theme:qe[P]||qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:mt,children:[jsxRuntime.jsxs("button",{ref:gt,className:"modal-v2-field",onClick:()=>Ee(!tt),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:Ae.labels&&Ae.labels.length>0?jsxRuntime.jsx("span",{children:Ae.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(So,{triggerRef:gt,isOpen:tt,onClose:()=>Ee(false),width:220,estimatedHeight:200,children:(p.length>0?p:["Bug","Feature","Enhancement","Documentation"]).map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Ae.labels?.includes(M)?"active":""}`,onClick:()=>De(M),children:[M,Ae.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:()=>{it(!dt),setTimeout(()=>Be.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:Ae.endDate?new Date(Ae.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Be,type:"date",value:typeof Ae.endDate=="string"?Ae.endDate.split("T")[0]:Ae.endDate?(()=>{let M=new Date(Ae.endDate),_=M.getUTCFullYear(),pe=String(M.getUTCMonth()+1).padStart(2,"0"),Ye=String(M.getUTCDate()).padStart(2,"0");return `${_}-${pe}-${Ye}`})():"",onChange:Se,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>_e(!ut),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:Ae.estimatedTime?`${Ae.estimatedTime}h`:"Not set"})]}),ut&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Ae.estimatedTime||"",onChange:M=>Oe(M.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>_e(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),R?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Ae.description||"",onChange:M=>{if(T){let _={...T,description:M.target.value};G(_);}},onBlur:E,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>Y(true),children:Ae.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Z(Ae.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"}),te.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[N,"/",te.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ue(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:[te.map(M=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${M.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Re(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:()=>Ze(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)),Ie&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:le,onChange:M=>O(M.target.value),onKeyDown:M=>{M.key==="Enter"&&Ve(),M.key==="Escape"&&(Ue(false),O(""));},onBlur:Ve,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(B||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(rr,{cardId:Ae.id,attachments:D,onUpload:B?M=>B(Ae.id,M):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ce,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:M=>H(M.target.value),onKeyDown:Kt,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:ht,disabled:!L.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ne.map(M=>{let _=s.find(Ye=>Ye.id===M.userId);if(M.type.includes("COMMENT")){let Ye=n.find(X=>X.id===M.metadata?.commentId);return Ye?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.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:Ye.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:_?.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)}),ne.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 Yu({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 As({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((c,m)=>c+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Yu,{})}),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((n,c)=>n+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,c)=>n+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,c)=>n+(c.planned||0),0)})]})]})]})}function rg({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 Fs({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,l=n<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(rg,{})}),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:l?"#10B981":"#EF4444",fill:l?"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:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#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:m>=50?"#10B981":"#F59E0B"},children:[m.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:l?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var mg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},wd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ug({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,c=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Cd({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 Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,l)=>m+l.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||mg[m.name]||wd[e.indexOf(m)%wd.length]})),c=n.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?ug:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,l)=>jsxRuntime.jsx(recharts.Cell,{fill:c[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,l)=>{let u=l.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,l)=>jsxRuntime.jsx(recharts.Cell,{fill:c[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,l)=>l.value>m.value?l:m).name})]})]})]})}var pn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,c]=react.useState(false),[m,l]=react.useState(false),[u,d]=react.useState(false),[i,h]=react.useState(false);if(e.length===0)return null;let C=e.map(k=>k.id),p=k=>{r.onBulkUpdate?.(C,{priority:k}),c(false);},y=k=>{r.onBulkMove?.(C,k),l(false),a();},f=k=>{r.onBulkUpdate?.(C,{assignedUserIds:k}),d(false);},v=k=>{let x=new Set;e.forEach(B=>{B.labels?.forEach(w=>x.add(w));});let D=Array.from(new Set([...x,...k]));r.onBulkUpdate?.(C,{labels:D}),h(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>p(k),children:[jsxRuntime.jsx("span",{className:b("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});pn.displayName="BulkOperationsToolbar";function yg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,c,m,l;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(p=>p.id===h);n=`assignee-${h}`,c=C?.name||`User ${h}`,m=C?.color,l=C?.avatar,r.has(n)||r.set(n,{id:n,title:c,groupValue:h,cardIds:[],color:m,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",c="Unassigned",m="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:m,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,m=i.color,r.has(n)||r.set(n,{id:n,title:c,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,c=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",c="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ls({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),c=react.useMemo(()=>yg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(l=>{n(u=>{let d=new Set(u);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(vr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:b("asakaa-swimlane-view",o),children:[c.map(l=>{let u=s.has(l.id),d=e.cards.filter(h=>l.cardIds.includes(h.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(vr,{board:i,callbacks:r,availableUsers:a})})]},l.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Bs=[{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 Rs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),c=Bs.find(l=>l.value===e)||Bs[0];react.useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let m=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:b("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:b("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Bs.map(l=>jsxRuntime.jsxs("button",{onClick:()=>m(l.value),className:b("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.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:l.label}),e===l.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:l.description})]})]},l.value))})]})]})}var Eo=[{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 kg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&c&&m}function Ed(e={}){let{shortcuts:t=Eo,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(l=>l.action!==m);},[]);return react.useEffect(()=>{function m(l){if(!s.current)return;let u=l.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(kg(l,d)){r&&l.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:c,isEnabled:a}}function Cg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Tg(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 Ng(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Tg(e),r=t?Cg(t):"";return a?`${a} + ${r}`:r}function Dg(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 Os({shortcuts:e=Eo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let n=Dg(e);return jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([c,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(l=>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:l.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:Ng(l)})]},l.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var zs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
72
72
  1.
73
73
 
74
74
  **Expected behavior:**
@@ -108,19 +108,19 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Us({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function l(g){s.current&&!s.current.contains(g.target)&&n.current&&!n.current.contains(g.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);},m=e.reduce((l,g)=>{let d=g.category||"Other";return l[d]||(l[d]=[]),l[d].push(g),l},{});return jsxRuntime.jsxs("div",{className:y("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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:y("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([l,g])=>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:l})}),jsxRuntime.jsx("div",{children:g.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),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 Ws({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,c]=react.useState("export"),[m,l]=react.useState("json"),[g,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let h=async()=>{let p=o?.current||void 0,v=await xl(e,m,p);kl(v,m);},b=async p=>{let v=p.target.files?.[0];if(v){try{let w=await Tl(v),u=v.name.endsWith(".json")?"json":"csv",f=Cl(w,u);d(f),f.success&&r&&r(f,w);}catch(w){d({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(p=>jsxRuntime.jsxs("button",{onClick:()=>l(p),className:y("p-4 rounded-lg border-2 transition-all text-center",m===p?"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:[p==="json"&&"\u{1F4C4}",p==="csv"&&"\u{1F4CA}",p==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:p})]},p))})]}),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:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),g&&jsxRuntime.jsxs("div",{className:y("p-4 rounded-lg",g.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:y("font-semibold mb-2",g.success?"text-green-400":"text-red-400"),children:g.success?"\u2713 Import Successful":"\u2717 Import Failed"}),g.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",g.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",g.columnsImported]})]}),g.errors&&g.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:g.errors.map((p,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",p]},v))})]})]})]})]})]})}var Mg=["URGENT","HIGH","MEDIUM","LOW"],Ag=[{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"}],Fg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Hs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:c,availableUsers:m=[],availableLabels:l=[],availableColumns:g=[],showQuickFilters:d=true,compact:i=false,groupBy:h="none",onGroupByChange:b}){let[p,v]=react.useState(true),w=react.useCallback(S=>{a({search:S.target.value});},[a]),u=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),f=react.useCallback(S=>{r({by:S.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${p?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!p),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:p?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.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:p?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!p&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:w,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:u,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:S=>{let L=S.target.value;a({priorities:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Mg.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let L=S.target.value;a({assignees:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let L=S.target.value;a({labels:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),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:Ag.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:S=>b(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Gs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:c,onExportGanttCSV:m}){let[l,g]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&g(false);};return l&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[l]);let i=h=>{h(),g(false);};return jsxRuntime.jsxs("div",{className:y("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>g(!l),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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await 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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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 _s={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"}},Vs={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"}},js={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"}},$r={dark:_s,light:Vs,neutral:js},un="dark";var gn=react.createContext(void 0),Hg="asakaa-theme";function Md({children:e,defaultTheme:t=un,storageKey:a=Hg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=$r[r];Object.entries(m.colors).forEach(([g,d])=>{d&&c.style.setProperty(`--theme-${Gg(g)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([g,d])=>{let i=m.colors[g];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:$r};return jsxRuntime.jsx(gn.Provider,{value:n,children:e})}function io(){let e=react.useContext(gn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Gg(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ks({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=io();return e?jsxRuntime.jsxs("div",{className:y("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($r).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:y("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ad(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ve[e]||Ve.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Ve[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ve[e].bgSecondary),bgGrid:r("--theme-bg-card",Ve[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ve[e].bgWeekend),border:r("--theme-border-primary",Ve[e].border),borderLight:r("--theme-border-subtle",Ve[e].borderLight),textPrimary:r("--theme-text-primary",Ve[e].textPrimary),textSecondary:r("--theme-text-secondary",Ve[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ve[e].textTertiary),accent:r("--theme-accent-primary",Ve[e].accent),accentHover:r("--theme-accent-hover",Ve[e].accentHover),accentLight:r("--theme-accent-primary",Ve[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ve[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ve[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ve[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ve[e].dependency),dependencyHover:r("--theme-border-secondary",Ve[e].dependencyHover),criticalPath:r("--theme-error",Ve[e].criticalPath),criticalPathLight:r("--theme-error",Ve[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ve[e].today):e==="neutral"?r("--theme-text-primary",Ve[e].today):r("--theme-error",Ve[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ve[e].todayLight):e==="neutral"?r("--theme-text-primary",Ve[e].todayLight):r("--theme-error",Ve[e].todayLight),milestone:r("--theme-warning",Ve[e].milestone),milestoneLight:r("--theme-warning",Ve[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ve[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ve[e].statusInProgress),statusCompleted:r("--theme-success",Ve[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ve[e].hoverBg),focusRing:r("--theme-accent-primary",Ve[e].focusRing)}}var fn={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"}},Fd={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"}},Ys={en:fn,es:Fd};function Id(e){return Ys[e]||Ys.en}function qs(e,t){let a=Id(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 co=react.createContext(fn);function Po(){return react.useContext(co)}function sf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[c,m]=react.useState(false),[l,g]=react.useState(null),d=react.useRef(null),i=Po();if(react.useEffect(()=>{let v=w=>{d.current&&!d.current.contains(w.target)&&m(false);};return c&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]),!(t||a||r||o||s||n))return null;let b=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(v=>v.handler),p=async(v,w)=>{if(w){g(v);try{await w();}catch(u){console.error(`Export ${v} failed:`,u);}finally{g(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:b.map((v,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(v.id,v.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<b.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:l===v.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):v.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:v.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:v.description})]})]},v.id))})})})]})}function lf({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function df({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function cf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Po();react.useEffect(()=>{let l=g=>{s.current&&!s.current.contains(g.target)&&o(false);};return r&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=c.find(l=>l.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((l,g)=>{let d=t===l.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(l.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:g<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:l.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},l.value)})})})})]})}function hn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:c,onRowDensityChange:m,showThemeSelector:l=false,showCreateTaskButton:g=false,createTaskLabel:d,onCreateTask:i,onExportPNG:h,onExportPDF:b,onExportExcel:p,onExportCSV:v,onExportJSON:w,onExportMSProject:u}){let f=Po(),x=h||b||p||v||w||u,D=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],S=[{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(df,{options:D,value:t,onChange:L=>a(L),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(cf,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||f.toolbar.createTask})]}),(x||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(sf,{theme:e,onExportPNG:h,onExportPDF:b,onExportExcel:p,onExportCSV:v,onExportJSON:w,onExportMSProject:u}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),l&&jsxRuntime.jsx(lf,{options:S,value:s,onChange:L=>n(L),theme:e})]})]})}function bn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let g=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]);let l=e.filter(g=>g.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let g=m.current.getBoundingClientRect();n({x:g.left,y:g.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(dt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(g=>jsxRuntime.jsxs("button",{onClick:()=>{t(g.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:g.label}),g.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},g.id))]})})})})]})}function po({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let g=200,d=r.length*36+8,i=8,h=window.innerWidth,b=window.innerHeight,p=t,v=a;t+g+i>h&&(p=t-g,p<i&&(p=i)),a+d+i>b&&(v=b-d-i,v<i&&(v=i)),m({x:p,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let g=i=>{n.current&&!n.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",g),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=g=>g.startsWith("#")&&(g.length===7||g.length===4)?g:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(g=>jsxRuntime.jsxs("div",{children:[g.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{g.disabled||(g.onClick(),o());},disabled:g.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:g.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:g.disabled?"not-allowed":"pointer",opacity:g.disabled?.5:1},onMouseEnter:d=>{g.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[g.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:g.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:g.label}),g.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},g.id))})})})}var It={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function jd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:c,onTaskOutdent:m,onTaskRename:l,onTaskToggleExpand:g,onOpenTaskModal:d,enableKeyboard:i=true}){let h=react.useRef(false),b=react.useCallback(f=>{h.current=f;},[]),p=react.useCallback(f=>{let x=[],D=S=>{for(let L of S)x.push(L),L.subtasks&&L.subtasks.length>0&&L.isExpanded&&D(L.subtasks);};return D(f),x},[]),v=react.useCallback(()=>{let f=p(e);for(let x of f)if(t.has(x.id))return x;return null},[e,t,p]),w=react.useCallback((f,x)=>{let D=p(e);if(D.length===0)return;let S=v();if(!S){a(D[0].id,false);return}let L=D.findIndex(P=>P.id===S.id);if(L===-1)return;let k=f==="up"?L-1:L+1;if(k<0||k>=D.length)return;let U=D[k];a(U.id,x);},[e,v,p,a]),u=react.useCallback(f=>{if(!i)return;let x=f.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){f.key==="Escape"&&(x.blur(),h.current=false);return}let L=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,k=Array.from(t),U=v();if(f.key==="ArrowUp"){f.preventDefault(),w("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),w("down",f.shiftKey);return}if(U&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){U.subtasks&&U.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!U.isExpanded||f.key==="ArrowLeft"&&U.isExpanded)&&g(U.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){k.length>0&&(f.preventDefault(),n(k,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){k.length>0&&(f.preventDefault(),c(k));return}if(f.key==="Tab"&&f.shiftKey){k.length>0&&(f.preventDefault(),m(k));return}if(f.key==="Enter"&&!f.shiftKey&&!L){U&&(f.preventDefault(),r(U.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!L){U&&(f.preventDefault(),r(U.id,"above"));return}if(f.key==="Enter"&&L){U&&(f.preventDefault(),d(U.id));return}if(f.key==="F2"){U&&(f.preventDefault(),l(U.id));return}if(f.key==="Delete"||f.key==="Backspace"&&L){k.length>0&&(f.preventDefault(),o(k));return}if(f.key==="d"&&L&&!f.shiftKey){k.length>0&&(f.preventDefault(),s(k));return}},[i,t,v,w,r,o,s,n,c,m,l,g,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[i,u]),{setIsEditing:b}}function Yd(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(i=>{let h=new Set(i);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,i)=>{if(!a){o(d);return}let h=i.indexOf(a),b=i.indexOf(d);if(h===-1||b===-1){o(d);return}let p=Math.min(h,b),v=Math.max(h,b),w=i.slice(p,v+1);t(new Set(w)),r(d);},[a,o]),c=react.useCallback((d,i,h,b)=>{b?n(d,i):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,i)=>{i?t(h=>{let b=new Set(h);return b.add(d),b}):o(d);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),g=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:l,isTaskSelected:g}}function mo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let c={...r[n],parentId:o,level:s,position:n};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function qd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=qd(a.subtasks,t);if(r)return r}}return null}function Zs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Zs(a.subtasks,t);if(r)return r}return null}function Qs(e,t){if(t.length===0)return e;let a=mo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,i)=>{let h=[];return {tasks:d.filter(p=>{if(i.has(p.id))return h.push(p),false;if(p.subtasks){let v=n(p.subtasks,i);p.subtasks=v.tasks,h.push(...v.removed);}return true}),removed:h}},c=(d,i,h)=>d.map(b=>b.id===i?{...b,subtasks:[...b.subtasks||[],...h],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,i,h)}:b),m=new Set(t),{tasks:l,removed:g}=n(e,m);return c(l,s.id,g)}function ei(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Zs(a,r);if(!o)continue;let s=Zs(a,o.id),n=(l,g,d)=>{for(let i=0;i<l.length;i++){let h=l[i];if(h.id===g&&h.subtasks){let b=h.subtasks.findIndex(p=>p.id===d);if(b!==-1){let[p]=h.subtasks.splice(b,1);return p}}if(h.subtasks){let b=n(h.subtasks,g,d);if(b)return b}}return null},c=(l,g,d)=>{let i=l.findIndex(h=>h.id===g);if(i!==-1)return l.splice(i+1,0,d),l;for(let h of l)h.subtasks&&c(h.subtasks,g,d);return l},m=n(a,o.id,r);m&&(s&&s.subtasks?c(s.subtasks,o.id,m):c(a,o.id,m));}return a}function ti(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,c,m)=>{let l=n.findIndex(d=>d.id===c);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,c,m))return true;return false}let g=m==="up"?l-1:l+1;return g<0||g>=n.length?false:([n[l],n[g]]=[n[g],n[l]],true)};return s(r,o,a),r}function ai(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ri(e,t){let a=[...e];for(let r of t){let o=n=>{let c=n.findIndex(g=>g.id===r);if(c===-1){for(let g of n)if(g.subtasks&&o(g.subtasks))return true;return false}let m=n[c],l={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(c+1,0,l),true},s=n=>n.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Xd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=m=>{let l=m.findIndex(d=>d.id===t);if(l===-1){for(let d of m)if(d.subtasks&&c(d.subtasks))return true;return false}let g=a==="above"?l:l+1;return m.splice(g,0,n),true};return c(r),{tasks:r,newTask:n}}function oi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:oi(r.subtasks,t,a)}:r)}function ni(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ni(a.subtasks,t)}:a)}function si(e,t){let a=g=>{for(let d of g){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,c=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(c),color:r?.color||"#3B82F6"},l=g=>g.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,m],isExpanded:true}}return d.subtasks?{...d,subtasks:l(d.subtasks)}:d});return {tasks:l(e),newTask:m}}function Jd(e,t,a,r){if(t===a)return e;let o=qd(e,t);if(!o)return e;if(a){let c=(m,l)=>{if(!m.subtasks)return false;for(let g of m.subtasks)if(g.id===l||c(g,l))return true;return false};if(c(o,a))return e}let s=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let c=r!==void 0?r:n.length;n.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(l=>{if(l.id===a){let g=l.subtasks||[],d=r!==void 0?r:g.length,i=[...g];return i.splice(d,0,{...o,parentId:a}),{...l,subtasks:i,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:c(l.subtasks)}:l});n=c(n);}return n}function xn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:c,onTaskToggle:m,scrollTop:l,columns:g,onToggleColumn:d,onColumnResize:i,onTaskUpdate:h,onTaskIndent:b,onTaskOutdent:p,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:u,onTaskCreate:f,onTaskRename:x,onCreateSubtask:D,onOpenTaskModal:S,onDeleteRequest:L,onTaskReparent:k}){let U=react.useContext(co),[P,C]=react.useState(null),[H,R]=react.useState(null),[J,re]=react.useState(""),Ce=react.useRef(null),[Se,Fe]=react.useState(null),[se,O]=react.useState(0),[B,$]=react.useState(0),[F,q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Z,z]=react.useState(null),[ve,we]=react.useState(null),[Me,ge]=react.useState(null),ot=react.useRef(0),Ae=5,pt=react.useRef(false),[mt,gt]=react.useState(null),[Je,W]=react.useState(false),[T,V]=react.useState(null),[te,ue]=react.useState(false),Le=react.useRef(null);react.useEffect(()=>{function Q(oe){Le.current&&!Le.current.contains(oe.target)&&ue(false);}if(te)return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[te]),react.useEffect(()=>{H&&Ce.current&&(Ce.current.focus(),Ce.current.select());},[H]),react.useEffect(()=>{if(!Se)return;let Q=De=>{let Re=De.clientX-se,N=B+Re;i?.(Se,N);},oe=()=>{Fe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",oe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",oe),document.body.style.cursor="",document.body.style.userSelect="";}},[Se,se,B,i]);let{selectedTaskIds:nt,handleTaskClick:Ne,isTaskSelected:de}=Yd(),{setIsEditing:xe}=jd({tasks:e,selectedTaskIds:nt,onTaskSelect:(Q,oe)=>{let Re=mo(e).map(N=>N.id);Ne(Q,Re,oe||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:u||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:p||(()=>{}),onTaskRename:Q=>{let oe=mo(e).find(De=>De.id===Q);oe&&ze(oe);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:Q=>{let oe=mo(e).find(De=>De.id===Q);oe&&S&&S(oe);},enableKeyboard:true}),it=(Q,oe=0)=>{let De=[];for(let Re of Q)De.push({task:Re,level:oe}),Re.subtasks&&Re.subtasks.length>0&&Re.isExpanded&&De.push(...it(Re.subtasks,oe+1));return De},lt=it(e),sa=48,ca=Math.max(lt.length*a,600-sa),He=Q=>!Q.startDate||!Q.endDate?"-":`${Math.ceil((Q.endDate.getTime()-Q.startDate.getTime())/(1e3*60*60*24))}d`,ze=Q=>{R(Q.id),re(Q.name),xe(true);},pa=Q=>{J.trim()&&J!==e.find(oe=>oe.id===Q)?.name&&x?.(Q,J.trim()),R(null),re(""),xe(false);},fe=()=>{R(null),re(""),xe(false);},Ge=(Q,oe)=>{oe.stopPropagation(),D?.(Q.id);},Ee=(Q,oe)=>{oe.preventDefault(),ot.current=oe.clientY,z(Q),pt.current=false,W(false),gt({x:oe.clientX,y:oe.clientY});},Ue=Q=>{if(!Z||(Math.abs(Q.clientY-ot.current)>Ae&&!pt.current&&(pt.current=true,W(true)),gt({x:Q.clientX,y:Q.clientY}),!pt.current))return;let De=document.querySelectorAll("[data-task-row]"),Re=null,N=null;De.forEach(M=>{let _=M.getBoundingClientRect(),ce=M.getAttribute("data-task-row");if(ce&&ce!==Z&&Q.clientY>=_.top&&Q.clientY<=_.bottom){Re=ce;let _e=Q.clientY-_.top,X=_.height;_e<X*.25?N="above":_e>X*.75?N="below":N="child";}}),we(Re),ge(N);},Ye=()=>{if(pt.current&&Z&&ve&&Me){if(Me==="child")k?.(Z,ve);else if(Me==="above"||Me==="below"){let Q=(Re,N,M=null)=>{for(let _ of Re){if(_.id===N)return M;if(_.subtasks){let ce=Q(_.subtasks,N,_.id);if(ce!==void 0)return ce}}},oe=Q(e,ve,null),De=(Re,N)=>{let M=Re.findIndex(_=>_.id===N);return Me==="below"?M+1:M};if(oe===null){let Re=De(e,ve);k?.(Z,null,Re);}else {let Re=lt.find(N=>N.task.id===oe)?.task;if(Re?.subtasks){let N=De(Re.subtasks,ve);k?.(Z,oe,N);}}}}z(null),we(null),ge(null),gt(null),pt.current=false,W(false);};react.useEffect(()=>{if(Z)return document.addEventListener("mousemove",Ue),document.addEventListener("mouseup",Ye),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ue),document.removeEventListener("mouseup",Ye),document.body.style.cursor="",document.body.style.userSelect="";}},[Z,ve,Me]);let ft=(Q,oe,De)=>{switch(Q.id){case "name":let Re=H===oe.id,N=P===oe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${De*20}px`},children:[k&&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:N?1:.3},onMouseDown:ae=>Ee(oe.id,ae),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),oe.subtasks&&oe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),m?.(oe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:oe.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:oe.color||"#3B82F6",opacity:oe.parentId?.6:1,borderColor:oe.isMilestone?t.accent:"transparent",borderWidth:oe.isMilestone?"2px":"0px"},title:oe.isMilestone?"Milestone":oe.parentId?"Subtask":"Task"})}),Re?jsxRuntime.jsx("input",{ref:Ce,type:"text",value:J,onChange:ae=>re(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?pa(oe.id):ae.key==="Escape"&&fe();},onBlur:()=>pa(oe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ae=>ae.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:oe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:oe.parentId?"13px":"14px",fontWeight:oe.isMilestone?600:oe.parentId?400:600,letterSpacing:oe.parentId?"0":"-0.01em"},title:oe.name,children:oe.name}),N&&!Re&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ae=>Ge(oe,ae),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),ze(oe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let _=Q.id==="startDate"?"startDate":"endDate",ce=oe[_],_e=T?.taskId===oe.id&&T?.field===_,X=ae=>ae?(typeof ae=="string"?new Date(ae):ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:ae=>{if(_e)V(null);else {let at=ae.currentTarget.getBoundingClientRect();V({taskId:oe.id,field:_,month:ce?typeof ce=="string"?new Date(ce):ce:new Date,position:{top:at.bottom+4,left:at.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:X(ce)})]}),_e&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>V(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:T?.position.top,left:T?.position.left},onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ae=new Date,at=new Date(ae);at.setDate(ae.getDate()+1);let Qe=new Date(ae);Qe.setDate(ae.getDate()+7);let Be=new Date(ae);return Be.setDate(ae.getDate()+14),[{label:"Hoy",date:ae},{label:"Ma\xF1ana",date:at},{label:"Pr\xF3xima semana",date:Qe},{label:"2 semanas",date:Be}].map((Et,ia)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Er=>Er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Er=>Er.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(oe.id,{[_]:Et.date}),V(null);},children:Et.label},ia))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(oe.id,{[_]:void 0}),V(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>V(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:T?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>V(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ae,at)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ae},at))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=T?.month||new Date,at=ae.getFullYear(),Qe=ae.getMonth(),Be=new Date(at,Qe,1).getDay(),St=new Date(at,Qe+1,0).getDate(),Et=new Date,ia=[];for(let _t=Be-1;_t>=0;_t--)ia.push({day:new Date(at,Qe,-_t).getDate(),date:new Date(at,Qe-1,new Date(at,Qe,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=St;_t++)ia.push({day:_t,date:new Date(at,Qe,_t),isCurrentMonth:true});let Er=42-ia.length;for(let _t=1;_t<=Er;_t++)ia.push({day:_t,date:new Date(at,Qe+1,_t),isCurrentMonth:false});return ia.map((_t,bo)=>{let Kn=_t.date.toDateString()===Et.toDateString(),yo=(ce?typeof ce=="string"?new Date(ce):ce:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?yo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:yo?"#3B82F6":"transparent",boxShadow:Kn&&!yo?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(oe.id,{[_]:_t.date}),V(null);},children:_t.day},bo)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:He(oe)})});case "assignees":let Ie=r.filter(ae=>oe.assignees?.some(at=>at.name===ae.name||at.initials===ae.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(Lr,{assignedUsers:Ie,availableUsers:r,onChange:ae=>{let at=ae.map(Qe=>({id:Qe.id,name:Qe.name,initials:Qe.initials,color:Qe.color}));h?.(oe.id,{assignees:at.length>0?at:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(Gl,{status:oe.status||"todo",onChange:ae=>{h?.(oe.id,{status:ae,progress:ae==="completed"?100:oe.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:`${oe.progress}%`,backgroundColor:oe.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:[oe.progress,"%"]})]});case "priority":let Nt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Pe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ta=Nt[oe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(Fr,{priority:ta,onChange:ae=>{ae&&h?.(oe.id,{priority:Pe[ae]||"medium"});}})});default:return null}},Ze=Q=>[{id:"hide",label:"Hide Column",icon:It.Hide,onClick:()=>d(Q),disabled:Q==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:It.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:It.SortDesc,onClick:()=>{}}],tt=Q=>Q.subtasks&&Q.subtasks.length>0?[{id:"addSubtask",label:U?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{D?.(Q.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:U?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{L?L(Q.id,Q.name):w?.([Q.id]);}}]:[{id:"edit",label:U?.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{n?.(Q);}},{id:"addSubtask",label:U?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{D?.(Q.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:U?.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{h?.(Q.id,{status:"todo",progress:0});},disabled:Q.status==="todo"},{id:"setInProgress",label:U?.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{h?.(Q.id,{status:"in-progress"});},disabled:Q.status==="in-progress"},{id:"markComplete",label:U?.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{h?.(Q.id,{status:"completed",progress:100});},disabled:Q.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:U?.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:U?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{L?L(Q.id,Q.name):w?.([Q.id]);}}],ht=g.filter(Q=>Q.visible),jt=ht.reduce((Q,oe)=>Q+oe.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:jt},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:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:ht.map((Q,oe)=>{let De=oe===ht.length-1,Re=Q.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Re?"":"justify-center"}`,style:{width:`${Q.width}px`,minWidth:`${Q.minWidth??(Re?200:60)}px`,maxWidth:`${Q.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:De?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:N=>{N.preventDefault(),q({isOpen:true,x:N.clientX,y:N.clientY,type:"header",columnId:Q.id});},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:Q.label,children:Q.label}),Q.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Se===Q.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:N=>{N.preventDefault(),N.stopPropagation(),Fe(Q.id),O(N.clientX),$(Q.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"}})})]},Q.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(bn,{columns:g,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>ue(!te),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),te&&jsxRuntime.jsxs("div",{ref:Le,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:Q=>Q.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:()=>ue(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ca},children:lt.map(({task:Q,level:oe},De)=>{let Re=de(Q.id),N=ve===Q.id,M=N&&Me==="above",_=N&&Me==="below",ce=N&&Me==="child",_e={};return ce&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":Q.id,className:`flex items-center cursor-pointer group ${Z===Q.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Re?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Re?t.accentLight:ce?`${t.accent}15`:De%2===0?t.bgPrimary:t.bgGrid,..._e},onMouseEnter:()=>C(Q.id),onMouseLeave:()=>C(null),onClick:X=>{let Nt=mo(e).map(ae=>ae.id),ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;Ne(Q.id,Nt,ta,X.shiftKey),s?.(Q);},onDoubleClick:X=>{X.stopPropagation(),n?.(Q);},onContextMenu:X=>{X.preventDefault(),q({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:Q}),c?.(Q,X);},whileHover:{backgroundColor:Re?t.accentLight:t.hoverBg},children:[M&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),_&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ht.map((X,Ie)=>{let Nt=Ie===ht.length-1,Pe=X.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Pe?"justify-start":"justify-center"}`,style:{width:`${X.width}px`,minWidth:`${X.minWidth??(Pe?200:60)}px`,maxWidth:`${X.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Nt?"none":`1px solid ${P===Q.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ft(X,Q,Pe?oe:0)},`${Q.id}-${X.id}`)})]},Q.id)})}),jsxRuntime.jsx(po,{isOpen:F.isOpen,x:F.x,y:F.y,items:F.type==="header"&&F.columnId?Ze(F.columnId):F.type==="task"&&F.task?tt(F.task):[],onClose:()=>q({...F,isOpen:false}),theme:t}),Je&&mt&&Z&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:mt.x+12,top:mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Q=lt.find(oe=>oe.task.id===Z)?.task;return Q?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:Q.name})}):null})()}),document.body)]})}function ac(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,c]=react.useState(e),[m,l]=react.useState(t),[g,d]=react.useState(null),[i,h]=react.useState(null),[b,p]=react.useState(null),[v,w]=react.useState(null),[u,f]=react.useState(0),[x,D]=react.useState(0),[S,L]=react.useState(null),[k,U]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:c,ghostWidth:m,setGhostWidth:l,connectionLine:g,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:h,activeZone:b,setActiveZone:p,draggedSegmentIndex:v,setDraggedSegmentIndex:w,draggedSegmentStartX:u,setDraggedSegmentStartX:f,segmentDragOffsetX:x,setSegmentDragOffsetX:D,hoveredSegmentIndex:S,setHoveredSegmentIndex:L,isHovered:k,setIsHovered:U,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,re)=>{r("none"),d(null),h(null),c(J),l(re),D(0),w(null),f(0);}}}function kn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:c,onClick:m,onDoubleClick:l,onContextMenu:g,onDateChange:d,onDependencyCreate:i,allTaskPositions:h=[],onDragMove:b,onHoverChange:p}){let v=ac(t,r),w=react.useRef(null),{dragMode:u,setDragMode:f,dragOffset:x,setDragOffset:D,ghostX:S,setGhostX:L,ghostWidth:k,setGhostWidth:U,connectionLine:P,setConnectionLine:C,hoveredTaskId:H,setHoveredTaskId:R,activeZone:J,setActiveZone:re,draggedSegmentIndex:Ce,setDraggedSegmentIndex:Se,draggedSegmentStartX:Fe,setDraggedSegmentStartX:se,segmentDragOffsetX:O,setSegmentDragOffsetX:B,hoveredSegmentIndex:$,setHoveredSegmentIndex:F,isHovered:q,setIsHovered:Z,isDragging:z,isResizing:ve,isConnecting:we,resetDragState:Me}=v,ge=32,ot=8,Ae=e.endDate&&e.endDate<new Date&&e.progress<100,pt=e.isCriticalPath,mt=o.name==="neutral"||o.today==="#1C1917",gt=e.status==="completed"||e.progress===100,Je={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},T=e.isCriticalPath||Ae?"#DC2626":e.color?e.color:e.priority&&Je[e.priority]?Je[e.priority]:o.taskBarPrimary,te=(fe=>fe>=80?20:fe>=60?15:fe>=50?12:10)(r),ue=r<50,Le=r<40;react.useEffect(()=>{if(p)if(q&&!z&&!e.segments){let fe=a<100;p({task:e,x:t,y:a,width:r,height:ge,showBelow:fe});}else p(null);},[q,z,e,t,a,r,ge,p]);let nt=fe=>fe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ne=()=>{let fe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${fe} day${fe!==1?"s":""}`},de=fe=>Math.round(fe/s)*s,xe=fe=>{let Ge=Math.round(fe/s),Ee=new Date(n);return Ee.setDate(Ee.getDate()+Ge),Ee},it=(fe,Ge)=>{for(let Ee of h){if(Ee.id===e.id)continue;let Ue=5;if(fe>=Ee.x-Ue&&fe<=Ee.x+Ee.width+Ue&&Ge>=Ee.y-Ue&&Ge<=Ee.y+Ee.height+Ue)return Ee.id}return null},lt=react.useCallback((fe,Ge,Ee)=>{fe.preventDefault(),fe.stopPropagation();let Ue=w.current?.ownerSVGElement;if(!Ue)return;let Ye=Ue.createSVGPoint();Ye.x=fe.clientX,Ye.y=fe.clientY;let ft=Ye.matrixTransform(Ue.getScreenCTM()?.inverse()),Ze=Ee!==void 0?Ee:t,tt=Ge;if(!tt){let ht=ft.x-Ze;fe.shiftKey?(tt="connect",C({x:t+r,y:a+ge/2})):fe.ctrlKey||fe.metaKey?tt="move":fe.altKey?tt=ht<r/2?"resize-start":"resize-end":Le?ht<r/2?tt="move":tt="resize-end":ue?ht<=te/2?tt="resize-start":ht>=r-te/2?tt="resize-end":tt="move":ht<=te?tt="resize-start":ht>=r-te?tt="resize-end":tt="move";}f(tt),Z(false),re(null),tt==="move"?D(ft.x-Ze):tt==="connect"?C({x:t+r,y:a+ge/2}):D(0),L(Ze),U(r);},[t,r,a,ge]),sa=react.useCallback(fe=>{if(u==="none")return;let Ge=w.current?.ownerSVGElement;if(!Ge)return;let Ee=Ge.createSVGPoint();Ee.x=fe.clientX,Ee.y=fe.clientY;let Ue=Ee.matrixTransform(Ge.getScreenCTM()?.inverse());if(u==="connect"){C({x:Ue.x,y:Ue.y});let Ye=it(Ue.x,Ue.y);R(Ye);}else if(u==="move"){let Ye=Ue.x-x,ft=de(Ye);L(ft),U(r);let Ze=Math.round((ft-t)/s);if(b?.(e.id,Ze,true),e.segments&&e.segments.length>0&&Ce!==null){let tt=ft-Fe;B(tt);}}else if(u==="resize-start"){let Ye=Ue.x,ft=de(Ye),Ze=t+r-ft;Ze>=s&&(L(ft),U(Ze));}else if(u==="resize-end"){let Ye=Ue.x,Ze=de(Ye)-t;Ze>=s&&U(Ze);}},[u,t,r,s,x,e,de,Ce,Fe,it,R,C,L,U,B,b]),ca=react.useCallback(()=>{if(u!=="none"){if(u==="connect")H&&i&&i(e,H),C(null),R(null);else {let fe=e.endDate.getTime()-e.startDate.getTime(),Ge,Ee,Ue=true;if(u==="move"){if(Ge=xe(S),Ee=new Date(Ge.getTime()+fe),e.segments&&e.segments.length>0&&Ce!==null){let Ye=Math.round(O/s),ft=e.segments.map((jt,Q)=>{if(Q===Ce){let oe=new Date(jt.startDate),De=new Date(jt.endDate);return oe.setDate(oe.getDate()+Ye),De.setDate(De.getDate()+Ye),{startDate:oe,endDate:De}}return jt}),Ze=ft.flatMap(jt=>[jt.startDate,jt.endDate]),tt=new Date(Math.min(...Ze.map(jt=>jt.getTime()))),ht=new Date(Math.max(...Ze.map(jt=>jt.getTime())));d?.({...e,segments:ft},tt,ht),Me(t,r);return}}else u==="resize-start"?(Ge=xe(S),Ee=e.endDate,Ge>Ee&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ue=false)):u==="resize-end"?(Ge=e.startDate,Ee=xe(S+k),Ee<Ge&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ue=false)):Ue=false;Ue&&Ge&&Ee&&(Ee.getTime()<Ge.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Ge,Ee));}b?.(e.id,0,false),Me(t,r);}},[u,S,k,e,d,H,i,t,r,s,xe,O,Ce,Me,b]);react.useEffect(()=>{if(u==="none")return;let fe=Ee=>{sa(Ee);},Ge=()=>{ca();};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",Ge),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",Ge);}},[u,sa,ca]);let He=z&&!we?S:t,ze=z&&!we?k:r,pa=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:w,onMouseEnter:()=>!z&&Z(true),onMouseLeave:()=>{z||(Z(false),re(null));},onClick:()=>!z&&m?.(e),onDoubleClick:fe=>{z||(fe.stopPropagation(),l?.(e));},onContextMenu:fe=>{fe.preventDefault(),g?.(e,fe);},children:[q&&!z&&!ue&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:te,height:ge,fill:J==="resize-start"?o.accent:"transparent",opacity:J==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:fe=>lt(fe,"resize-start")}),jsxRuntime.jsx("rect",{x:t+te,y:a,width:r-te*2,height:ge,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:fe=>lt(fe,"move")}),jsxRuntime.jsx("rect",{x:t+r-te,y:a,width:te,height:ge,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:fe=>lt(fe,"resize-end")})]}),q&&!z&&Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ge,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:fe=>lt(fe,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ge,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:fe=>lt(fe,"resize-end")}),q&&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"}})]}),z&&!we&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:S,y:a,width:k,height:ge,rx:ot,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:He,y:a,width:ze,height:ge,rx:ot,fill:T,"data-task-class":pa,initial:{opacity:0,scale:.95},animate:{opacity:z&&!we?.15:e.parentId?.6:q?.9:.8,scale:q&&!z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>lt(fe),style:{cursor:z?we?"crosshair":ve?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:He,y:a,width:ze*(e.progress/100),height:ge,rx:ot,fill:T,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((fe,Ge)=>{let Ee=(fe.startDate.getTime()-n.getTime())/864e5*s,Ye=(fe.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ee+s,ft=z&&u==="move"&&Ce===Ge,Ze=$===Ge,tt=ft?Ee+O:Ee;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!z&&F(Ge),onMouseLeave:()=>!z&&F(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:tt,y:a,width:Ye,height:ge,rx:ot,fill:T,initial:{opacity:0,scale:.95},animate:{opacity:ft||e.parentId?.6:Ze?.9:.8,scale:Ze&&!z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ht=>{ht.stopPropagation(),Se(Ge),se(Ee),lt(ht,void 0,Ee);},style:{cursor:z?we?"crosshair":ve?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:tt,y:a,width:Ye*(e.progress/100),height:ge,rx:ot,fill:T,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ge}`)}),mt&&(Ae||pt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[pt&&!Ae&&jsxRuntime.jsx("rect",{x:He,y:a,width:ze,height:ge,rx:ot,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ae&&jsxRuntime.jsx("rect",{x:He,y:a,width:ze,height:ge,rx:ot,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ze>60&&!e.segments&&(()=>{let fe=c.taskLabel(e),Ge=typeof fe=="string"?fe:e.name,Ee=Ge.length>Math.floor(ze/8)?`${Ge.substring(0,Math.floor(ze/8))}...`:Ge;return jsxRuntime.jsx("text",{x:He+12,y:a+ge/2,dominantBaseline:"middle",fill:gt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:gt?"line-through":"none"},children:Ee})})(),ze>100&&e.progress>0&&e.progress<100&&!z&&!e.segments&&jsxRuntime.jsxs("text",{x:He+ze-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&&ze>80&&!z&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:He+ze-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:He+ze-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(q||ve)&&!we&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ue?He-15:He-10,y:a-5,width:ue?25:20,height:ge+10,fill:"transparent",onMouseDown:fe=>lt(fe,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ue?He-8:He-3,y:a+6,width:ue?8:6,height:ue?ge-12:ge-16,rx:3,fill:u==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:u==="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:He+ze-10,y:a-5,width:ue?25:20,height:ge+10,fill:"transparent",onMouseDown:fe=>lt(fe,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ue?He+ze:He+ze-3,y:a+6,width:ue?8:6,height:ue?ge-12:ge-16,rx:3,fill:u==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:u==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&!z&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+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:fe=>{fe.stopPropagation(),lt(fe,"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"})]})}),we&&P&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ge/2,x2:P.x,y2:P.y,stroke:H?o.statusCompleted:o.accent,strokeWidth:H?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:H?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:P.x,cy:P.y,r:H?8:6,fill:H?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),H&&jsxRuntime.jsx(framerMotion.motion.text,{x:P.x+15,y:P.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:P.x+10},animate:{opacity:1,x:P.x+15},transition:{duration:.2},children:"Connect"})]}),(q||z)&&!we&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:He-2,y:a-2,width:ze+4,height:ge+4,rx:ot+2,fill:"none",stroke:z?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:z?.6:.4,initial:{opacity:0},animate:{opacity:z?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:S+k,y1:0,x2:S+k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&!z&&!e.segments&&!p&&(()=>{let Ee=a<100,Ue=Ee?a+ge+13:a-82-13,Ye=Ee?`M ${He+ze/2-6} ${a+ge+3} L ${He+ze/2} ${a+ge+13} L ${He+ze/2+6} ${a+ge+3}`:`M ${He+ze/2-6} ${a-13} L ${He+ze/2} ${a-3} L ${He+ze/2+6} ${a-13}`,ft=Ue+22,Ze=Ue+40,tt=Ue+55,ht=Ue+70,jt=Ee?Ue+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Ee?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ee?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ye,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:He+ze/2-120,y:Ue,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:He+ze/2,y:ft,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:He+ze/2-110,y:Ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:He+ze/2-70,y:Ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt(e.startDate)}),jsxRuntime.jsx("text",{x:He+ze/2-110,y:tt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:He+ze/2-70,y:tt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt(e.endDate)}),jsxRuntime.jsx("text",{x:He+ze/2+10,y:Ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:He+ze/2+65,y:Ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ne()}),jsxRuntime.jsx("text",{x:He+ze/2+10,y:tt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:He+ze/2+65,y:tt,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:He+ze/2-110,y:ht,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:He+ze/2-50,y:ht,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Q=>Q.name).join(", ").substring(0,30),e.assignees.map(Q=>Q.name).join(", ").length>30?"...":""]})]}),!Ee&&jsxRuntime.jsx("text",{x:He+ze/2,y:jt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Le?"Left: move \u2022 Right: resize":ue?"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 nc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:c}=e,m=82,l=13,g=c?o+n+l:o-m-l,d=c?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=g+22,h=g+40,b=g+55,p=g+70,v=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),w=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:g,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?v(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?v(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:w()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Tn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:n}){let[c,m]=react.useState(false),l=a-e,g=r-t,d=e+l/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,h=6,b=Math.atan2(g,l),p=a-h*Math.cos(b-Math.PI/6),v=r-h*Math.sin(b-Math.PI/6),w=a-h*Math.cos(b+Math.PI/6),u=r-h*Math.sin(b+Math.PI/6),f=o.dependency;react.useEffect(()=>{n&&s&&n(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,n]);let x=!s&&!n;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!x&&m(true),onMouseLeave:()=>!x&&m(false),style:{pointerEvents:x?"none":"auto"},children:[!x&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&n?0:c?1:.8,strokeWidth:c?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 ${p} ${v} M ${a} ${r} L ${w} ${u}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&n?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&n?0:c?1.3:1,opacity:c&&n?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Dn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),c=16,m=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var pe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(g=>{g.dependencies&&r.set(g.id,g.dependencies),g.subtasks&&o(g.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,c=new Set,m=l=>{if(!n.has(l)){n.add(l),c.add(l);let g=r.get(l)||[];for(let d of g){if(!n.has(d)&&m(d))return true;if(c.has(d))return true}}return c.delete(l),false};return m(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=pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=pe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
- `)},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=pe.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=pe.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)=>pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=pe.findTaskById(e,t);return !a||!a.dependencies?[]:pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>pe.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=pe.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>pe.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=pe.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(m=>{let l=m.startDate&&m.endDate?pe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?pe.formatDate(m.startDate):"N/A",m.endDate?pe.formatDate(m.endDate):"N/A",l>0?`${l} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=pe.flattenTasks(e).map(m=>{let l=m.startDate&&m.endDate?pe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?pe.formatDate(m.startDate):"","End Date":m.endDate?pe.formatDate(m.endDate):"","Duration (days)":l>0?l:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(g=>g.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=pe.flattenTasks(e),o=new Map;r.forEach((i,h)=>{o.set(i.id,h+1);});let s=i=>i.toISOString().replace("Z",""),n=pe.getEarliestStartDate(e)||new Date,c=pe.getLatestEndDate(e)||new Date,m=r.map((i,h)=>{let b=o.get(i.id),p=i.startDate&&i.endDate?pe.calculateDuration(i.startDate,i.endDate):0,v=(i.dependencies||[]).filter(w=>o.has(w)).map(w=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Us({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);},m=e.reduce((l,u)=>{let d=u.category||"Other";return l[d]||(l[d]=[]),l[d].push(u),l},{});return jsxRuntime.jsxs("div",{className:b("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:b("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([l,u])=>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:l})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),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 Hs({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,c]=react.useState("export"),[m,l]=react.useState("json"),[u,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let h=async()=>{let p=o?.current||void 0,y=await xl(e,m,p);kl(y,m);},C=async p=>{let y=p.target.files?.[0];if(y){try{let f=await Tl(y),v=y.name.endsWith(".json")?"json":"csv",g=Cl(f,v);d(g),g.success&&r&&r(g,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(p=>jsxRuntime.jsxs("button",{onClick:()=>l(p),className:b("p-4 rounded-lg border-2 transition-all text-center",m===p?"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:[p==="json"&&"\u{1F4C4}",p==="csv"&&"\u{1F4CA}",p==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:p})]},p))})]}),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:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:b("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:b("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((p,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",p]},y))})]})]})]})]})]})}var Ag=["URGENT","HIGH","MEDIUM","LOW"],Fg=[{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"}],Ig=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:c,availableUsers:m=[],availableLabels:l=[],availableColumns:u=[],showQuickFilters:d=true,compact:i=false,groupBy:h="none",onGroupByChange:C}){let[p,y]=react.useState(true),f=react.useCallback(D=>{a({search:D.target.value});},[a]),v=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),g=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${p?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!p),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:p?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:p?"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"}),x&&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)"]})]}),!p&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:D=>{let B=D.target.value;a({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ag.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let B=D.target.value;a({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let B=D.target.value;a({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),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:Fg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:D=>C(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ig.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Gs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:c,onExportGanttCSV:m}){let[l,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return l&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[l]);let i=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:b("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!l),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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await 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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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 _s={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"}},Vs={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"}},js={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"}},$r={dark:_s,light:Vs,neutral:js},un="dark";var gn=react.createContext(void 0),Gg="asakaa-theme";function Ad({children:e,defaultTheme:t=un,storageKey:a=Gg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=$r[r];Object.entries(m.colors).forEach(([u,d])=>{d&&c.style.setProperty(`--theme-${_g(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let i=m.colors[u];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:$r};return jsxRuntime.jsx(gn.Provider,{value:n,children:e})}function io(){let e=react.useContext(gn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function _g(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ks({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=io();return e?jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries($r).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:b("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Fd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var fn={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"}},Id={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"}},Ys={en:fn,es:Id};function Ld(e){return Ys[e]||Ys.en}function qs(e,t){let a=Ld(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 co=react.createContext(fn);function Po(){return react.useContext(co)}function lf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[c,m]=react.useState(false),[l,u]=react.useState(null),d=react.useRef(null),i=Po();if(react.useEffect(()=>{let y=f=>{d.current&&!d.current.contains(f.target)&&m(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(y=>y.handler),p=async(y,f)=>{if(f){u(y);try{await f();}catch(v){console.error(`Export ${y} failed:`,v);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:C.map((y,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(y.id,y.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):y.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function df({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function cf({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function pf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Po();react.useEffect(()=>{let l=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=c.find(l=>l.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((l,u)=>{let d=t===l.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(l.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:l.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},l.value)})})})})]})}function hn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:c,onRowDensityChange:m,showThemeSelector:l=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:i,onExportPNG:h,onExportPDF:C,onExportExcel:p,onExportCSV:y,onExportJSON:f,onExportMSProject:v}){let g=Po(),k=h||C||p||y||f||v,x=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],D=[{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(cf,{options:x,value:t,onChange:B=>a(B),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(pf,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||g.toolbar.createTask})]}),(k||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lf,{theme:e,onExportPNG:h,onExportPDF:C,onExportExcel:p,onExportCSV:y,onExportJSON:f,onExportMSProject:v}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),l&&jsxRuntime.jsx(df,{options:D,value:s,onChange:B=>n(B),theme:e})]})]})}function bn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let l=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.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(ct,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function po({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,i=8,h=window.innerWidth,C=window.innerHeight,p=t,y=a;t+u+i>h&&(p=t-u,p<i&&(p=i)),a+d+i>C&&(y=C-d-i,y<i&&(y=i)),m({x:p,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=i=>{n.current&&!n.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var It={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Kd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:c,onTaskOutdent:m,onTaskRename:l,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:i=true}){let h=react.useRef(false),C=react.useCallback(g=>{h.current=g;},[]),p=react.useCallback(g=>{let k=[],x=D=>{for(let B of D)k.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&x(B.subtasks);};return x(g),k},[]),y=react.useCallback(()=>{let g=p(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,p]),f=react.useCallback((g,k)=>{let x=p(e);if(x.length===0)return;let D=y();if(!D){a(x[0].id,false);return}let B=x.findIndex(P=>P.id===D.id);if(B===-1)return;let w=g==="up"?B-1:B+1;if(w<0||w>=x.length)return;let z=x[w];a(z.id,k);},[e,y,p,a]),v=react.useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||h.current){g.key==="Escape"&&(k.blur(),h.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,w=Array.from(t),z=y();if(g.key==="ArrowUp"){g.preventDefault(),f("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),f("down",g.shiftKey);return}if(z&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){z.subtasks&&z.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!z.isExpanded||g.key==="ArrowLeft"&&z.isExpanded)&&u(z.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){w.length>0&&(g.preventDefault(),n(w,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){w.length>0&&(g.preventDefault(),c(w));return}if(g.key==="Tab"&&g.shiftKey){w.length>0&&(g.preventDefault(),m(w));return}if(g.key==="Enter"&&!g.shiftKey&&!B){z&&(g.preventDefault(),r(z.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!B){z&&(g.preventDefault(),r(z.id,"above"));return}if(g.key==="Enter"&&B){z&&(g.preventDefault(),d(z.id));return}if(g.key==="F2"){z&&(g.preventDefault(),l(z.id));return}if(g.key==="Delete"||g.key==="Backspace"&&B){w.length>0&&(g.preventDefault(),o(w));return}if(g.key==="d"&&B&&!g.shiftKey){w.length>0&&(g.preventDefault(),s(w));return}},[i,t,y,f,r,o,s,n,c,m,l,u,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[i,v]),{setIsEditing:C}}function qd(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(i=>{let h=new Set(i);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,i)=>{if(!a){o(d);return}let h=i.indexOf(a),C=i.indexOf(d);if(h===-1||C===-1){o(d);return}let p=Math.min(h,C),y=Math.max(h,C),f=i.slice(p,y+1);t(new Set(f)),r(d);},[a,o]),c=react.useCallback((d,i,h,C)=>{C?n(d,i):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,i)=>{i?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:l,isTaskSelected:u}}function mo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let c={...r[n],parentId:o,level:s,position:n};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Xd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Xd(a.subtasks,t);if(r)return r}}return null}function Zs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Zs(a.subtasks,t);if(r)return r}return null}function Qs(e,t){if(t.length===0)return e;let a=mo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,i)=>{let h=[];return {tasks:d.filter(p=>{if(i.has(p.id))return h.push(p),false;if(p.subtasks){let y=n(p.subtasks,i);p.subtasks=y.tasks,h.push(...y.removed);}return true}),removed:h}},c=(d,i,h)=>d.map(C=>C.id===i?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:c(C.subtasks,i,h)}:C),m=new Set(t),{tasks:l,removed:u}=n(e,m);return c(l,s.id,u)}function ei(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Zs(a,r);if(!o)continue;let s=Zs(a,o.id),n=(l,u,d)=>{for(let i=0;i<l.length;i++){let h=l[i];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(p=>p.id===d);if(C!==-1){let[p]=h.subtasks.splice(C,1);return p}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},c=(l,u,d)=>{let i=l.findIndex(h=>h.id===u);if(i!==-1)return l.splice(i+1,0,d),l;for(let h of l)h.subtasks&&c(h.subtasks,u,d);return l},m=n(a,o.id,r);m&&(s&&s.subtasks?c(s.subtasks,o.id,m):c(a,o.id,m));}return a}function ti(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,c,m)=>{let l=n.findIndex(d=>d.id===c);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,c,m))return true;return false}let u=m==="up"?l-1:l+1;return u<0||u>=n.length?false:([n[l],n[u]]=[n[u],n[l]],true)};return s(r,o,a),r}function ai(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ri(e,t){let a=[...e];for(let r of t){let o=n=>{let c=n.findIndex(u=>u.id===r);if(c===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[c],l={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(c+1,0,l),true},s=n=>n.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Jd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=m=>{let l=m.findIndex(d=>d.id===t);if(l===-1){for(let d of m)if(d.subtasks&&c(d.subtasks))return true;return false}let u=a==="above"?l:l+1;return m.splice(u,0,n),true};return c(r),{tasks:r,newTask:n}}function oi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:oi(r.subtasks,t,a)}:r)}function ni(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ni(a.subtasks,t)}:a)}function si(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,c=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(c),color:r?.color||"#3B82F6"},l=u=>u.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,m],isExpanded:true}}return d.subtasks?{...d,subtasks:l(d.subtasks)}:d});return {tasks:l(e),newTask:m}}function Zd(e,t,a,r){if(t===a)return e;let o=Xd(e,t);if(!o)return e;if(a){let c=(m,l)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===l||c(u,l))return true;return false};if(c(o,a))return e}let s=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let c=r!==void 0?r:n.length;n.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(l=>{if(l.id===a){let u=l.subtasks||[],d=r!==void 0?r:u.length,i=[...u];return i.splice(d,0,{...o,parentId:a}),{...l,subtasks:i,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:c(l.subtasks)}:l});n=c(n);}return n}function xn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:c,onTaskToggle:m,scrollTop:l,columns:u,onToggleColumn:d,onColumnResize:i,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:p,onTaskMove:y,onMultiTaskDelete:f,onTaskDuplicate:v,onTaskCreate:g,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:B,onTaskReparent:w}){let z=react.useContext(co),[P,T]=react.useState(null),[G,R]=react.useState(null),[Y,te]=react.useState(""),ve=react.useRef(null),[Ie,Ue]=react.useState(null),[le,O]=react.useState(0),[L,H]=react.useState(0),[F,q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,U]=react.useState(null),[xe,Te]=react.useState(null),[Le,ye]=react.useState(null),tt=react.useRef(0),Ee=5,dt=react.useRef(false),[it,ut]=react.useState(null),[_e,$]=react.useState(false),[ae,ce]=react.useState(null),[Ce,Pe]=react.useState(false),at=react.useRef(null);react.useEffect(()=>{function Z(ne){at.current&&!at.current.contains(ne.target)&&Pe(false);}if(Ce)return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[Ce]),react.useEffect(()=>{G&&ve.current&&(ve.current.focus(),ve.current.select());},[G]),react.useEffect(()=>{if(!Ie)return;let Z=Ae=>{let We=Ae.clientX-le,N=L+We;i?.(Ie,N);},ne=()=>{Ue(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",Z),document.addEventListener("mouseup",ne),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",ne),document.body.style.cursor="",document.body.style.userSelect="";}},[Ie,le,L,i]);let{selectedTaskIds:mt,handleTaskClick:Be,isTaskSelected:fe}=qd(),{setIsEditing:Me}=Kd({tasks:e,selectedTaskIds:mt,onTaskSelect:(Z,ne)=>{let We=mo(e).map(N=>N.id);Be(Z,We,ne||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:p||(()=>{}),onTaskRename:Z=>{let ne=mo(e).find(Ae=>Ae.id===Z);ne&&ee(ne);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:Z=>{let ne=mo(e).find(Ae=>Ae.id===Z);ne&&D&&D(ne);},enableKeyboard:true}),_t=(Z,ne=0)=>{let Ae=[];for(let We of Z)Ae.push({task:We,level:ne}),We.subtasks&&We.subtasks.length>0&&We.isExpanded&&Ae.push(..._t(We.subtasks,ne+1));return Ae},gt=_t(e),aa=48,ia=Math.max(gt.length*a,600-aa),E=Z=>!Z.startDate||!Z.endDate?"-":`${Math.ceil((Z.endDate.getTime()-Z.startDate.getTime())/(1e3*60*60*24))}d`,ee=Z=>{R(Z.id),te(Z.name),Me(true);},$e=Z=>{Y.trim()&&Y!==e.find(ne=>ne.id===Z)?.name&&k?.(Z,Y.trim()),R(null),te(""),Me(false);},re=()=>{R(null),te(""),Me(false);},De=(Z,ne)=>{ne.stopPropagation(),x?.(Z.id);},we=(Z,ne)=>{ne.preventDefault(),tt.current=ne.clientY,U(Z),dt.current=false,$(false),ut({x:ne.clientX,y:ne.clientY});},Se=Z=>{if(!J||(Math.abs(Z.clientY-tt.current)>Ee&&!dt.current&&(dt.current=true,$(true)),ut({x:Z.clientX,y:Z.clientY}),!dt.current))return;let Ae=document.querySelectorAll("[data-task-row]"),We=null,N=null;Ae.forEach(M=>{let _=M.getBoundingClientRect(),pe=M.getAttribute("data-task-row");if(pe&&pe!==J&&Z.clientY>=_.top&&Z.clientY<=_.bottom){We=pe;let Ye=Z.clientY-_.top,X=_.height;Ye<X*.25?N="above":Ye>X*.75?N="below":N="child";}}),Te(We),ye(N);},Oe=()=>{if(dt.current&&J&&xe&&Le){if(Le==="child")w?.(J,xe);else if(Le==="above"||Le==="below"){let Z=(We,N,M=null)=>{for(let _ of We){if(_.id===N)return M;if(_.subtasks){let pe=Z(_.subtasks,N,_.id);if(pe!==void 0)return pe}}},ne=Z(e,xe,null),Ae=(We,N)=>{let M=We.findIndex(_=>_.id===N);return Le==="below"?M+1:M};if(ne===null){let We=Ae(e,xe);w?.(J,null,We);}else {let We=gt.find(N=>N.task.id===ne)?.task;if(We?.subtasks){let N=Ae(We.subtasks,xe);w?.(J,ne,N);}}}}U(null),Te(null),ye(null),ut(null),dt.current=false,$(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",Se),document.addEventListener("mouseup",Oe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Se),document.removeEventListener("mouseup",Oe),document.body.style.cursor="",document.body.style.userSelect="";}},[J,xe,Le]);let Ve=(Z,ne,Ae)=>{switch(Z.id){case "name":let We=G===ne.id,N=P===ne.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ae*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:N?1:.3},onMouseDown:oe=>we(ne.id,oe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ne.subtasks&&ne.subtasks.length>0?jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),m?.(ne.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ne.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ne.color||"#3B82F6",opacity:ne.parentId?.6:1,borderColor:ne.isMilestone?t.accent:"transparent",borderWidth:ne.isMilestone?"2px":"0px"},title:ne.isMilestone?"Milestone":ne.parentId?"Subtask":"Task"})}),We?jsxRuntime.jsx("input",{ref:ve,type:"text",value:Y,onChange:oe=>te(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"?$e(ne.id):oe.key==="Escape"&&re();},onBlur:()=>$e(ne.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:oe=>oe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ne.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ne.parentId?"13px":"14px",fontWeight:ne.isMilestone?600:ne.parentId?400:600,letterSpacing:ne.parentId?"0":"-0.01em"},title:ne.name,children:ne.name}),N&&!We&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:oe=>De(ne,oe),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:oe=>{oe.stopPropagation(),ee(ne);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let _=Z.id==="startDate"?"startDate":"endDate",pe=ne[_],Ye=ae?.taskId===ne.id&&ae?.field===_,X=oe=>oe?(typeof oe=="string"?new Date(oe):oe).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:oe=>{if(Ye)ce(null);else {let nt=oe.currentTarget.getBoundingClientRect();ce({taskId:ne.id,field:_,month:pe?typeof pe=="string"?new Date(pe):pe:new Date,position:{top:nt.bottom+4,left:nt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:X(pe)})]}),Ye&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ce(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:ae?.position.top,left:ae?.position.left},onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let oe=new Date,nt=new Date(oe);nt.setDate(oe.getDate()+1);let rt=new Date(oe);rt.setDate(oe.getDate()+7);let He=new Date(oe);return He.setDate(oe.getDate()+14),[{label:"Hoy",date:oe},{label:"Ma\xF1ana",date:nt},{label:"Pr\xF3xima semana",date:rt},{label:"2 semanas",date:He}].map((Et,da)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Er=>Er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Er=>Er.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ne.id,{[_]:Et.date}),ce(null);},children:Et.label},da))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:oe=>oe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ne.id,{[_]:void 0}),ce(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>ce(oe=>oe?{...oe,month:new Date(oe.month.getFullYear(),oe.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ae?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ce(oe=>oe?{...oe,month:new Date(oe.month.getFullYear(),oe.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((oe,nt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:oe},nt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let oe=ae?.month||new Date,nt=oe.getFullYear(),rt=oe.getMonth(),He=new Date(nt,rt,1).getDay(),St=new Date(nt,rt+1,0).getDate(),Et=new Date,da=[];for(let Vt=He-1;Vt>=0;Vt--)da.push({day:new Date(nt,rt,-Vt).getDate(),date:new Date(nt,rt-1,new Date(nt,rt,-Vt).getDate()),isCurrentMonth:false});for(let Vt=1;Vt<=St;Vt++)da.push({day:Vt,date:new Date(nt,rt,Vt),isCurrentMonth:true});let Er=42-da.length;for(let Vt=1;Vt<=Er;Vt++)da.push({day:Vt,date:new Date(nt,rt+1,Vt),isCurrentMonth:false});return da.map((Vt,bo)=>{let Kn=Vt.date.toDateString()===Et.toDateString(),yo=(pe?typeof pe=="string"?new Date(pe):pe:null)?.toDateString()===Vt.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Vt.isCurrentMonth?yo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:yo?"#3B82F6":"transparent",boxShadow:Kn&&!yo?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ne.id,{[_]:Vt.date}),ce(null);},children:Vt.day},bo)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:E(ne)})});case "assignees":let ze=r.filter(oe=>ne.assignees?.some(nt=>nt.name===oe.name||nt.initials===oe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:oe=>oe.stopPropagation(),children:jsxRuntime.jsx(Lr,{assignedUsers:ze,availableUsers:r,onChange:oe=>{let nt=oe.map(rt=>({id:rt.id,name:rt.name,initials:rt.initials,color:rt.color}));h?.(ne.id,{assignees:nt.length>0?nt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:oe=>oe.stopPropagation(),children:jsxRuntime.jsx(Gl,{status:ne.status||"todo",onChange:oe=>{h?.(ne.id,{status:oe,progress:oe==="completed"?100:ne.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:`${ne.progress}%`,backgroundColor:ne.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[ne.progress,"%"]})]});case "priority":let Nt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Fe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ra=Nt[ne.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:oe=>oe.stopPropagation(),children:jsxRuntime.jsx(Fr,{priority:ra,onChange:oe=>{oe&&h?.(ne.id,{priority:Fe[oe]||"medium"});}})});default:return null}},Re=Z=>[{id:"hide",label:"Hide Column",icon:It.Hide,onClick:()=>d(Z),disabled:Z==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:It.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:It.SortDesc,onClick:()=>{}}],Ze=Z=>Z.subtasks&&Z.subtasks.length>0?[{id:"addSubtask",label:z?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{x?.(Z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:z?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{B?B(Z.id,Z.name):f?.([Z.id]);}}]:[{id:"edit",label:z?.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{n?.(Z);}},{id:"addSubtask",label:z?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{x?.(Z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:z?.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{h?.(Z.id,{status:"todo",progress:0});},disabled:Z.status==="todo"},{id:"setInProgress",label:z?.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{h?.(Z.id,{status:"in-progress"});},disabled:Z.status==="in-progress"},{id:"markComplete",label:z?.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{h?.(Z.id,{status:"completed",progress:100});},disabled:Z.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:z?.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:z?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{B?B(Z.id,Z.name):f?.([Z.id]);}}],ht=u.filter(Z=>Z.visible),Kt=ht.reduce((Z,ne)=>Z+ne.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:Kt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${aa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:ht.map((Z,ne)=>{let Ae=ne===ht.length-1,We=Z.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${We?"":"justify-center"}`,style:{width:`${Z.width}px`,minWidth:`${Z.minWidth??(We?200:60)}px`,maxWidth:`${Z.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ae?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:N=>{N.preventDefault(),q({isOpen:true,x:N.clientX,y:N.clientY,type:"header",columnId:Z.id});},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:Z.label,children:Z.label}),Z.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Ie===Z.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:N=>{N.preventDefault(),N.stopPropagation(),Ue(Z.id),O(N.clientX),H(Z.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"}})})]},Z.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(bn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Pe(!Ce),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Ce&&jsxRuntime.jsxs("div",{ref:at,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:Z=>Z.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:()=>Pe(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ia},children:gt.map(({task:Z,level:ne},Ae)=>{let We=fe(Z.id),N=xe===Z.id,M=N&&Le==="above",_=N&&Le==="below",pe=N&&Le==="child",Ye={};return pe&&(Ye.backgroundColor=`${t.accent}15`,Ye.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":Z.id,className:`flex items-center cursor-pointer group ${J===Z.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:We?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:We?t.accentLight:pe?`${t.accent}15`:Ae%2===0?t.bgPrimary:t.bgGrid,...Ye},onMouseEnter:()=>T(Z.id),onMouseLeave:()=>T(null),onClick:X=>{let Nt=mo(e).map(oe=>oe.id),ra=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;Be(Z.id,Nt,ra,X.shiftKey),s?.(Z);},onDoubleClick:X=>{X.stopPropagation(),n?.(Z);},onContextMenu:X=>{X.preventDefault(),q({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:Z}),c?.(Z,X);},whileHover:{backgroundColor:We?t.accentLight:t.hoverBg},children:[M&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),_&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ht.map((X,ze)=>{let Nt=ze===ht.length-1,Fe=X.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Fe?"justify-start":"justify-center"}`,style:{width:`${X.width}px`,minWidth:`${X.minWidth??(Fe?200:60)}px`,maxWidth:`${X.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Nt?"none":`1px solid ${P===Z.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(X,Z,Fe?ne:0)},`${Z.id}-${X.id}`)})]},Z.id)})}),jsxRuntime.jsx(po,{isOpen:F.isOpen,x:F.x,y:F.y,items:F.type==="header"&&F.columnId?Re(F.columnId):F.type==="task"&&F.task?Ze(F.task):[],onClose:()=>q({...F,isOpen:false}),theme:t}),_e&&it&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:it.x+12,top:it.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Z=gt.find(ne=>ne.task.id===J)?.task;return Z?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:Z.name})}):null})()}),document.body)]})}function rc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,c]=react.useState(e),[m,l]=react.useState(t),[u,d]=react.useState(null),[i,h]=react.useState(null),[C,p]=react.useState(null),[y,f]=react.useState(null),[v,g]=react.useState(0),[k,x]=react.useState(0),[D,B]=react.useState(null),[w,z]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:c,ghostWidth:m,setGhostWidth:l,connectionLine:u,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:h,activeZone:C,setActiveZone:p,draggedSegmentIndex:y,setDraggedSegmentIndex:f,draggedSegmentStartX:v,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:B,isHovered:w,setIsHovered:z,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,te)=>{r("none"),d(null),h(null),c(Y),l(te),x(0),f(null),g(0);}}}function kn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:c,onClick:m,onDoubleClick:l,onContextMenu:u,onDateChange:d,onDependencyCreate:i,allTaskPositions:h=[],onDragMove:C,onHoverChange:p}){let y=rc(t,r),f=react.useRef(null),{dragMode:v,setDragMode:g,dragOffset:k,setDragOffset:x,ghostX:D,setGhostX:B,ghostWidth:w,setGhostWidth:z,connectionLine:P,setConnectionLine:T,hoveredTaskId:G,setHoveredTaskId:R,activeZone:Y,setActiveZone:te,draggedSegmentIndex:ve,setDraggedSegmentIndex:Ie,draggedSegmentStartX:Ue,setDraggedSegmentStartX:le,segmentDragOffsetX:O,setSegmentDragOffsetX:L,hoveredSegmentIndex:H,setHoveredSegmentIndex:F,isHovered:q,setIsHovered:J,isDragging:U,isResizing:xe,isConnecting:Te,resetDragState:Le}=y,ye=32,tt=8,Ee=e.endDate&&e.endDate<new Date&&e.progress<100,dt=e.isCriticalPath,it=o.name==="neutral"||o.today==="#1C1917",ut=e.status==="completed"||e.progress===100,_e={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ae=e.isCriticalPath||Ee?"#DC2626":e.color?e.color:e.priority&&_e[e.priority]?_e[e.priority]:o.taskBarPrimary,Ce=(re=>re>=80?20:re>=60?15:re>=50?12:10)(r),Pe=r<50,at=r<40;react.useEffect(()=>{if(p)if(q&&!U&&!e.segments){let re=a<100;p({task:e,x:t,y:a,width:r,height:ye,showBelow:re});}else p(null);},[q,U,e,t,a,r,ye,p]);let mt=re=>re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let re=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${re} day${re!==1?"s":""}`},fe=re=>Math.round(re/s)*s,Me=re=>{let De=Math.round(re/s),we=new Date(n);return we.setDate(we.getDate()+De),we},_t=(re,De)=>{for(let we of h){if(we.id===e.id)continue;let Se=5;if(re>=we.x-Se&&re<=we.x+we.width+Se&&De>=we.y-Se&&De<=we.y+we.height+Se)return we.id}return null},gt=react.useCallback((re,De,we)=>{re.preventDefault(),re.stopPropagation();let Se=f.current?.ownerSVGElement;if(!Se)return;let Oe=Se.createSVGPoint();Oe.x=re.clientX,Oe.y=re.clientY;let Ve=Oe.matrixTransform(Se.getScreenCTM()?.inverse()),Re=we!==void 0?we:t,Ze=De;if(!Ze){let ht=Ve.x-Re;re.shiftKey?(Ze="connect",T({x:t+r,y:a+ye/2})):re.ctrlKey||re.metaKey?Ze="move":re.altKey?Ze=ht<r/2?"resize-start":"resize-end":at?ht<r/2?Ze="move":Ze="resize-end":Pe?ht<=Ce/2?Ze="resize-start":ht>=r-Ce/2?Ze="resize-end":Ze="move":ht<=Ce?Ze="resize-start":ht>=r-Ce?Ze="resize-end":Ze="move";}g(Ze),J(false),te(null),Ze==="move"?x(Ve.x-Re):Ze==="connect"?T({x:t+r,y:a+ye/2}):x(0),B(Re),z(r);},[t,r,a,ye]),aa=react.useCallback(re=>{if(v==="none")return;let De=f.current?.ownerSVGElement;if(!De)return;let we=De.createSVGPoint();we.x=re.clientX,we.y=re.clientY;let Se=we.matrixTransform(De.getScreenCTM()?.inverse());if(v==="connect"){T({x:Se.x,y:Se.y});let Oe=_t(Se.x,Se.y);R(Oe);}else if(v==="move"){let Oe=Se.x-k,Ve=fe(Oe);B(Ve),z(r);let Re=Math.round((Ve-t)/s);if(C?.(e.id,Re,true),e.segments&&e.segments.length>0&&ve!==null){let Ze=Ve-Ue;L(Ze);}}else if(v==="resize-start"){let Oe=Se.x,Ve=fe(Oe),Re=t+r-Ve;Re>=s&&(B(Ve),z(Re));}else if(v==="resize-end"){let Oe=Se.x,Re=fe(Oe)-t;Re>=s&&z(Re);}},[v,t,r,s,k,e,fe,ve,Ue,_t,R,T,B,z,L,C]),ia=react.useCallback(()=>{if(v!=="none"){if(v==="connect")G&&i&&i(e,G),T(null),R(null);else {let re=e.endDate.getTime()-e.startDate.getTime(),De,we,Se=true;if(v==="move"){if(De=Me(D),we=new Date(De.getTime()+re),e.segments&&e.segments.length>0&&ve!==null){let Oe=Math.round(O/s),Ve=e.segments.map((Kt,Z)=>{if(Z===ve){let ne=new Date(Kt.startDate),Ae=new Date(Kt.endDate);return ne.setDate(ne.getDate()+Oe),Ae.setDate(Ae.getDate()+Oe),{startDate:ne,endDate:Ae}}return Kt}),Re=Ve.flatMap(Kt=>[Kt.startDate,Kt.endDate]),Ze=new Date(Math.min(...Re.map(Kt=>Kt.getTime()))),ht=new Date(Math.max(...Re.map(Kt=>Kt.getTime())));d?.({...e,segments:Ve},Ze,ht),Le(t,r);return}}else v==="resize-start"?(De=Me(D),we=e.endDate,De>we&&(console.warn("Invalid date range: start date must be before or equal to end date"),Se=false)):v==="resize-end"?(De=e.startDate,we=Me(D+w),we<De&&(console.warn("Invalid date range: end date must be after or equal to start date"),Se=false)):Se=false;Se&&De&&we&&(we.getTime()<De.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,De,we));}C?.(e.id,0,false),Le(t,r);}},[v,D,w,e,d,G,i,t,r,s,Me,O,ve,Le,C]);react.useEffect(()=>{if(v==="none")return;let re=we=>{aa(we);},De=()=>{ia();};return window.addEventListener("mousemove",re),window.addEventListener("mouseup",De),()=>{window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",De);}},[v,aa,ia]);let E=U&&!Te?D:t,ee=U&&!Te?w:r,$e=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:f,onMouseEnter:()=>!U&&J(true),onMouseLeave:()=>{U||(J(false),te(null));},onClick:()=>!U&&m?.(e),onDoubleClick:re=>{U||(re.stopPropagation(),l?.(e));},onContextMenu:re=>{re.preventDefault(),u?.(e,re);},children:[q&&!U&&!Pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ce,height:ye,fill:Y==="resize-start"?o.accent:"transparent",opacity:Y==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:re=>gt(re,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ce,y:a,width:r-Ce*2,height:ye,fill:Y==="move"?o.accent:"transparent",opacity:Y==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:re=>gt(re,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ce,y:a,width:Ce,height:ye,fill:Y==="resize-end"?o.accent:"transparent",opacity:Y==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:re=>gt(re,"resize-end")})]}),q&&!U&&at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:Y==="move"?o.accent:"transparent",opacity:Y==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:re=>gt(re,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:Y==="resize-end"?o.accent:"transparent",opacity:Y==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:re=>gt(re,"resize-end")}),q&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ye-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),U&&!Te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:D,y:a,width:w,height:ye,rx:tt,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:E,y:a,width:ee,height:ye,rx:tt,fill:ae,"data-task-class":$e,initial:{opacity:0,scale:.95},animate:{opacity:U&&!Te?.15:e.parentId?.6:q?.9:.8,scale:q&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>gt(re),style:{cursor:U?Te?"crosshair":xe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:E,y:a,width:ee*(e.progress/100),height:ye,rx:tt,fill:ae,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((re,De)=>{let we=(re.startDate.getTime()-n.getTime())/864e5*s,Oe=(re.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-we+s,Ve=U&&v==="move"&&ve===De,Re=H===De,Ze=Ve?we+O:we;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!U&&F(De),onMouseLeave:()=>!U&&F(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze,y:a,width:Oe,height:ye,rx:tt,fill:ae,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:Re?.9:.8,scale:Re&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ht=>{ht.stopPropagation(),Ie(De),le(we),gt(ht,void 0,we);},style:{cursor:U?Te?"crosshair":xe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ze,y:a,width:Oe*(e.progress/100),height:ye,rx:tt,fill:ae,opacity:1,style:{pointerEvents:"none"}})]},`segment-${De}`)}),it&&(Ee||dt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[dt&&!Ee&&jsxRuntime.jsx("rect",{x:E,y:a,width:ee,height:ye,rx:tt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ee&&jsxRuntime.jsx("rect",{x:E,y:a,width:ee,height:ye,rx:tt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ee>60&&!e.segments&&(()=>{let re=c.taskLabel(e),De=typeof re=="string"?re:e.name,we=De.length>Math.floor(ee/8)?`${De.substring(0,Math.floor(ee/8))}...`:De;return jsxRuntime.jsx("text",{x:E+12,y:a+ye/2,dominantBaseline:"middle",fill:ut?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ut?"line-through":"none"},children:we})})(),ee>100&&e.progress>0&&e.progress<100&&!U&&!e.segments&&jsxRuntime.jsxs("text",{x:E+ee-12,y:a+ye/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&&ee>80&&!U&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:E+ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:E+ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(q||xe)&&!Te&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Pe?E-15:E-10,y:a-5,width:Pe?25:20,height:ye+10,fill:"transparent",onMouseDown:re=>gt(re,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Pe?E-8:E-3,y:a+6,width:Pe?8:6,height:Pe?ye-12:ye-16,rx:3,fill:v==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:v==="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:E+ee-10,y:a-5,width:Pe?25:20,height:ye+10,fill:"transparent",onMouseDown:re=>gt(re,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Pe?E+ee:E+ee-3,y:a+6,width:Pe?8:6,height:Pe?ye-12:ye-16,rx:3,fill:v==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:v==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&!U&&!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+ye/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:re=>{re.stopPropagation(),gt(re,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ye/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Te&&P&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ye/2,x2:P.x,y2:P.y,stroke:G?o.statusCompleted:o.accent,strokeWidth:G?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:G?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:P.x,cy:P.y,r:G?8:6,fill:G?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),G&&jsxRuntime.jsx(framerMotion.motion.text,{x:P.x+15,y:P.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:P.x+10},animate:{opacity:1,x:P.x+15},transition:{duration:.2},children:"Connect"})]}),(q||U)&&!Te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E-2,y:a-2,width:ee+4,height:ye+4,rx:tt+2,fill:"none",stroke:U?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:U?.6:.4,initial:{opacity:0},animate:{opacity:U?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:D+w,y1:0,x2:D+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&!U&&!e.segments&&!p&&(()=>{let we=a<100,Se=we?a+ye+13:a-82-13,Oe=we?`M ${E+ee/2-6} ${a+ye+3} L ${E+ee/2} ${a+ye+13} L ${E+ee/2+6} ${a+ye+3}`:`M ${E+ee/2-6} ${a-13} L ${E+ee/2} ${a-3} L ${E+ee/2+6} ${a-13}`,Ve=Se+22,Re=Se+40,Ze=Se+55,ht=Se+70,Kt=we?Se+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:we?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:we?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Oe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:E+ee/2-120,y:Se,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:E+ee/2,y:Ve,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:E+ee/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:E+ee/2-70,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsxRuntime.jsx("text",{x:E+ee/2-110,y:Ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:E+ee/2-70,y:Ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsxRuntime.jsx("text",{x:E+ee/2+10,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:E+ee/2+65,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsxRuntime.jsx("text",{x:E+ee/2+10,y:Ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:E+ee/2+65,y:Ze,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:E+ee/2-110,y:ht,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:E+ee/2-50,y:ht,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Z=>Z.name).join(", ").substring(0,30),e.assignees.map(Z=>Z.name).join(", ").length>30?"...":""]})]}),!we&&jsxRuntime.jsx("text",{x:E+ee/2,y:Kt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":Pe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function sc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:c}=e,m=82,l=13,u=c?o+n+l:o-m-l,d=c?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=u+22,h=u+40,C=u+55,p=u+70,y=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),f=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:f()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Tn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:n}){let[c,m]=react.useState(false),l=a-e,u=r-t,d=e+l/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,h=6,C=Math.atan2(u,l),p=a-h*Math.cos(C-Math.PI/6),y=r-h*Math.sin(C-Math.PI/6),f=a-h*Math.cos(C+Math.PI/6),v=r-h*Math.sin(C+Math.PI/6),g=o.dependency;react.useEffect(()=>{n&&s&&n(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,n]);let k=!s&&!n;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&m(true),onMouseLeave:()=>!k&&m(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&n?0:c?1:.8,strokeWidth:c?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 ${p} ${y} M ${a} ${r} L ${f} ${v}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&n?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:c&&n?0:c?1.3:1,opacity:c&&n?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:x=>{x.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Dn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),c=16,m=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var me={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,c=new Set,m=l=>{if(!n.has(l)){n.add(l),c.add(l);let u=r.get(l)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(c.has(d))return true}}return c.delete(l),false};return m(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=me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=me.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=me.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
+ `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=me.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=me.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>me.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=me.findTaskById(e,t);return !a||!a.dependencies?[]:me.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>me.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>me.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=me.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>me.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=me.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(m=>{let l=m.startDate&&m.endDate?me.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?me.formatDate(m.startDate):"N/A",m.endDate?me.formatDate(m.endDate):"N/A",l>0?`${l} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=me.flattenTasks(e).map(m=>{let l=m.startDate&&m.endDate?me.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?me.formatDate(m.startDate):"","End Date":m.endDate?me.formatDate(m.endDate):"","Duration (days)":l>0?l:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=me.flattenTasks(e),o=new Map;r.forEach((i,h)=>{o.set(i.id,h+1);});let s=i=>i.toISOString().replace("Z",""),n=me.getEarliestStartDate(e)||new Date,c=me.getLatestEndDate(e)||new Date,m=r.map((i,h)=>{let C=o.get(i.id),p=i.startDate&&i.endDate?me.calculateDuration(i.startDate,i.endDate):0,y=(i.dependencies||[]).filter(f=>o.has(f)).map(f=>`
113
113
  <PredecessorLink>
114
- <PredecessorUID>${o.get(w)}</PredecessorUID>
114
+ <PredecessorUID>${o.get(f)}</PredecessorUID>
115
115
  <Type>1</Type>
116
116
  <CrossProject>0</CrossProject>
117
117
  <LinkLag>0</LinkLag>
118
118
  <LagFormat>7</LagFormat>
119
119
  </PredecessorLink>`).join("");return `
120
120
  <Task>
121
- <UID>${b}</UID>
121
+ <UID>${C}</UID>
122
122
  <ID>${h+1}</ID>
123
- <Name>${i.name.replace(/[<>&'"]/g,w=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[w]||w)}</Name>
123
+ <Name>${i.name.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</Name>
124
124
  <Type>0</Type>
125
125
  <IsNull>0</IsNull>
126
126
  <CreateDate>${s(new Date)}</CreateDate>
@@ -191,7 +191,7 @@
191
191
  <PhysicalPercentComplete>0</PhysicalPercentComplete>
192
192
  <EarnedValueMethod>0</EarnedValueMethod>
193
193
  <IsPublished>1</IsPublished>
194
- <CommitmentType>0</CommitmentType>${v}
194
+ <CommitmentType>0</CommitmentType>${y}
195
195
  </Task>`}).join(""),l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
196
196
  <Project xmlns="http://schemas.microsoft.com/project">
197
197
  <SaveVersion>14</SaveVersion>
@@ -339,9 +339,9 @@
339
339
  </Calendars>
340
340
  <Tasks>${m}
341
341
  </Tasks>
342
- </Project>`,g=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(g),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=pe.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let g=l.startDate&&l.endDate?pe.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let h of l.dependencies){let b=t.find(p=>p.id===h);if(b){o(b);let p=r.get(h)?.ef||0;d=Math.max(d,p);}}let i=d+g;r.set(l.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,c=l=>{if(n.has(l.id))return;let g=l.startDate&&l.endDate?pe.calculateDuration(l.startDate,l.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(l.id)),i=s;if(d.length>0)for(let b of d){c(b);let p=n.get(b.id)?.ls||0;i=Math.min(i,p);}let h=i-g;n.set(l.id,{ls:h,lf:i});};a.forEach(c);let m=[];for(let l of a){let g=r.get(l.id),d=n.get(l.id);if(g&&d){let i=d.ls-g.es;Math.abs(i)<.01&&m.push(l.id);}}return m},calculateSlack:(e,t)=>{let a=pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(pe.calculateCriticalPath(e).includes(t))return 0;let o=pe.getDependentTasks(e,t);if(o.length===0){let c=pe.getLatestEndDate(e);if(!c)return null;let m=pe.calculateDuration(a.endDate,c);return Math.max(0,m)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!s)return null;let n=pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=pe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let c=pe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let l=pe.calculateEndDate(m,c),g=d=>d.map(i=>i.id===n.id?{...i,startDate:m,endDate:l}:i.subtasks?{...i,subtasks:g(i.subtasks)}:i);s=g(s),s=pe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,c)=>{if(a===0)return [];let m=[],l=o.getTime(),g=1e3*60*60*24,d=pe.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(h,b,p=new Set)=>{if(p.has(h))return;p.add(h);let v=pe.getDependentTasks(e,h);for(let w of v){if(!w.startDate||!w.endDate)continue;let u=r.findIndex(C=>C.id===w.id);if(u===-1)continue;let f=w.startDate.getTime(),D=(w.endDate.getTime()-f)/g,L=(f-l)/g*s,k=L+b*s,U=Math.max(D*s,s),P=c+u*n+12;m.push({taskId:w.id,taskName:w.name,originalX:L,previewX:k,width:U,y:P,rowIndex:u,daysDelta:b,color:w.color}),i(w.id,b,p);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:c}],l=g=>g.map(d=>d.id===o.id?{...d,endDate:c,segments:m}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function En({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:c,onTaskClick:m,onTaskDblClick:l,onTaskContextMenu:g,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:h}){let[p,v]=react.useState([]),[w,u]=react.useState(null),[f,x]=react.useState(null),D=react.useCallback(O=>{u(O);},[]),S=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),L=r==="day"?60:r==="week"?20:8,k=S*L*n,U=O=>{let B=new Date(Date.UTC(O.getFullYear(),O.getMonth(),O.getDate())),$=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-$);let F=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-F.getTime())/864e5+1)/7)},P=O=>{let B=O.getDay();return B===0||B===6},C=react.useCallback(O=>{let B=Math.round(O/(L*n)),$=new Date(o);return $.setDate($.getDate()+B),$},[o,L,n]),H=react.useCallback((O,B)=>{if(B.startDate&&B.endDate)return;let $=O.currentTarget.ownerSVGElement;if(!$)return;let F=$.createSVGPoint();F.x=O.clientX,F.y=O.clientY;let q=F.matrixTransform($.getScreenCTM()?.inverse()),Z=C(q.x),z=new Date(Z);z.setDate(z.getDate()+1),d?.(B,Z,z);},[C,d]),R=react.useMemo(()=>{let O=q=>q.map(Z=>{if(Z.subtasks&&Z.subtasks.length>0){let z=O(Z.subtasks),ve=z.filter(we=>we.startDate&&we.endDate);if(ve.length>0){let we=ve.map(Ae=>Ae.startDate.getTime()),Me=ve.map(Ae=>Ae.endDate.getTime()),ge=new Date(Math.min(...we)),ot=new Date(Math.max(...Me));return {...Z,subtasks:z,startDate:ge,endDate:ot}}return {...Z,subtasks:z}}return Z}),B=(q,Z=[])=>{for(let z of q)Z.push(z),z.subtasks&&z.subtasks.length>0&&(z.isExpanded===void 0||z.isExpanded)&&B(z.subtasks,Z);return Z},$=O(e);return B($)},[e]),J=react.useCallback(O=>{if(!O.startDate||!O.endDate)return {x:0,width:0};let B=O.startDate.getTime(),$=O.endDate.getTime(),F=o.getTime(),q=(B-F)/(1e3*60*60*24),Z=($-B)/(1e3*60*60*24),z=q*L*n,ve=Math.max(L*n,40),we=Math.max(Z*L*n,ve);return {x:z,width:we}},[o,L,n]),re=react.useMemo(()=>R.filter(O=>O.startDate&&O.endDate).map(O=>{let{x:B,width:$}=J(O),q=R.findIndex(Z=>Z.id===O.id)*a+12;return {id:O.id,x:B,y:q,width:$,height:32}}),[R,J]),Ce=react.useCallback((O,B,$)=>{if(!$||B===0){v([]);return}let F=pe.calculateCascadePreview(e,O,B,R,o,L*n,a,48);v(F);},[e,R,o,L,n,a,48]),Se=react.useMemo(()=>{let O=[],B=new Date(o);for(;B<=s;){let q=(B.getTime()-o.getTime())/864e5*L*n;if(r==="day")O.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:q}),B.setDate(B.getDate()+1);else if(r==="week"){let Z=U(B);O.push({date:new Date(B),label:`Week ${Z}`,x:q}),B.setDate(B.getDate()+7);}else O.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:q}),B.setMonth(B.getMonth()+1);}return O},[o,s,r,L,n]),Fe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*L*n,[o,L,n]),se=Math.max(R.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(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),Se.map((O,B)=>jsxRuntime.jsxs("g",{children:[B>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:O.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:O.label})]},`header-${B}`)),Fe>=0&&Fe<=k&&jsxRuntime.jsx("circle",{cx:Fe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:se,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(k,1e3),height:se,fill:t.bgPrimary}),Se.map((O,B)=>{let $=Se[B+1]?.x||k,F=P(O.date);return jsxRuntime.jsxs("g",{children:[F&&jsxRuntime.jsx("rect",{x:O.x,y:0,width:$-O.x,height:R.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:R.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),R.map((O,B)=>{let $=O.startDate&&O.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:k,height:a,fill:B%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${O.id}`),!$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:F=>H(F,O),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-${O.id}`),jsxRuntime.jsx("text",{x:Fe>0?Fe:100,y:B*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-${O.id}`)]})]},`row-group-${O.id}`)}),R.map((O,B)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map($=>{let F=R.find(ve=>ve.id===$);if(!F||!F.startDate||!F.endDate)return null;let q=R.findIndex(ve=>ve.id===$),Z=J(F),z=J(O);return jsxRuntime.jsx(Tn,{x1:Z.x+Z.width,y1:q*a+a/2,x2:z.x,y2:B*a+a/2,theme:t},`dep-${$}-${O.id}`)})),R.map((O,B)=>{if(!O.startDate||!O.endDate)return null;let{x:$,width:F}=J(O),q=B*a+12,Z=O.subtasks&&O.subtasks.length>0&&!O.isMilestone;return O.isMilestone?jsxRuntime.jsx(Dn,{task:O,x:$+F/2,y:q+16,theme:t,onClick:m},O.id):Z?jsxRuntime.jsxs("g",{onClick:()=>m?.(O),onContextMenu:z=>{z.preventDefault(),z.stopPropagation(),g?.(O,z);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:$,y:q,width:F,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:$,y1:q,x2:$+F,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:q,x2:$,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$+F,y1:q,x2:$+F,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:q+32,x2:$+F,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),F>60&&jsxRuntime.jsx("text",{x:$+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:O.name})]},O.id):jsxRuntime.jsx(kn,{task:O,x:$,y:q,width:F,theme:t,dayWidth:L*n,startDate:o,templates:c,onClick:m,onDoubleClick:l,onContextMenu:g,onDateChange:d,onDependencyCreate:i,allTaskPositions:re,onDragMove:Ce,onHoverChange:D},O.id)}),R.map((O,B)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map($=>{let F=R.find(V=>V.id===$);if(!F||!F.startDate||!F.endDate)return null;let q=R.findIndex(V=>V.id===$),Z=J(F),z=J(O),ve=Z.x+Z.width,we=q*a+a/2,Me=z.x,ge=B*a+a/2,ot=Me-ve,Ae=ve+ot/2,pt=V=>{let te=1-V,ue=te*te,Le=ue*te,nt=V*V,Ne=nt*V,de=Le*ve+3*ue*V*Ae+3*te*nt*Ae+Ne*Me,xe=Le*we+3*ue*V*we+3*te*nt*ge+Ne*ge;return {x:de,y:xe}},mt=20,gt=[];for(let V=0;V<=mt;V++){let te=.1+V/mt*.8;gt.push(pt(te));}let Je=gt[0],W=`M ${Je.x} ${Je.y} `+gt.slice(1).map(V=>`L ${V.x} ${V.y}`).join(" ");return f&&f.x1===ve&&f.y1===we&&f.x2===Me&&f.y2===ge?null:jsxRuntime.jsx("path",{d:W,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{x({x1:ve,y1:we,x2:Me,y2:ge,onDelete:()=>h?.(O.id,$)});}},`dep-hover-${$}-${O.id}`)})),p.map(O=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:O.previewX,y:O.y-48,width:O.width,height:32,rx:8,fill:O.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(O.daysDelta)>0&&jsxRuntime.jsx("text",{x:O.previewX+O.width/2,y:O.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:O.daysDelta>0?`+${O.daysDelta}d`:`${O.daysDelta}d`})]},`cascade-preview-${O.taskId}`)),f&&(()=>{let{x1:O,y1:B,x2:$,y2:F,onDelete:q}=f,Z=$-O,z=F-B,ve=O+Z/2,we=(B+F)/2,Me=`M ${O} ${B} C ${ve} ${B}, ${ve} ${F}, ${$} ${F}`,ge=6,ot=Math.atan2(z,Z),Ae=$-ge*Math.cos(ot-Math.PI/6),pt=F-ge*Math.sin(ot-Math.PI/6),mt=$-ge*Math.cos(ot+Math.PI/6),gt=F-ge*Math.sin(ot+Math.PI/6),Je=t.dependency,W="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>x(null),children:[jsxRuntime.jsx("path",{d:Me,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:ve,cy:we,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Me,fill:"none",stroke:Je,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Me,fill:"none",stroke:Je,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${$} ${F} L ${Ae} ${pt} M ${$} ${F} L ${mt} ${gt}`,fill:"none",stroke:Je,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:$,cy:F,r:4,fill:Je,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:V=>{V.stopPropagation(),x(null),q();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:ve,cy:we,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:W,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:ve-3,y1:we-3,x2:ve+3,y2:we+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ve+3,y1:we-3,x2:ve-3,y2:we+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Fe>=0&&Fe<=k&&jsxRuntime.jsx("line",{x1:Fe,y1:0,x2:Fe,y2:se,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsxRuntime.jsx(nc,{tooltipData:w,theme:t})]})]})}var r0=['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"'],lc=()=>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"})]}),o0=()=>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"})}),n0=()=>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"})}),s0=()=>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"})}),i0=()=>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 Pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:c,onDependencyDelete:m}){let[l,g]=react.useState(false),[d,i]=react.useState(false),[h,b]=react.useState([]),[p,v]=react.useState(""),[w,u]=react.useState(false),[f,x]=react.useState(true),D=react.useRef(null),S=react.useRef(null),L=react.useRef(null),{enabled:k=true,placeholder:U='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:C,suggestions:H=r0,maxHistory:R=50,persistHistory:J}=a,re=J?.storageKey||"gantt-ai-history",Ce=J?.maxMessages??5;react.useEffect(()=>{if(J?.enabled)try{let $=localStorage.getItem(re);if($){let q=JSON.parse($).map(Z=>({...Z,timestamp:new Date(Z.timestamp)}));b(q.slice(-Ce));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[J?.enabled,re,Ce]),react.useEffect(()=>{if(J?.enabled&&h.length>0)try{let $=h.filter(F=>!F.isLoading).slice(-Ce);localStorage.setItem(re,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[h,J?.enabled,re,Ce]),react.useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{l&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[l,d]);let Se=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&o?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&n?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&c?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&m?.($.taskId,$.dependencyFrom);break}},[o,s,n,c,m]),Fe=react.useCallback(async $=>{if(!$.trim()||w)return;let F={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};b(Z=>[...Z.slice(-(R-1)),F]),v(""),x(false),u(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(Z=>[...Z,q]);try{if(C){let Z=await C($,e);b(z=>{let ve=z.filter(Me=>!Me.isLoading),we={id:`assistant-${Date.now()}`,role:"assistant",content:Z.message,timestamp:new Date,command:Z};return [...ve,we]}),Se(Z);}else b(Z=>[...Z.filter(ve=>!ve.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(Z){b(z=>[...z.filter(we=>!we.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Z instanceof Error?Z.message:"Unknown error"}`,timestamp:new Date}]);}finally{u(false);}},[w,R,C,e,Se]),se=$=>{$.preventDefault(),Fe(p);},O=$=>{v($),D.current?.focus();};if(react.useEffect(()=>{let $=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),g(q=>!q),l||i(false)),F.key==="Escape"&&l&&g(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[l]),react.useEffect(()=>{if(!l)return;let $=q=>{let Z=q.target;L.current&&!L.current.contains(Z)&&g(false);},F=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(F),document.removeEventListener("mousedown",$);}},[l]),!k)return null;let B={"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(dt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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 ${B[P]} 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:()=>g(true),children:[jsxRuntime.jsx(lc,{}),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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${B[P]} 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(lc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i($=>!$),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(s0,{})}),jsxRuntime.jsx("button",{onClick:()=>g(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(n0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.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:H.slice(0,4).map(($,F)=>jsxRuntime.jsx("button",{onClick:()=>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:$.length>30?$.slice(0,30)+"...":$},F))})]}),h.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:$.role==="user"?"white":t.textPrimary},children:[$.isLoading?jsxRuntime.jsx(i0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:$.command.success?"#10B981":"#EF4444"},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:S})]}),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:D,type:"text",value:p,onChange:$=>v($.target.value),placeholder:U,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!p.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:p.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:p.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(o0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function dc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,g=true)=>{r(d=>{let i=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:i};if(!g)return {...d,present:i};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:i,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let g=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:g,future:[l.present,...l.future]}});},[]),c=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let g=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:g,future:d}});},[]),m=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function cc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!c&&m&&n.key==="y"){n.preventDefault(),t();return}if(c&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var p0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${pe.formatDate(e.startDate)} - ${pe.formatDate(e.endDate)}`);let a=pe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function pc(e){return {...p0,...e}}var y0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},gc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:l=true,availableUsers:g=[],templates:d,enableAutoCriticalPath:i=true,persistExpandedState:h,aiAssistant:b,locale:p="en",customTranslations:v,showCreateTaskButton:w=false,createTaskLabel:u,onCreateTask:f,onThemeChange:x,onTaskClick:D,onTaskDblClick:S,onTaskContextMenu:L,onTaskUpdate:k,onProgressChange:U,onTaskEdit:P,onTaskAddSubtask:C,onTaskMarkIncomplete:H,onTaskSetInProgress:R,onDependencyCreate:J,onDependencyDelete:re,onBeforeTaskAdd:Ce,onAfterTaskAdd:Se,onBeforeTaskUpdate:Fe,onAfterTaskUpdate:se,onBeforeTaskDelete:O,onAfterTaskDelete:B}=a,F=react.useContext(gn)?.theme,[q,Z]=react.useState(F||s||"dark"),[z,ve]=react.useState(n),[we,Me]=react.useState(c),[ge,ot]=react.useState(1),[Ae,pt]=react.useState(0),[mt,gt]=react.useState(false),[Je,W]=react.useState(null),[T,V]=react.useState({isOpen:false,x:0,y:0,task:null}),[te,ue]=react.useState(null),[Le,nt]=react.useState(null);react.useEffect(()=>{F&&F!==q&&Z(F);},[F]),react.useEffect(()=>{s&&s!==q&&Z(s);},[s]);let Ne=react.useCallback(A=>{Z(A),x?.(A);},[x]),{state:de,setState:xe,undo:it,redo:lt,canUndo:sa,canRedo:ca,clearHistory:He}=dc(t,50),ze=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),pa=react.useRef(new Map),fe=react.useRef(false);if(!fe.current&&h){fe.current=true;let A=typeof h=="string"?h:"gantt-expanded-tasks";try{let I=localStorage.getItem(A);if(I){let j=JSON.parse(I);Array.isArray(j)&&(pa.current=new Map(j));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let Ge=react.useCallback(()=>{let A=ze();if(A)try{let I=Array.from(pa.current.entries());localStorage.setItem(A,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[ze]);react.useEffect(()=>{let A=I=>I.map(j=>{let ne=pa.current.get(j.id),me=ne!==void 0?{...j,isExpanded:ne}:j;return me.subtasks?.length?{...me,subtasks:A(me.subtasks)}:me});pa.current.size>0?xe(A(t)):xe(t);},[t,xe]);let Ee=react.useRef(t),Ue=react.useRef(true);react.useEffect(()=>{if(Ue.current){Ue.current=false,Ee.current=de;return}if(!r)return;let A=JSON.stringify(Ee.current),I=JSON.stringify(de);A!==I&&(Ee.current=de,r(de));},[de,r]);let Ye=react.useMemo(()=>qs(p,v),[p,v]),ft=react.useCallback(A=>[{id:"name",label:A.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:A.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:A.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:A.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:A.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:A.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:A.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:A.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ze,tt]=react.useState(()=>ft(Ye));react.useEffect(()=>{tt(A=>A.map(I=>({...I,label:Ye.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Ye]);let ht=react.useMemo(()=>Ze.filter(I=>I.visible).reduce((I,j)=>I+j.width,0),[Ze]),jt=react.useRef(Ze.filter(A=>A.visible).map(A=>A.id).join(","));react.useEffect(()=>{let A=Ze.filter(ne=>ne.visible),I=A.map(ne=>ne.id).join(","),j=jt.current;if(I!==j){let ne=A.some(Te=>Te.id!=="name"),me=j.includes(",");ne?!me&&ne&&W(null):W(null),jt.current=I;}},[Ze]);let Q=60,oe=.6,De=react.useMemo(()=>{let I=ht+Q,j=typeof window<"u"?window.innerWidth*oe:800,ne=Math.max(I,j);return Je!==null?Math.max(200,Math.min(Je,ne)):Math.max(200,I)},[Je,ht]),Re=react.useRef(null),N=react.useRef(null),M=react.useRef(null),_=react.useMemo(()=>Ad(q),[q]),ce=react.useMemo(()=>({theme:_,themeName:q}),[_,q]),_e=react.useMemo(()=>pc(d),[d]),X=react.useMemo(()=>{if(!i)return de;let A=pe.calculateCriticalPath(de),I=j=>j.map(ne=>({...ne,isCriticalPath:A.includes(ne.id),subtasks:ne.subtasks?I(ne.subtasks):void 0}));return I(de)},[de,i]),Ie=y0(we);cc({undo:it,redo:lt,canUndo:sa,canRedo:ca,enabled:true}),react.useImperativeHandle(o,()=>({getTask:A=>pe.findTaskById(de,A),addTask:(A,I)=>{xe(j=>{if(!I)return [...j,{...A,level:0}];let ne=me=>me.map(Te=>Te.id===I?{...Te,subtasks:[...Te.subtasks||[],{...A,parentId:I,level:(Te.level||0)+1}],isExpanded:true}:Te.subtasks?{...Te,subtasks:ne(Te.subtasks)}:Te);return ne(j)});},updateTask:(A,I)=>{xe(j=>{let ne=me=>me.map(Te=>Te.id===A?{...Te,...I}:Te.subtasks?{...Te,subtasks:ne(Te.subtasks)}:Te);return ne(j)});},deleteTask:A=>{xe(I=>{let j=ne=>ne.filter(me=>me.id===A?false:(me.subtasks&&(me.subtasks=j(me.subtasks)),true));return j(I)});},deleteTasks:A=>{xe(I=>ai(I,A));},duplicateTask:A=>{xe(I=>ri(I,[A]));},splitTask:(A,I,j=3)=>{xe(ne=>pe.splitTask(ne,A,I,j));},calculateEndDate:pe.calculateEndDate,calculateDuration:pe.calculateDuration,validateDependency:(A,I)=>!pe.validateDependencies(de,A,I),getAllTasks:()=>pe.flattenTasks(de),getTasksByStatus:A=>pe.flattenTasks(de).filter(I=>I.status===A),getTasksByParent:A=>A?pe.findTaskById(de,A)?.subtasks||[]:de.filter(j=>!j.parentId),getCriticalPath:()=>pe.flattenTasks(de).filter(A=>A.isCriticalPath),indentTask:A=>{xe(I=>Qs(I,[A]));},outdentTask:A=>{xe(I=>ei(I,[A]));},moveTask:(A,I)=>{xe(j=>ti(j,[A],I));},createSubtask:async A=>{let{tasks:I,newTask:j}=si(de,A);if(Ce){let ne=Ce({...j,parentId:A});if((ne instanceof Promise?await ne:ne)===false)return}xe(I),Se&&Se({...j,parentId:A});},scrollToTask:A=>{let j=pe.flattenTasks(de).findIndex(ne=>ne.id===A);if(j!==-1&&Re.current){let ne=j*Ie;Re.current.scrollTo({top:ne,behavior:"smooth"}),N.current&&N.current.scrollTo({top:ne,behavior:"smooth"});}},highlightTask:(A,I=2e3)=>{},expandTask:A=>{xe(I=>{let j=ne=>ne.map(me=>me.id===A?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(I)});},collapseTask:A=>{xe(I=>{let j=ne=>ne.map(me=>me.id===A?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(I)});},expandAll:()=>{xe(A=>{let I=j=>j.map(ne=>({...ne,isExpanded:true,subtasks:ne.subtasks?I(ne.subtasks):void 0}));return I(A)});},collapseAll:()=>{xe(A=>{let I=j=>j.map(ne=>({...ne,isExpanded:false,subtasks:ne.subtasks?I(ne.subtasks):void 0}));return I(A)});},undo:it,redo:lt,canUndo:()=>sa,canRedo:()=>ca,clearHistory:He,exportToPNG:async()=>{if(!M.current||!Re.current||!N.current)throw new Error("Gantt container not found");let A=M.current,I=Re.current.querySelector(".gantt-grid-scroll"),j=N.current,ne=I?.scrollTop||0,me=j.scrollTop,Te=A.style.overflow,vt=A.style.height;try{let Kt=I?.querySelector(".gantt-taskgrid-content"),ma=j.querySelector("svg"),ua=Kt?.scrollHeight||I?.scrollHeight||600,Ca=ma?.getBoundingClientRect().height||j.scrollHeight,Pr=(A.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ua,Ca)+20;I&&(I.scrollTop=0),j.scrollTop=0,A.style.overflow="visible",A.style.height=`${Pr}px`,await new Promise(ur=>setTimeout(ur,100));let mr=await uc__default.default(A,{backgroundColor:_.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:ur=>{let Jr=window.getComputedStyle(ur),Mr=parseInt(Jr.zIndex,10);return !isNaN(Mr)&&Mr>=50||Jr.position==="fixed"}});return new Promise((ur,Jr)=>{mr.toBlob(Mr=>{Mr?ur(Mr):Jr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{A.style.overflow=Te,A.style.height=vt,I&&(I.scrollTop=ne),j.scrollTop=me;}},exportToPDF:async A=>{await pe.exportToPDF(de,A);},exportToExcel:async A=>{await pe.exportToExcel(de,A);},exportToJSON:()=>pe.exportToJSON(de),exportToCSV:()=>pe.exportToCSV(de),importFromJSON:A=>{let I=pe.importFromJSON(A);xe(I);},getTasks:()=>de,refresh:()=>{xe(A=>[...A]);},clearAll:()=>{xe([]);}}),[de,it,lt,sa,ca,He,_,Ie]);let Nt=react.useCallback(A=>{tt(I=>I.map(j=>j.id===A?{...j,visible:!j.visible}:j));},[]),Pe=react.useCallback((A,I)=>{tt(j=>j.map(ne=>{if(ne.id!==A)return ne;let me=ne.minWidth??100,Te=ne.maxWidth??800,vt=Math.max(me,Math.min(Te,I));return {...ne,width:vt}}));},[]),ta=react.useCallback(A=>{xe(I=>{let j=ni(I,A),ne=me=>{for(let Te of me){if(Te.id===A){pa.current.set(A,Te.isExpanded??true);return}Te.subtasks?.length&&ne(Te.subtasks);}};return ne(j),Ge(),j}),a.onTaskToggleExpand?.(A);},[a,Ge]),ae=react.useCallback((A,I)=>{if(Fe&&Fe(A,I)===false)return;let ne=pe.findTaskById(de,A)?.progress,me=vt=>vt.map(Kt=>Kt.id===A?{...Kt,...I}:Kt.subtasks?{...Kt,subtasks:me(Kt.subtasks)}:Kt);xe(me(de));let Te=pe.findTaskById(me(de),A);Te&&(k?.(Te),se?.(Te),I.progress!==void 0&&ne!==void 0&&I.progress!==ne&&U?.(A,ne,I.progress));},[de,k,Fe,se,U]),at=react.useCallback(A=>{A.length!==0&&(xe(I=>Qs(I,A)),a.onTaskIndent?.(A[0]));},[a]),Qe=react.useCallback(A=>{A.length!==0&&(xe(I=>ei(I,A)),a.onTaskOutdent?.(A[0]));},[a]),Be=react.useCallback((A,I,j)=>{xe(ne=>Jd(ne,A,I,j)),a.onTaskReparent?.(A,I,j);},[a]),St=react.useCallback((A,I)=>{A.length!==0&&(xe(j=>ti(j,A,I)),a.onTaskMove?.(A[0],I));},[a]),Et=react.useCallback(async A=>{let I=[];for(let j of A)O&&await Promise.resolve(O(j))===false||I.push(j);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(xe(j=>ai(j,I)),I.forEach(j=>a.onTaskDelete?.(j))),B&&I.forEach(j=>B(j)));},[a,O,B]),ia=react.useCallback(A=>{xe(I=>ri(I,A)),A.forEach(I=>a.onTaskDuplicate?.(I));},[a]),Er=react.useCallback((A,I)=>{xe(j=>{let{tasks:ne,newTask:me}=Xd(j,A,I);return Ce&&Ce(me)===false?j:(a.onTaskCreate?.(me.parentId,me.position||0),Se?.(me),ne)});},[a,Ce,Se]),_t=react.useCallback((A,I)=>{xe(j=>oi(j,A,I)),a.onTaskRename?.(A,I);},[a]),bo=react.useCallback(A=>{xe(I=>{let{tasks:j}=si(I,A);return a.onTaskCreate?.(A,0),j});},[a]),Kn=react.useCallback((A,I,j)=>{let ne=A.startDate?Math.round((I.getTime()-A.startDate.getTime())/864e5):0,me=Kt=>Kt.map(ma=>ma.id===A.id?{...ma,startDate:I,endDate:j,...A.segments&&{segments:A.segments}}:ma.subtasks?{...ma,subtasks:me(ma.subtasks)}:ma),Te=me(de);Te=pe.autoScheduleDependents(Te,A.id,ne),xe(Te);let vt={...A,startDate:I,endDate:j};k?.(vt);},[de,k]),ll=react.useCallback((A,I)=>{L?.(A,I),V({isOpen:true,x:I.clientX,y:I.clientY,task:A});},[L]),yo=react.useCallback((A,I)=>{let j=pe.splitTask(de,A.id,I);xe(j),V({isOpen:false,x:0,y:0,task:null});},[de]),dl=react.useCallback(A=>{let I=pe.findTaskById(de,A.id)||A;S?.(I),P||ue(I);},[de,S,P]),cl=react.useCallback((A,I,j)=>{let ne=new Map,me=ua=>{ua.forEach(Ca=>{Ca.dependencies&&ne.set(Ca.id,Ca.dependencies),Ca.subtasks&&me(Ca.subtasks);});};me(j);let Te=ne.get(I)||[];ne.set(I,[...Te,A]);let vt=new Set,Kt=new Set,ma=ua=>{if(!vt.has(ua)){vt.add(ua),Kt.add(ua);let Ca=ne.get(ua)||[];for(let pr of Ca){if(!vt.has(pr)&&ma(pr))return true;if(Kt.has(pr))return true}}return Kt.delete(ua),false};return ma(I)},[]),pl=react.useCallback((A,I)=>{if(cl(A.id,I,de)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,u=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=me.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let u=l.startDate&&l.endDate?me.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let h of l.dependencies){let C=t.find(p=>p.id===h);if(C){o(C);let p=r.get(h)?.ef||0;d=Math.max(d,p);}}let i=d+u;r.set(l.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,c=l=>{if(n.has(l.id))return;let u=l.startDate&&l.endDate?me.calculateDuration(l.startDate,l.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(l.id)),i=s;if(d.length>0)for(let C of d){c(C);let p=n.get(C.id)?.ls||0;i=Math.min(i,p);}let h=i-u;n.set(l.id,{ls:h,lf:i});};a.forEach(c);let m=[];for(let l of a){let u=r.get(l.id),d=n.get(l.id);if(u&&d){let i=d.ls-u.es;Math.abs(i)<.01&&m.push(l.id);}}return m},calculateSlack:(e,t)=>{let a=me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(me.calculateCriticalPath(e).includes(t))return 0;let o=me.getDependentTasks(e,t);if(o.length===0){let c=me.getLatestEndDate(e);if(!c)return null;let m=me.calculateDuration(a.endDate,c);return Math.max(0,m)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!s)return null;let n=me.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=me.findTaskById(e,t);if(!r||!r.endDate)return e;let o=me.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let c=me.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let l=me.calculateEndDate(m,c),u=d=>d.map(i=>i.id===n.id?{...i,startDate:m,endDate:l}:i.subtasks?{...i,subtasks:u(i.subtasks)}:i);s=u(s),s=me.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,c)=>{if(a===0)return [];let m=[],l=o.getTime(),u=1e3*60*60*24,d=me.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(h,C,p=new Set)=>{if(p.has(h))return;p.add(h);let y=me.getDependentTasks(e,h);for(let f of y){if(!f.startDate||!f.endDate)continue;let v=r.findIndex(T=>T.id===f.id);if(v===-1)continue;let g=f.startDate.getTime(),x=(f.endDate.getTime()-g)/u,B=(g-l)/u*s,w=B+C*s,z=Math.max(x*s,s),P=c+v*n+12;m.push({taskId:f.id,taskName:f.name,originalX:B,previewX:w,width:z,y:P,rowIndex:v,daysDelta:C,color:f.color}),i(f.id,C,p);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=me.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:c}],l=u=>u.map(d=>d.id===o.id?{...d,endDate:c,segments:m}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function En({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:c,onTaskClick:m,onTaskDblClick:l,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:h}){let[p,y]=react.useState([]),[f,v]=react.useState(null),[g,k]=react.useState(null),x=react.useCallback(O=>{v(O);},[]),D=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),B=r==="day"?60:r==="week"?20:8,w=D*B*n,z=O=>{let L=new Date(Date.UTC(O.getFullYear(),O.getMonth(),O.getDate())),H=L.getUTCDay()||7;L.setUTCDate(L.getUTCDate()+4-H);let F=new Date(Date.UTC(L.getUTCFullYear(),0,1));return Math.ceil(((L.getTime()-F.getTime())/864e5+1)/7)},P=O=>{let L=O.getDay();return L===0||L===6},T=react.useCallback(O=>{let L=Math.round(O/(B*n)),H=new Date(o);return H.setDate(H.getDate()+L),H},[o,B,n]),G=react.useCallback((O,L)=>{if(L.startDate&&L.endDate)return;let H=O.currentTarget.ownerSVGElement;if(!H)return;let F=H.createSVGPoint();F.x=O.clientX,F.y=O.clientY;let q=F.matrixTransform(H.getScreenCTM()?.inverse()),J=T(q.x),U=new Date(J);U.setDate(U.getDate()+1),d?.(L,J,U);},[T,d]),R=react.useMemo(()=>{let O=q=>q.map(J=>{if(J.subtasks&&J.subtasks.length>0){let U=O(J.subtasks),xe=U.filter(Te=>Te.startDate&&Te.endDate);if(xe.length>0){let Te=xe.map(Ee=>Ee.startDate.getTime()),Le=xe.map(Ee=>Ee.endDate.getTime()),ye=new Date(Math.min(...Te)),tt=new Date(Math.max(...Le));return {...J,subtasks:U,startDate:ye,endDate:tt}}return {...J,subtasks:U}}return J}),L=(q,J=[])=>{for(let U of q)J.push(U),U.subtasks&&U.subtasks.length>0&&(U.isExpanded===void 0||U.isExpanded)&&L(U.subtasks,J);return J},H=O(e);return L(H)},[e]),Y=react.useCallback(O=>{if(!O.startDate||!O.endDate)return {x:0,width:0};let L=O.startDate.getTime(),H=O.endDate.getTime(),F=o.getTime(),q=(L-F)/(1e3*60*60*24),J=(H-L)/(1e3*60*60*24),U=q*B*n,xe=Math.max(B*n,40),Te=Math.max(J*B*n,xe);return {x:U,width:Te}},[o,B,n]),te=react.useMemo(()=>R.filter(O=>O.startDate&&O.endDate).map(O=>{let{x:L,width:H}=Y(O),q=R.findIndex(J=>J.id===O.id)*a+12;return {id:O.id,x:L,y:q,width:H,height:32}}),[R,Y]),ve=react.useCallback((O,L,H)=>{if(!H||L===0){y([]);return}let F=me.calculateCascadePreview(e,O,L,R,o,B*n,a,48);y(F);},[e,R,o,B,n,a,48]),Ie=react.useMemo(()=>{let O=[],L=new Date(o);for(;L<=s;){let q=(L.getTime()-o.getTime())/864e5*B*n;if(r==="day")O.push({date:new Date(L),label:L.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:q}),L.setDate(L.getDate()+1);else if(r==="week"){let J=z(L);O.push({date:new Date(L),label:`Week ${J}`,x:q}),L.setDate(L.getDate()+7);}else O.push({date:new Date(L),label:L.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:q}),L.setMonth(L.getMonth()+1);}return O},[o,s,r,B,n]),Ue=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*B*n,[o,B,n]),le=Math.max(R.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(w,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(w,1e3),height:48,fill:t.bgGrid}),Ie.map((O,L)=>jsxRuntime.jsxs("g",{children:[L>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:O.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:O.label})]},`header-${L}`)),Ue>=0&&Ue<=w&&jsxRuntime.jsx("circle",{cx:Ue,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(w,1e3),height:le,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(w,1e3),height:le,fill:t.bgPrimary}),Ie.map((O,L)=>{let H=Ie[L+1]?.x||w,F=P(O.date);return jsxRuntime.jsxs("g",{children:[F&&jsxRuntime.jsx("rect",{x:O.x,y:0,width:H-O.x,height:R.length*a,fill:t.bgWeekend,opacity:1}),L>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:R.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},L)}),R.map((O,L)=>{let H=O.startDate&&O.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:w,height:a,fill:L%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${O.id}`),!H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:w,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:F=>G(F,O),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-${O.id}`),jsxRuntime.jsx("text",{x:Ue>0?Ue:100,y:L*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${O.id}`)]})]},`row-group-${O.id}`)}),R.map((O,L)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(H=>{let F=R.find(xe=>xe.id===H);if(!F||!F.startDate||!F.endDate)return null;let q=R.findIndex(xe=>xe.id===H),J=Y(F),U=Y(O);return jsxRuntime.jsx(Tn,{x1:J.x+J.width,y1:q*a+a/2,x2:U.x,y2:L*a+a/2,theme:t},`dep-${H}-${O.id}`)})),R.map((O,L)=>{if(!O.startDate||!O.endDate)return null;let{x:H,width:F}=Y(O),q=L*a+12,J=O.subtasks&&O.subtasks.length>0&&!O.isMilestone;return O.isMilestone?jsxRuntime.jsx(Dn,{task:O,x:H+F/2,y:q+16,theme:t,onClick:m},O.id):J?jsxRuntime.jsxs("g",{onClick:()=>m?.(O),onContextMenu:U=>{U.preventDefault(),U.stopPropagation(),u?.(O,U);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:H,y:q,width:F,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:H,y1:q,x2:H+F,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H,y1:q,x2:H,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+F,y1:q,x2:H+F,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H,y1:q+32,x2:H+F,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),F>60&&jsxRuntime.jsx("text",{x:H+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:O.name})]},O.id):jsxRuntime.jsx(kn,{task:O,x:H,y:q,width:F,theme:t,dayWidth:B*n,startDate:o,templates:c,onClick:m,onDoubleClick:l,onContextMenu:u,onDateChange:d,onDependencyCreate:i,allTaskPositions:te,onDragMove:ve,onHoverChange:x},O.id)}),R.map((O,L)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(H=>{let F=R.find(ce=>ce.id===H);if(!F||!F.startDate||!F.endDate)return null;let q=R.findIndex(ce=>ce.id===H),J=Y(F),U=Y(O),xe=J.x+J.width,Te=q*a+a/2,Le=U.x,ye=L*a+a/2,tt=Le-xe,Ee=xe+tt/2,dt=ce=>{let Ce=1-ce,Pe=Ce*Ce,at=Pe*Ce,mt=ce*ce,Be=mt*ce,fe=at*xe+3*Pe*ce*Ee+3*Ce*mt*Ee+Be*Le,Me=at*Te+3*Pe*ce*Te+3*Ce*mt*ye+Be*ye;return {x:fe,y:Me}},it=20,ut=[];for(let ce=0;ce<=it;ce++){let Ce=.1+ce/it*.8;ut.push(dt(Ce));}let _e=ut[0],$=`M ${_e.x} ${_e.y} `+ut.slice(1).map(ce=>`L ${ce.x} ${ce.y}`).join(" ");return g&&g.x1===xe&&g.y1===Te&&g.x2===Le&&g.y2===ye?null:jsxRuntime.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:xe,y1:Te,x2:Le,y2:ye,onDelete:()=>h?.(O.id,H)});}},`dep-hover-${H}-${O.id}`)})),p.map(O=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:O.previewX,y:O.y-48,width:O.width,height:32,rx:8,fill:O.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(O.daysDelta)>0&&jsxRuntime.jsx("text",{x:O.previewX+O.width/2,y:O.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:O.daysDelta>0?`+${O.daysDelta}d`:`${O.daysDelta}d`})]},`cascade-preview-${O.taskId}`)),g&&(()=>{let{x1:O,y1:L,x2:H,y2:F,onDelete:q}=g,J=H-O,U=F-L,xe=O+J/2,Te=(L+F)/2,Le=`M ${O} ${L} C ${xe} ${L}, ${xe} ${F}, ${H} ${F}`,ye=6,tt=Math.atan2(U,J),Ee=H-ye*Math.cos(tt-Math.PI/6),dt=F-ye*Math.sin(tt-Math.PI/6),it=H-ye*Math.cos(tt+Math.PI/6),ut=F-ye*Math.sin(tt+Math.PI/6),_e=t.dependency,$="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:Le,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:xe,cy:Te,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Le,fill:"none",stroke:_e,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Le,fill:"none",stroke:_e,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${H} ${F} L ${Ee} ${dt} M ${H} ${F} L ${it} ${ut}`,fill:"none",stroke:_e,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:H,cy:F,r:4,fill:_e,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ce=>{ce.stopPropagation(),k(null),q();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:xe,cy:Te,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:$,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:xe-3,y1:Te-3,x2:xe+3,y2:Te+3,stroke:$,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:xe+3,y1:Te-3,x2:xe-3,y2:Te+3,stroke:$,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Ue>=0&&Ue<=w&&jsxRuntime.jsx("line",{x1:Ue,y1:0,x2:Ue,y2:le,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),f&&jsxRuntime.jsx(sc,{tooltipData:f,theme:t})]})]})}var o0=['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"'],dc=()=>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"})]}),n0=()=>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"})}),s0=()=>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"})}),i0=()=>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"})}),l0=()=>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 Pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:c,onDependencyDelete:m}){let[l,u]=react.useState(false),[d,i]=react.useState(false),[h,C]=react.useState([]),[p,y]=react.useState(""),[f,v]=react.useState(false),[g,k]=react.useState(true),x=react.useRef(null),D=react.useRef(null),B=react.useRef(null),{enabled:w=true,placeholder:z='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:T,suggestions:G=o0,maxHistory:R=50,persistHistory:Y}=a,te=Y?.storageKey||"gantt-ai-history",ve=Y?.maxMessages??5;react.useEffect(()=>{if(Y?.enabled)try{let H=localStorage.getItem(te);if(H){let q=JSON.parse(H).map(J=>({...J,timestamp:new Date(J.timestamp)}));C(q.slice(-ve));}}catch(H){console.warn("[GanttAIAssistant] Failed to load persisted history:",H);}},[Y?.enabled,te,ve]),react.useEffect(()=>{if(Y?.enabled&&h.length>0)try{let H=h.filter(F=>!F.isLoading).slice(-ve);localStorage.setItem(te,JSON.stringify(H));}catch(H){console.warn("[GanttAIAssistant] Failed to persist history:",H);}},[h,Y?.enabled,te,ve]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{l&&!d&&x.current&&setTimeout(()=>x.current?.focus(),100);},[l,d]);let Ie=react.useCallback(H=>{if(H.success)switch(H.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":H.taskId&&H.updates&&o?.(H.taskId,H.updates);break;case "create_task":H.newTask&&s?.(H.newTask);break;case "delete_task":H.taskId&&n?.(H.taskId);break;case "link_tasks":H.dependencyFrom&&H.dependencyTo&&c?.(H.dependencyFrom,H.dependencyTo);break;case "unlink_tasks":H.taskId&&H.dependencyFrom&&m?.(H.taskId,H.dependencyFrom);break}},[o,s,n,c,m]),Ue=react.useCallback(async H=>{if(!H.trim()||f)return;let F={id:`user-${Date.now()}`,role:"user",content:H,timestamp:new Date};C(J=>[...J.slice(-(R-1)),F]),y(""),k(false),v(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(J=>[...J,q]);try{if(T){let J=await T(H,e);C(U=>{let xe=U.filter(Le=>!Le.isLoading),Te={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...xe,Te]}),Ie(J);}else C(J=>[...J.filter(xe=>!xe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(J){C(U=>[...U.filter(Te=>!Te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[f,R,T,e,Ie]),le=H=>{H.preventDefault(),Ue(p);},O=H=>{y(H),x.current?.focus();};if(react.useEffect(()=>{let H=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),u(q=>!q),l||i(false)),F.key==="Escape"&&l&&u(false);};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[l]),react.useEffect(()=>{if(!l)return;let H=q=>{let J=q.target;B.current&&!B.current.contains(J)&&u(false);},F=setTimeout(()=>{document.addEventListener("mousedown",H);},100);return ()=>{clearTimeout(F),document.removeEventListener("mousedown",H);}},[l]),!w)return null;let L={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(ct,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[P]} 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:()=>u(true),children:[jsxRuntime.jsx(dc,{}),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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:B,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[P]} 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(dc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(H=>!H),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(i0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(s0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.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:G.slice(0,4).map((H,F)=>jsxRuntime.jsx("button",{onClick:()=>O(H),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:H.length>30?H.slice(0,30)+"...":H},F))})]}),h.map(H=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${H.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${H.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:H.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:H.role==="user"?"white":t.textPrimary},children:[H.isLoading?jsxRuntime.jsx(l0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:H.content}),H.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:H.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:H.command.success?"#10B981":"#EF4444"},children:[H.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:H.command.type.replace(/_/g," ")})]})]})},H.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:le,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:x,type:"text",value:p,onChange:H=>y(H.target.value),placeholder:z,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!p.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:p.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:p.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(n0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function cc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,u=true)=>{r(d=>{let i=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:i};if(!u)return {...d,present:i};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:i,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let u=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[l.present,...l.future]}});},[]),c=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let u=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function pc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!c&&m&&n.key==="y"){n.preventDefault(),t();return}if(c&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var m0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${me.formatDate(e.startDate)} - ${me.formatDate(e.endDate)}`);let a=me.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function mc(e){return {...m0,...e}}var v0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},fc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:l=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:i=true,persistExpandedState:h,aiAssistant:C,locale:p="en",customTranslations:y,showCreateTaskButton:f=false,createTaskLabel:v,onCreateTask:g,onThemeChange:k,onTaskClick:x,onTaskDblClick:D,onTaskContextMenu:B,onTaskUpdate:w,onProgressChange:z,onTaskEdit:P,onTaskAddSubtask:T,onTaskMarkIncomplete:G,onTaskSetInProgress:R,onDependencyCreate:Y,onDependencyDelete:te,onBeforeTaskAdd:ve,onAfterTaskAdd:Ie,onBeforeTaskUpdate:Ue,onAfterTaskUpdate:le,onBeforeTaskDelete:O,onAfterTaskDelete:L}=a,F=react.useContext(gn)?.theme,[q,J]=react.useState(F||s||"dark"),[U,xe]=react.useState(n),[Te,Le]=react.useState(c),[ye,tt]=react.useState(1),[Ee,dt]=react.useState(0),[it,ut]=react.useState(false),[_e,$]=react.useState(null),[ae,ce]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ce,Pe]=react.useState(null),[at,mt]=react.useState(null);react.useEffect(()=>{F&&F!==q&&J(F);},[F]),react.useEffect(()=>{s&&s!==q&&J(s);},[s]);let Be=react.useCallback(A=>{J(A),k?.(A);},[k]),{state:fe,setState:Me,undo:_t,redo:gt,canUndo:aa,canRedo:ia,clearHistory:E}=cc(t,50),ee=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),$e=react.useRef(new Map),re=react.useRef(false);if(!re.current&&h){re.current=true;let A=typeof h=="string"?h:"gantt-expanded-tasks";try{let I=localStorage.getItem(A);if(I){let V=JSON.parse(I);Array.isArray(V)&&($e.current=new Map(V));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let De=react.useCallback(()=>{let A=ee();if(A)try{let I=Array.from($e.current.entries());localStorage.setItem(A,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[ee]);react.useEffect(()=>{let A=I=>I.map(V=>{let se=$e.current.get(V.id),ge=se!==void 0?{...V,isExpanded:se}:V;return ge.subtasks?.length?{...ge,subtasks:A(ge.subtasks)}:ge});$e.current.size>0?Me(A(t)):Me(t);},[t,Me]);let we=react.useRef(t),Se=react.useRef(true);react.useEffect(()=>{if(Se.current){Se.current=false,we.current=fe;return}if(!r)return;let A=JSON.stringify(we.current),I=JSON.stringify(fe);A!==I&&(we.current=fe,r(fe));},[fe,r]);let Oe=react.useMemo(()=>qs(p,y),[p,y]),Ve=react.useCallback(A=>[{id:"name",label:A.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:A.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:A.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:A.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:A.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:A.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:A.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:A.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Re,Ze]=react.useState(()=>Ve(Oe));react.useEffect(()=>{Ze(A=>A.map(I=>({...I,label:Oe.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Oe]);let ht=react.useMemo(()=>Re.filter(I=>I.visible).reduce((I,V)=>I+V.width,0),[Re]),Kt=react.useRef(Re.filter(A=>A.visible).map(A=>A.id).join(","));react.useEffect(()=>{let A=Re.filter(se=>se.visible),I=A.map(se=>se.id).join(","),V=Kt.current;if(I!==V){let se=A.some(Ne=>Ne.id!=="name"),ge=V.includes(",");se?!ge&&se&&$(null):$(null),Kt.current=I;}},[Re]);let Z=60,ne=.6,Ae=react.useMemo(()=>{let I=ht+Z,V=typeof window<"u"?window.innerWidth*ne:800,se=Math.max(I,V);return _e!==null?Math.max(200,Math.min(_e,se)):Math.max(200,I)},[_e,ht]),We=react.useRef(null),N=react.useRef(null),M=react.useRef(null),_=react.useMemo(()=>Fd(q),[q]),pe=react.useMemo(()=>({theme:_,themeName:q}),[_,q]),Ye=react.useMemo(()=>mc(d),[d]),X=react.useMemo(()=>{if(!i)return fe;let A=me.calculateCriticalPath(fe),I=V=>V.map(se=>({...se,isCriticalPath:A.includes(se.id),subtasks:se.subtasks?I(se.subtasks):void 0}));return I(fe)},[fe,i]),ze=v0(Te);pc({undo:_t,redo:gt,canUndo:aa,canRedo:ia,enabled:true}),react.useImperativeHandle(o,()=>({getTask:A=>me.findTaskById(fe,A),addTask:(A,I)=>{Me(V=>{if(!I)return [...V,{...A,level:0}];let se=ge=>ge.map(Ne=>Ne.id===I?{...Ne,subtasks:[...Ne.subtasks||[],{...A,parentId:I,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:se(Ne.subtasks)}:Ne);return se(V)});},updateTask:(A,I)=>{Me(V=>{let se=ge=>ge.map(Ne=>Ne.id===A?{...Ne,...I}:Ne.subtasks?{...Ne,subtasks:se(Ne.subtasks)}:Ne);return se(V)});},deleteTask:A=>{Me(I=>{let V=se=>se.filter(ge=>ge.id===A?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(I)});},deleteTasks:A=>{Me(I=>ai(I,A));},duplicateTask:A=>{Me(I=>ri(I,[A]));},splitTask:(A,I,V=3)=>{Me(se=>me.splitTask(se,A,I,V));},calculateEndDate:me.calculateEndDate,calculateDuration:me.calculateDuration,validateDependency:(A,I)=>!me.validateDependencies(fe,A,I),getAllTasks:()=>me.flattenTasks(fe),getTasksByStatus:A=>me.flattenTasks(fe).filter(I=>I.status===A),getTasksByParent:A=>A?me.findTaskById(fe,A)?.subtasks||[]:fe.filter(V=>!V.parentId),getCriticalPath:()=>me.flattenTasks(fe).filter(A=>A.isCriticalPath),indentTask:A=>{Me(I=>Qs(I,[A]));},outdentTask:A=>{Me(I=>ei(I,[A]));},moveTask:(A,I)=>{Me(V=>ti(V,[A],I));},createSubtask:async A=>{let{tasks:I,newTask:V}=si(fe,A);if(ve){let se=ve({...V,parentId:A});if((se instanceof Promise?await se:se)===false)return}Me(I),Ie&&Ie({...V,parentId:A});},scrollToTask:A=>{let V=me.flattenTasks(fe).findIndex(se=>se.id===A);if(V!==-1&&We.current){let se=V*ze;We.current.scrollTo({top:se,behavior:"smooth"}),N.current&&N.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(A,I=2e3)=>{},expandTask:A=>{Me(I=>{let V=se=>se.map(ge=>ge.id===A?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(I)});},collapseTask:A=>{Me(I=>{let V=se=>se.map(ge=>ge.id===A?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(I)});},expandAll:()=>{Me(A=>{let I=V=>V.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?I(se.subtasks):void 0}));return I(A)});},collapseAll:()=>{Me(A=>{let I=V=>V.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?I(se.subtasks):void 0}));return I(A)});},undo:_t,redo:gt,canUndo:()=>aa,canRedo:()=>ia,clearHistory:E,exportToPNG:async()=>{if(!M.current||!We.current||!N.current)throw new Error("Gantt container not found");let A=M.current,I=We.current.querySelector(".gantt-grid-scroll"),V=N.current,se=I?.scrollTop||0,ge=V.scrollTop,Ne=A.style.overflow,vt=A.style.height;try{let Yt=I?.querySelector(".gantt-taskgrid-content"),ma=V.querySelector("svg"),ua=Yt?.scrollHeight||I?.scrollHeight||600,Na=ma?.getBoundingClientRect().height||V.scrollHeight,Pr=(A.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ua,Na)+20;I&&(I.scrollTop=0),V.scrollTop=0,A.style.overflow="visible",A.style.height=`${Pr}px`,await new Promise(ur=>setTimeout(ur,100));let mr=await gc__default.default(A,{backgroundColor:_.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:ur=>{let Jr=window.getComputedStyle(ur),Mr=parseInt(Jr.zIndex,10);return !isNaN(Mr)&&Mr>=50||Jr.position==="fixed"}});return new Promise((ur,Jr)=>{mr.toBlob(Mr=>{Mr?ur(Mr):Jr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{A.style.overflow=Ne,A.style.height=vt,I&&(I.scrollTop=se),V.scrollTop=ge;}},exportToPDF:async A=>{await me.exportToPDF(fe,A);},exportToExcel:async A=>{await me.exportToExcel(fe,A);},exportToJSON:()=>me.exportToJSON(fe),exportToCSV:()=>me.exportToCSV(fe),importFromJSON:A=>{let I=me.importFromJSON(A);Me(I);},getTasks:()=>fe,refresh:()=>{Me(A=>[...A]);},clearAll:()=>{Me([]);}}),[fe,_t,gt,aa,ia,E,_,ze]);let Nt=react.useCallback(A=>{Ze(I=>I.map(V=>V.id===A?{...V,visible:!V.visible}:V));},[]),Fe=react.useCallback((A,I)=>{Ze(V=>V.map(se=>{if(se.id!==A)return se;let ge=se.minWidth??100,Ne=se.maxWidth??800,vt=Math.max(ge,Math.min(Ne,I));return {...se,width:vt}}));},[]),ra=react.useCallback(A=>{Me(I=>{let V=ni(I,A),se=ge=>{for(let Ne of ge){if(Ne.id===A){$e.current.set(A,Ne.isExpanded??true);return}Ne.subtasks?.length&&se(Ne.subtasks);}};return se(V),De(),V}),a.onTaskToggleExpand?.(A);},[a,De]),oe=react.useCallback((A,I)=>{if(Ue&&Ue(A,I)===false)return;let se=me.findTaskById(fe,A)?.progress,ge=vt=>vt.map(Yt=>Yt.id===A?{...Yt,...I}:Yt.subtasks?{...Yt,subtasks:ge(Yt.subtasks)}:Yt);Me(ge(fe));let Ne=me.findTaskById(ge(fe),A);Ne&&(w?.(Ne),le?.(Ne),I.progress!==void 0&&se!==void 0&&I.progress!==se&&z?.(A,se,I.progress));},[fe,w,Ue,le,z]),nt=react.useCallback(A=>{A.length!==0&&(Me(I=>Qs(I,A)),a.onTaskIndent?.(A[0]));},[a]),rt=react.useCallback(A=>{A.length!==0&&(Me(I=>ei(I,A)),a.onTaskOutdent?.(A[0]));},[a]),He=react.useCallback((A,I,V)=>{Me(se=>Zd(se,A,I,V)),a.onTaskReparent?.(A,I,V);},[a]),St=react.useCallback((A,I)=>{A.length!==0&&(Me(V=>ti(V,A,I)),a.onTaskMove?.(A[0],I));},[a]),Et=react.useCallback(async A=>{let I=[];for(let V of A)O&&await Promise.resolve(O(V))===false||I.push(V);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(Me(V=>ai(V,I)),I.forEach(V=>a.onTaskDelete?.(V))),L&&I.forEach(V=>L(V)));},[a,O,L]),da=react.useCallback(A=>{Me(I=>ri(I,A)),A.forEach(I=>a.onTaskDuplicate?.(I));},[a]),Er=react.useCallback((A,I)=>{Me(V=>{let{tasks:se,newTask:ge}=Jd(V,A,I);return ve&&ve(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),Ie?.(ge),se)});},[a,ve,Ie]),Vt=react.useCallback((A,I)=>{Me(V=>oi(V,A,I)),a.onTaskRename?.(A,I);},[a]),bo=react.useCallback(A=>{Me(I=>{let{tasks:V}=si(I,A);return a.onTaskCreate?.(A,0),V});},[a]),Kn=react.useCallback((A,I,V)=>{let se=A.startDate?Math.round((I.getTime()-A.startDate.getTime())/864e5):0,ge=Yt=>Yt.map(ma=>ma.id===A.id?{...ma,startDate:I,endDate:V,...A.segments&&{segments:A.segments}}:ma.subtasks?{...ma,subtasks:ge(ma.subtasks)}:ma),Ne=ge(fe);Ne=me.autoScheduleDependents(Ne,A.id,se),Me(Ne);let vt={...A,startDate:I,endDate:V};w?.(vt);},[fe,w]),ll=react.useCallback((A,I)=>{B?.(A,I),ce({isOpen:true,x:I.clientX,y:I.clientY,task:A});},[B]),yo=react.useCallback((A,I)=>{let V=me.splitTask(fe,A.id,I);Me(V),ce({isOpen:false,x:0,y:0,task:null});},[fe]),dl=react.useCallback(A=>{let I=me.findTaskById(fe,A.id)||A;D?.(I),P||Pe(I);},[fe,D,P]),cl=react.useCallback((A,I,V)=>{let se=new Map,ge=ua=>{ua.forEach(Na=>{Na.dependencies&&se.set(Na.id,Na.dependencies),Na.subtasks&&ge(Na.subtasks);});};ge(V);let Ne=se.get(I)||[];se.set(I,[...Ne,A]);let vt=new Set,Yt=new Set,ma=ua=>{if(!vt.has(ua)){vt.add(ua),Yt.add(ua);let Na=se.get(ua)||[];for(let pr of Na){if(!vt.has(pr)&&ma(pr))return true;if(Yt.has(pr))return true}}return Yt.delete(ua),false};return ma(I)},[]),pl=react.useCallback((A,I)=>{if(cl(A.id,I,fe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
343
343
 
344
- Task dependencies must flow in one direction only.`);return}let j=ne=>ne.map(me=>{if(me.id===I){let Te=me.dependencies||[];if(!Te.includes(A.id))return {...me,dependencies:[...Te,A.id]}}return me.subtasks?{...me,subtasks:j(me.subtasks)}:me});xe(j(de)),J?.(A.id,I);},[de,J,cl]),ml=react.useCallback((A,I)=>{let j=ne=>ne.map(me=>{if(me.id===A&&me.dependencies){let Te=me.dependencies.filter(vt=>vt!==I);return {...me,dependencies:Te}}return me.subtasks?{...me,subtasks:j(me.subtasks)}:me});xe(j(de)),re?.(A,I);},[de,re]),{startDate:Ip,endDate:Lp}=react.useMemo(()=>{let A=de.filter(Te=>Te.startDate&&Te.endDate);if(A.length===0){let Te=new Date,vt=new Date(Te);vt.setDate(vt.getDate()-30);let Kt=new Date(Te);return Kt.setDate(Kt.getDate()+60),{startDate:vt,endDate:Kt}}let I=A.flatMap(Te=>[Te.startDate,Te.endDate]).filter(Te=>Te!==void 0),j=new Date(Math.min(...I.map(Te=>Te.getTime()))),ne=new Date(Math.max(...I.map(Te=>Te.getTime()))),me=z==="day"?7:z==="week"?14:30;return j.setDate(j.getDate()-me),ne.setDate(ne.getDate()+me),{startDate:j,endDate:ne}},[de,z]),Bp=react.useCallback(async()=>{if(!M.current||!Re.current||!N.current)return;await new Promise(Pr=>setTimeout(Pr,200));let A=M.current,I=Re.current.querySelector(".gantt-grid-scroll"),j=N.current,ne=I?.scrollTop||0,me=I?.scrollLeft||0,Te=j.scrollTop,vt=j.scrollLeft,Kt=A.style.overflow,ma=A.style.height,ua=I?.style.overflow||"",Ca=j.style.overflow,pr=A.style.width,Ko=j.style.width;try{let Pr=I?.querySelector(".gantt-taskgrid-content"),mr=j.querySelector("svg"),ur=mr?.getAttribute("height")?parseInt(mr.getAttribute("height"),10):mr?.getBoundingClientRect().height||0,Jr=Pr?.scrollHeight||I?.scrollHeight||600,Mr=Math.max(ur,j.scrollHeight),ul=mr?.getAttribute("width")?parseInt(mr.getAttribute("width"),10):mr?.getBoundingClientRect().width||j.scrollWidth,Hp=A.querySelector('[class*="h-12"]')?.offsetHeight||48,Yn=Math.max(Jr,Mr,ur),qn=Hp+Yn+50,Xn=(I?.offsetWidth||300)+ul+10;I&&(I.scrollTop=0,I.scrollLeft=0),j.scrollTop=0,j.scrollLeft=0,A.style.overflow="visible",A.style.height=`${qn}px`,A.style.width=`${Xn}px`,I&&(I.style.overflow="visible",I.style.height=`${Yn+50}px`),j.style.overflow="visible",j.style.height=`${Yn+50}px`,j.style.width=`${ul+10}px`,await new Promise(Zn=>setTimeout(Zn,150));let Gp=await uc__default.default(A,{backgroundColor:_.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Xn,height:qn,windowWidth:Xn+100,windowHeight:qn+100,scrollX:0,scrollY:0,ignoreElements:Zn=>{let gl=window.getComputedStyle(Zn),fl=parseInt(gl.zIndex,10);return !isNaN(fl)&&fl>=50||gl.position==="fixed"}}),Jn=document.createElement("a");Jn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Jn.href=Gp.toDataURL("image/png"),Jn.click();}finally{A.style.overflow=Kt,A.style.height=ma,A.style.width=pr,I&&(I.style.overflow=ua,I.style.height="",I.scrollTop=ne,I.scrollLeft=me),j.style.overflow=Ca,j.style.height="",j.style.width=Ko,j.scrollTop=Te,j.scrollLeft=vt;}},[_]),Rp=react.useCallback(async()=>{await pe.exportToPDF(de);},[de]),Op=react.useCallback(async()=>{await pe.exportToExcel(de);},[de]),zp=react.useCallback(()=>{let A=pe.exportToCSV(de),I=new Blob([A],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(I),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[de]),Up=react.useCallback(()=>{let A=pe.exportToJSON(de),I=new Blob([A],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(I),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[de]),$p=react.useCallback(()=>{pe.exportToMSProject(de,"Gantt Project","project.xml");},[de]),Wp=A=>{A.preventDefault(),gt(true);},Xr=react.useRef(false);return react.useEffect(()=>{let A=N.current,I=Re.current?.querySelector(".gantt-grid-scroll");if(!A||!I)return;let j=()=>{if(Xr.current)return;Xr.current=true;let vt=A.scrollTop;pt(vt),I.scrollTop=vt,requestAnimationFrame(()=>{Xr.current=false;});},ne=()=>{if(Xr.current)return;Xr.current=true;let vt=I.scrollTop;pt(vt),A.scrollTop=vt,requestAnimationFrame(()=>{Xr.current=false;});},me=vt=>{if(mt&&I){let ma=I.parentElement?.getBoundingClientRect()?.left||0,ua=vt.clientX-ma,Ca=200,pr=ht+Q,Ko=window.innerWidth*oe,Pr=Math.max(pr,Ko);ua>=Ca&&ua<=Pr&&W(ua);}},Te=()=>{gt(false);};return A.addEventListener("scroll",j),I.addEventListener("scroll",ne),document.addEventListener("mousemove",me),document.addEventListener("mouseup",Te),()=>{A.removeEventListener("scroll",j),I.removeEventListener("scroll",ne),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Te);}},[mt,ht]),jsxRuntime.jsx(co.Provider,{value:Ye,children:jsxRuntime.jsx(rs.Provider,{value:ce,children:jsxRuntime.jsxs("div",{ref:M,className:"flex flex-col h-full w-full",style:{backgroundColor:_.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(hn,{theme:_,timeScale:z,onTimeScaleChange:ve,zoom:ge,onZoomChange:ot,currentTheme:q,onThemeChange:Ne,rowDensity:we,onRowDensityChange:Me,showThemeSelector:m,showCreateTaskButton:w,createTaskLabel:u,onCreateTask:f,onExportPNG:l?Bp:void 0,onExportPDF:l?Rp:void 0,onExportExcel:l?Op:void 0,onExportCSV:l?zp:void 0,onExportJSON:l?Up:void 0,onExportMSProject:l?$p:void 0}),jsxRuntime.jsxs("div",{ref:Re,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,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(xn,{tasks:X,theme:_,rowHeight:Ie,availableUsers:g,templates:_e,onTaskClick:D,onTaskDblClick:dl,onTaskContextMenu:L,onTaskToggle:ta,scrollTop:Ae,columns:Ze,onToggleColumn:Nt,onColumnResize:Pe,onTaskUpdate:ae,onTaskIndent:at,onTaskOutdent:Qe,onTaskMove:St,onMultiTaskDelete:Et,onTaskDuplicate:ia,onTaskCreate:Er,onTaskRename:_t,onCreateSubtask:bo,onOpenTaskModal:D?A=>D(A):void 0,onDeleteRequest:(A,I)=>nt({taskId:A,taskName:I}),onTaskReparent:Be})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:_.border,zIndex:15},onMouseDown:Wp}),jsxRuntime.jsx("div",{ref:N,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(En,{tasks:X,theme:_,rowHeight:Ie,timeScale:z,startDate:Ip,endDate:Lp,zoom:ge,templates:_e,onTaskClick:D,onTaskDblClick:dl,onTaskContextMenu:ll,onTaskDateChange:Kn,onDependencyCreate:pl,onDependencyDelete:ml})})]}),T.task&&jsxRuntime.jsx(po,{isOpen:T.isOpen,x:T.x,y:T.y,theme:_,onClose:()=>V({isOpen:false,x:0,y:0,task:null}),items:(()=>{let A=T.task;if(!A)return [];let I=pe.findTaskById(de,A.id)||A;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:Ye.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{C?C(I):bo(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ye.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{nt({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:Ye.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{P?P(I):ue(I);}},{id:"addSubtask",label:Ye.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{C?C(I):bo(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Ye.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{H?H(I):ae(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:Ye.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{R?R(I):ae(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:Ye.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{ae(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Ye.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let ne=I.startDate.getTime(),me=I.endDate.getTime(),Te=ne+(me-ne)/2,vt=new Date(Te);yo(I,vt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ye.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{nt({taskId:I.id,taskName:I.name});}}]})()}),jsxRuntime.jsx(Or,{task:te,isOpen:!!te,onClose:()=>ue(null),onTaskUpdate:A=>{te&&(ae(te.id,A),ue(null));},theme:q==="light"?"light":"dark",locale:p==="es"?"es":"en",availableUsers:g,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&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:()=>nt(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:A=>A.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:_.bgSecondary,border:`1px solid ${_.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${_.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:_.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ye.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:_.textSecondary,fontFamily:"Inter, sans-serif"},children:p==="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:_.textSecondary,fontFamily:"Inter, sans-serif"},children:[p==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:_.textPrimary},children:['"',Le.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:_.bgPrimary,borderTop:`1px solid ${_.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>nt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:_.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=_.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:p==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Et([Le.taskId]),nt(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:A=>{A.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),p==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsxRuntime.jsx(Pn,{tasks:de,theme:_,config:b,onTasksUpdate:xe,onTaskUpdate:ae,onTaskCreate:A=>{xe(I=>[...I,A]);},onTaskDelete:A=>{Et([A]);},onDependencyCreate:(A,I)=>{let j=pe.findTaskById(de,A);j&&pl(j,I);},onDependencyDelete:ml})]})})})});var ui=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function bc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:l=[],availableTags:g=[],onCreateTag:d,attachments:i=[],onUploadAttachments:h,onDeleteAttachment:b}){let p=[...ui,...l.filter(W=>!ui.some(T=>T.id===W.id))],v=Ve[m]||Ve.dark,[w,u]=react.useState(false),[f,x]=react.useState(false),[D,S]=react.useState(false),[L,k]=react.useState(false),[U,P]=react.useState({top:0,left:0}),[C,H]=react.useState(null),[R,J]=react.useState(new Date),[re,Ce]=react.useState({top:0,left:0}),[Se,Fe]=react.useState(false),[se,O]=react.useState([]),B=react.useRef(null),$=react.useRef(null),F=react.useRef(null),q=react.useRef(null),Z=react.useRef(null),[z,ve]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[we,Me]=react.useState({});react.useEffect(()=>{a?(ve({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Fe(true)):(ve({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Fe(false),O([]));},[a,e]),react.useEffect(()=>{let W=T=>{B.current&&!B.current.contains(T.target)&&u(false),$.current&&!$.current.contains(T.target)&&x(false),F.current&&!F.current.contains(T.target)&&S(false),q.current&&!q.current.contains(T.target)&&k(false);};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[]);let ge=()=>{let W={};return z.name.trim()||(W.name="El nombre es requerido"),z.startDate&&z.endDate&&z.startDate>z.endDate&&(W.endDate="La fecha de fin debe ser posterior a la de inicio"),Me(W),Object.keys(W).length===0},ot=async W=>{if(W.preventDefault(),!!ge())try{let T=c==="create"&&se.length>0?{...z,pendingFiles:se}:z;await s(T),O([]),t();}catch(T){console.error("Error submitting task:",T);}},Ae=(W,T)=>{ve(V=>{let te={...V,[W]:T};if(W==="status"){let ue=T;ue==="todo"?te.progress=0:ue==="in-progress"?(V.progress===0||V.progress===100)&&(te.progress=50):ue==="completed"||ue==="closed"?te.progress=100:(ue==="in-review"||ue==="review")&&(te.progress=75);}if(W==="progress"){let ue=typeof T=="number"?T:parseInt(T,10);ue===100&&V.status!=="completed"?te.status="completed":ue>0&&ue<100&&V.status==="todo"?te.status="in-progress":ue===0&&V.status!=="todo"&&(te.status="todo");}return te}),we[W]&&Me(V=>{let te={...V};return delete te[W],te});},pt=p.find(W=>W.id===z.status)??ui[0],mt=gi.find(W=>W.id===z.priority)??gi[1],gt=er.find(W=>W.value===z.color)??er[0],Je={backgroundColor:v.bgSecondary,border:`1px solid ${v.borderLight}`,color:v.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${v.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pt.color||v.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:v.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:v.textTertiary},onMouseEnter:W=>{W.currentTarget.style.backgroundColor=v.hoverBg,W.currentTarget.style.color=v.textPrimary;},onMouseLeave:W=>{W.currentTarget.style.backgroundColor="transparent",W.currentTarget.style.color=v.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ot,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:z.name,onChange:W=>Ae("name",W.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:v.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),we.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),we.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:z.description||"",onChange:W=>Ae("description",W.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:v.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${v.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:B,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&u(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Je,borderColor:pt.color,backgroundColor:`${pt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:pt.color}}),jsxRuntime.jsx("span",{style:{color:pt.color},children:pt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:pt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},children:p.map(W=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:v.textPrimary},onMouseEnter:T=>T.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ae("status",W.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:W.color}}),W.title,z.status===W.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:v.accent}})]},W.id))})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Je,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsxRuntime.jsx("span",{children:mt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},children:gi.map(W=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:v.textPrimary},onMouseEnter:T=>T.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ae("priority",W.id),x(false);},children:[jsxRuntime.jsx("span",{children:W.icon}),W.label,z.priority===W.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:v.accent}})]},W.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Je,disabled:n,children:[z.assignees&&z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,3).map((W,T)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:W.color||v.accent,borderColor:v.bgSecondary},children:W.initials},T))}),z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:v.textTertiary},children:["+",z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:v.textTertiary}}),jsxRuntime.jsx("span",{style:{color:v.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},children:o.map(W=>{let T=z.assignees?.some(V=>V.name===W.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:v.textPrimary},onMouseEnter:V=>V.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:V=>V.currentTarget.style.backgroundColor="transparent",onClick:()=>{let V=T?(z.assignees||[]).filter(te=>te.name!==W.name):[...z.assignees||[],{name:W.name,avatar:W.avatar,initials:W.name.split(" ").map(te=>te[0]).join("").toUpperCase().slice(0,2),color:v.accent}];Ae("assignees",V);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:v.accent},children:W.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:W.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:v.accent}})})]},W.id)})})})]}),jsxRuntime.jsxs("div",{ref:q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(L)k(false);else {if(q.current){let W=q.current.getBoundingClientRect(),T=window.innerHeight,V=120,ue=T-W.bottom<V?W.top-V-8:W.bottom+8;P({top:ue,left:W.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Je,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:z.color}}),jsxRuntime.jsx("span",{children:gt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${U.top}px`,left:`${U.left}px`,zIndex:99999,backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:W=>W.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:er.slice(0,18).map(W=>{let T=z.color===W.value;return jsxRuntime.jsx("button",{type:"button",onClick:V=>{V.preventDefault(),V.stopPropagation(),Ae("color",W.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:W.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:W.value,outline:T?`2px solid ${W.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},W.value)})})})})]})})]}),g.length>0||d?jsxRuntime.jsx(Qa,{selectedTags:z.tags||[],availableTags:g,onChange:W=>Ae("tags",W),onCreateTag:d,theme:v,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:v.textTertiary}}),jsxRuntime.jsxs("div",{ref:Z,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(C==="start")H(null);else {if(Z.current){let W=Z.current.getBoundingClientRect(),T=window.innerHeight,V=320,ue=T-W.bottom<V?W.top-V-8:W.bottom+8;Ce({top:ue,left:W.left});}H("start"),J(z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Je,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:n||z.isMilestone,children:z.startDate?z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:v.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(C==="end")H(null);else {if(Z.current){let W=Z.current.getBoundingClientRect(),T=window.innerHeight,V=320,ue=T-W.bottom<V?W.top-V-8:W.bottom+8;Ce({top:ue,left:W.left});}H("end"),J(z.endDate||z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Je,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:n||z.isMilestone,children:z.endDate?z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${re.top}px`,left:`${re.left}px`,zIndex:99999,backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${v.border}`},children:[(()=>{let W=new Date,T=new Date(W);T.setDate(W.getDate()+1);let V=new Date(W);V.setDate(W.getDate()+7);let te=new Date(W);return te.setDate(W.getDate()+14),[{label:"Hoy",date:W},{label:"Ma\xF1ana",date:T},{label:"Pr\xF3xima semana",date:V},{label:"2 semanas",date:te}].map((Le,nt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:v.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Ae("startDate",Le.date),(!z.endDate||Le.date>z.endDate)&&Ae("endDate",Le.date),H("end")):(Ae("endDate",Le.date),(!z.startDate||Le.date<z.startDate)&&Ae("startDate",Le.date),H(null));},children:Le.label},nt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${v.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:W=>W.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ae("startDate",void 0),Ae("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>J(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:v.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:v.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>J(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:v.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((W,T)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:v.textTertiary},children:W},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let W=R.getFullYear(),T=R.getMonth(),V=new Date(W,T,1).getDay(),te=new Date(W,T+1,0).getDate(),ue=new Date,Le=[];for(let Ne=V-1;Ne>=0;Ne--)Le.push({day:new Date(W,T,-Ne).getDate(),date:new Date(W,T-1,new Date(W,T,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=te;Ne++)Le.push({day:Ne,date:new Date(W,T,Ne),isCurrentMonth:true});let nt=42-Le.length;for(let Ne=1;Ne<=nt;Ne++)Le.push({day:Ne,date:new Date(W,T+1,Ne),isCurrentMonth:false});return Le.map((Ne,de)=>{let xe=Ne.date.toDateString()===ue.toDateString(),it=z.startDate?.toDateString()===Ne.date.toDateString(),lt=z.endDate?.toDateString()===Ne.date.toDateString(),sa=z.startDate&&z.endDate&&Ne.date>=z.startDate&&Ne.date<=z.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?it||lt?"#FFF":v.textPrimary:v.textTertiary,backgroundColor:it?"#3B82F6":lt?"#7C3AED":sa?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:xe&&!it&&!lt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Ae("startDate",Ne.date),z.endDate&&Ne.date>z.endDate&&Ae("endDate",Ne.date),H("end")):(Ae("endDate",Ne.date),z.startDate&&Ne.date<z.startDate&&Ae("startDate",Ne.date),H(null));},children:Ne.day},de)})})()})]})]})]})})]}),we.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:we.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:v.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:z.progress,onChange:W=>Ae("progress",parseInt(W.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:v.bgSecondary,accentColor:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"}20`,color:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},children:[z.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Fe(!Se),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:v.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Se?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(h||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:v.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:v.textTertiary},children:["Adjuntos ",c==="create"?se.length>0&&`(${se.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx(rr,{cardId:"pending",attachments:se.map((W,T)=>({id:`pending-${T}`,cardId:"pending",name:W.name,size:W.size,type:W.type,url:URL.createObjectURL(W),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:W=>O(T=>[...T,...W]),onDelete:W=>{let T=parseInt(W.replace("pending-",""),10);O(V=>V.filter((te,ue)=>ue!==T));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(rr,{cardId:a?.id||"new",attachments:i,onUpload:h&&a?.id?W=>h(a.id,W):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),c==="create"&&se.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:v.textTertiary},children:[se.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:z.isMilestone,onChange:W=>Ae("isMilestone",W.target.checked),className:"w-4 h-4 rounded",style:{accentColor:v.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:v.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:v.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:v.bgSecondary},children:r.filter(W=>W.id!==a?.id).map(W=>{let T=z.dependencies?.includes(W.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let V=T?(z.dependencies||[]).filter(te=>te!==W.id):[...z.dependencies||[],W.id];Ae("dependencies",V);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:T?`${v.accent}30`:v.bgPrimary,color:T?v.accent:v.textSecondary,border:`1px solid ${T?v.accent:v.borderLight}`},disabled:n,children:W.name},W.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${v.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:v.textSecondary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:v.accent,color:"#FFF"},onMouseEnter:W=>!n&&(W.currentTarget.style.opacity="0.9"),onMouseLeave:W=>!n&&(W.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var yc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
344
+ Task dependencies must flow in one direction only.`);return}let V=se=>se.map(ge=>{if(ge.id===I){let Ne=ge.dependencies||[];if(!Ne.includes(A.id))return {...ge,dependencies:[...Ne,A.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});Me(V(fe)),Y?.(A.id,I);},[fe,Y,cl]),ml=react.useCallback((A,I)=>{let V=se=>se.map(ge=>{if(ge.id===A&&ge.dependencies){let Ne=ge.dependencies.filter(vt=>vt!==I);return {...ge,dependencies:Ne}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});Me(V(fe)),te?.(A,I);},[fe,te]),{startDate:Lp,endDate:Bp}=react.useMemo(()=>{let A=fe.filter(Ne=>Ne.startDate&&Ne.endDate);if(A.length===0){let Ne=new Date,vt=new Date(Ne);vt.setDate(vt.getDate()-30);let Yt=new Date(Ne);return Yt.setDate(Yt.getDate()+60),{startDate:vt,endDate:Yt}}let I=A.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),V=new Date(Math.min(...I.map(Ne=>Ne.getTime()))),se=new Date(Math.max(...I.map(Ne=>Ne.getTime()))),ge=U==="day"?7:U==="week"?14:30;return V.setDate(V.getDate()-ge),se.setDate(se.getDate()+ge),{startDate:V,endDate:se}},[fe,U]),Rp=react.useCallback(async()=>{if(!M.current||!We.current||!N.current)return;await new Promise(Pr=>setTimeout(Pr,200));let A=M.current,I=We.current.querySelector(".gantt-grid-scroll"),V=N.current,se=I?.scrollTop||0,ge=I?.scrollLeft||0,Ne=V.scrollTop,vt=V.scrollLeft,Yt=A.style.overflow,ma=A.style.height,ua=I?.style.overflow||"",Na=V.style.overflow,pr=A.style.width,Ko=V.style.width;try{let Pr=I?.querySelector(".gantt-taskgrid-content"),mr=V.querySelector("svg"),ur=mr?.getAttribute("height")?parseInt(mr.getAttribute("height"),10):mr?.getBoundingClientRect().height||0,Jr=Pr?.scrollHeight||I?.scrollHeight||600,Mr=Math.max(ur,V.scrollHeight),ul=mr?.getAttribute("width")?parseInt(mr.getAttribute("width"),10):mr?.getBoundingClientRect().width||V.scrollWidth,Gp=A.querySelector('[class*="h-12"]')?.offsetHeight||48,Yn=Math.max(Jr,Mr,ur),qn=Gp+Yn+50,Xn=(I?.offsetWidth||300)+ul+10;I&&(I.scrollTop=0,I.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,A.style.overflow="visible",A.style.height=`${qn}px`,A.style.width=`${Xn}px`,I&&(I.style.overflow="visible",I.style.height=`${Yn+50}px`),V.style.overflow="visible",V.style.height=`${Yn+50}px`,V.style.width=`${ul+10}px`,await new Promise(Zn=>setTimeout(Zn,150));let _p=await gc__default.default(A,{backgroundColor:_.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Xn,height:qn,windowWidth:Xn+100,windowHeight:qn+100,scrollX:0,scrollY:0,ignoreElements:Zn=>{let gl=window.getComputedStyle(Zn),fl=parseInt(gl.zIndex,10);return !isNaN(fl)&&fl>=50||gl.position==="fixed"}}),Jn=document.createElement("a");Jn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Jn.href=_p.toDataURL("image/png"),Jn.click();}finally{A.style.overflow=Yt,A.style.height=ma,A.style.width=pr,I&&(I.style.overflow=ua,I.style.height="",I.scrollTop=se,I.scrollLeft=ge),V.style.overflow=Na,V.style.height="",V.style.width=Ko,V.scrollTop=Ne,V.scrollLeft=vt;}},[_]),Op=react.useCallback(async()=>{await me.exportToPDF(fe);},[fe]),zp=react.useCallback(async()=>{await me.exportToExcel(fe);},[fe]),Up=react.useCallback(()=>{let A=me.exportToCSV(fe),I=new Blob([A],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[fe]),$p=react.useCallback(()=>{let A=me.exportToJSON(fe),I=new Blob([A],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[fe]),Hp=react.useCallback(()=>{me.exportToMSProject(fe,"Gantt Project","project.xml");},[fe]),Wp=A=>{A.preventDefault(),ut(true);},Xr=react.useRef(false);return react.useEffect(()=>{let A=N.current,I=We.current?.querySelector(".gantt-grid-scroll");if(!A||!I)return;let V=()=>{if(Xr.current)return;Xr.current=true;let vt=A.scrollTop;dt(vt),I.scrollTop=vt,requestAnimationFrame(()=>{Xr.current=false;});},se=()=>{if(Xr.current)return;Xr.current=true;let vt=I.scrollTop;dt(vt),A.scrollTop=vt,requestAnimationFrame(()=>{Xr.current=false;});},ge=vt=>{if(it&&I){let ma=I.parentElement?.getBoundingClientRect()?.left||0,ua=vt.clientX-ma,Na=200,pr=ht+Z,Ko=window.innerWidth*ne,Pr=Math.max(pr,Ko);ua>=Na&&ua<=Pr&&$(ua);}},Ne=()=>{ut(false);};return A.addEventListener("scroll",V),I.addEventListener("scroll",se),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ne),()=>{A.removeEventListener("scroll",V),I.removeEventListener("scroll",se),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ne);}},[it,ht]),jsxRuntime.jsx(co.Provider,{value:Oe,children:jsxRuntime.jsx(rs.Provider,{value:pe,children:jsxRuntime.jsxs("div",{ref:M,className:"flex flex-col h-full w-full",style:{backgroundColor:_.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(hn,{theme:_,timeScale:U,onTimeScaleChange:xe,zoom:ye,onZoomChange:tt,currentTheme:q,onThemeChange:Be,rowDensity:Te,onRowDensityChange:Le,showThemeSelector:m,showCreateTaskButton:f,createTaskLabel:v,onCreateTask:g,onExportPNG:l?Rp:void 0,onExportPDF:l?Op:void 0,onExportExcel:l?zp:void 0,onExportCSV:l?Up:void 0,onExportJSON:l?$p:void 0,onExportMSProject:l?Hp:void 0}),jsxRuntime.jsxs("div",{ref:We,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:Ae,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(xn,{tasks:X,theme:_,rowHeight:ze,availableUsers:u,templates:Ye,onTaskClick:x,onTaskDblClick:dl,onTaskContextMenu:B,onTaskToggle:ra,scrollTop:Ee,columns:Re,onToggleColumn:Nt,onColumnResize:Fe,onTaskUpdate:oe,onTaskIndent:nt,onTaskOutdent:rt,onTaskMove:St,onMultiTaskDelete:Et,onTaskDuplicate:da,onTaskCreate:Er,onTaskRename:Vt,onCreateSubtask:bo,onOpenTaskModal:x?A=>x(A):void 0,onDeleteRequest:(A,I)=>mt({taskId:A,taskName:I}),onTaskReparent:He})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:_.border,zIndex:15},onMouseDown:Wp}),jsxRuntime.jsx("div",{ref:N,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(En,{tasks:X,theme:_,rowHeight:ze,timeScale:U,startDate:Lp,endDate:Bp,zoom:ye,templates:Ye,onTaskClick:x,onTaskDblClick:dl,onTaskContextMenu:ll,onTaskDateChange:Kn,onDependencyCreate:pl,onDependencyDelete:ml})})]}),ae.task&&jsxRuntime.jsx(po,{isOpen:ae.isOpen,x:ae.x,y:ae.y,theme:_,onClose:()=>ce({isOpen:false,x:0,y:0,task:null}),items:(()=>{let A=ae.task;if(!A)return [];let I=me.findTaskById(fe,A.id)||A;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:Oe.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{T?T(I):bo(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Oe.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{mt({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:Oe.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{P?P(I):Pe(I);}},{id:"addSubtask",label:Oe.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{T?T(I):bo(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Oe.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{G?G(I):oe(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:Oe.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{R?R(I):oe(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:Oe.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{oe(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Oe.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let se=I.startDate.getTime(),ge=I.endDate.getTime(),Ne=se+(ge-se)/2,vt=new Date(Ne);yo(I,vt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Oe.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{mt({taskId:I.id,taskName:I.name});}}]})()}),jsxRuntime.jsx(Or,{task:Ce,isOpen:!!Ce,onClose:()=>Pe(null),onTaskUpdate:A=>{Ce&&(oe(Ce.id,A),Pe(null));},theme:q==="light"?"light":"dark",locale:p==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>mt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:A=>A.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:_.bgSecondary,border:`1px solid ${_.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${_.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:_.textPrimary,fontFamily:"Inter, sans-serif"},children:[Oe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:_.textSecondary,fontFamily:"Inter, sans-serif"},children:p==="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:_.textSecondary,fontFamily:"Inter, sans-serif"},children:[p==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:_.textPrimary},children:['"',at.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:_.bgPrimary,borderTop:`1px solid ${_.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>mt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:_.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=_.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:p==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Et([at.taskId]),mt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),p==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Pn,{tasks:fe,theme:_,config:C,onTasksUpdate:Me,onTaskUpdate:oe,onTaskCreate:A=>{Me(I=>[...I,A]);},onTaskDelete:A=>{Et([A]);},onDependencyCreate:(A,I)=>{let V=me.findTaskById(fe,A);V&&pl(V,I);},onDependencyDelete:ml})]})})})});var ui=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function yc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:l=[],availableTags:u=[],onCreateTag:d,attachments:i=[],onUploadAttachments:h,onDeleteAttachment:C}){let p=[...ui,...l.filter($=>!ui.some(ae=>ae.id===$.id))],y=qe[m]||qe.dark,[f,v]=react.useState(false),[g,k]=react.useState(false),[x,D]=react.useState(false),[B,w]=react.useState(false),[z,P]=react.useState({top:0,left:0}),[T,G]=react.useState(null),[R,Y]=react.useState(new Date),[te,ve]=react.useState({top:0,left:0}),[Ie,Ue]=react.useState(false),[le,O]=react.useState([]),L=react.useRef(null),H=react.useRef(null),F=react.useRef(null),q=react.useRef(null),J=react.useRef(null),[U,xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Te,Le]=react.useState({});react.useEffect(()=>{a?(xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ue(true)):(xe({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ue(false),O([]));},[a,e]),react.useEffect(()=>{let $=ae=>{L.current&&!L.current.contains(ae.target)&&v(false),H.current&&!H.current.contains(ae.target)&&k(false),F.current&&!F.current.contains(ae.target)&&D(false),q.current&&!q.current.contains(ae.target)&&w(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let ye=()=>{let $={};return U.name.trim()||($.name="El nombre es requerido"),U.startDate&&U.endDate&&U.startDate>U.endDate&&($.endDate="La fecha de fin debe ser posterior a la de inicio"),Le($),Object.keys($).length===0},tt=async $=>{if($.preventDefault(),!!ye())try{let ae=c==="create"&&le.length>0?{...U,pendingFiles:le}:U;await s(ae),O([]),t();}catch(ae){console.error("Error submitting task:",ae);}},Ee=($,ae)=>{xe(ce=>{let Ce={...ce,[$]:ae};if($==="status"){let Pe=ae;Pe==="todo"?Ce.progress=0:Pe==="in-progress"?(ce.progress===0||ce.progress===100)&&(Ce.progress=50):Pe==="completed"||Pe==="closed"?Ce.progress=100:(Pe==="in-review"||Pe==="review")&&(Ce.progress=75);}if($==="progress"){let Pe=typeof ae=="number"?ae:parseInt(ae,10);Pe===100&&ce.status!=="completed"?Ce.status="completed":Pe>0&&Pe<100&&ce.status==="todo"?Ce.status="in-progress":Pe===0&&ce.status!=="todo"&&(Ce.status="todo");}return Ce}),Te[$]&&Le(ce=>{let Ce={...ce};return delete Ce[$],Ce});},dt=p.find($=>$.id===U.status)??ui[0],it=gi.find($=>$.id===U.priority)??gi[1],ut=er.find($=>$.value===U.color)??er[0],_e={backgroundColor:y.bgSecondary,border:`1px solid ${y.borderLight}`,color:y.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:y.bgPrimary,border:`1px solid ${y.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${y.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:dt.color||y.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:y.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:y.textTertiary},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=y.hoverBg,$.currentTarget.style.color=y.textPrimary;},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=y.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:tt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:U.name,onChange:$=>Ee("name",$.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:y.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Te.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Te.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:U.description||"",onChange:$=>Ee("description",$.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:y.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${y.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:L,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{..._e,borderColor:dt.color,backgroundColor:`${dt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:dt.color}}),jsxRuntime.jsx("span",{style:{color:dt.color},children:dt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:dt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:y.bgPrimary,border:`1px solid ${y.border}`},children:p.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ee("status",$.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:$.color}}),$.title,U.status===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:y.accent}})]},$.id))})})]}),jsxRuntime.jsxs("div",{ref:H,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!g),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:_e,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:it.color}}),jsxRuntime.jsx("span",{children:it.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:y.bgPrimary,border:`1px solid ${y.border}`},children:gi.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ee("priority",$.id),k(false);},children:[jsxRuntime.jsx("span",{children:$.icon}),$.label,U.priority===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:y.accent}})]},$.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:_e,disabled:n,children:[U.assignees&&U.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:U.assignees.slice(0,3).map(($,ae)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:$.color||y.accent,borderColor:y.bgSecondary},children:$.initials},ae))}),U.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:y.textTertiary},children:["+",U.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:y.textTertiary}}),jsxRuntime.jsx("span",{style:{color:y.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:y.bgPrimary,border:`1px solid ${y.border}`},children:o.map($=>{let ae=U.assignees?.some(ce=>ce.name===$.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=ae?(U.assignees||[]).filter(Ce=>Ce.name!==$.name):[...U.assignees||[],{name:$.name,avatar:$.avatar,initials:$.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:y.accent}];Ee("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:y.accent},children:$.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:$.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:y.accent}})})]},$.id)})})})]}),jsxRuntime.jsxs("div",{ref:q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(B)w(false);else {if(q.current){let $=q.current.getBoundingClientRect(),ae=window.innerHeight,ce=120,Pe=ae-$.bottom<ce?$.top-ce-8:$.bottom+8;P({top:Pe,left:$.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:_e,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:U.color}}),jsxRuntime.jsx("span",{children:ut.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(ct,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${z.top}px`,left:`${z.left}px`,zIndex:99999,backgroundColor:y.bgPrimary,border:`1px solid ${y.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:$=>$.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:er.slice(0,18).map($=>{let ae=U.color===$.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),Ee("color",$.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:$.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:$.value,outline:ae?`2px solid ${$.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},$.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(Qa,{selectedTags:U.tags||[],availableTags:u,onChange:$=>Ee("tags",$),onCreateTag:d,theme:y,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:y.textTertiary}}),jsxRuntime.jsxs("div",{ref:J,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!U.isMilestone)if(T==="start")G(null);else {if(J.current){let $=J.current.getBoundingClientRect(),ae=window.innerHeight,ce=320,Pe=ae-$.bottom<ce?$.top-ce-8:$.bottom+8;ve({top:Pe,left:$.left});}G("start"),Y(U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{..._e,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:n||U.isMilestone,children:U.startDate?U.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:y.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!U.isMilestone)if(T==="end")G(null);else {if(J.current){let $=J.current.getBoundingClientRect(),ae=window.innerHeight,ce=320,Pe=ae-$.bottom<ce?$.top-ce-8:$.bottom+8;ve({top:Pe,left:$.left});}G("end"),Y(U.endDate||U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{..._e,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:n||U.isMilestone,children:U.endDate?U.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(ct,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>G(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:y.bgPrimary,border:`1px solid ${y.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${y.border}`},children:[(()=>{let $=new Date,ae=new Date($);ae.setDate($.getDate()+1);let ce=new Date($);ce.setDate($.getDate()+7);let Ce=new Date($);return Ce.setDate($.getDate()+14),[{label:"Hoy",date:$},{label:"Ma\xF1ana",date:ae},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Ce}].map((at,mt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:y.textPrimary},onMouseEnter:Be=>Be.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:Be=>Be.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(Ee("startDate",at.date),(!U.endDate||at.date>U.endDate)&&Ee("endDate",at.date),G("end")):(Ee("endDate",at.date),(!U.startDate||at.date<U.startDate)&&Ee("startDate",at.date),G(null));},children:at.label},mt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${y.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:$=>$.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ee("startDate",void 0),Ee("endDate",void 0),G(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:y.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:y.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:y.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map(($,ae)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:y.textTertiary},children:$},ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=R.getFullYear(),ae=R.getMonth(),ce=new Date($,ae,1).getDay(),Ce=new Date($,ae+1,0).getDate(),Pe=new Date,at=[];for(let Be=ce-1;Be>=0;Be--)at.push({day:new Date($,ae,-Be).getDate(),date:new Date($,ae-1,new Date($,ae,-Be).getDate()),isCurrentMonth:false});for(let Be=1;Be<=Ce;Be++)at.push({day:Be,date:new Date($,ae,Be),isCurrentMonth:true});let mt=42-at.length;for(let Be=1;Be<=mt;Be++)at.push({day:Be,date:new Date($,ae+1,Be),isCurrentMonth:false});return at.map((Be,fe)=>{let Me=Be.date.toDateString()===Pe.toDateString(),_t=U.startDate?.toDateString()===Be.date.toDateString(),gt=U.endDate?.toDateString()===Be.date.toDateString(),aa=U.startDate&&U.endDate&&Be.date>=U.startDate&&Be.date<=U.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Be.isCurrentMonth?_t||gt?"#FFF":y.textPrimary:y.textTertiary,backgroundColor:_t?"#3B82F6":gt?"#7C3AED":aa?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Me&&!_t&&!gt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(Ee("startDate",Be.date),U.endDate&&Be.date>U.endDate&&Ee("endDate",Be.date),G("end")):(Ee("endDate",Be.date),U.startDate&&Be.date<U.startDate&&Ee("startDate",Be.date),G(null));},children:Be.day},fe)})})()})]})]})]})})]}),Te.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Te.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:y.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:U.progress,onChange:$=>Ee("progress",parseInt($.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:y.bgSecondary,accentColor:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"}20`,color:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},children:[U.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ue(!Ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:y.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(h||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:y.textTertiary},children:["Adjuntos ",c==="create"?le.length>0&&`(${le.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx(rr,{cardId:"pending",attachments:le.map(($,ae)=>({id:`pending-${ae}`,cardId:"pending",name:$.name,size:$.size,type:$.type,url:URL.createObjectURL($),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:$=>O(ae=>[...ae,...$]),onDelete:$=>{let ae=parseInt($.replace("pending-",""),10);O(ce=>ce.filter((Ce,Pe)=>Pe!==ae));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(rr,{cardId:a?.id||"new",attachments:i,onUpload:h&&a?.id?$=>h(a.id,$):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),c==="create"&&le.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:y.textTertiary},children:[le.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:U.isMilestone,onChange:$=>Ee("isMilestone",$.target.checked),className:"w-4 h-4 rounded",style:{accentColor:y.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:y.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:y.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:y.bgSecondary},children:r.filter($=>$.id!==a?.id).map($=>{let ae=U.dependencies?.includes($.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=ae?(U.dependencies||[]).filter(Ce=>Ce!==$.id):[...U.dependencies||[],$.id];Ee("dependencies",ce);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ae?`${y.accent}30`:y.bgPrimary,color:ae?y.accent:y.textSecondary,border:`1px solid ${ae?y.accent:y.borderLight}`},disabled:n,children:$.name},$.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${y.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:y.textSecondary},onMouseEnter:$=>$.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:y.accent,color:"#FFF"},onMouseEnter:$=>!n&&($.currentTarget.style.opacity="0.9"),onMouseLeave:$=>!n&&($.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var vc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
345
345
 
346
346
  AVAILABLE COMMANDS:
347
347
  1. move_task - Move a task to a different date
@@ -382,11 +382,11 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
382
382
 
383
383
  Always try to match task names case-insensitively and handle partial matches.
384
384
  If you can't find a task by name, search through the provided task list.
385
- If ambiguous, ask for clarification in the message field.`;function vc(e){return `CURRENT TASKS:
386
- ${xc(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
385
+ If ambiguous, ask for clarification in the message field.`;function xc(e){return `CURRENT TASKS:
386
+ ${kc(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function xc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function cr(e,t){let a=xc(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return n.every(l=>m.includes(l))})}function fi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let h={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(h!==void 0){let b=new Date(r),p=b.getDay(),v=h-p;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),h=s[2].toLowerCase(),b=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?b.setDate(b.getDate()+i):h==="week"||h==="semana"||h==="semanas"?b.setDate(b.getDate()+i*7):(h==="month"||h==="mes"||h==="meses")&&b.setMonth(b.getMonth()+i),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),h=parseInt(c[2],10)-1,b=parseInt(c[3],10);return new Date(b,h,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=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(l&&l[1]&&l[2]){let i=parseInt(l[1],10),h=m[l[2].toLowerCase()],b=l[3]?parseInt(l[3],10):r.getFullYear();if(h!==void 0)return new Date(b,h,i)}let g={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=g[d[1].toLowerCase()],h=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(b,i,h)}return null}function hi(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 bi(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 kc(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 wc(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 l=r[1].trim(),g=r[2].trim(),d=cr(t,l),i=fi(g);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${g}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(i);return b.setDate(b.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:b},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),g=o[2].trim(),d=cr(t,l),i=hi(g);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${g}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${i} days. New end date: ${h.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),g=s[2].trim(),d=cr(t,l),i=bi(g);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${g}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),g=n[2].trim(),d=cr(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:g},message:`Renamed "${d.name}" to "${g}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let l=c[1].trim(),g=c[2].trim(),d=cr(t,l),i=cr(t,g);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:g,message:`Could not find a task named "${g}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let l=m[1].trim(),g=cr(t,l);return g?{type:"delete_task",taskId:g.id,taskName:g.name,message:`Deleted "${g.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Cc(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 P0(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 M0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function An(e,t=[],a=[]){let r=e.assignedUserIds?.map(g=>{let d=a.find(i=>i.id===g);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(g=>g!==null),o=t.filter(g=>g.metadata?.parentCardId===e.id).map(g=>An(g,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(g=>g.type==="finish-to-start").map(g=>g.taskId));let n=g=>{if(g)return typeof g=="string"?new Date(g):g},c=n(e.startDate),m=n(e.endDate),l=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:P0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Tc(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:M0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Nc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>An(r,e,t))}var yi={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"}},vi={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"}},Fn={en:yi,es:vi};function xi(e){return Fn[e]||Fn.en}function In(e,t){let a=xi(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 Pc(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(...Pc(r.subtasks,t+1));return a}function W0({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 Mc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:c="dark",locale:m="en",customTranslations:l,showSearch:g=true,showHierarchy:d=true}=t,i=In(m,l),h=c==="dark",[b,p]=react.useState(new Set),[v,w]=react.useState("startDate"),[u,f]=react.useState("asc"),[x,D]=react.useState("");react.useMemo(()=>{let P=new Set;function C(H){for(let R of H)R.subtasks?.length&&(P.add(R.id),C(R.subtasks));}C(e),p(P);},[e]);let S=react.useCallback(P=>{p(C=>{let H=new Set(C);return H.has(P)?H.delete(P):H.add(P),H}),a.onTaskToggleExpand?.(P);},[a]),L=react.useCallback(P=>{v===P?f(C=>C==="asc"?"desc":"asc"):(w(P),f("asc")),a.onSortChange?.({column:P,direction:u==="asc"?"desc":"asc"});},[v,u,a]),k=react.useMemo(()=>{let P=Pc(e);if(x.trim()){let H=x.toLowerCase();P=P.filter(R=>R.name.toLowerCase().includes(H));}let C=[];for(let H of P){let R=H.level===0;H.level>0&&(R=true),(R||x.trim())&&C.push(H);}return x.trim()&&C.sort((H,R)=>{let J,re;switch(v){case "name":J=H.name.toLowerCase(),re=R.name.toLowerCase();break;case "startDate":J=H.startDate?.getTime()||0,re=R.startDate?.getTime()||0;break;case "endDate":J=H.endDate?.getTime()||0,re=R.endDate?.getTime()||0;break;case "progress":J=H.progress||0,re=R.progress||0;break;case "status":J=H.status||"todo",re=R.status||"todo";break;default:return 0}return J<re?u==="asc"?-1:1:J>re?u==="asc"?1:-1:0}),C},[e,x,v,u]),U=P=>P?(P instanceof Date?P:new Date(P)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:y("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:P=>D(P.target.value),placeholder:i.toolbar.searchPlaceholder,className:y("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"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:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:y("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"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:()=>L("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>L("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>L("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>L("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>L("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:k.map((P,C)=>{let H=b.has(P.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:y("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+P.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&P.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),S(P.id);},className:y("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:H?jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:y("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!P.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...P,progress:P.progress===100?0:100,status:P.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(W0,{status:P.status,progress:P.progress})}),jsxRuntime.jsx("span",{className:y("truncate",h?"text-white":"text-gray-900",P.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:P.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:y("px-2 py-1 rounded-full text-xs font-medium",P.progress===100||P.status==="completed"?"bg-green-500/10 text-green-500":P.progress&&P.progress>0||P.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:P.progress===100||P.status==="completed"?i.status.completed:P.progress&&P.progress>0||P.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),U(P.startDate)]}),jsxRuntime.jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),U(P.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:y("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",P.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${P.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[P.progress||0,"%"]})]})})]},P.id)})}),k.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:y("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y(h?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var ki={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"},wi={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"},Ci={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"},Bn={dark:ki,light:wi,neutral:Ci};function Ac(e){return Bn[e]||Bn.dark}var Ti={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"}},Ni={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"}},Rn={en:Ti,es:Ni};function Oo(e){return Rn[e]||Rn.en}function On(e,t){let a=Oo(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 Fc(e){let t=Oo(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 Ic(e,t=0,a=true){let r=Oo(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 nh(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 Ai(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 zc({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 $c({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:c,availableTags:m=[],onCreateTag:l,attachmentsByTask:g}){let{theme:d="dark",locale:i="en",customTranslations:h}=t,b=On(i,h),p=d==="dark",v={textTertiary:p?"#6B7280":"#9CA3AF",textSecondary:p?"#9CA3AF":"#6B7280",textPrimary:p?"#FFFFFF":"#111827",borderLight:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:p?"#1A1D25":"#FFFFFF",bgSecondary:p?"#0F1117":"#F9FAFB",hoverBg:p?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[w,u]=react.useState(r||new Date),[f,x]=react.useState(null),[D,S]=react.useState(null),[L,k]=react.useState(null),[U,P]=react.useState(new Date),[C,H]=react.useState({}),R=4,J=3,[re,Ce]=react.useState(false),[Se,Fe]=react.useState(false),[se,O]=react.useState(false),[B,$]=react.useState(false),[F,q]=react.useState(null),[Z,z]=react.useState(""),[ve,we]=react.useState(void 0),[Me,ge]=react.useState(null),[ot,Ae]=react.useState(false),[pt,mt]=react.useState(false),[gt,Je]=react.useState(null),[W,T]=react.useState(false),[V,te]=react.useState(new Date),[ue,Le]=react.useState(false),[nt,Ne]=react.useState(false),[de,xe]=react.useState(false),[it,lt]=react.useState(""),[sa,ca]=react.useState(false),He=react.useCallback(()=>{u(new Date(w.getFullYear(),w.getMonth()-1,1));},[w]),ze=react.useCallback(()=>{u(new Date(w.getFullYear(),w.getMonth()+1,1));},[w]),pa=react.useCallback(()=>{u(new Date);},[]),fe=react.useMemo(()=>{let N=w.getFullYear(),M=w.getMonth(),_=new Date(N,M,1),ce=new Date(N,M+1,0),_e=_.getDay(),X=ce.getDate(),Ie=nh(e),Nt=new Date;Nt.setHours(0,0,0,0);let Pe=[],ta=_e,ae=new Date(N,M,0).getDate();for(let Qe=ta-1;Qe>=0;Qe--){let Be=new Date(N,M-1,ae-Qe);Pe.push({date:Be,isCurrentMonth:false,isToday:false,isWeekend:Be.getDay()===0||Be.getDay()===6,events:Ie.filter(St=>Ai(Be,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}for(let Qe=1;Qe<=X;Qe++){let Be=new Date(N,M,Qe),St=Be.getTime()===Nt.getTime();Pe.push({date:Be,isCurrentMonth:true,isToday:St,isWeekend:Be.getDay()===0||Be.getDay()===6,events:Ie.filter(Et=>Ai(Be,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}let at=42-Pe.length;for(let Qe=1;Qe<=at;Qe++){let Be=new Date(N,M+1,Qe);Pe.push({date:Be,isCurrentMonth:false,isToday:false,isWeekend:Be.getDay()===0||Be.getDay()===6,events:Ie.filter(St=>Ai(Be,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}return Pe},[w,e]),Ge=i==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ee=w.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ue=react.useCallback((N,M)=>{if(!f)return;let _={...f,[N]:M};x(_),a.onTaskUpdate?.(_);},[f,a]),Ye=react.useCallback(N=>{if(!f)return;let M=f.progress||0;N==="completed"?M=100:N==="todo"&&(M=0);let _={...f,status:N,progress:M};x(_),a.onTaskUpdate?.(_),Ce(false);},[f,a]),ft=react.useCallback((N,M)=>{if(!f)return;let _={...f,startDate:N,endDate:M};x(_),a.onTaskUpdate?.(_);},[f,a]),Ze=react.useCallback(()=>{Ce(false),Fe(false),O(false),k(null),xe(false),lt(""),ca(false);},[]),tt=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),Le(false),!f||!a.onUploadAttachments)return;let M=Array.from(N.dataTransfer.files);if(M.length!==0){Ne(true);try{await a.onUploadAttachments(f.id,M);}finally{Ne(false);}}},[f,a]),ht=react.useCallback(async N=>{if(!f||!a.onUploadAttachments||!N.target.files)return;let M=Array.from(N.target.files);if(M.length!==0){Ne(true);try{await a.onUploadAttachments(f.id,M);}finally{Ne(false);}N.target.value="";}},[f,a]),jt=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),Le(true);},[]),Q=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),Le(false);},[]),oe=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),De=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]),Re=react.useMemo(()=>!f||!g?[]:g.get(f.id)||[],[f,g]);return o?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:y("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:[b.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",p?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:y("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",p?"text-white":"text-gray-900"),children:b.labels.noEvents}),jsxRuntime.jsx("p",{className:y("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:b.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-auto",p?"bg-[#0F1117]":"bg-white",n),style:c,children:[jsxRuntime.jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:y("text-xl font-semibold capitalize",p?"text-white":"text-gray-900"),children:Ee}),jsxRuntime.jsx("button",{onClick:pa,className:y("px-3 py-1.5 text-sm rounded-lg transition-colors",p?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:b.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:He,className:y("p-2 rounded-lg transition-colors",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:y("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ze,className:y("p-2 rounded-lg transition-colors",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:y("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:Ge.map(N=>jsxRuntime.jsx("div",{className:y("py-2 text-center text-xs font-medium uppercase",p?"text-[#9CA3AF]":"text-gray-500"),children:N},N))}),jsxRuntime.jsx("div",{className:y("grid grid-cols-7 auto-rows-min gap-px rounded-lg",p?"bg-[#2D2D2D]":"bg-gray-300"),children:fe.map((N,M)=>{let _=N.date.getDay()===0||N.date.getDay()===6;return jsxRuntime.jsxs("div",{className:y("min-h-[120px] p-2 transition-colors flex flex-col relative group",p?_?"bg-[#1C1F26]":N.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":_?"bg-gray-100":N.isCurrentMonth?"bg-white":"bg-gray-50",N.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let ce=C[M]||R,_e=N.events.slice(0,ce),X=N.events.length-ce;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[_e.map(Ie=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{x(Ie.task),a.onEventClick?.(Ie);},whileHover:{scale:1.02},className:y("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ie.task.progress===100?p?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":p?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(zc,{task:Ie.task}),jsxRuntime.jsx("span",{className:"truncate",children:Ie.title})]})},Ie.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Ie=>{Ie.stopPropagation(),H(Nt=>({...Nt,[M]:ce+J}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",p?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",i==="es"?"M\xC1S":"MORE"]}),ce>R&&N.events.length>R&&jsxRuntime.jsx("button",{onClick:Ie=>{Ie.stopPropagation(),H(Nt=>({...Nt,[M]:R}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",p?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:i==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let ce=M>=28,_e=M%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),F===M?q(null):(q(M),z(""),we(void 0),ge(null),Je(null),Ae(false),mt(false),T(false),te(N.date));},className:y("w-5 h-5 rounded flex items-center justify-center transition-all",F===M?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",p?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:y("w-3.5 h-3.5 transition-transform",F===M&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F===M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{q(null),z(""),we(void 0),ge(null),Je(null),Ae(false),mt(false),T(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:ce?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ce?-5:5,scale:.95},transition:{duration:.12},className:y("absolute w-[320px] rounded-lg shadow-2xl z-50",ce?"bottom-full mb-1":"top-full mt-1",_e?"right-0":"left-0",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),Ae(false),mt(false),T(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Z,onChange:X=>z(X.target.value),placeholder:i==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:y("w-full bg-transparent text-sm outline-none placeholder:opacity-40",p?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&Z.trim()){let Ie=t.availableUsers?.find(Pe=>Pe.id===Me),Nt=gt||N.date;a.onTaskCreate?.({name:Z.trim(),startDate:Nt,endDate:Nt,priority:ve,assignees:Ie?[Ie]:void 0}),z(""),we(void 0),ge(null),Je(null),q(null);}X.key==="Escape"&&(q(null),z(""),we(void 0),ge(null),Je(null));}})}),jsxRuntime.jsxs("div",{className:y("px-2.5 py-2 flex items-center justify-between border-t",p?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),Ae(!ot),mt(false);},className:y("p-1 rounded transition-colors",ve?ve==="urgent"||ve==="high"?"text-red-400 bg-red-500/20":ve==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":p?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:i==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:i==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:i==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:i==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:i==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{we(X.id),Ae(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",ve===X.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),T(!W),Ae(false),mt(false),te(gt||N.date);},className:y("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",gt?"bg-[#7C3AED]/20 text-[#7C3AED]":p?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(gt||N.date).toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:y("w-40 py-2 border-r",p?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Ie=new Date(X);Ie.setDate(X.getDate()+1);let Nt=new Date(X);Nt.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Pe=new Date(X);Pe.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let ta=new Date(X);ta.setDate(X.getDate()+14);let ae=new Date(X);return ae.setDate(X.getDate()+28),[{label:i==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Ma\xF1ana":"Tomorrow",date:Ie,display:Ie.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Este fin de semana":"This weekend",date:Nt,display:i==="es"?"s\xE1b.":"sat."},{label:i==="es"?"Pr\xF3xima semana":"Next week",date:Pe,display:i==="es"?"lun.":"mon."},{label:i==="es"?"2 semanas":"2 weeks",date:ta,display:ta.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:i==="es"?"4 semanas":"4 weeks",date:ae,display:ae.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Qe,Be)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Je(Qe.date),T(false);},children:[jsxRuntime.jsx("span",{children:Qe.label}),jsxRuntime.jsx("span",{className:y("text-[10px]",p?"text-[#6B7280]":"text-gray-400"),children:Qe.display})]},Be))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:y("text-xs font-medium",p?"text-white":"text-gray-900"),children:V.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>te(new Date),className:y("px-1.5 py-0.5 rounded text-[10px] transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:i==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>te(new Date(V.getFullYear(),V.getMonth()-1)),className:y("p-0.5 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>te(new Date(V.getFullYear(),V.getMonth()+1)),className:y("p-0.5 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(i==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:y("w-6 h-6 flex items-center justify-center text-[10px]",p?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=V.getFullYear(),Ie=V.getMonth(),Nt=new Date(X,Ie,1).getDay(),Pe=new Date(X,Ie+1,0).getDate(),ta=new Date(X,Ie,0).getDate(),ae=new Date,at=[];for(let Be=Nt-1;Be>=0;Be--)at.push({dayNum:ta-Be,isCurrentMonth:false,date:new Date(X,Ie-1,ta-Be)});for(let Be=1;Be<=Pe;Be++)at.push({dayNum:Be,isCurrentMonth:true,date:new Date(X,Ie,Be)});let Qe=42-at.length;for(let Be=1;Be<=Qe;Be++)at.push({dayNum:Be,isCurrentMonth:false,date:new Date(X,Ie+1,Be)});return at.map((Be,St)=>{let Et=Be.date.toDateString()===ae.toDateString(),ia=(gt||N.date).toDateString()===Be.date.toDateString();return jsxRuntime.jsx("button",{className:y("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Be.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),Be.isCurrentMonth&&(p?"text-white":"text-gray-900"),Et&&"ring-1 ring-[#3B82F6]",ia&&"bg-[#7C3AED] text-white",!ia&&(p?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Je(Be.date),T(false);},children:Be.dayNum},St)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),mt(!pt),Ae(false);},className:y("p-1 rounded transition-colors",Me?"text-[#7C3AED] bg-[#7C3AED]/20":p?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Me?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===Me)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===Me)?.initials||t.availableUsers?.find(X=>X.id===Me)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{ge(null),mt(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",!Me&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:y("w-5 h-5 rounded-full flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:p?"text-[#9CA3AF]":"text-gray-500",children:i==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{ge(X.id),mt(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Me===X.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:y("px-3 py-2 text-xs",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Z.trim()){let X=t.availableUsers?.find(Nt=>Nt.id===Me),Ie=gt||N.date;a.onTaskCreate?.({name:Z.trim(),startDate:Ie,endDate:Ie,priority:ve,assignees:X?[X]:void 0}),z(""),we(void 0),ge(null),Je(null),q(null);}},disabled:!Z.trim(),className:y("px-2.5 py-1 rounded text-xs font-medium transition-colors",Z.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":p?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:i==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:y("text-sm font-medium",N.isToday?"text-[#3B82F6]":N.isCurrentMonth?p?"text-white":"text-gray-900":p?"text-[#6B7280]":"text-gray-400"),children:N.date.getDate()})]})]},M)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>x(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:y("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[i==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:y("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",p?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>x(null),className:y("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=f.progress===100?0:100,_={...f,progress:N,status:N===100?"completed":"todo"};x(_),a.onTaskUpdate?.(_);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:y("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:f.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ze(),Ce(!re);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?i==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?i==="es"?"EN PROGRESO":"IN PROGRESS":i==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ce(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:i==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:i==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:i==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>Ye(N.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",(f.status===N.id||N.id==="completed"&&f.progress===100||N.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||N.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",N.id==="completed"?"bg-green-500":N.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ce(false),Fe(false),k(null),O(!se);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((N,M)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},M)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:y("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:y("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(N=>{let M=f.assignees?.some(_=>_.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let _=f.assignees||[],ce;M?ce=_.filter(_e=>_e.name!==N.name):ce=[..._,{name:N.name,avatar:N.avatar,initials:N.initials||N.name.slice(0,2).toUpperCase(),color:N.color||"#8B5CF6"}],Ue("assignees",ce);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50",M&&(p?"bg-white/5":"bg-gray-50")),children:[N.avatar?jsxRuntime.jsx("img",{src:N.avatar,alt:N.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:y("flex-1 text-left",p?"text-white":"text-gray-900"),children:N.name}),M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.id||N.name)}):jsxRuntime.jsx("div",{className:y("px-3 py-4 text-sm text-center",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(L?null:"start"),P(f.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:y("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:N=>{N.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:y("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,M=new Date(N);M.setDate(N.getDate()+1);let _=new Date(N);_.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let ce=new Date(N);ce.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let _e=new Date(N);_e.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let X=new Date(N);X.setDate(N.getDate()+14);let Ie=new Date(N);return Ie.setDate(N.getDate()+28),[{label:i==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Ma\xF1ana":"Tomorrow",date:M,display:M.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Este fin de semana":"This weekend",date:_,display:i==="es"?"s\xE1b.":"sat."},{label:i==="es"?"Pr\xF3xima semana":"Next week",date:ce,display:i==="es"?"lun.":"mon."},{label:i==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:_e,display:_e.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:i==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:i==="es"?"4 semanas":"4 weeks",date:Ie,display:Ie.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Pe,ta)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(L==="start"){let ae=f.endDate&&Pe.date>f.endDate?Pe.date:f.endDate;ft(Pe.date,ae),k("end");}else {let ae=f.startDate&&Pe.date<f.startDate?Pe.date:f.startDate;ft(ae,Pe.date),k(null);}},children:[jsxRuntime.jsx("span",{children:Pe.label}),jsxRuntime.jsx("span",{className:y("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Pe.display})]},ta))})(),jsxRuntime.jsx("div",{className:y("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ft(void 0,void 0),k(null);},className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:i==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:y("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:L==="start"?i==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":i==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:y("font-medium",p?"text-white":"text-gray-900"),children:U.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>P(new Date),className:y("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:i==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>P(new Date(U.getFullYear(),U.getMonth()-1)),className:y("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>P(new Date(U.getFullYear(),U.getMonth()+1)),className:y("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(i==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:y("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=U.getFullYear(),M=U.getMonth(),_=new Date(N,M,1).getDay(),ce=new Date(N,M+1,0).getDate(),_e=new Date(N,M,0).getDate(),X=new Date,Ie=[];for(let Pe=_-1;Pe>=0;Pe--)Ie.push({day:_e-Pe,isCurrentMonth:false,date:new Date(N,M-1,_e-Pe)});for(let Pe=1;Pe<=ce;Pe++)Ie.push({day:Pe,isCurrentMonth:true,date:new Date(N,M,Pe)});let Nt=42-Ie.length;for(let Pe=1;Pe<=Nt;Pe++)Ie.push({day:Pe,isCurrentMonth:false,date:new Date(N,M+1,Pe)});return Ie.map((Pe,ta)=>{let ae=Pe.date.toDateString()===X.toDateString(),at=f.startDate?.toDateString()===Pe.date.toDateString(),Qe=f.endDate?.toDateString()===Pe.date.toDateString(),Be=at||Qe,St=f.startDate&&f.endDate&&Pe.date>=f.startDate&&Pe.date<=f.endDate;return jsxRuntime.jsx("button",{className:y("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Pe.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),Pe.isCurrentMonth&&(p?"text-white":"text-gray-900"),ae&&"ring-2 ring-[#3B82F6]",at&&"bg-[#3B82F6] text-white",Qe&&!at&&"bg-[#7C3AED] text-white",St&&!Be&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!Be&&(p?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Et=new Date(Pe.date);if(L==="start"){let ia=f.endDate&&Et>f.endDate?Et:f.endDate;ft(Et,ia),k("end");}else {let ia=f.startDate&&Et<f.startDate?Et:f.startDate;ft(ia,Et),k(null);}},children:Pe.day},ta)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ze(),Fe(!Se);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?i==="es"?"Urgente":"Urgent":f.priority==="medium"?i==="es"?"Media":"Medium":i==="es"?"Baja":"Low":i==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:i==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:i==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:i==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:i==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:i==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>{Ue("priority",N.id),Fe(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",f.priority===N.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:y("text-sm",p?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${i==="es"?"d\xEDas":"days"}`:i==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:N=>{let M=parseInt(N.target.value),_=f.status;M===100?_="completed":M>0?_="in-progress":_="todo";let ce={...f,progress:M,status:_};x(ce),a.onTaskUpdate?.(ce);},onBlur:()=>$(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",p?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>$(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Qa,{selectedTags:f.tags||[],availableTags:m,onChange:N=>{Ue("tags",N);},onCreateTag:l,theme:v})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:y("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[f.dependencies&&f.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:f.dependencies.map(N=>{let M=e.find(_=>_.id===N);return jsxRuntime.jsxs("span",{className:y("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",p?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[M?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let _=(f.dependencies||[]).filter(ce=>ce!==N);Ue("dependencies",_);},className:y("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ze(),xe(!de);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:y("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{xe(false),lt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:y("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:it,onChange:N=>lt(N.target.value),placeholder:i==="es"?"Buscar tarea...":"Search task...",className:y("w-full px-3 py-2 rounded-md text-sm outline-none",p?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(N=>N.id!==f.id).filter(N=>it===""||N.name.toLowerCase().includes(it.toLowerCase())).map(N=>{let M=f.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let _=f.dependencies||[],ce;M?ce=_.filter(_e=>_e!==N.id):ce=[..._,N.id],Ue("dependencies",ce);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",M&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",M?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),children:M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:y("block truncate",p?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:y("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:y("px-3 py-4 text-sm text-center",p?"text-[#6B7280]":"text-gray-500"),children:i==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ze(),ca(!sa);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:f.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:y("text-sm",p?"text-white":"text-gray-900"),children:er.find(N=>N.value===f.color)?.name||(i==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:sa&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ca(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:er.map(N=>{let M=f.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{Ue("color",N.value),ca(false);},className:y("w-7 h-7 rounded-full flex items-center justify-center transition-all",M&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:M?N.value:void 0},title:N.name,children:M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.isMilestone||false,onChange:N=>Ue("isMilestone",N.target.checked),className:y("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",f.isMilestone?"bg-purple-500 border-purple-500":p?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:y("text-sm",p?"text-white":"text-gray-900"),children:i==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:y("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",p?"text-white":"text-gray-900"),children:i==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:f.description||"",onChange:N=>Ue("description",N.target.value),placeholder:i==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",p?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm mt-2 transition-colors",p?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),i==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:i==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),i==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:i==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(N=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",N.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:y("text-sm",N.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:N.name})]},N.id))}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),i==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",p?"text-white":"text-gray-900"),children:i==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:y("p-1 rounded transition-colors",p?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),i==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:y("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[i==="es"?"Adjuntos":"Attachments",Re.length>0&&jsxRuntime.jsxs("span",{className:y("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",Re.length,")"]})]}),Re.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:Re.map(N=>{let M=De(N.type),_=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[_&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(M,{className:y("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:y("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:oe(N.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(N.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",p?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:i==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:jt,onDragLeave:Q,onDrop:tt,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ue?p?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":p?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",nt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ht,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||nt}),nt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:y("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:y("w-6 h-6 mx-auto mb-2",ue?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:ue?i==="es"?"Suelta los archivos aqu\xED":"Drop files here":i==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:y("text-xs mt-1",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:y("w-[280px] border-l flex flex-col",p?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:y("px-4 py-3 border-b flex items-center justify-between",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:y("font-medium",p?"text-white":"text-gray-900"),children:i==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:y("text-sm text-center py-8",p?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),i==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:y("p-3 border-t",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:i==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",p?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>S(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:y("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:y("px-4 py-3 border-b flex items-center justify-between",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:y("font-medium",p?"text-white":"text-gray-900"),children:D.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>S(null),className:y("p-1 rounded",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:D.events.map(N=>jsxRuntime.jsxs("button",{onClick:()=>{S(null),x(N.task);},className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(zc,{task:N.task}),jsxRuntime.jsx("span",{className:y("text-sm truncate flex-1",p?"text-white":"text-gray-900"),children:N.title}),N.task.priority==="high"||N.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},N.id))})]})]})})]})}var Fi={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"},Ii={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"},Li={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"},Un={dark:Fi,light:Ii,neutral:Li};function Wc(e){return Un[e]||Un.dark}function ih({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:c}){let[m,l]=react.useState(false),g=react.useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=react.useMemo(()=>{let h=g.length,b=new Set(g.flatMap(w=>w.assignedUserIds||[])).size,p=g.map(w=>w.priority).filter(Boolean),v=new Set(g.flatMap(w=>w.labels||[])).size;return {totalCards:h,uniqueAssignees:b,priorities:p,labels:v}},[g]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:y("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:y("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:g.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:g.map(h=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsxRuntime.jsx("h4",{children:h.title}),h.description&&jsxRuntime.jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.stopPropagation(),s?.(e.id,h.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"})]})})]},h.id))})})]})}var Gc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function $o(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 Wo(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 _c(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 Vc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:c}){let m=react.useMemo(()=>({...Gc,...n}),[n]),[l,g]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let u=new Map;return e.forEach(f=>{let x=f.timestamp.toISOString().split("T")[0],D=u.get(x);D?D.push(f):u.set(x,[f]);}),Array.from(u.entries()).sort((f,x)=>x[0].localeCompare(f[0])).map(([f,x])=>({date:new Date(f),events:x.sort((D,S)=>S.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:b}=react.useMemo(()=>{let u=new Set,f=new Set;return e.forEach(x=>{u.add(x.userId),f.add(x.type);}),{uniqueUsers:Array.from(u),uniqueTypes:Array.from(f)}},[e]),p=u=>{g(f=>{let x=new Set(f);return x.has(u)?x.delete(u):x.add(u),x});},v=u=>{let x=new Date().getTime()-u.getTime(),D=Math.floor(x/6e4),S=Math.floor(x/36e5),L=Math.floor(x/864e5);return D<1?"just now":D<60?`${D}m ago`:S<24?`${S}h ago`:L<7?`${L}d ago`:u.toLocaleDateString()},w=react.useMemo(()=>{let u=0;return t.types&&t.types.length>0&&u++,t.users&&t.users.length>0&&u++,t.dateRange&&u++,t.searchTerm&&u++,u},[t]);return react.useEffect(()=>{if(s&&d.current){let u=d.current.querySelector(`[data-event-id="${s}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:y("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:y("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:u=>{let f=u.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(u=>jsxRuntime.jsxs("option",{value:u,children:[Wo(u)," ",u.replace("_"," ")]},u))]}),h.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:u=>{let f=u.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),h.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:u=>a({...t,searchTerm:u.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:d,children:i.map(u=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&u.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:u.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[u.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:u.events.map((f,x)=>{let D=l.has(f.id),S=s===f.id,L=_c(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:y("history-timeline-event",D&&"expanded",S&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:L},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Wo(f.type)})}),x<u.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:L}})]}),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:[m.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:$o(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?v(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),p(f.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([k,U])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(U.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(U.to)})]})]},k)),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(([k,U])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(U)})]},k))]})]})]})]},f.id)})})]},u.date?.toISOString()||"all"))})]})}function Kc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:c,onSpeedChange:m,className:l}){let g=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:y("history-replay-empty",l),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:y("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Wo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&$o(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:h=>c(parseInt(h.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((h,b)=>jsxRuntime.jsx("div",{className:y("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>c(b),title:$o(h)},h.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:g.map(h=>jsxRuntime.jsxs("button",{className:y("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(h=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxRuntime.jsxs("div",{className:y("history-replay-start",l),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 Bi(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 Ri(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 Yc(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 qc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function uh(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let l=1-m/s;n.forEach(g=>{let d=a/2,i=r/2;g.vx+=(d-g.x)*o.centerForce*l,g.vy+=(i-g.y)*o.centerForce*l,n.forEach(h=>{if(g.id===h.id)return;let b=g.x-h.x,p=g.y-h.y,v=Math.sqrt(b*b+p*p)||1,w=o.chargeStrength*l/(v*v);g.vx+=b/v*w,g.vy+=p/v*w;});}),t.forEach(g=>{let d=c.get(typeof g.source=="string"?g.source:g.source.id),i=c.get(typeof g.target=="string"?g.target:g.target.id);if(!d||!i)return;let h=i.x-d.x,b=i.y-d.y,p=Math.sqrt(h*h+b*b)||1,v=(p-o.linkDistance)/p*o.forceStrength*l;d.vx+=h*v,d.vy+=b*v,i.vx-=h*v,i.vy-=b*v;}),n.forEach(g=>{g.fx!==null&&g.fx!==void 0?(g.x=g.fx,g.vx=0):g.x+=g.vx,g.fy!==null&&g.fy!==void 0?(g.y=g.fy,g.vy=0):g.y+=g.vy,g.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,g.x)),g.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,g.y)),g.vx*=.9,g.vy*=.9;});}return n}function Xc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:c,className:m}){let l=react.useRef(null),[g,d]=react.useState([]),[i,h]=react.useState(null),[b,p]=react.useState(null),[v,w]=react.useState(null),[u,f]=react.useState(1),[x,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=uh(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let S=react.useCallback((R,J)=>{a.enableDragging&&(J.stopPropagation(),h(R));},[a.enableDragging]),L=react.useCallback(R=>{if(!i||!l.current)return;let re=l.current.getBoundingClientRect(),Ce=(R.clientX-re.left-x.x)/u,Se=(R.clientY-re.top-x.y)/u;d(Fe=>Fe.map(se=>se.id===i?{...se,x:Ce,y:Se,fx:Ce,fy:Se}:se));},[i,u,x]),k=react.useCallback(()=>{h(null);},[]),U=react.useCallback((R,J)=>{J.stopPropagation(),c?.({type:"node-click",node:R,position:{x:J.clientX,y:J.clientY}});},[c]),P=react.useCallback((R,J)=>{J.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:J.clientX,y:J.clientY}});},[c]),C=react.useCallback(R=>{let J=g.find(re=>re.id===R);return J?{x:J.x,y:J.y}:{x:0,y:0}},[g]),H=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let J=R.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:y("relationships-graph-empty",m),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:y("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(u*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Bi(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Yc(R)," ",Ri(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:L,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${u})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let J=C(typeof R.source=="string"?R.source:R.source.id),re=C(typeof R.target=="string"?R.target:R.target.id),Ce=qc(R.type),Se=v===R.id,Fe=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:y("relationships-graph-edge",Se&&"hovered",Fe&&"critical"),onMouseEnter:()=>w(R.id),onMouseLeave:()=>w(null),onClick:se=>P(R,se),children:[jsxRuntime.jsx("line",{x1:J.x,y1:J.y,x2:re.x,y2:re.y,stroke:Bi(R.type),strokeWidth:Fe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Se?1:.6,markerEnd:Ce?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Se&&jsxRuntime.jsx("text",{x:(J.x+re.x)/2,y:(J.y+re.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ri(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:g.map(R=>{let J=b===R.id,re=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:y("relationships-graph-node",J&&"hovered",re&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:Ce=>S(R.id,Ce),onMouseEnter:()=>p(R.id),onMouseLeave:()=>p(null),onClick:Ce=>U(R,Ce),children:[jsxRuntime.jsx("circle",{r:re?a.nodeSize*1.2:a.nodeSize,fill:H(R),stroke:re?"#fbbf24":"#ffffff",strokeWidth:re?3:2,opacity:J?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Qc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[c,m]=react.useState(false),[l,g]=react.useState(null),[d,i]=react.useState(null),h=react.useRef(null),b=c||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let u=f=>{f.key==="Escape"&&!b&&p();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,b]);let p=()=>{b||(n(""),g(null),i(null),t());},v=async()=>{if(!(!s.trim()||b)){m(true),g(null),i(null);try{let u=await r(s.trim());i(u);}catch(u){g(u instanceof Error?u.message:"Failed to generate plan");}finally{m(false);}}},w=()=>{d&&(a(d),p());};return e?jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:p}),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:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:p,disabled:b,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((u,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:u.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((u,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:u.title}),u.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:u.description})]}),u.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${u.priority==="URGENT"?"bg-red-500/20 text-red-400":u.priority==="HIGH"?"bg-orange-500/20 text-orange-400":u.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:u.priority})]})},f)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:h,value:s,onChange:u=>n(u.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:b}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),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((u,f)=>jsxRuntime.jsx("button",{onClick:()=>n(u),disabled:b,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:u},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&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:p,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick: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:v,disabled:!s.trim()||b,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:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Oi={"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 fh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},hh={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 bh(e,t,a){let r=Oi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ho(e){return `$${e.toFixed(4)}`}var zi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=bh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),n=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),m=a.reduce((d,i)=>d+i.duration,0),l={},g={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,g[d.feature]=(g[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:g,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let c=this.operations.filter(g=>g.timestamp>=n).length,m=Math.max(0,o-c),l=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:l,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},jr=new zi;function ap({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(jr.getStats()),[s,n]=react.useState(jr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(jr.getStats()),n(jr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=jr.getRecentOperations(5);return jsxRuntime.jsxs(dt,{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:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ho(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,l])=>{let g=r.costsByFeature[m]||0,d=r.totalOperations>0?l/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:m.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:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ho(g)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ho(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 np({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,c]=react.useState(""),[m,l]=react.useState(""),[g,d]=react.useState(""),[i,h]=react.useState(false),[b,p]=react.useState(null),[v,w]=react.useState(null),[u,f]=react.useState(null),x=react.useRef(null),D=i||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let P=C=>{C.key==="Escape"&&!D&&S();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,D]);let S=()=>{D||(c(""),l(""),d(""),p(null),w(null),f(null),t());},L=async()=>{if(!(!n.trim()||D)){h(true),p(null),w(null),f(null);try{let P=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:g||void 0});w(P.tasks.tasks),f({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){p(P instanceof Error?P.message:"Failed to generate tasks");}finally{h(false);}}},k=()=>{v&&(a(v),S());};if(!e)return null;let U=u?.similarity?((u.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:S,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[u?.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"}),u?.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 (",U,"% 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:[u?.tokens_used||0," tokens"]}),u?.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:[u.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((P,C)=>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:["#",C+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.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"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:P.priority})]})},P.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:x,value:n,onChange:P=>c(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:P=>l(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:P=>d(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),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((P,C)=>jsxRuntime.jsx("button",{onClick:()=>c(P),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},C))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:S,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:L,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&Jo(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,u,f)=>{console.warn(`Retry attempt ${u} after ${f}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),s=react.useCallback(async(v,w,u)=>{r(f=>{let x=f.cards.find(P=>P.id===v);if(!x)return f;let D=x.columnId,S={...x,columnId:w,position:u},L=f.cards.map(P=>P.id===v?S:P),k=f.columns.map(P=>{if(P.id===D)return {...P,cardIds:P.cardIds.filter(C=>C!==v)};if(P.id===w){let C=L.filter(H=>H.columnId===w).sort((H,R)=>H.position-R.position);return {...P,cardIds:C.map(H=>H.id)}}return P}),U={...f,cards:L,columns:k};return o(U),U});},[o]),n=react.useCallback(async(v,w)=>{r(u=>{let f=u.cards.map(D=>D.id===v?{...D,...w}:D),x={...u,cards:f};return o(x),x});},[o]),c=react.useCallback(async v=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let f={...v,id:w},x=u.columns.map(S=>S.id===v.columnId?{...S,cardIds:[...S.cardIds,w]}:S),D={...u,cards:[...u.cards,f],columns:x};return o(D),D});},[o]),m=react.useCallback(async v=>{r(w=>{let u=w.cards.find(S=>S.id===v);if(!u)return w;let f=w.cards.filter(S=>S.id!==v),x=w.columns.map(S=>S.id===u.columnId?{...S,cardIds:S.cardIds.filter(L=>L!==v)}:S),D={...w,cards:f,columns:x};return o(D),D});},[o]),l=react.useCallback(async v=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let f={...v,id:w,cardIds:[]},x={...u,columns:[...u.columns,f]};return o(x),x});},[o]),g=react.useCallback(async(v,w)=>{r(u=>{let f=u.columns.map(D=>D.id===v?{...D,...w}:D),x={...u,columns:f};return o(x),x});},[o]),d=react.useCallback(async v=>{r(w=>{let u=w.cards.filter(D=>D.columnId!==v),f=w.columns.filter(D=>D.id!==v),x={...w,cards:u,columns:f};return o(x),x});},[o]),i=react.useCallback(v=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(v),w},[c]),h=react.useCallback(v=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),w},[l]),b=react.useCallback(()=>{r(v=>{let w={...v,cards:[],columns:[]};return o(w),w});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:c,onCardDelete:m,onColumnCreate:l,onColumnUpdate:g,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:b}}}function ip({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Hn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,l,g={})=>{s.addCard({title:l,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...g});},addColumn:(m,l)=>{let g=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:l??g+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Go={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},dp={by:"none",order:"asc"};function cp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Go,...e}),[s,n]=react.useState({...dp,...t}),c=react.useCallback(p=>{o(v=>({...v,...p}));},[]),m=react.useCallback(p=>{n(v=>({...v,...p}));},[]),l=react.useCallback(()=>{o(Go),n(dp);},[]),g=react.useCallback(()=>{a&&o({...Go,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Go,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Go,priorities:["HIGH","URGENT"]});},[]),h=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),b=react.useCallback(p=>{let v=[...p];if(r.search){let w=r.search.toLowerCase();v=v.filter(u=>u.title.toLowerCase().includes(w)||u.description?.toLowerCase().includes(w));}if(r.dateFilter!=="all"){let w=new Date,u=w.getFullYear(),f=String(w.getMonth()+1).padStart(2,"0"),x=String(w.getDate()).padStart(2,"0"),D=`${u}-${f}-${x}`;v=v.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let L=S.endDate||S.dueDate;if(!L)return false;let k;if(typeof L=="string")k=L.split("T")[0]||L;else {let U=L.getUTCFullYear(),P=String(L.getUTCMonth()+1).padStart(2,"0"),C=String(L.getUTCDate()).padStart(2,"0");k=`${U}-${P}-${C}`;}switch(r.dateFilter){case "overdue":return k<D;case "today":return k===D;case "this-week":let U=new Date(D+"T00:00:00"),P=new Date(k+"T00:00:00"),C=new Date(U);return C.setDate(C.getDate()+7),P>=U&&P<=C;case "custom":if(r.dateRange){let H=typeof L=="string"?new Date(L):L;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(w=>w.priority&&r.priorities.includes(w.priority))),r.assignees.length>0&&(v=v.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(v=v.filter(w=>w.labels&&w.labels.some(u=>r.labels.includes(u)))),r.columns.length>0&&(v=v.filter(w=>r.columns.includes(w.columnId))),s.by!=="none"&&v.sort((w,u)=>{let f=0;switch(s.by){case "created":let x=w.createdAt?new Date(w.createdAt).getTime():0,D=u.createdAt?new Date(u.createdAt).getTime():0;f=x-D;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},L=S[w.priority||"LOW"],k=S[u.priority||"LOW"];f=L-k;break;case "dueDate":let U=w.endDate||w.dueDate,P=u.endDate||u.dueDate;if(!U)return 1;if(!P)return -1;let C=typeof U=="string"?new Date(U).getTime():U.getTime(),H=typeof P=="string"?new Date(P).getTime():P.getTime();f=C-H;break;case "title":f=w.title.localeCompare(u.title);break;case "estimate":let R=w.estimatedTime||0,J=u.estimatedTime||0;f=R-J;break;default:f=0;}return s.order==="asc"?f:-f}),v},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:m,resetFilters:l,filterMyTasks:g,filterOverdue:d,filterHighPriority:i,applyFilters:b,hasActiveFilters:h}}var mp,up;if(typeof window<"u")try{let e=Yo("ai");mp=e.generateObject,up=e.generateText;}catch{}function gp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(mp&&up&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let h=i instanceof Error?i:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let h=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let h=i instanceof Error?i:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(i){let h=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),g=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let h=i instanceof Error?i:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:l,onEstimateEffort:g,isAvailable:s,isLoading:t,error:r}}function $i(){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 fp(e){let{cards:t}=e,[a,r]=$i(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=i.ctrlKey||i.metaKey,b=i.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let p=t.find(w=>w.id===d),v=t.find(w=>w.id===a.lastSelectedCardId);if(p&&v&&p.columnId===v.columnId){let w=t.filter(k=>k.columnId===p.columnId).sort((k,U)=>k.position-U.position),u=w.findIndex(k=>k.id===a.lastSelectedCardId),f=w.findIndex(k=>k.id===d),[x,D]=u<f?[u,f]:[f,u],S=w.slice(x,D+1).map(k=>k.id),L=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:L,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),g=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:c,selectAll:m,toggleCard:l,getSelectedCards:g}}var hp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function bp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...hp,...a}),[a]),[s,n]=react.useState([]),c=react.useCallback((p,v,w,u,f)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:p,cardIds:v,columnId:w,strategy:u,color:f,isExpanded:true,position:s.filter(D=>D.columnId===w).length,createdAt:new Date};n(D=>[...D,x]);},[o.minCardsPerStack,s]),m=react.useCallback(p=>{n(v=>v.filter(w=>w.id!==p));},[]),l=react.useCallback(p=>{n(v=>v.map(w=>w.id===p?{...w,isExpanded:!w.isExpanded}:w));},[]),g=react.useCallback((p,v)=>{n(w=>w.map(u=>u.id===p&&!u.cardIds.includes(v)?{...u,cardIds:[...u.cardIds,v]}:u));},[]),d=react.useCallback((p,v)=>{n(w=>w.map(u=>{if(u.id===p){let f=u.cardIds.filter(x=>x!==v);return f.length<o.minCardsPerStack?null:{...u,cardIds:f}}return u}).filter(u=>u!==null));},[o.minCardsPerStack]),i=react.useCallback(p=>s.filter(v=>v.columnId===p).sort((v,w)=>v.position-w.position),[s]),h=react.useCallback(async p=>{let v=t.filter(D=>D.columnId===p);if(v.length<o.minCardsPerStack*2)return [];let w=[],u=new Map;v.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(S=>{u.has(S)||u.set(S,[]),u.get(S).push(D);});}),u.forEach((D,S)=>{D.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:D.map(L=>L.id),columnId:p,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${S}"`,confidence:.85});});let f=new Map;v.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(S=>{f.has(S)||f.set(S,[]),f.get(S).push(D);});}),f.forEach((D,S)=>{D.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:D.map(L=>L.id),columnId:p,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(D=>{D.priority&&(x.has(D.priority)||x.set(D.priority,[]),x.get(D.priority).push(D));}),x.forEach((D,S)=>{if(D.length>=o.minCardsPerStack){let L={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";w.push({stack:{title:`${L} ${S} Priority`,cardIds:D.map(k=>k.id),columnId:p,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of v){let L=(await r.findSimilar(D,v)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(L.length>=o.minCardsPerStack-1){let k=[D.id,...L.map(P=>P.card.id)],U=L.reduce((P,C)=>P+C.similarity,0)/L.length;w.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:k,columnId:p,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${L.length+1} similar tasks`,confidence:U});}}return w.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,S)=>S.confidence-D.confidence).slice(0,5)},[t,o,r]),b=react.useCallback(p=>{c(p.stack.title,p.stack.cardIds,p.stack.columnId,p.stack.strategy,p.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let w=await h(v),u=w[0];w.length>0&&u&&u.confidence>=.9&&b(u);});},[]),{stacks:s,createStack:c,deleteStack:m,toggleStack:l,addToStack:g,removeFromStack:d,getStacksForColumn:i,getSuggestions:h,applySuggestion:b,config:o}}var yp=react.createContext(null);function vp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:l}=Yo("@libxai/core");s.set(m.id,new l(m));}),t?.cards?.forEach(m=>{let{Card:l}=Yo("@libxai/core");n.set(m.id,new l(m));});let c=null;if(t?.board){let{Board:m}=Yo("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(yp.Provider,{value:{store:o},children:e})}function Gn(){let e=react.useContext(yp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Vo(){let e=Gn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let c=react.useCallback(u=>{e.updateBoard(u);},[e]),m=react.useCallback(u=>{e.addColumn(u);},[e]),l=react.useCallback((u,f)=>{e.updateColumn(u,f);},[e]),g=react.useCallback(u=>{e.deleteColumn(u);},[e]),d=react.useCallback(u=>e.getColumn(u),[e]),i=react.useCallback(u=>{e.addCard(u);},[e]),h=react.useCallback((u,f)=>{e.updateCard(u,f);},[e]),b=react.useCallback(u=>{e.deleteCard(u);},[e]),p=react.useCallback((u,f,x)=>{e.moveCard(u,f,x);},[e]),v=react.useCallback(u=>e.getCard(u),[e]),w=react.useCallback(u=>e.getCardsByColumn(u),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:m,updateColumn:l,deleteColumn:g,getColumn:d,addCard:i,updateCard:h,deleteCard:b,moveCard:p,getCard:v,getCardsByColumn:w}}function kp(e){let{cards:t}=Vo();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function wp(e="position",t="asc"){let{cards:a}=Vo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,l=s.priority?c[s.priority]:0;n=m-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var _n=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=yl.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let c=await Promise.resolve(n.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Lh=new _n;function Tp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:c=0,getItemKey:m}){let l=react.useRef(null),g=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:c}),d=g.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${g.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${g.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:i,className:o,children:jsxRuntime.jsx("div",{style:h,children:d.map(b=>{let p=e[b.index];if(!p)return null;let v=m?m(p,b.index):b.index,w={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsxRuntime.jsx("div",{style:w,"data-index":b.index,children:r(p,b.index)},v)})})})}function Np(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 Sp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:c=16,getItemKey:m,horizontal:l=true}){let g=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>g.current,estimateSize:()=>r,overscan:n,gap:c}),i=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:g,style:h,className:s,children:jsxRuntime.jsx("div",{style:b,children:i.map(p=>{let v=e[p.index];if(!v)return null;let w=m?m(v,p.index):p.index,u={position:"absolute",top:0,left:p.start,width:p.size,height:"100%"};return jsxRuntime.jsx("div",{style:u,"data-index":p.index,children:o(v,p.index)},w)})})})}function Ep(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 Pp(e,t=10){return e>t}var _i={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Vi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ji={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ki={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Yi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},qi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Xi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ji={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)"},Zi={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)"},Qi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},el={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}},tl={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}},Vn={spacing:_i,borderRadius:Vi,fontSize:ji,fontWeight:Ki,lineHeight:Yi,zIndex:qi,duration:Xi,easing:Ji,shadows:Zi,opacity:Qi,kanban:el,gantt:tl};function Mp(e,t,a){return e[t]??a}function al(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?al(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Oh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function rl(e="asakaa"){let t=al(Vn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Oh(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function kc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function cr(e,t){let a=kc(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return n.every(l=>m.includes(l))})}function fi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let h={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(h!==void 0){let C=new Date(r),p=C.getDay(),y=h-p;return y<=0&&(y+=7),C.setDate(C.getDate()+y),C}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+i):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+i*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+i),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),h=parseInt(c[2],10)-1,C=parseInt(c[3],10);return new Date(C,h,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=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(l&&l[1]&&l[2]){let i=parseInt(l[1],10),h=m[l[2].toLowerCase()],C=l[3]?parseInt(l[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,i)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(C,i,h)}return null}function hi(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 bi(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 wc(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 Cc(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 l=r[1].trim(),u=r[2].trim(),d=cr(t,l),i=fi(u);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(i);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:C},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),u=o[2].trim(),d=cr(t,l),i=hi(u);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${i} days. New end date: ${h.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),u=s[2].trim(),d=cr(t,l),i=bi(u);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),u=n[2].trim(),d=cr(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let l=c[1].trim(),u=c[2].trim(),d=cr(t,l),i=cr(t,u);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let l=m[1].trim(),u=cr(t,l);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Tc(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 M0(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 A0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function An(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(i=>i.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>An(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},c=n(e.startDate),m=n(e.endDate),l=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:M0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Nc(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:A0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Dc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>An(r,e,t))}var yi={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"}},vi={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"}},Fn={en:yi,es:vi};function xi(e){return Fn[e]||Fn.en}function In(e,t){let a=xi(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 Mc(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(...Mc(r.subtasks,t+1));return a}function W0({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 Ac({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:c="dark",locale:m="en",customTranslations:l,showSearch:u=true,showHierarchy:d=true}=t,i=In(m,l),h=c==="dark",[C,p]=react.useState(new Set),[y,f]=react.useState("startDate"),[v,g]=react.useState("asc"),[k,x]=react.useState("");react.useMemo(()=>{let P=new Set;function T(G){for(let R of G)R.subtasks?.length&&(P.add(R.id),T(R.subtasks));}T(e),p(P);},[e]);let D=react.useCallback(P=>{p(T=>{let G=new Set(T);return G.has(P)?G.delete(P):G.add(P),G}),a.onTaskToggleExpand?.(P);},[a]),B=react.useCallback(P=>{y===P?g(T=>T==="asc"?"desc":"asc"):(f(P),g("asc")),a.onSortChange?.({column:P,direction:v==="asc"?"desc":"asc"});},[y,v,a]),w=react.useMemo(()=>{let P=Mc(e);if(k.trim()){let G=k.toLowerCase();P=P.filter(R=>R.name.toLowerCase().includes(G));}let T=[];for(let G of P){let R=G.level===0;G.level>0&&(R=true),(R||k.trim())&&T.push(G);}return k.trim()&&T.sort((G,R)=>{let Y,te;switch(y){case "name":Y=G.name.toLowerCase(),te=R.name.toLowerCase();break;case "startDate":Y=G.startDate?.getTime()||0,te=R.startDate?.getTime()||0;break;case "endDate":Y=G.endDate?.getTime()||0,te=R.endDate?.getTime()||0;break;case "progress":Y=G.progress||0,te=R.progress||0;break;case "status":Y=G.status||"todo",te=R.status||"todo";break;default:return 0}return Y<te?v==="asc"?-1:1:Y>te?v==="asc"?1:-1:0}),T},[e,k,y,v]),z=P=>P?(P instanceof Date?P:new Date(P)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:b("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:b("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:P=>x(P.target.value),placeholder:i.toolbar.searchPlaceholder,className:b("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:b("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:b("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"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:()=>B("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>B("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>B("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>B("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>B("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((P,T)=>{let G=C.has(P.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:T*.02},className:b("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+P.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&P.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),D(P.id);},className:b("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:G?jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!P.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...P,progress:P.progress===100?0:100,status:P.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(W0,{status:P.status,progress:P.progress})}),jsxRuntime.jsx("span",{className:b("truncate",h?"text-white":"text-gray-900",P.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:P.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:b("px-2 py-1 rounded-full text-xs font-medium",P.progress===100||P.status==="completed"?"bg-green-500/10 text-green-500":P.progress&&P.progress>0||P.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:P.progress===100||P.status==="completed"?i.status.completed:P.progress&&P.progress>0||P.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:b("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),z(P.startDate)]}),jsxRuntime.jsxs("div",{className:b("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),z(P.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:b("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",P.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${P.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[P.progress||0,"%"]})]})})]},P.id)})}),w.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:b("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b(h?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var ki={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"},wi={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"},Ci={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"},Bn={dark:ki,light:wi,neutral:Ci};function Fc(e){return Bn[e]||Bn.dark}var Ti={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"}},Ni={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"}},Rn={en:Ti,es:Ni};function Oo(e){return Rn[e]||Rn.en}function On(e,t){let a=Oo(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 Ic(e){let t=Oo(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 Lc(e,t=0,a=true){let r=Oo(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 sh(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 Ai(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 Uc({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 Hc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:c,availableTags:m=[],onCreateTag:l,attachmentsByTask:u}){let{theme:d="dark",locale:i="en",customTranslations:h}=t,C=On(i,h),p=d==="dark",y={textTertiary:p?"#6B7280":"#9CA3AF",textSecondary:p?"#9CA3AF":"#6B7280",textPrimary:p?"#FFFFFF":"#111827",borderLight:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:p?"#1A1D25":"#FFFFFF",bgSecondary:p?"#0F1117":"#F9FAFB",hoverBg:p?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[f,v]=react.useState(r||new Date),[g,k]=react.useState(null),[x,D]=react.useState(null),[B,w]=react.useState(null),[z,P]=react.useState(new Date),[T,G]=react.useState({}),R=4,Y=3,[te,ve]=react.useState(false),[Ie,Ue]=react.useState(false),[le,O]=react.useState(false),[L,H]=react.useState(false),[F,q]=react.useState(null),[J,U]=react.useState(""),[xe,Te]=react.useState(void 0),[Le,ye]=react.useState(null),[tt,Ee]=react.useState(false),[dt,it]=react.useState(false),[ut,_e]=react.useState(null),[$,ae]=react.useState(false),[ce,Ce]=react.useState(new Date),[Pe,at]=react.useState(false),[mt,Be]=react.useState(false),[fe,Me]=react.useState(false),[_t,gt]=react.useState(""),[aa,ia]=react.useState(false),E=react.useCallback(()=>{v(new Date(f.getFullYear(),f.getMonth()-1,1));},[f]),ee=react.useCallback(()=>{v(new Date(f.getFullYear(),f.getMonth()+1,1));},[f]),$e=react.useCallback(()=>{v(new Date);},[]),re=react.useMemo(()=>{let N=f.getFullYear(),M=f.getMonth(),_=new Date(N,M,1),pe=new Date(N,M+1,0),Ye=_.getDay(),X=pe.getDate(),ze=sh(e),Nt=new Date;Nt.setHours(0,0,0,0);let Fe=[],ra=Ye,oe=new Date(N,M,0).getDate();for(let rt=ra-1;rt>=0;rt--){let He=new Date(N,M-1,oe-rt);Fe.push({date:He,isCurrentMonth:false,isToday:false,isWeekend:He.getDay()===0||He.getDay()===6,events:ze.filter(St=>Ai(He,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}for(let rt=1;rt<=X;rt++){let He=new Date(N,M,rt),St=He.getTime()===Nt.getTime();Fe.push({date:He,isCurrentMonth:true,isToday:St,isWeekend:He.getDay()===0||He.getDay()===6,events:ze.filter(Et=>Ai(He,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}let nt=42-Fe.length;for(let rt=1;rt<=nt;rt++){let He=new Date(N,M+1,rt);Fe.push({date:He,isCurrentMonth:false,isToday:false,isWeekend:He.getDay()===0||He.getDay()===6,events:ze.filter(St=>Ai(He,St)).map(St=>({id:St.id,title:St.name,start:St.startDate,end:St.endDate,task:St}))});}return Fe},[f,e]),De=i==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],we=f.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Se=react.useCallback((N,M)=>{if(!g)return;let _={...g,[N]:M};k(_),a.onTaskUpdate?.(_);},[g,a]),Oe=react.useCallback(N=>{if(!g)return;let M=g.progress||0;N==="completed"?M=100:N==="todo"&&(M=0);let _={...g,status:N,progress:M};k(_),a.onTaskUpdate?.(_),ve(false);},[g,a]),Ve=react.useCallback((N,M)=>{if(!g)return;let _={...g,startDate:N,endDate:M};k(_),a.onTaskUpdate?.(_);},[g,a]),Re=react.useCallback(()=>{ve(false),Ue(false),O(false),w(null),Me(false),gt(""),ia(false);},[]),Ze=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),at(false),!g||!a.onUploadAttachments)return;let M=Array.from(N.dataTransfer.files);if(M.length!==0){Be(true);try{await a.onUploadAttachments(g.id,M);}finally{Be(false);}}},[g,a]),ht=react.useCallback(async N=>{if(!g||!a.onUploadAttachments||!N.target.files)return;let M=Array.from(N.target.files);if(M.length!==0){Be(true);try{await a.onUploadAttachments(g.id,M);}finally{Be(false);}N.target.value="";}},[g,a]),Kt=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),at(true);},[]),Z=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),at(false);},[]),ne=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),Ae=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]),We=react.useMemo(()=>!g||!u?[]:u.get(g.id)||[],[g,u]);return o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:[C.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",p?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",p?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",p?"text-white":"text-gray-900"),children:C.labels.noEvents}),jsxRuntime.jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:C.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-auto",p?"bg-[#0F1117]":"bg-white",n),style:c,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:b("text-xl font-semibold capitalize",p?"text-white":"text-gray-900"),children:we}),jsxRuntime.jsx("button",{onClick:$e,className:b("px-3 py-1.5 text-sm rounded-lg transition-colors",p?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:C.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:E,className:b("p-2 rounded-lg transition-colors",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:b("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ee,className:b("p-2 rounded-lg transition-colors",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:De.map(N=>jsxRuntime.jsx("div",{className:b("py-2 text-center text-xs font-medium uppercase",p?"text-[#9CA3AF]":"text-gray-500"),children:N},N))}),jsxRuntime.jsx("div",{className:b("grid grid-cols-7 auto-rows-min gap-px rounded-lg",p?"bg-[#2D2D2D]":"bg-gray-300"),children:re.map((N,M)=>{let _=N.date.getDay()===0||N.date.getDay()===6;return jsxRuntime.jsxs("div",{className:b("min-h-[120px] p-2 transition-colors flex flex-col relative group",p?_?"bg-[#1C1F26]":N.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":_?"bg-gray-100":N.isCurrentMonth?"bg-white":"bg-gray-50",N.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let pe=T[M]||R,Ye=N.events.slice(0,pe),X=N.events.length-pe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Ye.map(ze=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{k(ze.task),a.onEventClick?.(ze);},whileHover:{scale:1.02},className:b("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ze.task.progress===100?p?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":p?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Uc,{task:ze.task}),jsxRuntime.jsx("span",{className:"truncate",children:ze.title})]})},ze.id)),X>0&&jsxRuntime.jsxs("button",{onClick:ze=>{ze.stopPropagation(),G(Nt=>({...Nt,[M]:pe+Y}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",p?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",i==="es"?"M\xC1S":"MORE"]}),pe>R&&N.events.length>R&&jsxRuntime.jsx("button",{onClick:ze=>{ze.stopPropagation(),G(Nt=>({...Nt,[M]:R}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",p?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:i==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let pe=M>=28,Ye=M%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),F===M?q(null):(q(M),U(""),Te(void 0),ye(null),_e(null),Ee(false),it(false),ae(false),Ce(N.date));},className:b("w-5 h-5 rounded flex items-center justify-center transition-all",F===M?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",p?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:b("w-3.5 h-3.5 transition-transform",F===M&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F===M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{q(null),U(""),Te(void 0),ye(null),_e(null),Ee(false),it(false),ae(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:pe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:pe?-5:5,scale:.95},transition:{duration:.12},className:b("absolute w-[320px] rounded-lg shadow-2xl z-50",pe?"bottom-full mb-1":"top-full mt-1",Ye?"right-0":"left-0",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),Ee(false),it(false),ae(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:J,onChange:X=>U(X.target.value),placeholder:i==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:b("w-full bg-transparent text-sm outline-none placeholder:opacity-40",p?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&J.trim()){let ze=t.availableUsers?.find(Fe=>Fe.id===Le),Nt=ut||N.date;a.onTaskCreate?.({name:J.trim(),startDate:Nt,endDate:Nt,priority:xe,assignees:ze?[ze]:void 0}),U(""),Te(void 0),ye(null),_e(null),q(null);}X.key==="Escape"&&(q(null),U(""),Te(void 0),ye(null),_e(null));}})}),jsxRuntime.jsxs("div",{className:b("px-2.5 py-2 flex items-center justify-between border-t",p?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),Ee(!tt),it(false);},className:b("p-1 rounded transition-colors",xe?xe==="urgent"||xe==="high"?"text-red-400 bg-red-500/20":xe==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":p?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:i==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:i==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:i==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:i==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:i==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{Te(X.id),Ee(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",xe===X.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),ae(!$),Ee(false),it(false),Ce(ut||N.date);},className:b("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",ut?"bg-[#7C3AED]/20 text-[#7C3AED]":p?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(ut||N.date).toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:b("w-40 py-2 border-r",p?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,ze=new Date(X);ze.setDate(X.getDate()+1);let Nt=new Date(X);Nt.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Fe=new Date(X);Fe.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let ra=new Date(X);ra.setDate(X.getDate()+14);let oe=new Date(X);return oe.setDate(X.getDate()+28),[{label:i==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Ma\xF1ana":"Tomorrow",date:ze,display:ze.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Este fin de semana":"This weekend",date:Nt,display:i==="es"?"s\xE1b.":"sat."},{label:i==="es"?"Pr\xF3xima semana":"Next week",date:Fe,display:i==="es"?"lun.":"mon."},{label:i==="es"?"2 semanas":"2 weeks",date:ra,display:ra.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:i==="es"?"4 semanas":"4 weeks",date:oe,display:oe.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((rt,He)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{_e(rt.date),ae(false);},children:[jsxRuntime.jsx("span",{children:rt.label}),jsxRuntime.jsx("span",{className:b("text-[10px]",p?"text-[#6B7280]":"text-gray-400"),children:rt.display})]},He))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:b("text-xs font-medium",p?"text-white":"text-gray-900"),children:ce.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ce(new Date),className:b("px-1.5 py-0.5 rounded text-[10px] transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:i==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ce(new Date(ce.getFullYear(),ce.getMonth()-1)),className:b("p-0.5 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ce(new Date(ce.getFullYear(),ce.getMonth()+1)),className:b("p-0.5 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(i==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:b("w-6 h-6 flex items-center justify-center text-[10px]",p?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=ce.getFullYear(),ze=ce.getMonth(),Nt=new Date(X,ze,1).getDay(),Fe=new Date(X,ze+1,0).getDate(),ra=new Date(X,ze,0).getDate(),oe=new Date,nt=[];for(let He=Nt-1;He>=0;He--)nt.push({dayNum:ra-He,isCurrentMonth:false,date:new Date(X,ze-1,ra-He)});for(let He=1;He<=Fe;He++)nt.push({dayNum:He,isCurrentMonth:true,date:new Date(X,ze,He)});let rt=42-nt.length;for(let He=1;He<=rt;He++)nt.push({dayNum:He,isCurrentMonth:false,date:new Date(X,ze+1,He)});return nt.map((He,St)=>{let Et=He.date.toDateString()===oe.toDateString(),da=(ut||N.date).toDateString()===He.date.toDateString();return jsxRuntime.jsx("button",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!He.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),He.isCurrentMonth&&(p?"text-white":"text-gray-900"),Et&&"ring-1 ring-[#3B82F6]",da&&"bg-[#7C3AED] text-white",!da&&(p?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{_e(He.date),ae(false);},children:He.dayNum},St)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),it(!dt),Ee(false);},className:b("p-1 rounded transition-colors",Le?"text-[#7C3AED] bg-[#7C3AED]/20":p?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Le?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===Le)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===Le)?.initials||t.availableUsers?.find(X=>X.id===Le)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{ye(null),it(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",!Le&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-5 h-5 rounded-full flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:p?"text-[#9CA3AF]":"text-gray-500",children:i==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{ye(X.id),it(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Le===X.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:b("px-3 py-2 text-xs",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(J.trim()){let X=t.availableUsers?.find(Nt=>Nt.id===Le),ze=ut||N.date;a.onTaskCreate?.({name:J.trim(),startDate:ze,endDate:ze,priority:xe,assignees:X?[X]:void 0}),U(""),Te(void 0),ye(null),_e(null),q(null);}},disabled:!J.trim(),className:b("px-2.5 py-1 rounded text-xs font-medium transition-colors",J.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":p?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:i==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:b("text-sm font-medium",N.isToday?"text-[#3B82F6]":N.isCurrentMonth?p?"text-white":"text-gray-900":p?"text-[#6B7280]":"text-gray-400"),children:N.date.getDate()})]})]},M)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>k(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[i==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:b("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:g.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",p?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>k(null),className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=g.progress===100?0:100,_={...g,progress:N,status:N===100?"completed":"todo"};k(_),a.onTaskUpdate?.(_);},className:b("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",g.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:g.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:b("text-xl font-semibold flex-1",g.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:g.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Re(),ve(!te);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.progress===100||g.status==="completed"?"bg-green-500/20 text-green-400":g.progress&&g.progress>0||g.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:g.progress===100||g.status==="completed"?i==="es"?"COMPLETADO":"DONE":g.progress&&g.progress>0||g.status==="in-progress"?i==="es"?"EN PROGRESO":"IN PROGRESS":i==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ve(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:i==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:i==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:i==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>Oe(N.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",(g.status===N.id||N.id==="completed"&&g.progress===100||N.id==="in-progress"&&g.progress&&g.progress>0&&g.progress<100||N.id==="todo"&&(!g.progress||g.progress===0)&&g.status!=="in-progress"&&g.status!=="completed")&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",N.id==="completed"?"bg-green-500":N.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{ve(false),Ue(false),w(null),O(!le);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[g.assignees&&g.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[g.assignees.slice(0,3).map((N,M)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},M)),g.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",g.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(N=>{let M=g.assignees?.some(_=>_.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let _=g.assignees||[],pe;M?pe=_.filter(Ye=>Ye.name!==N.name):pe=[..._,{name:N.name,avatar:N.avatar,initials:N.initials||N.name.slice(0,2).toUpperCase(),color:N.color||"#8B5CF6"}],Se("assignees",pe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50",M&&(p?"bg-white/5":"bg-gray-50")),children:[N.avatar?jsxRuntime.jsx("img",{src:N.avatar,alt:N.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:b("flex-1 text-left",p?"text-white":"text-gray-900"),children:N.name}),M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.id||N.name)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{w(B?null:"start"),P(g.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[g.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),g.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Fin":"End"),(g.startDate||g.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:N=>{N.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:b("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,M=new Date(N);M.setDate(N.getDate()+1);let _=new Date(N);_.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let pe=new Date(N);pe.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let Ye=new Date(N);Ye.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let X=new Date(N);X.setDate(N.getDate()+14);let ze=new Date(N);return ze.setDate(N.getDate()+28),[{label:i==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Ma\xF1ana":"Tomorrow",date:M,display:M.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:i==="es"?"Este fin de semana":"This weekend",date:_,display:i==="es"?"s\xE1b.":"sat."},{label:i==="es"?"Pr\xF3xima semana":"Next week",date:pe,display:i==="es"?"lun.":"mon."},{label:i==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ye,display:Ye.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:i==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:i==="es"?"4 semanas":"4 weeks",date:ze,display:ze.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Fe,ra)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(B==="start"){let oe=g.endDate&&Fe.date>g.endDate?Fe.date:g.endDate;Ve(Fe.date,oe),w("end");}else {let oe=g.startDate&&Fe.date<g.startDate?Fe.date:g.startDate;Ve(oe,Fe.date),w(null);}},children:[jsxRuntime.jsx("span",{children:Fe.label}),jsxRuntime.jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Fe.display})]},ra))})(),jsxRuntime.jsx("div",{className:b("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ve(void 0,void 0),w(null);},className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:i==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:b("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:B==="start"?i==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":i==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:b("font-medium",p?"text-white":"text-gray-900"),children:z.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>P(new Date),className:b("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:i==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>P(new Date(z.getFullYear(),z.getMonth()-1)),className:b("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>P(new Date(z.getFullYear(),z.getMonth()+1)),className:b("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(i==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=z.getFullYear(),M=z.getMonth(),_=new Date(N,M,1).getDay(),pe=new Date(N,M+1,0).getDate(),Ye=new Date(N,M,0).getDate(),X=new Date,ze=[];for(let Fe=_-1;Fe>=0;Fe--)ze.push({day:Ye-Fe,isCurrentMonth:false,date:new Date(N,M-1,Ye-Fe)});for(let Fe=1;Fe<=pe;Fe++)ze.push({day:Fe,isCurrentMonth:true,date:new Date(N,M,Fe)});let Nt=42-ze.length;for(let Fe=1;Fe<=Nt;Fe++)ze.push({day:Fe,isCurrentMonth:false,date:new Date(N,M+1,Fe)});return ze.map((Fe,ra)=>{let oe=Fe.date.toDateString()===X.toDateString(),nt=g.startDate?.toDateString()===Fe.date.toDateString(),rt=g.endDate?.toDateString()===Fe.date.toDateString(),He=nt||rt,St=g.startDate&&g.endDate&&Fe.date>=g.startDate&&Fe.date<=g.endDate;return jsxRuntime.jsx("button",{className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Fe.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),Fe.isCurrentMonth&&(p?"text-white":"text-gray-900"),oe&&"ring-2 ring-[#3B82F6]",nt&&"bg-[#3B82F6] text-white",rt&&!nt&&"bg-[#7C3AED] text-white",St&&!He&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!He&&(p?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Et=new Date(Fe.date);if(B==="start"){let da=g.endDate&&Et>g.endDate?Et:g.endDate;Ve(Et,da),w("end");}else {let da=g.startDate&&Et<g.startDate?Et:g.startDate;Ve(da,Et),w(null);}},children:Fe.day},ra)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Re(),Ue(!Ie);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.priority==="high"||g.priority==="urgent"?"bg-red-500/20 text-red-400":g.priority==="medium"?"bg-yellow-500/20 text-yellow-400":g.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g.priority?g.priority==="high"||g.priority==="urgent"?i==="es"?"Urgente":"Urgent":g.priority==="medium"?i==="es"?"Media":"Medium":i==="es"?"Baja":"Low":i==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:i==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:i==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:i==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:i==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:i==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>{Se("priority",N.id),Ue(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",g.priority===N.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:g.startDate&&g.endDate?`${Math.ceil((g.endDate.getTime()-g.startDate.getTime())/(1e3*60*60*24))} ${i==="es"?"d\xEDas":"days"}`:i==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[L?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:g.progress||0,onChange:N=>{let M=parseInt(N.target.value),_=g.status;M===100?_="completed":M>0?_="in-progress":_="todo";let pe={...g,progress:M,status:_};k(pe),a.onTaskUpdate?.(pe);},onBlur:()=>H(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",p?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>H(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",g.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${g.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[g.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Qa,{selectedTags:g.tags||[],availableTags:m,onChange:N=>{Se("tags",N);},onCreateTag:l,theme:y})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[g.dependencies&&g.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:g.dependencies.map(N=>{let M=e.find(_=>_.id===N);return jsxRuntime.jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",p?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[M?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let _=(g.dependencies||[]).filter(pe=>pe!==N);Se("dependencies",_);},className:b("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{Re(),Me(!fe);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(false),gt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:b("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:_t,onChange:N=>gt(N.target.value),placeholder:i==="es"?"Buscar tarea...":"Search task...",className:b("w-full px-3 py-2 rounded-md text-sm outline-none",p?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(N=>N.id!==g.id).filter(N=>_t===""||N.name.toLowerCase().includes(_t.toLowerCase())).map(N=>{let M=g.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let _=g.dependencies||[],pe;M?pe=_.filter(Ye=>Ye!==N.id):pe=[..._,N.id],Se("dependencies",pe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",M&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",M?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),children:M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:b("block truncate",p?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"text-[#6B7280]":"text-gray-500"),children:i==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Re(),ia(!aa);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:g.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:er.find(N=>N.value===g.color)?.name||(i==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:aa&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ia(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:er.map(N=>{let M=g.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{Se("color",N.value),ia(false);},className:b("w-7 h-7 rounded-full flex items-center justify-center transition-all",M&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:M?N.value:void 0},title:N.name,children:M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:g.isMilestone||false,onChange:N=>Se("isMilestone",N.target.checked),className:b("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",g.isMilestone?"bg-purple-500 border-purple-500":p?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:i==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:i==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:g.description||"",onChange:N=>Se("description",N.target.value),placeholder:i==="es"?"Agregar descripci\xF3n...":"Add description...",className:b("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",p?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm mt-2 transition-colors",p?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),i==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:i==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),i==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:i==="es"?"Agregar subtarea":"Add subtask"}),g.subtasks&&g.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:g.subtasks.map(N=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",N.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm",N.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:N.name})]},N.id))}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),i==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:i==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:b("p-1 rounded transition-colors",p?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),i==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:b("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[i==="es"?"Adjuntos":"Attachments",We.length>0&&jsxRuntime.jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",We.length,")"]})]}),We.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:We.map(N=>{let M=Ae(N.type),_=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg group transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[_&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:b("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(M,{className:b("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:b("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:ne(N.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(N.id),className:b("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",p?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:i==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:Kt,onDragLeave:Z,onDrop:Ze,className:b("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Pe?p?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":p?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",mt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ht,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||mt}),mt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",Pe?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:Pe?i==="es"?"Suelta los archivos aqu\xED":"Drop files here":i==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:b("text-xs mt-1",p?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-[280px] border-l flex flex-col",p?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b flex items-center justify-between",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:b("font-medium",p?"text-white":"text-gray-900"),children:i==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:b("text-sm text-center py-8",p?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),i==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:b("p-3 border-t",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:b("flex items-center gap-2 px-3 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:i==="es"?"Escribe un comentario...":"Write a comment...",className:b("flex-1 bg-transparent text-sm outline-none",p?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>D(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:b("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:b("font-medium",p?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>D(null),className:b("p-1 rounded",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(N=>jsxRuntime.jsxs("button",{onClick:()=>{D(null),k(N.task);},className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Uc,{task:N.task}),jsxRuntime.jsx("span",{className:b("text-sm truncate flex-1",p?"text-white":"text-gray-900"),children:N.title}),N.task.priority==="high"||N.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},N.id))})]})]})})]})}var Fi={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"},Ii={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"},Li={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"},Un={dark:Fi,light:Ii,neutral:Li};function Wc(e){return Un[e]||Un.dark}function lh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:c}){let[m,l]=react.useState(false),u=react.useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=react.useMemo(()=>{let h=u.length,C=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,p=u.map(f=>f.priority).filter(Boolean),y=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:p,labels:y}},[u]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:b("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:b("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.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:u.map(h=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsxRuntime.jsx("h4",{children:h.title}),h.description&&jsxRuntime.jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:C=>{C.stopPropagation(),s?.(e.id,h.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"})]})})]},h.id))})})]})}var _c={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function $o(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 Ho(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 Vc(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 jc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:c}){let m=react.useMemo(()=>({..._c,...n}),[n]),[l,u]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(g=>{let k=g.timestamp.toISOString().split("T")[0],x=v.get(k);x?x.push(g):v.set(k,[g]);}),Array.from(v.entries()).sort((g,k)=>k[0].localeCompare(g[0])).map(([g,k])=>({date:new Date(g),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=react.useMemo(()=>{let v=new Set,g=new Set;return e.forEach(k=>{v.add(k.userId),g.add(k.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(g)}},[e]),p=v=>{u(g=>{let k=new Set(g);return k.has(v)?k.delete(v):k.add(v),k});},y=v=>{let k=new Date().getTime()-v.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),B=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:B<7?`${B}d ago`:v.toLocaleDateString()},f=react.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return react.useEffect(()=>{if(s&&d.current){let v=d.current.querySelector(`[data-event-id="${s}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:b("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:b("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:v=>{let g=v.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),C.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Ho(v)," ",v.replace("_"," ")]},v))]}),h.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let g=v.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),h.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>a({...t,searchTerm:v.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((g,k)=>{let x=l.has(g.id),D=s===g.id,B=Vc(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:b("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ho(g.type)})}),k<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),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:[m.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:$o(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),p(g.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([w,z])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(z.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(z.to)})]})]},w)),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(([w,z])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(z)})]},w))]})]})]})]},g.id)})})]},v.date?.toISOString()||"all"))})]})}function Yc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:c,onSpeedChange:m,className:l}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:b("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:b("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Ho(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&$o(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:h=>c(parseInt(h.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsxRuntime.jsx("div",{className:b("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>c(C),title:$o(h)},h.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:u.map(h=>jsxRuntime.jsxs("button",{className:b("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(h=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxRuntime.jsxs("div",{className:b("history-replay-start",l),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 Bi(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 Ri(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 qc(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 Xc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function gh(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let l=1-m/s;n.forEach(u=>{let d=a/2,i=r/2;u.vx+=(d-u.x)*o.centerForce*l,u.vy+=(i-u.y)*o.centerForce*l,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,p=u.y-h.y,y=Math.sqrt(C*C+p*p)||1,f=o.chargeStrength*l/(y*y);u.vx+=C/y*f,u.vy+=p/y*f;});}),t.forEach(u=>{let d=c.get(typeof u.source=="string"?u.source:u.source.id),i=c.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!i)return;let h=i.x-d.x,C=i.y-d.y,p=Math.sqrt(h*h+C*C)||1,y=(p-o.linkDistance)/p*o.forceStrength*l;d.vx+=h*y,d.vy+=C*y,i.vx-=h*y,i.vy-=C*y;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Jc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:c,className:m}){let l=react.useRef(null),[u,d]=react.useState([]),[i,h]=react.useState(null),[C,p]=react.useState(null),[y,f]=react.useState(null),[v,g]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=gh(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let D=react.useCallback((R,Y)=>{a.enableDragging&&(Y.stopPropagation(),h(R));},[a.enableDragging]),B=react.useCallback(R=>{if(!i||!l.current)return;let te=l.current.getBoundingClientRect(),ve=(R.clientX-te.left-k.x)/v,Ie=(R.clientY-te.top-k.y)/v;d(Ue=>Ue.map(le=>le.id===i?{...le,x:ve,y:Ie,fx:ve,fy:Ie}:le));},[i,v,k]),w=react.useCallback(()=>{h(null);},[]),z=react.useCallback((R,Y)=>{Y.stopPropagation(),c?.({type:"node-click",node:R,position:{x:Y.clientX,y:Y.clientY}});},[c]),P=react.useCallback((R,Y)=>{Y.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:Y.clientX,y:Y.clientY}});},[c]),T=react.useCallback(R=>{let Y=u.find(te=>te.id===R);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[u]),G=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Y=R.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:b("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:b("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Bi(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[qc(R)," ",Ri(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:B,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let Y=T(typeof R.source=="string"?R.source:R.source.id),te=T(typeof R.target=="string"?R.target:R.target.id),ve=Xc(R.type),Ie=y===R.id,Ue=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-edge",Ie&&"hovered",Ue&&"critical"),onMouseEnter:()=>f(R.id),onMouseLeave:()=>f(null),onClick:le=>P(R,le),children:[jsxRuntime.jsx("line",{x1:Y.x,y1:Y.y,x2:te.x,y2:te.y,stroke:Bi(R.type),strokeWidth:Ue?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Ie?1:.6,markerEnd:ve?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Ie&&jsxRuntime.jsx("text",{x:(Y.x+te.x)/2,y:(Y.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ri(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(R=>{let Y=C===R.id,te=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-node",Y&&"hovered",te&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:ve=>D(R.id,ve),onMouseEnter:()=>p(R.id),onMouseLeave:()=>p(null),onClick:ve=>z(R,ve),children:[jsxRuntime.jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:G(R),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:Y?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function ep({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[c,m]=react.useState(false),[l,u]=react.useState(null),[d,i]=react.useState(null),h=react.useRef(null),C=c||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let v=g=>{g.key==="Escape"&&!C&&p();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,C]);let p=()=>{C||(n(""),u(null),i(null),t());},y=async()=>{if(!(!s.trim()||C)){m(true),u(null),i(null);try{let v=await r(s.trim());i(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{m(false);}}},f=()=>{d&&(a(d),p());};return e?jsxRuntime.jsxs(ct,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:p}),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:v=>v.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:p,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((v,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:v.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((v,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:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},g)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:h,value:s,onChange:v=>n(v.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:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),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((v,g)=>jsxRuntime.jsx("button",{onClick:()=>n(v),disabled:C,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:v},g))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&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:p,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||C,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:C?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Oi={"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 hh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},bh={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 yh(e,t,a){let r=Oi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Wo(e){return `$${e.toFixed(4)}`}var zi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=yh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),n=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),m=a.reduce((d,i)=>d+i.duration,0),l={},u={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let c=this.operations.filter(u=>u.timestamp>=n).length,m=Math.max(0,o-c),l=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:l,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},jr=new zi;function rp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(jr.getStats()),[s,n]=react.useState(jr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(jr.getStats()),n(jr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=jr.getRecentOperations(5);return jsxRuntime.jsxs(ct,{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:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Wo(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(([m,l])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?l/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:m.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:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Wo(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Wo(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 sp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,c]=react.useState(""),[m,l]=react.useState(""),[u,d]=react.useState(""),[i,h]=react.useState(false),[C,p]=react.useState(null),[y,f]=react.useState(null),[v,g]=react.useState(null),k=react.useRef(null),x=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let P=T=>{T.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,x]);let D=()=>{x||(c(""),l(""),d(""),p(null),f(null),g(null),t());},B=async()=>{if(!(!n.trim()||x)){h(true),p(null),f(null),g(null);try{let P=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});f(P.tasks.tasks),g({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){p(P instanceof Error?P.message:"Failed to generate tasks");}finally{h(false);}}},w=()=>{y&&(a(y),D());};if(!e)return null;let z=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ct,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:D,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[v?.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"}),v?.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 (",z,"% 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:[v?.tokens_used||0," tokens"]}),v?.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:[v.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,T)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",T+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.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"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:P.priority})]})},P.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:k,value:n,onChange:P=>c(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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:m,onChange:P=>l(P.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:x})]}),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:u,onChange:P=>d(P.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:x})]})]}),C&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),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((P,T)=>jsxRuntime.jsx("button",{onClick:()=>c(P),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},T))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:B,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&Jo(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,v,g)=>{console.warn(`Retry attempt ${v} after ${g}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(y,f,v)=>{r(g=>{let k=g.cards.find(P=>P.id===y);if(!k)return g;let x=k.columnId,D={...k,columnId:f,position:v},B=g.cards.map(P=>P.id===y?D:P),w=g.columns.map(P=>{if(P.id===x)return {...P,cardIds:P.cardIds.filter(T=>T!==y)};if(P.id===f){let T=B.filter(G=>G.columnId===f).sort((G,R)=>G.position-R.position);return {...P,cardIds:T.map(G=>G.id)}}return P}),z={...g,cards:B,columns:w};return o(z),z});},[o]),n=react.useCallback(async(y,f)=>{r(v=>{let g=v.cards.map(x=>x.id===y?{...x,...f}:x),k={...v,cards:g};return o(k),k});},[o]),c=react.useCallback(async y=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let g={...y,id:f},k=v.columns.map(D=>D.id===y.columnId?{...D,cardIds:[...D.cardIds,f]}:D),x={...v,cards:[...v.cards,g],columns:k};return o(x),x});},[o]),m=react.useCallback(async y=>{r(f=>{let v=f.cards.find(D=>D.id===y);if(!v)return f;let g=f.cards.filter(D=>D.id!==y),k=f.columns.map(D=>D.id===v.columnId?{...D,cardIds:D.cardIds.filter(B=>B!==y)}:D),x={...f,cards:g,columns:k};return o(x),x});},[o]),l=react.useCallback(async y=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let g={...y,id:f,cardIds:[]},k={...v,columns:[...v.columns,g]};return o(k),k});},[o]),u=react.useCallback(async(y,f)=>{r(v=>{let g=v.columns.map(x=>x.id===y?{...x,...f}:x),k={...v,columns:g};return o(k),k});},[o]),d=react.useCallback(async y=>{r(f=>{let v=f.cards.filter(x=>x.columnId!==y),g=f.columns.filter(x=>x.id!==y),k={...f,cards:v,columns:g};return o(k),k});},[o]),i=react.useCallback(y=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),f},[c]),h=react.useCallback(y=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),f},[l]),C=react.useCallback(()=>{r(y=>{let f={...y,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:c,onCardDelete:m,onColumnCreate:l,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:C}}}function lp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Wn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,l,u={})=>{s.addCard({title:l,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,l)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:l??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Go={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},cp={by:"none",order:"asc"};function pp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Go,...e}),[s,n]=react.useState({...cp,...t}),c=react.useCallback(p=>{o(y=>({...y,...p}));},[]),m=react.useCallback(p=>{n(y=>({...y,...p}));},[]),l=react.useCallback(()=>{o(Go),n(cp);},[]),u=react.useCallback(()=>{a&&o({...Go,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Go,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Go,priorities:["HIGH","URGENT"]});},[]),h=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),C=react.useCallback(p=>{let y=[...p];if(r.search){let f=r.search.toLowerCase();y=y.filter(v=>v.title.toLowerCase().includes(f)||v.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,v=f.getFullYear(),g=String(f.getMonth()+1).padStart(2,"0"),k=String(f.getDate()).padStart(2,"0"),x=`${v}-${g}-${k}`;y=y.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let B=D.endDate||D.dueDate;if(!B)return false;let w;if(typeof B=="string")w=B.split("T")[0]||B;else {let z=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),T=String(B.getUTCDate()).padStart(2,"0");w=`${z}-${P}-${T}`;}switch(r.dateFilter){case "overdue":return w<x;case "today":return w===x;case "this-week":let z=new Date(x+"T00:00:00"),P=new Date(w+"T00:00:00"),T=new Date(z);return T.setDate(T.getDate()+7),P>=z&&P<=T;case "custom":if(r.dateRange){let G=typeof B=="string"?new Date(B):B;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(y=y.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(f=>f.labels&&f.labels.some(v=>r.labels.includes(v)))),r.columns.length>0&&(y=y.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&y.sort((f,v)=>{let g=0;switch(s.by){case "created":let k=f.createdAt?new Date(f.createdAt).getTime():0,x=v.createdAt?new Date(v.createdAt).getTime():0;g=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=D[f.priority||"LOW"],w=D[v.priority||"LOW"];g=B-w;break;case "dueDate":let z=f.endDate||f.dueDate,P=v.endDate||v.dueDate;if(!z)return 1;if(!P)return -1;let T=typeof z=="string"?new Date(z).getTime():z.getTime(),G=typeof P=="string"?new Date(P).getTime():P.getTime();g=T-G;break;case "title":g=f.title.localeCompare(v.title);break;case "estimate":let R=f.estimatedTime||0,Y=v.estimatedTime||0;g=R-Y;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:m,resetFilters:l,filterMyTasks:u,filterOverdue:d,filterHighPriority:i,applyFilters:C,hasActiveFilters:h}}var up,gp;if(typeof window<"u")try{let e=Yo("ai");up=e.generateObject,gp=e.generateText;}catch{}function fp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(up&&gp&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let h=i instanceof Error?i:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let h=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let h=i instanceof Error?i:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(i){let h=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let h=i instanceof Error?i:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:l,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function $i(){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 hp(e){let{cards:t}=e,[a,r]=$i(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=i.ctrlKey||i.metaKey,C=i.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let p=t.find(f=>f.id===d),y=t.find(f=>f.id===a.lastSelectedCardId);if(p&&y&&p.columnId===y.columnId){let f=t.filter(w=>w.columnId===p.columnId).sort((w,z)=>w.position-z.position),v=f.findIndex(w=>w.id===a.lastSelectedCardId),g=f.findIndex(w=>w.id===d),[k,x]=v<g?[v,g]:[g,v],D=f.slice(k,x+1).map(w=>w.id),B=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:B,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:c,selectAll:m,toggleCard:l,getSelectedCards:u}}var bp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function yp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...bp,...a}),[a]),[s,n]=react.useState([]),c=react.useCallback((p,y,f,v,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:p,cardIds:y,columnId:f,strategy:v,color:g,isExpanded:true,position:s.filter(x=>x.columnId===f).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(p=>{n(y=>y.filter(f=>f.id!==p));},[]),l=react.useCallback(p=>{n(y=>y.map(f=>f.id===p?{...f,isExpanded:!f.isExpanded}:f));},[]),u=react.useCallback((p,y)=>{n(f=>f.map(v=>v.id===p&&!v.cardIds.includes(y)?{...v,cardIds:[...v.cardIds,y]}:v));},[]),d=react.useCallback((p,y)=>{n(f=>f.map(v=>{if(v.id===p){let g=v.cardIds.filter(k=>k!==y);return g.length<o.minCardsPerStack?null:{...v,cardIds:g}}return v}).filter(v=>v!==null));},[o.minCardsPerStack]),i=react.useCallback(p=>s.filter(y=>y.columnId===p).sort((y,f)=>y.position-f.position),[s]),h=react.useCallback(async p=>{let y=t.filter(x=>x.columnId===p);if(y.length<o.minCardsPerStack*2)return [];let f=[],v=new Map;y.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(x);});}),v.forEach((x,D)=>{x.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(B=>B.id),columnId:p,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let g=new Map;y.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{g.has(D)||g.set(D,[]),g.get(D).push(x);});}),g.forEach((x,D)=>{x.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(B=>B.id),columnId:p,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(y.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";f.push({stack:{title:`${B} ${D} Priority`,cardIds:x.map(w=>w.id),columnId:p,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of y){let B=(await r.findSimilar(x,y)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(B.length>=o.minCardsPerStack-1){let w=[x.id,...B.map(P=>P.card.id)],z=B.reduce((P,T)=>P+T.similarity,0)/B.length;f.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:w,columnId:p,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:z});}}return f.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),C=react.useCallback(p=>{c(p.stack.title,p.stack.cardIds,p.stack.columnId,p.stack.strategy,p.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let f=await h(y),v=f[0];f.length>0&&v&&v.confidence>=.9&&C(v);});},[]),{stacks:s,createStack:c,deleteStack:m,toggleStack:l,addToStack:u,removeFromStack:d,getStacksForColumn:i,getSuggestions:h,applySuggestion:C,config:o}}var vp=react.createContext(null);function xp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:l}=Yo("@libxai/core");s.set(m.id,new l(m));}),t?.cards?.forEach(m=>{let{Card:l}=Yo("@libxai/core");n.set(m.id,new l(m));});let c=null;if(t?.board){let{Board:m}=Yo("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(vp.Provider,{value:{store:o},children:e})}function Gn(){let e=react.useContext(vp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Vo(){let e=Gn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let c=react.useCallback(v=>{e.updateBoard(v);},[e]),m=react.useCallback(v=>{e.addColumn(v);},[e]),l=react.useCallback((v,g)=>{e.updateColumn(v,g);},[e]),u=react.useCallback(v=>{e.deleteColumn(v);},[e]),d=react.useCallback(v=>e.getColumn(v),[e]),i=react.useCallback(v=>{e.addCard(v);},[e]),h=react.useCallback((v,g)=>{e.updateCard(v,g);},[e]),C=react.useCallback(v=>{e.deleteCard(v);},[e]),p=react.useCallback((v,g,k)=>{e.moveCard(v,g,k);},[e]),y=react.useCallback(v=>e.getCard(v),[e]),f=react.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:m,updateColumn:l,deleteColumn:u,getColumn:d,addCard:i,updateCard:h,deleteCard:C,moveCard:p,getCard:y,getCardsByColumn:f}}function wp(e){let{cards:t}=Vo();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Cp(e="position",t="asc"){let{cards:a}=Vo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,l=s.priority?c[s.priority]:0;n=m-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var _n=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=yl.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let c=await Promise.resolve(n.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Bh=new _n;function Np({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:c=0,getItemKey:m}){let l=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:c}),d=u.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:i,className:o,children:jsxRuntime.jsx("div",{style:h,children:d.map(C=>{let p=e[C.index];if(!p)return null;let y=m?m(p,C.index):C.index,f={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsxRuntime.jsx("div",{style:f,"data-index":C.index,children:r(p,C.index)},y)})})})}function Dp(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 Ep({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:c=16,getItemKey:m,horizontal:l=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:c}),i=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:h,className:s,children:jsxRuntime.jsx("div",{style:C,children:i.map(p=>{let y=e[p.index];if(!y)return null;let f=m?m(y,p.index):p.index,v={position:"absolute",top:0,left:p.start,width:p.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":p.index,children:o(y,p.index)},f)})})})}function Pp(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 Mp(e,t=10){return e>t}var _i={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Vi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ji={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ki={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Yi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},qi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Xi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ji={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)"},Zi={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)"},Qi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},el={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}},tl={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}},Vn={spacing:_i,borderRadius:Vi,fontSize:ji,fontWeight:Ki,lineHeight:Yi,zIndex:qi,duration:Xi,easing:Ji,shadows:Zi,opacity:Qi,kanban:el,gantt:tl};function Ap(e,t,a){return e[t]??a}function al(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?al(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function zh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function rl(e="asakaa"){let t=al(Vn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=zh(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
392
  }`}function jo(e,t="asakaa"){let a=[],r=al(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
@@ -394,7 +394,7 @@ ${a.join(`
394
394
  `)}
395
395
  }`}var jn={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"}},ol={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"}},nl={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 sl(e=jn,t="asakaa"){let a=rl(t),r=jo(e,t);return `${a}
396
396
 
397
- ${r}`}function Ap(){return `/**
397
+ ${r}`}function Fp(){return `/**
398
398
  * ASAKAA Design Tokens
399
399
  * Auto-generated from design-tokens.ts
400
400
  * Do not edit this file directly
@@ -415,6 +415,6 @@ ${jo(nl,"asakaa").split(`
415
415
  `).slice(1,-1).join(`
416
416
  `)}
417
417
  }
418
- `}var zh=({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 Fp({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=io();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,c])=>{let m=n,l=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":l,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(zh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},m)})})}
419
- 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=ap;exports.AI_FEATURES=hh;exports.AI_MODELS=Oi;exports.AddCardButton=xs;exports.AddColumnButton=vs;exports.AttachmentUploader=rr;exports.BoardProvider=vp;exports.BulkOperationsToolbar=pn;exports.BurnDownChart=Fs;exports.CalendarBoard=$c;exports.Card=sr;exports.CardDetailModal=Ds;exports.CardDetailModalV2=Ps;exports.CardHistoryReplay=Kc;exports.CardHistoryTimeline=Vc;exports.CardRelationshipsGraph=Xc;exports.CardStack=ih;exports.CardTemplateSelector=Us;exports.CircuitBreaker=es;exports.Column=to;exports.ColumnManager=bn;exports.CommandPalette=Cs;exports.ConfigMenu=Gs;exports.ContextMenu=po;exports.DEFAULT_SHORTCUTS=Eo;exports.DEFAULT_TEMPLATES=zs;exports.DateRangePicker=vo;exports.DependenciesSelector=ko;exports.DependencyLine=Tn;exports.DistributionCharts=Is;exports.EditableColumnTitle=ls;exports.ErrorBoundary=ro;exports.ExportImportModal=Ws;exports.FilterBar=Hs;exports.GANTT_AI_SYSTEM_PROMPT=yc;exports.GanttAIAssistant=Pn;exports.GanttBoard=gc;exports.GanttI18nContext=co;exports.GanttMilestone=Dn;exports.GanttToolbar=hn;exports.GenerateGanttTasksDialog=np;exports.GeneratePlanModal=Qc;exports.GroupBySelector=Rs;exports.KanbanBoard=vr;exports.KanbanToolbar=bs;exports.KanbanViewAdapter=No;exports.KeyboardShortcutsHelp=Os;exports.ListView=Mc;exports.MenuIcons=It;exports.PluginManager=_n;exports.PrioritySelector=Fr;exports.RATE_LIMITS=fh;exports.SwimlaneBoardView=Ls;exports.TagBadge=cs;exports.TagList=Yl;exports.TagPicker=Qa;exports.TaskBar=kn;exports.TaskDetailModal=Or;exports.TaskFormModal=bc;exports.TaskGrid=xn;exports.ThemeModal=Ks;exports.ThemeProvider=Md;exports.ThemeSwitcher=Fp;exports.Timeline=En;exports.UserAssignmentSelector=Lr;exports.VelocityChart=As;exports.VirtualGrid=Sp;exports.VirtualList=Tp;exports.aiUsageTracker=jr;exports.borderRadius=Vi;exports.calculatePosition=Xo;exports.calendarDarkTheme=Fi;exports.calendarEnTranslations=Ti;exports.calendarEsTranslations=Ni;exports.calendarLightTheme=Ii;exports.calendarNeutralTheme=Li;exports.calendarThemes=Un;exports.calendarTranslations=Rn;exports.cardToGanttTask=An;exports.cardsToGanttTasks=Nc;exports.cn=y;exports.createKanbanView=dd;exports.createRetryWrapper=Xp;exports.darkTheme=_s;exports.darkTokenTheme=jn;exports.defaultTheme=un;exports.designTokens=Vn;exports.duration=Xi;exports.easing=Ji;exports.exportTokensToCSS=Ap;exports.findTaskByName=cr;exports.fontSize=ji;exports.fontWeight=Ki;exports.formatCost=Ho;exports.ganttEnTranslations=fn;exports.ganttEsTranslations=Fd;exports.ganttTaskToCardUpdate=Tc;exports.ganttThemes=Ve;exports.ganttTokens=tl;exports.ganttTranslations=Ys;exports.ganttUtils=pe;exports.generateCSSVariables=rl;exports.generateCompleteCSS=sl;exports.generateInitialPositions=jp;exports.generateTasksContext=vc;exports.generateThemeVariables=jo;exports.getCalendarTheme=Wc;exports.getCalendarTranslations=Oo;exports.getListViewTheme=Ac;exports.getListViewTranslations=xi;exports.getMonthNames=Fc;exports.getToken=Mp;exports.getTranslations=Id;exports.getWeekdayNames=Ic;exports.kanbanTokens=el;exports.lightTheme=Vs;exports.lightTokenTheme=ol;exports.lineHeight=Yi;exports.listViewDarkTheme=ki;exports.listViewEnTranslations=yi;exports.listViewEsTranslations=vi;exports.listViewLightTheme=wi;exports.listViewNeutralTheme=Ci;exports.listViewThemes=Bn;exports.listViewTranslations=Fn;exports.mergeCalendarTranslations=On;exports.mergeListViewTranslations=In;exports.mergeTranslations=qs;exports.neutralTheme=js;exports.neutralTokenTheme=nl;exports.opacity=Qi;exports.parseLocalCommand=wc;exports.parseNaturalDate=fi;exports.parseNaturalDuration=hi;exports.parseProgress=bi;exports.parseStatus=kc;exports.pluginManager=Lh;exports.retrySyncOperation=qp;exports.retryWithBackoff=Jo;exports.shadows=Zi;exports.shouldVirtualizeGrid=Pp;exports.spacing=_i;exports.themes=$r;exports.useAI=gp;exports.useBoard=ip;exports.useBoardCore=Vo;exports.useBoardStore=Gn;exports.useCardStacking=bp;exports.useDragState=fs;exports.useFilteredCards=kp;exports.useFilters=cp;exports.useGanttI18n=Po;exports.useKanbanState=Hn;exports.useKeyboardShortcuts=Sd;exports.useMultiSelect=fp;exports.useSelectionState=$i;exports.useSortedCards=wp;exports.useTheme=io;exports.useVirtualGrid=Ep;exports.useVirtualList=Np;exports.validateAIResponse=Cc;exports.withErrorBoundary=ks;exports.wouldCreateCircularDependency=Qo;exports.zIndex=qi;//# sourceMappingURL=index.cjs.map
418
+ `}var Uh=({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 Ip({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=io();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,c])=>{let m=n,l=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":l,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Uh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},m)})})}
419
+ 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=rp;exports.AI_FEATURES=bh;exports.AI_MODELS=Oi;exports.AddCardButton=xs;exports.AddColumnButton=vs;exports.AttachmentUploader=rr;exports.BoardProvider=xp;exports.BulkOperationsToolbar=pn;exports.BurnDownChart=Fs;exports.CalendarBoard=Hc;exports.Card=sr;exports.CardDetailModal=Ds;exports.CardDetailModalV2=Ps;exports.CardHistoryReplay=Yc;exports.CardHistoryTimeline=jc;exports.CardRelationshipsGraph=Jc;exports.CardStack=lh;exports.CardTemplateSelector=Us;exports.CircuitBreaker=es;exports.Column=to;exports.ColumnManager=bn;exports.CommandPalette=Cs;exports.ConfigMenu=Gs;exports.ContextMenu=po;exports.DEFAULT_SHORTCUTS=Eo;exports.DEFAULT_TEMPLATES=zs;exports.DateRangePicker=vo;exports.DependenciesSelector=ko;exports.DependencyLine=Tn;exports.DistributionCharts=Is;exports.EditableColumnTitle=ls;exports.ErrorBoundary=ro;exports.ExportImportModal=Hs;exports.FilterBar=Ws;exports.GANTT_AI_SYSTEM_PROMPT=vc;exports.GanttAIAssistant=Pn;exports.GanttBoard=fc;exports.GanttI18nContext=co;exports.GanttMilestone=Dn;exports.GanttToolbar=hn;exports.GenerateGanttTasksDialog=sp;exports.GeneratePlanModal=ep;exports.GroupBySelector=Rs;exports.KanbanBoard=vr;exports.KanbanToolbar=bs;exports.KanbanViewAdapter=No;exports.KeyboardShortcutsHelp=Os;exports.ListView=Ac;exports.MenuIcons=It;exports.PluginManager=_n;exports.PrioritySelector=Fr;exports.RATE_LIMITS=hh;exports.SwimlaneBoardView=Ls;exports.TagBadge=cs;exports.TagList=Yl;exports.TagPicker=Qa;exports.TaskBar=kn;exports.TaskDetailModal=Or;exports.TaskFormModal=yc;exports.TaskGrid=xn;exports.ThemeModal=Ks;exports.ThemeProvider=Ad;exports.ThemeSwitcher=Ip;exports.Timeline=En;exports.UserAssignmentSelector=Lr;exports.VelocityChart=As;exports.VirtualGrid=Ep;exports.VirtualList=Np;exports.aiUsageTracker=jr;exports.borderRadius=Vi;exports.calculatePosition=Xo;exports.calendarDarkTheme=Fi;exports.calendarEnTranslations=Ti;exports.calendarEsTranslations=Ni;exports.calendarLightTheme=Ii;exports.calendarNeutralTheme=Li;exports.calendarThemes=Un;exports.calendarTranslations=Rn;exports.cardToGanttTask=An;exports.cardsToGanttTasks=Dc;exports.cn=b;exports.createKanbanView=cd;exports.createRetryWrapper=Jp;exports.darkTheme=_s;exports.darkTokenTheme=jn;exports.defaultTheme=un;exports.designTokens=Vn;exports.duration=Xi;exports.easing=Ji;exports.exportTokensToCSS=Fp;exports.findTaskByName=cr;exports.fontSize=ji;exports.fontWeight=Ki;exports.formatCost=Wo;exports.ganttEnTranslations=fn;exports.ganttEsTranslations=Id;exports.ganttTaskToCardUpdate=Nc;exports.ganttThemes=qe;exports.ganttTokens=tl;exports.ganttTranslations=Ys;exports.ganttUtils=me;exports.generateCSSVariables=rl;exports.generateCompleteCSS=sl;exports.generateInitialPositions=Kp;exports.generateTasksContext=xc;exports.generateThemeVariables=jo;exports.getCalendarTheme=Wc;exports.getCalendarTranslations=Oo;exports.getListViewTheme=Fc;exports.getListViewTranslations=xi;exports.getMonthNames=Ic;exports.getToken=Ap;exports.getTranslations=Ld;exports.getWeekdayNames=Lc;exports.kanbanTokens=el;exports.lightTheme=Vs;exports.lightTokenTheme=ol;exports.lineHeight=Yi;exports.listViewDarkTheme=ki;exports.listViewEnTranslations=yi;exports.listViewEsTranslations=vi;exports.listViewLightTheme=wi;exports.listViewNeutralTheme=Ci;exports.listViewThemes=Bn;exports.listViewTranslations=Fn;exports.mergeCalendarTranslations=On;exports.mergeListViewTranslations=In;exports.mergeTranslations=qs;exports.neutralTheme=js;exports.neutralTokenTheme=nl;exports.opacity=Qi;exports.parseLocalCommand=Cc;exports.parseNaturalDate=fi;exports.parseNaturalDuration=hi;exports.parseProgress=bi;exports.parseStatus=wc;exports.pluginManager=Bh;exports.retrySyncOperation=Xp;exports.retryWithBackoff=Jo;exports.shadows=Zi;exports.shouldVirtualizeGrid=Mp;exports.spacing=_i;exports.themes=$r;exports.useAI=fp;exports.useBoard=lp;exports.useBoardCore=Vo;exports.useBoardStore=Gn;exports.useCardStacking=yp;exports.useDragState=fs;exports.useFilteredCards=wp;exports.useFilters=pp;exports.useGanttI18n=Po;exports.useKanbanState=Wn;exports.useKeyboardShortcuts=Ed;exports.useMultiSelect=hp;exports.useSelectionState=$i;exports.useSortedCards=Cp;exports.useTheme=io;exports.useVirtualGrid=Pp;exports.useVirtualList=Dp;exports.validateAIResponse=Tc;exports.withErrorBoundary=ks;exports.wouldCreateCircularDependency=Qo;exports.zIndex=qi;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map