@libxai/board 0.17.404 → 0.17.406

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'),$c=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),cg=require('react-markdown'),mg=require('remark-gfm'),pg=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var $c__default=/*#__PURE__*/_interopDefault($c);var cg__default=/*#__PURE__*/_interopDefault(cg);var mg__default=/*#__PURE__*/_interopDefault(mg);var pg__default=/*#__PURE__*/_interopDefault(pg);var on=(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 nn=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 [nn.Translate.toString(e),nn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function sn(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 vp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ps(e,t){return e.length===0?1e3:t===0?sn(null,e[0].position):t>=e.length?sn(e[e.length-1].position,null):sn(e[t-1].position,e[t].position)}function Il(e,t=100){return e>t}var xp=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 kp(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 ln(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=xp,onRetry:m}=t,p,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(p=d,u===a||!n(p,u))return {error:p,attempts:i,success:false};let h=kp(u,r,o,s);if(m)try{m(p,u,h);}catch(C){console.error("Error in retry callback:",C);}await new Promise(C=>setTimeout(C,h));}}return {error:p||new Error("Unknown error"),attempts:i,success:false}}function wp(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 Cp(e,t={}){return async(...a)=>ln(()=>e(...a),t)}var us=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 Ll=(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))(Ll||{}),Hr=class Hr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,m=`[${a}] [${r}] [${s}]`,p=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(m,o,p?n:"");break;case "INFO":console.info(m,o,p?n:"");break;case "WARN":console.warn(m,o,p?n:"");break;case "ERROR":console.error(m,o,p?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",...Hr.globalOptions};}static configure(t){Hr.globalOptions={...Hr.globalOptions,...t};}child(t){return new Hr({...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 dn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new dn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Ll[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Hr.globalOptions={};var gs=Hr,dn=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}},Bl=new gs;function Np(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 Dp(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(m=>m.id===s.columnId);return [s.id,fs(s.title),fs(s.description||""),fs(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 Sp(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 $c__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=n.toDataURL("image/png"),p=297,i=210,u=n.width/n.height,d=p-20,g=d/u;g>i-20&&(g=i-20,d=g*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,p,15,"F"),h.text(e.title||"Kanban Board",10,10);let C=(p-d)/2;return h.addImage(m,"PNG",C,20,d,g),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 m=e.cards.filter(p=>p.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,m.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):m.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(p.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(p.priority&&i.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&i.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&i.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let u=[];p.startDate&&u.push(`Start: ${p.startDate}`),p.endDate&&u.push(`End: ${p.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function fs(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function $l(e,t,a,r){switch(t){case "json":return Np(e,r);case "csv":return Dp(e);case "pdf":return await Sp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Ol(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"},m=new Blob([e],{type:n[t]}),p=URL.createObjectURL(m),i=document.createElement("a");i.href=p,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(p);}function Ep(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 Pp(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=zl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let m=zl(t[n]||"");if(m.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((h,C)=>{i[h]=m[C]||"";});let u=i.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),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),d.cardIds.push(g.id);}catch(m){s.push(`Line ${n+1}: ${m instanceof Error?m.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 zl(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 Ul(e,t){switch(t){case "json":return Ep(e);case "csv":return Pp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Hl(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 hs=react.createContext(null);function Wl(){return react.useContext(hs)}var Gl=react.createContext(null);function _l({children:e,themeName:t}){return jsxRuntime.jsx(Gl.Provider,{value:{themeName:t},children:e})}function io(){return react.useContext(Gl)}function mt({children:e,container:t}){let[a,r]=react.useState(false),o=Wl(),s=io();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:m,themeName:p}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:i,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 ql={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},$p="#BDC3C7",Op=({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 Wr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),m=react.useRef(null),p=react.useRef(null),i=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,v=160,y=220,c=4,k=h.right-v;k<10&&(k=h.left),k+v>T-10&&(k=T-v-10);let l=C-h.bottom,N=h.top,x;l>=y+c?x=h.bottom+c:N>=y+c?x=h.top-y-c:x=l>=N?h.bottom+c:Math.max(10,h.top-y-c),n({top:x,left:k}),o(true);};react.useEffect(()=>{let h=C=>{m.current&&!m.current.contains(C.target)&&!p.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?ql[e]:null,g=d?.color||$p;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}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:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:m,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(ql).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:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Op,{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 zp=[{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 So({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),p=react.useRef(null),i=react.useRef(null),g=(io()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let k=i.current.getBoundingClientRect(),l=window.innerHeight,N=window.innerWidth,x=320,B=380,b=4,D=k.left;D+x>N-10&&(D=N-x-10),D<10&&(D=10);let M=l-k.bottom,w=k.top,R;M>=B+b?R=k.bottom+b:w>=B+b?R=k.top-B-b:R=M>=w?k.bottom+b:Math.max(10,k.top-B-b),m({top:R,left:D}),s(true);};react.useEffect(()=>{let k=l=>{p.current&&!p.current.contains(l.target)&&!i.current?.contains(l.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),react.useEffect(()=>{let k=l=>{l.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let C=k=>{let l=new Date,N=D=>{let M=D.getFullYear(),w=String(D.getMonth()+1).padStart(2,"0"),R=String(D.getDate()).padStart(2,"0");return `${M}-${w}-${R}`},x=N(l),B=new Date(l);B.setDate(B.getDate()+k);let b=N(B);a(x,b),s(false);},T=()=>{if(!e||!t)return "Set date";let k=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let b=B.split("-").map(Number);if(b.length!==3||b.some(R=>isNaN(R)))return null;let D=b[0],M=b[1],w=b[2];return D===void 0||M===void 0||w===void 0?null:new Date(D,M-1,w)},l=k(e),N=k(t);if(!l||!N||isNaN(l.getTime())||isNaN(N.getTime()))return "Set date";let x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${x[l.getMonth()]} ${l.getDate()} \u2013 ${x[N.getMonth()]} ${N.getDate()}`},v=e&&t,c=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,l=new Date;return l.setHours(0,0,0,0),k<l})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,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 ${c?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${T()}`:"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:T()})]}),o&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"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:g?"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:g?"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:zp.map(k=>jsxRuntime.jsx("button",{onClick:()=>C(k.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",l.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",l.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:k.label},k.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"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:k=>a(k.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:k=>a(e,k.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"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:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function _r({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[m,p]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),h=()=>{if(!g.current)return;let c=g.current.getBoundingClientRect(),k=window.innerHeight,l=window.innerWidth,N=300,x=380,B=4,b=c.right-N;b<10&&(b=c.left),b+N>l-10&&(b=l-N-10);let D=k-c.bottom,M=c.top,w;D>=x+B?w=c.bottom+B:M>=x+B?w=c.top-x-B:w=D>=M?c.bottom+B:Math.max(10,c.top-x-B),u({top:w,left:b}),n(true);};react.useEffect(()=>{let c=k=>{d.current&&!d.current.contains(k.target)&&!g.current?.contains(k.target)&&(n(false),p(""));};if(s)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),react.useEffect(()=>{let c=k=>{k.key==="Escape"&&(n(false),p(""));};if(s)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[s]);let C=c=>{let k=e.some(l=>l.id===c.id);a(k?e.filter(l=>l.id!==c.id):[...e,c]);},T=t.filter(c=>c.name.toLowerCase().includes(m.toLowerCase())),v=e.slice(0,o),y=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,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(c=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:c.name,children:c.avatar?jsxRuntime.jsx("img",{src:c.avatar,alt:c.name,className:"asakaa-avatar-img"}):c.initials},c.id)),y>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:c=>p(c.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:T.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"}):T.map(c=>{let k=e.some(l=>l.id===c.id);return jsxRuntime.jsxs("button",{onClick:()=>C(c),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:l=>{l.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:l=>{l.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:c.color,color:"#fff"},children:c.avatar?jsxRuntime.jsx("img",{src:c.avatar,alt:c.name,className:"w-full h-full rounded-full object-cover"}):c.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:c.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:k?"#3b82f6":"transparent"},children:k?"\u2713":""})]},c.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 cn(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let i=p.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,m=p=>{if(!s.has(p)){s.add(p),n.add(p);let i=r.get(p)||[];for(let u of i){if(!s.has(u)&&m(u))return true;if(n.has(u))return true}}return n.delete(p),false};return m(a)}function Po({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[m,p]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(t.length>0),[h,C]=react.useState({top:0,left:0}),[T,v]=react.useState(null),y=react.useRef(null),c=react.useRef(null),k=()=>{if(!c.current)return;let b=c.current.getBoundingClientRect(),D=window.innerHeight,M=window.innerWidth,w=300,R=d?380:120,$=4,K=b.right-w;K<10&&(K=b.left),K+w>M-10&&(K=M-w-10);let te=D-b.bottom,re=b.top,ae;te>=R+$?ae=b.bottom+$:re>=R+$?ae=b.top-R-$:ae=te>=re?b.bottom+$:Math.max(10,b.top-R-$),C({top:ae,left:K}),p(true);};react.useEffect(()=>{if(!m||!c.current)return;let b=c.current.getBoundingClientRect(),D=window.innerHeight,M=window.innerWidth,w=300,R=d?380:120,$=4,K=b.right-w;K<10&&(K=b.left),K+w>M-10&&(K=M-w-10);let te=D-b.bottom,re=b.top,ae;te>=R+$?ae=b.bottom+$:re>=R+$?ae=b.top-R-$:ae=te>=re?b.bottom+$:Math.max(10,b.top-R-$),C({top:ae,left:K});},[d,m]),react.useEffect(()=>{let b=D=>{y.current&&!y.current.contains(D.target)&&!c.current?.contains(D.target)&&(p(false),u(""));};if(m)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[m]),react.useEffect(()=>{let b=D=>{D.key==="Escape"&&(p(false),u(""));};if(m)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[m]);let l=b=>{let D=t.includes(b),M=a.find(w=>w.id===b);if(v(null),D){let w=t.filter(R=>R!==b);r(w),w.length===0&&g(false);}else {if(s&&cn(a,b,e)){let R=`Cannot add "${M?.title||b}" as dependency - would create circular reference`;v(R),n?.(b,M?.title||b),setTimeout(()=>v(null),3e3);return}r([...t,b]),g(true);}},N=()=>{let b=!d;g(b),b||r([]);},x=a.filter(b=>b.id!==e).filter(b=>b.title.toLowerCase().includes(i.toLowerCase())||b.id.toLowerCase().includes(i.toLowerCase())),B=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:c,onClick:()=>m?p(false):k(),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})]}),m&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:y,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:[T&&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:T})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background: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:i,onChange:b=>u(b.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:x.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"}):x.map(b=>{let D=t.includes(b.id);return jsxRuntime.jsxs("button",{onClick:()=>l(b.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.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: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.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:b.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:b.id})]})]},b.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),p(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var br=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:m=[],allCards:p=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:h,isDragging:C}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:nn.Transform.toString(g),transition:h};if(t)return jsxRuntime.jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=m.filter(l=>e.assignedUserIds?.includes(l.id)),y=e.progress===100,c=(e.attachments||[]).filter(l=>l.type.startsWith("image/")),k={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:k,className:f("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:l=>{l.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:l=>{l.currentTarget.style.display="none";}})}),c.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:c.length===1&&c[0]?jsxRuntime.jsx("img",{src:c[0].url,alt:c[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:l=>{l.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:c.slice(0,4).map((l,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:l.url,alt:l.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}),N===3&&c.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:["+",c.length-4]})})]},l.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:l=>l.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Wr,{priority:e.priority,onChange:l=>n?.(e.id,{priority:l})})}),jsxRuntime.jsx("div",{onClick:l=>l.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(So,{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:(l,N)=>n?.(e.id,{startDate:l,endDate:N})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:l=>l.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(_r,{assignedUsers:v,availableUsers:m,onChange:l=>n?.(e.id,{assignedUserIds:l.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:l=>l.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Po,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(l=>typeof l=="string"?l:l.taskId):[],availableTasks:p,onChange:l=>n?.(e.id,{dependencies:l})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(l=>jsxRuntime.jsx("span",{className:"asakaa-label",children:l},l))}),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)));br.displayName="Card";var mn={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"}},nd=({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 sd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),p=react.useRef(null),i=react.useRef(null),u=[...Object.entries(mn).map(([v,y])=>({id:v,label:y.label,color:y.color,icon:y.icon})),...r.filter(v=>!Object.keys(mn).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=mn[e];if(v)return {...v,id:e};let y=r.find(c=>c.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...mn.todo,id:"todo"}},g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),y=window.innerHeight,c=window.innerWidth,k=180,l=280,N=4,x=v.right-k;x<10&&(x=v.left),x+k>c-10&&(x=c-k-10);let B=y-v.bottom,b=v.top,D;B>=l+N?D=v.bottom+N:b>=l+N?D=v.top-l-N:D=B>=b?v.bottom+N:Math.max(10,v.top-l-N),m({top:D,left:x}),s(true);};react.useEffect(()=>{let v=y=>{p.current&&!p.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let h=v=>{t(v),s(false);},C=d(),T=C.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):g(),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:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsxRuntime.jsx(nd,{icon:C.icon,color:T})}),o&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:p,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(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(nd,{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 id({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[m,p]=react.useState(false),[i,u]=react.useState(e),[d,g]=react.useState({top:0,left:0}),h=react.useRef(null),C=react.useRef(null),T=react.useRef(null);react.useEffect(()=>{if(s&&C.current){let k=C.current.getBoundingClientRect();g({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[s]),react.useEffect(()=>{let k=l=>{h.current&&!h.current.contains(l.target)&&!C.current?.contains(l.target)&&(n(false),p(false));};if(s)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[s]),react.useEffect(()=>{let k=l=>{l.key==="Escape"&&(n(false),p(false),u(e));};if(s)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[s,e]),react.useEffect(()=>{m&&T.current&&(T.current.focus(),T.current.select());},[m]);let v=()=>{p(true),u(e);},y=()=>{let k=i.trim();k&&k!==e&&t(k),p(false),n(false),u(e);},c=k=>{k.key==="Enter"?y():k.key==="Escape"&&(p(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(mt,{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:m?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:T,type:"text",value:i,onChange:k=>u(k.target.value),onKeyDown:c,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick: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 mo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:m,availableUsers:p,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:h,onColumnRename:C,onColumnDelete:T,isDeletable:v=false,className:y})=>{let{setNodeRef:c,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),l=react.useRef(null),N=u??Il(t.length),x=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>l.current,estimateSize:()=>d,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:c,className:y,children:a(e,t)});let b=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let w=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:w}:w>=80?{state:"warning",percentage:w}:w>=60?{state:"approaching",percentage:w}:{state:"ok",percentage:w}})(),D=b.state==="exceeded",M=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:c,className:f("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",y),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:f(M()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&b.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${b.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[b.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"})]}),b.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"})]}),b.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"})}),b.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||T)&&jsxRuntime.jsx(id,{columnTitle:e.title,onRename:w=>C?.(e.id,w),onDelete:T?()=>T(e.id):void 0,isDeletable:v}),h&&jsxRuntime.jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsxRuntime.jsx("div",{ref:l,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(w=>w.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"})}):N?jsxRuntime.jsx("div",{style:{height:`${x.getTotalSize()}px`,position:"relative"},children:x.getVirtualItems().map(w=>{let R=t[w.index];return R?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${w.start}px)`},children:jsxRuntime.jsx(br,{card:R,render:r,onClick:n,onUpdate:m,availableUsers:p,allCards:i})},R.id):null})}):t.map(w=>jsxRuntime.jsx(br,{card:w,render:r,onClick:n,onUpdate:m,availableUsers:p,allCards:i},w.id))})})]})});mo.displayName="Column";function ks({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let p=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?p():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:p,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function tu(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function ud(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(m=>m.name.toLowerCase().replace(/\s+/g,"")===s||m.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function au(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function gd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:m="dark",locale:p="es",currentUser:i}){let u=m==="dark",[d,g]=react.useState(false),[h,C]=react.useState([]),[T,v]=react.useState(0),[y,c]=react.useState(null),k=react.useRef(null),l=react.useRef(null),N=react.useCallback((M,w)=>{let R=tu(M,w);if(c(R),R){let $=r.filter(K=>K.name.toLowerCase().includes(R.query)||K.email&&K.email.toLowerCase().includes(R.query)).slice(0,5);C($),g($.length>0),v(0);}else g(false),C([]);},[r]),x=M=>{let w=M.target.value;t(w),N(w,M.target.selectionStart||0);},B=()=>{k.current&&N(e,k.current.selectionStart||0);},b=react.useCallback(M=>{if(!y||!k.current)return;let w=e.slice(0,y.start),R=e.slice(y.end),$=`@${M.name.replace(/\s+/g,"")} `,K=w+$+R;t(K),g(false),c(null),setTimeout(()=>{if(k.current){let te=y.start+$.length;k.current.selectionStart=te,k.current.selectionEnd=te,k.current.focus();}},0);},[y,e,t]),D=M=>{if(d&&h.length>0)switch(M.key){case "ArrowDown":M.preventDefault(),v(w=>w<h.length-1?w+1:0);break;case "ArrowUp":M.preventDefault(),v(w=>w>0?w-1:h.length-1);break;case "Enter":{M.preventDefault();let w=h[T];w&&b(w);break}case "Tab":{M.preventDefault();let w=h[T];w&&b(w);break}case "Escape":M.preventDefault(),g(false);break}else M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),a());};return react.useEffect(()=>{let M=w=>{l.current&&!l.current.contains(w.target)&&k.current&&!k.current.contains(w.target)&&g(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]),react.useEffect(()=>{if(d&&l.current){let M=l.current.children[T];M&&M.scrollIntoView({block:"nearest"});}},[T,d]),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&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:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 relative"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center gap-2 px-3 py-2 rounded-lg",u?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{ref:k,type:"text",value:e,onChange:x,onSelect:B,onKeyDown:D,placeholder:o||(p==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:f("flex-1 bg-transparent text-sm outline-none",u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()||s,className:f("p-1.5 rounded transition-colors",e.trim()&&!s?"bg-blue-500 text-white hover:bg-blue-600":u?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&h.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:h.map((M,w)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(M),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",w===T?u?"bg-white/10":"bg-gray-100":u?"hover:bg-white/5":"hover: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:M.color||"#8B5CF6"},children:au(M.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:f("text-sm font-medium truncate",u?"text-white":"text-gray-900"),children:M.name}),M.email&&jsxRuntime.jsx("p",{className:f("text-xs truncate",u?"text-[#6B7280]":"text-gray-500"),children:M.email})]})]},M.id))})})]})]})}function fd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((m,p)=>m.type==="mention"?jsxRuntime.jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:m.value},p):jsxRuntime.jsx("span",{children:m.value},p))})}var hn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function dr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[m,p]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(false),[h,C]=react.useState(hn[10]||"#3B82F6"),[T,v]=react.useState({top:0,left:0}),y=react.useRef(null),c=react.useRef(null),k=react.useRef(null),l=react.useRef(null),N=t.filter(w=>w.name.toLowerCase().includes(i.toLowerCase())),x=t.some(w=>w.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(m&&c.current){let w=c.current.getBoundingClientRect();v({top:w.bottom+6,left:w.left});}},[m]),react.useEffect(()=>{let w=R=>{let $=R.target,K=y.current?.contains($),te=k.current?.contains($);!K&&!te&&(p(false),u(""),g(false));};if(m)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[m]),react.useEffect(()=>{m&&l.current&&l.current.focus();},[m]);let B=w=>{let R=e.some($=>$.id===w.id);a(R?e.filter($=>$.id!==w.id):[...e,w]);},b=async()=>{if(!(!r||!i.trim())){g(true);try{let w=await r(i.trim(),h);w&&(a([...e,w]),u(""),C(hn[Math.floor(Math.random()*hn.length)]||"#3B82F6"));}finally{g(false);}}},D=(w,R)=>{R.stopPropagation(),a(e.filter($=>$.id!==w));},M={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:y,className:"relative",children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!s&&p(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,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(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.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:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:k,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:T.top,left:T.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:l,type:"text",value:i,onChange:w=>u(w.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:w=>{w.key==="Enter"&&i.trim()&&!x&&r&&b();}})}),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(w=>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:`${w.color}20`,color:w.color},onClick:R=>D(w.id,R),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(w=>{let R=e.some($=>$.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:R?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{R||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{R||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),R&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.id)}):i.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"})}),i.trim()&&!x&&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:hn.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:h===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:b,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 "',i.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 bd({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 cr=[{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 wd(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 Pu(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 Kr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:m=[],availableTags:p=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:h=[],comments:C=[],onAddComment:T,currentUser:v,mentionableUsers:y=[]}){let c=s==="dark",k={textTertiary:c?"#6B7280":"#9CA3AF",textSecondary:c?"#9CA3AF":"#6B7280",textPrimary:c?"#FFFFFF":"#111827",borderLight:c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:c?"#1A1D25":"#FFFFFF",bgSecondary:c?"#0F1117":"#F9FAFB",hoverBg:c?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),N=e,[x,B]=react.useState(e?wd(e,m):null),[b,D]=react.useState(false),[M,w]=react.useState(false),[R,$]=react.useState(false),[K,te]=react.useState(null),[re,ae]=react.useState(new Date),[pe,fe]=react.useState(false),[Ie,F]=react.useState(false),[O,L]=react.useState(""),[j,X]=react.useState(false),[W,ye]=react.useState(false),[oe,Le]=react.useState(false),[Ye,et]=react.useState(""),se=react.useRef(null),[Xe,dt]=react.useState(""),kt=react.useRef(null),[wt,z]=react.useState(""),[ge,Se]=react.useState(false);react.useEffect(()=>{if(e){let I=wd(e,m);B(I),et(I.description||""),dt(I.name||"");}},[e?.id,m]),react.useEffect(()=>()=>{se.current&&clearTimeout(se.current),kt.current&&clearTimeout(kt.current);},[]);let Pe=react.useCallback(I=>{B(I),l&&o&&N?o(Pu(I,N)):r&&r(I);},[l,N,o,r]),_e=react.useCallback(()=>{D(false),w(false),$(false),te(null),F(false),L(""),X(false);},[]),Ve=react.useCallback((I,xe)=>{if(!x)return;let J={...x,[I]:xe};Pe(J);},[x,Pe]),Mt=react.useCallback(I=>{et(I),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>{if(x){let xe={...x,description:I};Pe(xe);}},800);},[x,Pe]),Me=react.useCallback(I=>{dt(I),kt.current&&clearTimeout(kt.current),kt.current=setTimeout(()=>{if(x&&I.trim()){let xe={...x,name:I.trim()};Pe(xe);}},800);},[x,Pe]),Qt=react.useCallback(async()=>{if(!(!x||!wt.trim()||!T)){Se(true);try{let I=ud(wt,y);await T(x.id,wt.trim(),I.length>0?I:void 0),z("");}finally{Se(false);}}},[x,wt,T,y]),Zt=react.useCallback(I=>{let xe=typeof I=="string"?new Date(I):I,he=new Date().getTime()-xe.getTime(),ve=Math.floor(he/6e4),Be=Math.floor(he/36e5),Ae=Math.floor(he/864e5);return ve<1?n==="es"?"Ahora":"Just now":ve<60?n==="es"?`Hace ${ve} min`:`${ve}m ago`:Be<24?n==="es"?`Hace ${Be}h`:`${Be}h ago`:Ae<7?n==="es"?`Hace ${Ae}d`:`${Ae}d ago`:xe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ft=react.useCallback(I=>{if(!x)return;let xe=x.progress||0;I==="completed"?xe=100:I==="in-progress"&&xe===0?xe=10:I==="todo"&&(xe=0);let J={...x,status:I,progress:xe};Pe(J),D(false);},[x,Pe]),bt=react.useCallback((I,xe)=>{if(!x)return;let J={...x,startDate:I,endDate:xe};Pe(J);},[x,Pe]),Ht=react.useCallback(()=>{let I=re.getFullYear(),xe=re.getMonth(),J=new Date(I,xe,1),ve=new Date(I,xe+1,0).getDate(),Be=J.getDay(),Ae=[],ot=new Date(I,xe,0).getDate();for(let Y=Be-1;Y>=0;Y--)Ae.push({date:new Date(I,xe-1,ot-Y),isCurrentMonth:false});for(let Y=1;Y<=ve;Y++)Ae.push({date:new Date(I,xe,Y),isCurrentMonth:true});let U=42-Ae.length;for(let Y=1;Y<=U;Y++)Ae.push({date:new Date(I,xe+1,Y),isCurrentMonth:false});return Ae},[re]),ea=react.useCallback(async I=>{if(I.preventDefault(),I.stopPropagation(),ye(false),!x||!d)return;let xe=Array.from(I.dataTransfer.files);if(xe.length!==0){Le(true);try{await d(x.id,xe);}finally{Le(false);}}},[x,d]),Ce=react.useCallback(async I=>{if(!x||!d||!I.target.files)return;let xe=Array.from(I.target.files);if(xe.length!==0){Le(true);try{await d(x.id,xe);}finally{Le(false);}I.target.value="";}},[x,d]),Ue=react.useCallback(I=>{I.preventDefault(),I.stopPropagation(),ye(true);},[]),ca=react.useCallback(I=>{I.preventDefault(),I.stopPropagation(),ye(false);},[]),qe=react.useCallback(I=>I<1024?`${I} B`:I<1024*1024?`${(I/1024).toFixed(1)} KB`:`${(I/(1024*1024)).toFixed(1)} MB`,[]),We=react.useCallback(I=>I.startsWith("image/")?lucideReact.Image:I.includes("pdf")||I.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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",c?"text-[#6B7280]":"text-gray-400"),children:x.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",c?"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:f("p-1.5 rounded transition-colors",c?"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:f("p-1.5 rounded transition-colors",c?"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:f("p-1.5 rounded transition-colors",c?"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 I=x.progress===100?0:100,J={...x,progress:I,status:I===100?"completed":"todo"};Pe(J);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",x.progress===100?"bg-green-500 border-green-500":c?"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("input",{type:"text",value:Xe,onChange:I=>Me(I.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",x.progress===100?"line-through text-[#6B7280]":c?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),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:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{_e(),D(!b);},className:f("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":c?"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:()=>D(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"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(I=>jsxRuntime.jsxs("button",{onClick:()=>Ft(I.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",x.status===I.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",I.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:I.label})]},I.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{_e(),$(!R);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"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((I,xe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:I.color||"#8B5CF6"},title:I.name,children:I.initials||I.name.slice(0,2).toUpperCase()},xe)),x.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:["+",x.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(I=>{let xe=x.assignees?.some(J=>J.name===I.name);return jsxRuntime.jsxs("button",{onClick:()=>{let J=x.assignees||[],he;xe?he=J.filter(ve=>ve.name!==I.name):he=[...J,I],Ve("assignees",he);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",xe&&(c?"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:I.color||"#8B5CF6"},children:I.initials||I.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",c?"text-white":"text-gray-900"),children:I.name}),xe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},I.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",c?"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:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{te(K?null:"start"),ae(x.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"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:f("mx-1",c?"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:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",c?"border-white/10":"border-gray-200"),children:[(()=>{let I=new Date,xe=new Date(I);xe.setDate(I.getDate()+1);let J=new Date(I);J.setDate(I.getDate()+((6-I.getDay()+7)%7||7));let he=new Date(I);he.setDate(I.getDate()+((1-I.getDay()+7)%7||7));let ve=new Date(I);ve.setDate(I.getDate()+(6-I.getDay()+7)%7+7);let Be=new Date(I);Be.setDate(I.getDate()+14);let Ae=new Date(I);return Ae.setDate(I.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:I,display:I.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:xe,display:xe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:J,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:he,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ve,display:ve.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Be,display:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ae,display:Ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((U,Y)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(K==="start"){let de=x.endDate&&U.date>x.endDate?U.date:x.endDate;bt(U.date,de),te("end");}else {let de=x.startDate&&U.date<x.startDate?U.date:x.startDate;bt(de,U.date),te(null);}},children:[jsxRuntime.jsx("span",{children:U.label}),jsxRuntime.jsx("span",{className:f("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:U.display})]},Y))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{bt(void 0,void 0),te(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",c?"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:f("text-xs mb-3 px-2 py-1 rounded",c?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:K==="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:f("font-medium",c?"text-white":"text-gray-900"),children:re.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:()=>ae(new Date),className:f("p-1 rounded text-sm transition-colors",c?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ae(new Date(re.getFullYear(),re.getMonth()-1)),className:f("p-1 rounded",c?"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:()=>ae(new Date(re.getFullYear(),re.getMonth()+1)),className:f("p-1 rounded",c?"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(I=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",c?"text-[#6B7280]":"text-gray-400"),children:I},I))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Ht().map((I,xe)=>{let J=I.date.toDateString()===new Date().toDateString(),he=x.startDate?.toDateString()===I.date.toDateString(),ve=x.endDate?.toDateString()===I.date.toDateString(),Be=he||ve,Ae=x.startDate&&x.endDate&&I.date>=x.startDate&&I.date<=x.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let ot=new Date(I.date);if(K==="start"){let U=x.endDate&&ot>x.endDate?ot:x.endDate;bt(ot,U),te("end");}else {let U=x.startDate&&ot<x.startDate?ot:x.startDate;bt(U,ot),te(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!I.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),I.isCurrentMonth&&(c?"text-white":"text-gray-900"),J&&"ring-2 ring-[#3B82F6]",he&&"bg-[#3B82F6] text-white",ve&&!he&&"bg-[#7C3AED] text-white",Ae&&!Be&&(c?"bg-[#7C3AED]/20":"bg-purple-100"),!Be&&(c?"hover:bg-white/10":"hover:bg-gray-100")),children:I.date.getDate()},xe)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{_e(),w(!M);},className:f("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":c?"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:M&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"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(I=>jsxRuntime.jsxs("button",{onClick:()=>{Ve("priority",I.id),w(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",x.priority===I.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",I.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:I.label})]},I.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",c?"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:f("w-4 h-4 rounded-full border-2",c?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[pe?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:x.progress||0,onChange:I=>{let xe=parseInt(I.target.value),J=x.status;xe===100?J="completed":xe>0?J="in-progress":J="todo";let he={...x,progress:xe,status:J};Pe(he);},onBlur:()=>fe(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",c?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>fe(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",x.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${x.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",c?"text-white":"text-gray-900"),children:[x.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(dr,{selectedTags:x.tags||[],availableTags:p,onChange:I=>{Ve("tags",I);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",c?"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(I=>{let xe=h.find(J=>J.id===I);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",c?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[xe?.name||I.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let J=(x.dependencies||[]).filter(he=>he!==I);Ve("dependencies",J);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},I)})}),jsxRuntime.jsxs("button",{onClick:()=>{_e(),F(!Ie);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"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:f("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{F(false),L("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:O,onChange:I=>L(I.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",c?"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(I=>I.id!==x.id).filter(I=>O===""||I.name.toLowerCase().includes(O.toLowerCase())).map(I=>{let xe=x.dependencies?.includes(I.id);return jsxRuntime.jsxs("button",{onClick:()=>{let J=x.dependencies||[],he;xe?he=J.filter(ve=>ve!==I.id):he=[...J,I.id],Ve("dependencies",he);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",xe&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",xe?"bg-blue-500 border-blue-500":c?"border-white/30":"border-gray-300"),children:xe&&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:f("block truncate",c?"text-white":"text-gray-900"),children:I.name}),jsxRuntime.jsx("span",{className:f("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:I.id.slice(0,8)})]})]},I.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",c?"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:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{_e(),X(!j);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"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:f("text-sm",c?"text-white":"text-gray-900"),children:cr.find(I=>I.value===x.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",c?"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:cr.map(I=>{let xe=x.color===I.value;return jsxRuntime.jsx("button",{onClick:()=>{Ve("color",I.value),X(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",xe&&"ring-2 ring-offset-2",c?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:I.value,outlineColor:xe?I.value:void 0},title:I.name,children:xe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},I.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",c?"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:I=>Ve("isMilestone",I.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",x.isMilestone?"bg-purple-500 border-purple-500":c?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",c?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",c?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Ye,onChange:I=>Mt(I.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",c?"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:f("flex items-center gap-2 text-sm mt-2 transition-colors",c?"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:f("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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:f("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",c?"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(I=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",I.progress===100?"bg-green-500 border-green-500":c?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:I.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",I.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:I.name})]},I.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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:f("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",c?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",c?"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:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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:f("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(I=>{let xe=We(I.type),J=I.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[J&&I.thumbnailUrl?jsxRuntime.jsx("img",{src:I.thumbnailUrl,alt:I.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(xe,{className:f("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",c?"text-white":"text-gray-900"),children:I.name}),jsxRuntime.jsx("p",{className:f("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:qe(I.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(I.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",c?"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"})})]},I.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ue,onDragLeave:ca,onDrop:ea,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",W?c?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":c?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",oe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ce,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||oe}),oe?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:f("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",W?"text-blue-500":c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:W?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:f("text-xs mt-1",c?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",c?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",c?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",c?"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(I=>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:I.user?.color||"#8B5CF6"},children:I.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:f("text-sm font-medium",c?"text-white":"text-gray-900"),children:I.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:Zt(I.createdAt)})]}),jsxRuntime.jsx("div",{className:f("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(fd,{content:I.content,theme:s})})]})]},I.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",c?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",c?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(gd,{value:wt,onChange:z,onSubmit:Qt,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!T,isSubmitting:ge,theme:s,locale:n,currentUser:v})})]})]})]})})}function Es(){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 Mr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:m,isLoading:p,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:T,comments:v,onAddComment:y,currentUser:c,mentionableUsers:k,onTaskOpen:l}){let[N,x]=Es(),[B,b]=react.useState(null),D=o?.theme||"dark",M=D==="dark"||D==="neutral",w=M?"dark":"",R=react.useCallback((j,X)=>{t.onCardUpdate?.(j,X);},[t]),$=react.useCallback((j,X)=>{t.onColumnUpdate?.(j,{title:X});},[t]),K=react.useCallback(j=>{t.onColumnDelete?.(j);},[t]),te=["todo","in-progress","completed"],re=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),ae=react.useMemo(()=>{let j=new Map;return e.columns.forEach(X=>{let W=X.cardIds.map(ye=>e.cards.find(oe=>oe.id===ye)).filter(ye=>ye!==void 0).sort((ye,oe)=>ye.position-oe.position);j.set(X.id,W);}),j},[e.cards,e.columns]),pe=react.useMemo(()=>e.cards.map(j=>({id:j.id,name:j.title,startDate:j.startDate?new Date(j.startDate):void 0,endDate:j.endDate?new Date(j.endDate):void 0,progress:j.progress||0,status:j.columnId,priority:j.priority?.toLowerCase(),dependencies:Array.isArray(j.dependencies)?j.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),fe=react.useCallback(j=>{let{active:X}=j,W=e.cards.find(ye=>ye.id===X.id);W&&x({isDragging:true,draggedCardId:W.id,sourceColumnId:W.columnId,targetColumnId:W.columnId});},[e.cards,x]),Ie=react.useCallback(j=>{let{active:X,over:W}=j;if(!W||!e.cards.find(Le=>Le.id===X.id))return;let oe=null;W.data.current?.type==="column"?oe=W.id:W.data.current?.type==="card"&&(oe=e.cards.find(Ye=>Ye.id===W.id)?.columnId||null),oe&&oe!==N.targetColumnId&&x({...N,targetColumnId:oe});},[e.cards,N,x]),F=react.useCallback(async j=>{let{active:X,over:W}=j;if(x({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!W)return;let ye=e.cards.find(et=>et.id===X.id);if(!ye)return;let oe,Le;if(W.data.current?.type==="column"){oe=W.id;let et=ae.get(oe)||[];Le=ps(et,0);}else {let et=e.cards.find(dt=>dt.id===W.id);if(!et)return;oe=et.columnId;let se=ae.get(oe)||[],Xe=se.findIndex(dt=>dt.id===W.id);Le=ps(se,Xe);}let Ye=e.columns.find(et=>et.id===oe);if(Ye&&Ye.wipLimit&&Ye.wipLimitType==="hard"){let et=ae.get(oe)||[];if(ye.columnId!==oe&&et.length>=Ye.wipLimit){t.onWipLimitExceeded?.(Ye,ye);return}}(ye.columnId!==oe||ye.position!==Le)&&await t.onCardMove?.(ye.id,oe,Le);},[e.cards,e.columns,ae,t,x]),O=react.useCallback(j=>{b(j),a?.(j),l?.(j.id);},[a,l]),L=react.useCallback(j=>{t.onCardUpdate?.(j.id,j),b(j);},[t]);return p?jsxRuntime.jsx("div",{className:f("asakaa-board",w,n),style:m,children:jsxRuntime.jsx(Hu,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",w,n),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(_l,{themeName:D,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:re,collisionDetection:core$1.closestCorners,onDragStart:fe,onDragOver:Ie,onDragEnd:F,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",w,n),style:m,"data-theme":D,children:[e.columns.sort((j,X)=>j.position-X.position).map(j=>{let X=ae.get(j.id)||[],W=!te.includes(j.id);return jsxRuntime.jsx(mo,{column:j,cards:X,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:O,onCardUpdate:R,onColumnRename:$,onColumnDelete:K,isDeletable:W,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},j.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:N.draggedCardId?jsxRuntime.jsx(br,{card:e.cards.find(j=>j.id===N.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Kr,{task:B,isOpen:!!B,onClose:()=>b(null),onCardUpdate:L,theme:M?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:B?h?.get(B.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:pe,comments:v,onAddComment:y,currentUser:c,mentionableUsers:k})]})}function Hu({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 ju={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)"},Ku={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"},qu={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),m=react.useRef(null);react.useEffect(()=>{let i=u=>{m.current&&!m.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let p=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:m,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((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(i.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:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Ju({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[m,p]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let h=C=>{i.current&&!i.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),g=async(h,C)=>{if(C){p(h);try{await C();}catch(T){console.error(`Export ${h} failed:`,T);}finally{p(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,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:()=>g(h.id,h.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:m===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 Qu({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 Ms({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:m,onExportExcel:p,translations:i}){let u=r==="dark"?ju:Ku,d={...o==="es"?Yu:qu,...i},g=n||m||p;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:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ju,{theme:u,t:d,onExportCSV:n,onExportJSON:m,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(Xu,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(Qu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Fs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[m,p]=react.useState(""),i=react.useCallback(()=>{let g=m.trim();g&&(e(g),p(""),n(false));},[m,e]),u=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(p(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{m.trim()||n(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:m,onChange:g=>p(g.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:i,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{p(""),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:f("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 Is({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:m="dark",locale:p="es"}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState(""),[T,v]=react.useState([]),[y,c]=react.useState(""),[k,l]=react.useState(""),[N,x]=react.useState(""),[B,b]=react.useState(false),[D,M]=react.useState(false),[w,R]=react.useState(false),$=react.useRef(null),K=react.useRef(null),te={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},re=react.useCallback(()=>{C(""),v([]),c(""),l(""),x(""),b(false),M(false),R(false),u(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=O=>{K.current&&!K.current.contains(O.target)&&(h.trim()||re());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,h,re]);let ae=react.useCallback(async()=>{let F=h.trim();if(!(!F||d)){g(true);try{await t({name:F,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:y?new Date(y):void 0,endDate:k?new Date(k):void 0,priority:N||void 0}),C(""),v([]),c(""),l(""),x(""),b(!1),M(!1),R(!1),$.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{g(false);}}},[h,e,T,y,k,N,t,d]),pe=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),ae()):F.key==="Escape"&&re();},[ae,re]),fe=react.useCallback(F=>{v(O=>O.includes(F)?O.filter(L=>L!==F):[...O,F]);},[]),Ie=m==="dark";return i?jsxRuntime.jsxs("div",{ref:K,className:f("rounded-lg overflow-hidden shadow-lg",Ie?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:h,onChange:F=>C(F.target.value),onKeyDown:pe,placeholder:te.placeholder,disabled:d,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ie?"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:()=>b(!B),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||T.length>0?"bg-emerald-500/20 text-emerald-400":Ie?"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"})]}),T.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:T.length})]}),jsxRuntime.jsx("button",{onClick:()=>M(!D),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",D||y||k?"bg-blue-500/20 text-blue-400":Ie?"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:()=>R(!w),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",w||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ie?"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:ae,disabled:!h.trim()||d,className:f("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:f("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>fe(F.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(F.id)?"bg-emerald-500 text-white":Ie?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),D&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ie?"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:f("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:F=>c(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.endDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:F=>l(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),w&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>x(N===F?"":F),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Ie?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ie?"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 Lo=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(Mr,{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 Ld(e={}){return new Lo(e)}var uo=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 Ls(e,t){let a=r=>jsxRuntime.jsx(uo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Rs({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:m,onOpenAIUsage:p,shortcut:i="k",className:u=""}){let[d,g]=react.useState(false),[h,C]=react.useState(""),[T,v]=react.useState("home"),[y,c]=react.useState(""),[k,l]=react.useState("");react.useEffect(()=>{let b=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),g(M=>!M)),D.key==="Escape"&&(g(false),v("home"),C(""));};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[i]),react.useEffect(()=>{d||(v("home"),C(""),c(""),l(""));},[d]);let N=react.useCallback(()=>{g(false);},[]),x=react.useCallback(b=>{let[D,M]=b.split(":");switch(D){case "create-card":v("create-card");break;case "create-card-in":c(M||"");break;case "navigate":M?(a?.(M),N()):v("navigate");break;case "search":r?.(h),N();break;case "priority":v("priority");break;case "set-priority":k&&M&&(o?.(k,M),N());break;case "assign":v("assign");break;case "assign-user":k&&M&&(s?.(k,M),N());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":m?.(),N();break;case "ai-usage":p?.(),N();break;case "back":v("home");break;}},[h,k,t,a,r,o,s,n,m,p,N]),B=react.useCallback(()=>{y&&h.trim()&&(t?.(y,h.trim()),N());},[y,h,t,N]);return d?jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:b=>b.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:T==="create-card"&&y?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:b=>{b.key==="Enter"&&T==="create-card"&&y&&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."}),T==="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:x,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:x,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:x,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:x,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(b=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${b.id}`,onSelect:x,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:b.priority==="URGENT"?"#EF4444":b.priority==="HIGH"?"#F59E0B":b.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:b.title}),b.labels&&b.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:b.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},b.id))})]}),T==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(b=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${b.id}`,onSelect:x,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:b.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[b.cardIds.length," cards"]})]},b.id))})]}),T==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(b=>{let D=e.columns.find(M=>M.id===b.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${b.id}`,onSelect:x,className:"command-palette-item",keywords:[b.title,b.description||"",...b.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:b.priority==="URGENT"?"#EF4444":b.priority==="HIGH"?"#F59E0B":b.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:b.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),b.labels&&b.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:b.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},b.id)})})]}),T==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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:x,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:x,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:x,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 $d(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'),dm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),yf=require('react-markdown'),vf=require('remark-gfm'),xf=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var dm__default=/*#__PURE__*/_interopDefault(dm);var yf__default=/*#__PURE__*/_interopDefault(yf);var vf__default=/*#__PURE__*/_interopDefault(vf);var xf__default=/*#__PURE__*/_interopDefault(xf);var yn=(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 vn=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 [vn.Translate.toString(e),vn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function d(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function xn(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 Du(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Fs(e,t){return e.length===0?1e3:t===0?xn(null,e[0].position):t>=e.length?xn(e[e.length-1].position,null):xn(e[t-1].position,e[t].position)}function nd(e,t=100){return e>t}var Su=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 Eu(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 kn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Su,onRetry:c}=t,g,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(g=l,u===a||!n(g,u))return {error:g,attempts:i,success:false};let v=Eu(u,r,o,s);if(c)try{c(g,u,v);}catch(k){console.error("Error in retry callback:",k);}await new Promise(k=>setTimeout(k,v));}}return {error:g||new Error("Unknown error"),attempts:i,success:false}}function Pu(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 Mu(e,t={}){return async(...a)=>kn(()=>e(...a),t)}var Ls=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 sd=(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))(sd||{}),Qr=class Qr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,c=`[${a}] [${r}] [${s}]`,g=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(c,o,g?n:"");break;case "INFO":console.info(c,o,g?n:"");break;case "WARN":console.warn(c,o,g?n:"");break;case "ERROR":console.error(c,o,g?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",...Qr.globalOptions};}static configure(t){Qr.globalOptions={...Qr.globalOptions,...t};}child(t){return new Qr({...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 wn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new wn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:sd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Qr.globalOptions={};var Is=Qr,wn=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}},id=new Is;function Fu(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 Lu(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,Bs(s.title),Bs(s.description||""),Bs(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 Iu(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 dm__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"),g=297,i=210,u=n.width/n.height,l=g-20,b=l/u;b>i-20&&(b=i-20,l=b*u);let v=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});v.setFontSize(16),v.setTextColor(255,255,255),v.setFillColor(10,10,10),v.rect(0,0,g,15,"F"),v.text(e.title||"Kanban Board",10,10);let k=(g-l)/2;return v.addImage(c,"PNG",k,20,l,b),v}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(g=>g.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(g=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(g.title,25,s),s+=6,g.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(g.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(g.priority&&i.push(`Priority: ${g.priority}`),g.labels&&g.labels.length>0&&i.push(`Labels: ${g.labels.join(", ")}`),g.assignedUserIds&&g.assignedUserIds.length>0&&i.push(`Assigned: ${g.assignedUserIds.length} user(s)`),g.startDate||g.endDate){let u=[];g.startDate&&u.push(`Start: ${g.startDate}`),g.endDate&&u.push(`End: ${g.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Bs(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function dd(e,t,a,r){switch(t){case "json":return Fu(e,r);case "csv":return Lu(e);case "pdf":return await Iu(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function cd(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]}),g=URL.createObjectURL(c),i=document.createElement("a");i.href=g,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(g);}function Bu(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 Ru(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=md(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let c=md(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 i={};a.forEach((v,k)=>{i[v]=c[k]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let l=o.get(u),b={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(b),l.cardIds.push(b.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 md(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 pd(e,t){switch(t){case "json":return Bu(e);case "csv":return Ru(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ud(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 gd(){return react.useContext(Rs)}var fd=react.createContext(null);function bd({children:e,themeName:t}){return jsxRuntime.jsx(fd.Provider,{value:{themeName:t},children:e})}function ko(){return react.useContext(fd)}function ft({children:e,container:t}){let[a,r]=react.useState(false),o=gd(),s=ko();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:g}=o,i={"--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":g,"data-gantt-portal":"true",style:i,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 kd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},_u="#BDC3C7",Vu=({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 eo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),c=react.useRef(null),g=react.useRef(null),i=()=>{if(!g.current)return;let v=g.current.getBoundingClientRect(),k=window.innerHeight,C=window.innerWidth,h=160,f=220,p=4,x=v.right-h;x<10&&(x=v.left),x+h>C-10&&(x=C-h-10);let m=k-v.bottom,N=v.top,w;m>=f+p?w=v.bottom+p:N>=f+p?w=v.top-f-p:w=m>=N?v.bottom+p:Math.max(10,v.top-f-p),n({top:w,left:x}),o(true);};react.useEffect(()=>{let v=k=>{c.current&&!c.current.contains(k.target)&&!g.current?.contains(k.target)&&o(false);};if(r)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r]),react.useEffect(()=>{let v=k=>{k.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[r]);let u=v=>{t(v),o(false);},l=e?kd[e]:null,b=l?.color||_u;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${b}10`:"transparent",boxShadow:e?`0 0 0 2px ${b}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:b,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:b,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ft,{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(kd).map(([v,k])=>jsxRuntime.jsxs("button",{onClick:()=>u(v),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:k.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Vu,{color:k.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:k.label}),e===v&&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)),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:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("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 ju=[{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 Ho({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),g=react.useRef(null),i=react.useRef(null),b=(ko()?.themeName||"dark")==="dark",v=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),m=window.innerHeight,N=window.innerWidth,w=320,B=380,y=4,I=x.left;I+w>N-10&&(I=N-w-10),I<10&&(I=10);let P=m-x.bottom,T=x.top,W;P>=B+y?W=x.bottom+y:T>=B+y?W=x.top-B-y:W=P>=T?x.bottom+y:Math.max(10,x.top-B-y),c({top:W,left:I}),s(true);};react.useEffect(()=>{let x=m=>{g.current&&!g.current.contains(m.target)&&!i.current?.contains(m.target)&&s(false);};if(o)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{let x=m=>{m.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o]);let k=x=>{let m=new Date,N=I=>{let P=I.getFullYear(),T=String(I.getMonth()+1).padStart(2,"0"),W=String(I.getDate()).padStart(2,"0");return `${P}-${T}-${W}`},w=N(m),B=new Date(m);B.setDate(B.getDate()+x);let y=N(B);a(w,y),s(false);},C=()=>{if(!e||!t)return "Set date";let x=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let y=B.split("-").map(Number);if(y.length!==3||y.some(W=>isNaN(W)))return null;let I=y[0],P=y[1],T=y[2];return I===void 0||P===void 0||T===void 0?null:new Date(I,P-1,T)},m=x(e),N=x(t);if(!m||!N||isNaN(m.getTime())||isNaN(N.getTime()))return "Set date";let w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${w[m.getMonth()]} ${m.getDate()} \u2013 ${w[N.getMonth()]} ${N.getDate()}`},h=e&&t,p=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,m=new Date;return m.setHours(0,0,0,0),x<m})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):v(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${p?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${C()}`:"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:C()})]}),o&&jsxRuntime.jsx(ft,{children:jsxRuntime.jsxs("div",{ref:g,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:b?"#1A1D25":"#FFFFFF",border:`1px solid ${b?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:b?"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:b?"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:b?"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:ju.map(x=>jsxRuntime.jsx("button",{onClick:()=>k(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:b?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=b?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",m.currentTarget.style.border=`1px solid ${b?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",m.currentTarget.style.border=`1px solid ${b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:b?"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:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:b?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:b?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:b?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:b?"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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ao({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[c,g]=react.useState(""),[i,u]=react.useState({top:0,left:0}),l=react.useRef(null),b=react.useRef(null),v=()=>{if(!b.current)return;let p=b.current.getBoundingClientRect(),x=window.innerHeight,m=window.innerWidth,N=300,w=380,B=4,y=p.right-N;y<10&&(y=p.left),y+N>m-10&&(y=m-N-10);let I=x-p.bottom,P=p.top,T;I>=w+B?T=p.bottom+B:P>=w+B?T=p.top-w-B:T=I>=P?p.bottom+B:Math.max(10,p.top-w-B),u({top:T,left:y}),n(true);};react.useEffect(()=>{let p=x=>{l.current&&!l.current.contains(x.target)&&!b.current?.contains(x.target)&&(n(false),g(""));};if(s)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),react.useEffect(()=>{let p=x=>{x.key==="Escape"&&(n(false),g(""));};if(s)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]);let k=p=>{let x=e.some(m=>m.id===p.id);a(x?e.filter(m=>m.id!==p.id):[...e,p]);},C=t.filter(p=>p.name.toLowerCase().includes(c.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:b,onClick:()=>s?n(false):v(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(p=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:p.name,children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,className:"asakaa-avatar-img"}):p.initials},p.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(ft,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:p=>g(p.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:C.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"}):C.map(p=>{let x=e.some(m=>m.id===p.id);return jsxRuntime.jsxs("button",{onClick:()=>k(p),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:m=>{m.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:p.color,color:"#fff"},children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,className:"w-full h-full rounded-full object-cover"}):p.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:p.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#3b82f6":"transparent"},children:x?"\u2713":""})]},p.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 Cn(e,t,a){let r=new Map;e.forEach(g=>{if(g.dependencies&&Array.isArray(g.dependencies)){let i=g.dependencies.map(u=>{if(typeof u=="string")return u;let l=u;return l.taskId||l.targetId||""}).filter(Boolean);r.set(g.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,c=g=>{if(!s.has(g)){s.add(g),n.add(g);let i=r.get(g)||[];for(let u of i){if(!s.has(u)&&c(u))return true;if(n.has(u))return true}}return n.delete(g),false};return c(a)}function Go({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[c,g]=react.useState(false),[i,u]=react.useState(""),[l,b]=react.useState(t.length>0),[v,k]=react.useState({top:0,left:0}),[C,h]=react.useState(null),f=react.useRef(null),p=react.useRef(null),x=()=>{if(!p.current)return;let y=p.current.getBoundingClientRect(),I=window.innerHeight,P=window.innerWidth,T=300,W=l?380:120,O=4,q=y.right-T;q<10&&(q=y.left),q+T>P-10&&(q=P-T-10);let te=I-y.bottom,ne=y.top,re;te>=W+O?re=y.bottom+O:ne>=W+O?re=y.top-W-O:re=te>=ne?y.bottom+O:Math.max(10,y.top-W-O),k({top:re,left:q}),g(true);};react.useEffect(()=>{if(!c||!p.current)return;let y=p.current.getBoundingClientRect(),I=window.innerHeight,P=window.innerWidth,T=300,W=l?380:120,O=4,q=y.right-T;q<10&&(q=y.left),q+T>P-10&&(q=P-T-10);let te=I-y.bottom,ne=y.top,re;te>=W+O?re=y.bottom+O:ne>=W+O?re=y.top-W-O:re=te>=ne?y.bottom+O:Math.max(10,y.top-W-O),k({top:re,left:q});},[l,c]),react.useEffect(()=>{let y=I=>{f.current&&!f.current.contains(I.target)&&!p.current?.contains(I.target)&&(g(false),u(""));};if(c)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),react.useEffect(()=>{let y=I=>{I.key==="Escape"&&(g(false),u(""));};if(c)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[c]);let m=y=>{let I=t.includes(y),P=a.find(T=>T.id===y);if(h(null),I){let T=t.filter(W=>W!==y);r(T),T.length===0&&b(false);}else {if(s&&Cn(a,y,e)){let W=`Cannot add "${P?.title||y}" as dependency - would create circular reference`;h(W),n?.(y,P?.title||y),setTimeout(()=>h(null),3e3);return}r([...t,y]),b(true);}},N=()=>{let y=!l;b(y),y||r([]);},w=a.filter(y=>y.id!==e).filter(y=>y.title.toLowerCase().includes(i.toLowerCase())||y.id.toLowerCase().includes(i.toLowerCase())),B=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:p,onClick:()=>c?g(false):x(),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(ft,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${v.top}px`,left:`${v.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:[C&&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:C})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:y=>u(y.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:w.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"}):w.map(y=>{let I=t.includes(y.id);return jsxRuntime.jsxs("button",{onClick:()=>m(y.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:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.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:y.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:y.id})]})]},y.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),b(false),g(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 Dr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:c=[],allCards:g=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:b,transition:v,isDragging:k}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:vn.Transform.toString(b),transition:v};if(t)return jsxRuntime.jsx("div",{ref:l,style:C,...i,...u,onClick:()=>a?.(e),children:t(e)});let h=c.filter(m=>e.assignedUserIds?.includes(m.id)),f=e.progress===100,p=(e.attachments||[]).filter(m=>m.type.startsWith("image/")),x={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:x,className:d("asakaa-card",k&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:m=>{m.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:m=>{m.currentTarget.style.display="none";}})}),p.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:p.length===1&&p[0]?jsxRuntime.jsx("img",{src:p[0].url,alt:p[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:m=>{m.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:p.slice(0,4).map((m,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:m.url,alt:m.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}),N===3&&p.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:["+",p.length-4]})})]},m.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:m=>m.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(eo,{priority:e.priority,onChange:m=>n?.(e.id,{priority:m})})}),jsxRuntime.jsx("div",{onClick:m=>m.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ho,{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:(m,N)=>n?.(e.id,{startDate:m,endDate:N})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:m=>m.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(ao,{assignedUsers:h,availableUsers:c,onChange:m=>n?.(e.id,{assignedUserIds:m.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:m=>m.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Go,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(m=>typeof m=="string"?m:m.taskId):[],availableTasks:g,onChange:m=>n?.(e.id,{dependencies:m})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(m=>jsxRuntime.jsx("span",{className:"asakaa-label",children:m},m))}),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)));Dr.displayName="Card";var Tn={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"}},Ad=({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 Fd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,c]=react.useState({top:0,left:0}),g=react.useRef(null),i=react.useRef(null),u=[...Object.entries(Tn).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Tn).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let h=Tn[e];if(h)return {...h,id:e};let f=r.find(p=>p.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Tn.todo,id:"todo"}},b=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,p=window.innerWidth,x=180,m=280,N=4,w=h.right-x;w<10&&(w=h.left),w+x>p-10&&(w=p-x-10);let B=f-h.bottom,y=h.top,I;B>=m+N?I=h.bottom+N:y>=m+N?I=h.top-m-N:I=B>=y?h.bottom+N:Math.max(10,h.top-m-N),c({top:I,left:w}),s(true);};react.useEffect(()=>{let h=f=>{g.current&&!g.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let v=h=>{t(h),s(false);},k=l(),C=k.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):b(),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:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:k.label,children:jsxRuntime.jsx(Ad,{icon:k.icon,color:C})}),o&&jsxRuntime.jsx(ft,{children:jsxRuntime.jsxs("div",{ref:g,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(h=>jsxRuntime.jsxs("button",{onClick:()=>v(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter: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(Ad,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Ld({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[c,g]=react.useState(false),[i,u]=react.useState(e),[l,b]=react.useState({top:0,left:0}),v=react.useRef(null),k=react.useRef(null),C=react.useRef(null);react.useEffect(()=>{if(s&&k.current){let x=k.current.getBoundingClientRect();b({top:x.bottom+window.scrollY+8,left:x.left+window.scrollX});}},[s]),react.useEffect(()=>{let x=m=>{v.current&&!v.current.contains(m.target)&&!k.current?.contains(m.target)&&(n(false),g(false));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),react.useEffect(()=>{let x=m=>{m.key==="Escape"&&(n(false),g(false),u(e));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s,e]),react.useEffect(()=>{c&&C.current&&(C.current.focus(),C.current.select());},[c]);let h=()=>{g(true),u(e);},f=()=>{let x=i.trim();x&&x!==e&&t(x),g(false),n(false),u(e);},p=x=>{x.key==="Enter"?f():x.key==="Escape"&&(g(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:k,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(ft,{children:jsxRuntime.jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:x=>u(x.target.value),onKeyDown:p,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:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),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:g,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:b,onToggleCollapse:v,onColumnRename:k,onColumnDelete:C,isDeletable:h=false,className:f})=>{let{setNodeRef:p,isOver:x}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),m=react.useRef(null),N=u??nd(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>m.current,estimateSize:()=>l,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:p,className:f,children:a(e,t)});let y=(()=>{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}})(),I=y.state==="exceeded",P=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:p,className:d("asakaa-column",x&&"ring-2 ring-asakaa-accent-blue",I&&"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:d(P()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&y.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${y.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[y.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"})]}),y.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"})]}),y.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"})}),y.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(k||C)&&jsxRuntime.jsx(Ld,{columnTitle:e.title,onRename:T=>k?.(e.id,T),onDelete:C?()=>C(e.id):void 0,isDeletable:h}),v&&jsxRuntime.jsx("button",{onClick:v,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":b?"Expand column":"Collapse column",children:b?"\u25B6":"\u25BC"})]})]}),!b&&jsxRuntime.jsx("div",{ref:m,className:"asakaa-column-cards",style:{maxHeight:N?"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"})}):N?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(T=>{let W=t[T.index];return W?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsxRuntime.jsx(Dr,{card:W,render:r,onClick:n,onUpdate:c,availableUsers:g,allCards:i})},W.id):null})}):t.map(T=>jsxRuntime.jsx(Dr,{card:T,render:r,onClick:n,onUpdate:c,availableUsers:g,allCards:i},T.id))})})]})});To.displayName="Column";function Hs({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 g=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?g():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:g,onKeyDown:i,className:d("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:d("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function lg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Ud(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(c=>c.name.toLowerCase().replace(/\s+/g,"")===s||c.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function dg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function zd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:c="dark",locale:g="es",currentUser:i}){let u=c==="dark",[l,b]=react.useState(false),[v,k]=react.useState([]),[C,h]=react.useState(0),[f,p]=react.useState(null),x=react.useRef(null),m=react.useRef(null),N=react.useCallback((P,T)=>{let W=lg(P,T);if(p(W),W){let O=r.filter(q=>q.name.toLowerCase().includes(W.query)||q.email&&q.email.toLowerCase().includes(W.query)).slice(0,5);k(O),b(O.length>0),h(0);}else b(false),k([]);},[r]),w=P=>{let T=P.target.value;t(T),N(T,P.target.selectionStart||0);},B=()=>{x.current&&N(e,x.current.selectionStart||0);},y=react.useCallback(P=>{if(!f||!x.current)return;let T=e.slice(0,f.start),W=e.slice(f.end),O=`@${P.name.replace(/\s+/g,"")} `,q=T+O+W;t(q),b(false),p(null),setTimeout(()=>{if(x.current){let te=f.start+O.length;x.current.selectionStart=te,x.current.selectionEnd=te,x.current.focus();}},0);},[f,e,t]),I=P=>{if(l&&v.length>0)switch(P.key){case "ArrowDown":P.preventDefault(),h(T=>T<v.length-1?T+1:0);break;case "ArrowUp":P.preventDefault(),h(T=>T>0?T-1:v.length-1);break;case "Enter":{P.preventDefault();let T=v[C];T&&y(T);break}case "Tab":{P.preventDefault();let T=v[C];T&&y(T);break}case "Escape":P.preventDefault(),b(false);break}else P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),a());};return react.useEffect(()=>{let P=T=>{m.current&&!m.current.contains(T.target)&&x.current&&!x.current.contains(T.target)&&b(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]),react.useEffect(()=>{if(l&&m.current){let P=m.current.children[C];P&&P.scrollIntoView({block:"nearest"});}},[C,l]),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&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:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:d("flex-1 relative"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center gap-2 px-3 py-2 rounded-lg",u?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{ref:x,type:"text",value:e,onChange:w,onSelect:B,onKeyDown:I,placeholder:o||(g==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:d("flex-1 bg-transparent text-sm outline-none",u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()||s,className:d("p-1.5 rounded transition-colors",e.trim()&&!s?"bg-blue-500 text-white hover:bg-blue-600":u?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:d("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((P,T)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>y(P),className:d("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",T===C?u?"bg-white/10":"bg-gray-100":u?"hover:bg-white/5":"hover: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:P.color||"#8B5CF6"},children:dg(P.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:d("text-sm font-medium truncate",u?"text-white":"text-gray-900"),children:P.name}),P.email&&jsxRuntime.jsx("p",{className:d("text-xs truncate",u?"text-[#6B7280]":"text-gray-500"),children:P.email})]})]},P.id))})})]})]})}function Hd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((c,g)=>c.type==="mention"?jsxRuntime.jsx("span",{className:d("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:c.value},g):jsxRuntime.jsx("span",{children:c.value},g))})}var Pn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function br({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[c,g]=react.useState(false),[i,u]=react.useState(""),[l,b]=react.useState(false),[v,k]=react.useState(Pn[10]||"#3B82F6"),[C,h]=react.useState({top:0,left:0}),f=react.useRef(null),p=react.useRef(null),x=react.useRef(null),m=react.useRef(null),N=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),w=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(c&&p.current){let T=p.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[c]),react.useEffect(()=>{let T=W=>{let O=W.target,q=f.current?.contains(O),te=x.current?.contains(O);!q&&!te&&(g(false),u(""),b(false));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),react.useEffect(()=>{c&&m.current&&m.current.focus();},[c]);let B=T=>{let W=e.some(O=>O.id===T.id);a(W?e.filter(O=>O.id!==T.id):[...e,T]);},y=async()=>{if(!(!r||!i.trim())){b(true);try{let T=await r(i.trim(),v);T&&(a([...e,T]),u(""),k(Pn[Math.floor(Math.random()*Pn.length)]||"#3B82F6"));}finally{b(false);}}},I=(T,W)=>{W.stopPropagation(),a(e.filter(O=>O.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:p,type:"button",onClick:()=>!s&&g(!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:x,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:C.top,left:C.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:m,type:"text",value:i,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"&&i.trim()&&!w&&r&&y();}})}),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:W=>I(T.id,W),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:N.length>0?N.map(T=>{let W=e.some(O=>O.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:W?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{W||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{W||(O.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}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.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"})}),i.trim()&&!w&&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:Pn.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>k(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:v===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:y,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:v,color:"#FFFFFF",opacity:l?.7:1},children:[l?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 "',i.trim(),'"']})]})]})}),document.body)]})}function Gs({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 Gd({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(Gs,{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 hr=[{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 Yd(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 Rg(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 no({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:c=[],availableTags:g=[],onCreateTag:i,attachments:u=[],onUploadAttachments:l,onDeleteAttachment:b,availableTasks:v=[],comments:k=[],onAddComment:C,currentUser:h,mentionableUsers:f=[]}){let p=s==="dark",x={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)"},m=e&&"title"in e&&!("name"in e),N=e,[w,B]=react.useState(e?Yd(e,c):null),[y,I]=react.useState(false),[P,T]=react.useState(false),[W,O]=react.useState(false),[q,te]=react.useState(null),[ne,re]=react.useState(new Date),[ce,be]=react.useState(false),[Le,A]=react.useState(false),[R,L]=react.useState(""),[j,X]=react.useState(false),[z,ve]=react.useState(false),[se,Ie]=react.useState(false),[qe,Qe]=react.useState(""),ie=react.useRef(null),[Xe,lt]=react.useState(""),kt=react.useRef(null),[yt,$]=react.useState(""),[fe,Ae]=react.useState(false);react.useEffect(()=>{if(e){let F=Yd(e,c);B(F),Qe(F.description||""),lt(F.name||"");}},[e?.id,c]),react.useEffect(()=>()=>{ie.current&&clearTimeout(ie.current),kt.current&&clearTimeout(kt.current);},[]);let G=react.useCallback(F=>{B(F),m&&o&&N?o(Rg(F,N)):r&&r(F);},[m,N,o,r]),oe=react.useCallback(()=>{I(false),T(false),O(false),te(null),A(false),L(""),X(false);},[]),xe=react.useCallback((F,Te)=>{if(!w)return;let Z={...w,[F]:Te};G(Z);},[w,G]),Oe=react.useCallback(F=>{Qe(F),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{if(w){let Te={...w,description:F};G(Te);}},800);},[w,G]),ye=react.useCallback(F=>{lt(F),kt.current&&clearTimeout(kt.current),kt.current=setTimeout(()=>{if(w&&F.trim()){let Te={...w,name:F.trim()};G(Te);}},800);},[w,G]),it=react.useCallback(async()=>{if(!(!w||!yt.trim()||!C)){Ae(true);try{let F=Ud(yt,f);await C(w.id,yt.trim(),F.length>0?F:void 0),$("");}finally{Ae(false);}}},[w,yt,C,f]),Ue=react.useCallback(F=>{let Te=typeof F=="string"?new Date(F):F,ke=new Date().getTime()-Te.getTime(),Ce=Math.floor(ke/6e4),$e=Math.floor(ke/36e5),Be=Math.floor(ke/864e5);return Ce<1?n==="es"?"Ahora":"Just now":Ce<60?n==="es"?`Hace ${Ce} min`:`${Ce}m ago`:$e<24?n==="es"?`Hace ${$e}h`:`${$e}h ago`:Be<7?n==="es"?`Hace ${Be}d`:`${Be}d ago`:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),wt=react.useCallback(F=>{if(!w)return;let Te=w.progress||0;F==="completed"?Te=100:F==="in-progress"&&Te===0?Te=10:F==="todo"&&(Te=0);let Z={...w,status:F,progress:Te};G(Z),I(false);},[w,G]),ut=react.useCallback((F,Te)=>{if(!w)return;let Z={...w,startDate:F,endDate:Te};G(Z);},[w,G]),Bt=react.useCallback(()=>{let F=ne.getFullYear(),Te=ne.getMonth(),Z=new Date(F,Te,1),Ce=new Date(F,Te+1,0).getDate(),$e=Z.getDay(),Be=[],st=new Date(F,Te,0).getDate();for(let Y=$e-1;Y>=0;Y--)Be.push({date:new Date(F,Te-1,st-Y),isCurrentMonth:false});for(let Y=1;Y<=Ce;Y++)Be.push({date:new Date(F,Te,Y),isCurrentMonth:true});let U=42-Be.length;for(let Y=1;Y<=U;Y++)Be.push({date:new Date(F,Te+1,Y),isCurrentMonth:false});return Be},[ne]),jt=react.useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),ve(false),!w||!l)return;let Te=Array.from(F.dataTransfer.files);if(Te.length!==0){Ie(true);try{await l(w.id,Te);}finally{Ie(false);}}},[w,l]),Se=react.useCallback(async F=>{if(!w||!l||!F.target.files)return;let Te=Array.from(F.target.files);if(Te.length!==0){Ie(true);try{await l(w.id,Te);}finally{Ie(false);}F.target.value="";}},[w,l]),Ve=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),ve(true);},[]),ua=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),ve(false);},[]),Ze=react.useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),Ke=react.useCallback(F=>F.startsWith("image/")?lucideReact.Image:F.includes("pdf")||F.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!w?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&w&&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:d("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:d("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:d("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:d("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:w.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:d("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:d("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:d("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:a,className:d("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 F=w.progress===100?0:100,Z={...w,progress:F,status:F===100?"completed":"todo"};G(Z);},className:d("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",w.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:w.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Xe,onChange:F=>ye(F.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:d("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",w.progress===100?"line-through text-[#6B7280]":p?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),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:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{oe(),I(!y);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.progress===100||w.status==="completed"?"bg-green-500/20 text-green-400":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.progress===100||w.status==="completed"?n==="es"?"COMPLETADO":"DONE":w.progress&&w.progress>0||w.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("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: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(F=>jsxRuntime.jsxs("button",{onClick:()=>wt(F.id),className:d("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",w.status===F.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{oe(),O(!W);},className:d("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:[w.assignees&&w.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[w.assignees.slice(0,3).map((F,Te)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},Te)),w.assignees.length>3&&jsxRuntime.jsxs("span",{className:d("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&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:d("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:c.length>0?c.map(F=>{let Te=w.assignees?.some(Z=>Z.name===F.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Z=w.assignees||[],ke;Te?ke=Z.filter(Ce=>Ce.name!==F.name):ke=[...Z,F],xe("assignees",ke);},className:d("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",Te&&(p?"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:F.color||"#8B5CF6"},children:F.initials||F.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:d("flex-1",p?"text-white":"text-gray-900"),children:F.name}),Te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},F.name)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",p?"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:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{te(q?null:"start"),re(w.startDate||new Date);},className:d("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:[w.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:d("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),w.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("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:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:d("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,Te=new Date(F);Te.setDate(F.getDate()+1);let Z=new Date(F);Z.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let ke=new Date(F);ke.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let Ce=new Date(F);Ce.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let $e=new Date(F);$e.setDate(F.getDate()+14);let Be=new Date(F);return Be.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Z,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ke,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:$e,display:$e.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Be,display:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((U,Y)=>jsxRuntime.jsxs("button",{className:d("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(q==="start"){let pe=w.endDate&&U.date>w.endDate?U.date:w.endDate;ut(U.date,pe),te("end");}else {let pe=w.startDate&&U.date<w.startDate?U.date:w.startDate;ut(pe,U.date),te(null);}},children:[jsxRuntime.jsx("span",{children:U.label}),jsxRuntime.jsx("span",{className:d("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:U.display})]},Y))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ut(void 0,void 0),te(null);},className:d("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: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:d("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:q==="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:d("font-medium",p?"text-white":"text-gray-900"),children:ne.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:()=>re(new Date),className:d("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>re(new Date(ne.getFullYear(),ne.getMonth()-1)),className:d("p-1 rounded",p?"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:()=>re(new Date(ne.getFullYear(),ne.getMonth()+1)),className:d("p-1 rounded",p?"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(F=>jsxRuntime.jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Bt().map((F,Te)=>{let Z=F.date.toDateString()===new Date().toDateString(),ke=w.startDate?.toDateString()===F.date.toDateString(),Ce=w.endDate?.toDateString()===F.date.toDateString(),$e=ke||Ce,Be=w.startDate&&w.endDate&&F.date>=w.startDate&&F.date<=w.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let st=new Date(F.date);if(q==="start"){let U=w.endDate&&st>w.endDate?st:w.endDate;ut(st,U),te("end");}else {let U=w.startDate&&st<w.startDate?st:w.startDate;ut(U,st),te(null);}},className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!F.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(p?"text-white":"text-gray-900"),Z&&"ring-2 ring-[#3B82F6]",ke&&"bg-[#3B82F6] text-white",Ce&&!ke&&"bg-[#7C3AED] text-white",Be&&!$e&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!$e&&(p?"hover:bg-white/10":"hover:bg-gray-100")),children:F.date.getDate()},Te)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{oe(),T(!P);},className:d("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",w.priority==="high"||w.priority==="urgent"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":w.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.priority?w.priority==="high"||w.priority==="urgent"?n==="es"?"Alta":"High":w.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("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:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{xe("priority",F.id),T(false);},className:d("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",w.priority===F.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",p?"text-white":"text-gray-900"),children:w.startDate&&w.endDate?`${Math.ceil((w.endDate.getTime()-w.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:d("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ce?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:F=>{let Te=parseInt(F.target.value),Z=w.status;Te===100?Z="completed":Te>0?Z="in-progress":Z="todo";let ke={...w,progress:Te,status:Z};G(ke);},onBlur:()=>be(false),className:d("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:()=>be(true),className:d("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:d("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(br,{selectedTags:w.tags||[],availableTags:g,onChange:F=>{xe("tags",F);},onCreateTag:i,theme:x})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[w.dependencies&&w.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:w.dependencies.map(F=>{let Te=v.find(Z=>Z.id===F);return jsxRuntime.jsxs("span",{className:d("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:[Te?.name||F.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Z=(w.dependencies||[]).filter(ke=>ke!==F);xe("dependencies",Z);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},F)})}),jsxRuntime.jsxs("button",{onClick:()=>{oe(),A(!Le);},className:d("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:d("text-sm",p?"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:()=>{A(false),L("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("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:d("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:R,onChange:F=>L(F.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:d("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:v.length>0?v.filter(F=>F.id!==w.id).filter(F=>R===""||F.name.toLowerCase().includes(R.toLowerCase())).map(F=>{let Te=w.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Z=w.dependencies||[],ke;Te?ke=Z.filter(Ce=>Ce!==F.id):ke=[...Z,F.id],xe("dependencies",ke);},className:d("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",Te&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Te?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),children:Te&&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:d("block truncate",p?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("span",{className:d("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",p?"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:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{oe(),X(!j);},className:d("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:w.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:d("text-sm",p?"text-white":"text-gray-900"),children:hr.find(F=>F.value===w.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("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:hr.map(F=>{let Te=w.color===F.value;return jsxRuntime.jsx("button",{onClick:()=>{xe("color",F.value),X(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",Te&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:Te?F.value:void 0},title:F.name,children:Te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",p?"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:w.isMilestone||false,onChange:F=>xe("isMilestone",F.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",w.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:d("text-sm",p?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:d("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:d("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:qe,onChange:F=>Oe(F.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("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:d("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"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:d("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"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),w.subtasks&&w.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:w.subtasks.map(F=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",F.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:d("text-sm",F.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:F.name})]},F.id))}),jsxRuntime.jsxs("button",{className:d("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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:d("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:d("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:d("p-1 rounded transition-colors",p?"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:d("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"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(F=>{let Te=Ke(F.type),Z=F.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("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:[Z&&F.thumbnailUrl?jsxRuntime.jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(Te,{className:d("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("p",{className:d("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Ze(F.size)})]}),b&&jsxRuntime.jsx("button",{onClick:()=>b(F.id),className:d("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:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ve,onDragLeave:ua,onDrop:jt,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?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",se&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Se,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||se}),se?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:d("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:d("w-6 h-6 mx-auto mb-2",z?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:z?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"})]})}),!l&&jsxRuntime.jsx("p",{className:d("text-xs mt-1",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:d("w-80 border-l flex flex-col",p?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",k.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",k.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:k.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:k.map(F=>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:F.user?.color||"#8B5CF6"},children:F.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:d("text-sm font-medium",p?"text-white":"text-gray-900"),children:F.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Ue(F.createdAt)})]}),jsxRuntime.jsx("div",{className:d("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Hd,{content:F.content,theme:s})})]})]},F.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:d("w-10 h-10 mb-3",p?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("p-4 border-t",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(zd,{value:yt,onChange:$,onSubmit:it,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:fe,theme:s,locale:n,currentUser:h})})]})]})]})})}function Ys(){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 Ur({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:c,isLoading:g,error:i,children:u,availableTags:l=[],onCreateTag:b,attachmentsByCard:v,onUploadAttachments:k,onDeleteAttachment:C,comments:h,onAddComment:f,currentUser:p,mentionableUsers:x,onTaskOpen:m}){let[N,w]=Ys(),[B,y]=react.useState(null),I=o?.theme||"dark",P=I==="dark"||I==="neutral",T=P?"dark":"",W=react.useCallback((j,X)=>{t.onCardUpdate?.(j,X);},[t]),O=react.useCallback((j,X)=>{t.onColumnUpdate?.(j,{title:X});},[t]),q=react.useCallback(j=>{t.onColumnDelete?.(j);},[t]),te=["todo","in-progress","completed"],ne=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),re=react.useMemo(()=>{let j=new Map;return e.columns.forEach(X=>{let z=X.cardIds.map(ve=>e.cards.find(se=>se.id===ve)).filter(ve=>ve!==void 0).sort((ve,se)=>ve.position-se.position);j.set(X.id,z);}),j},[e.cards,e.columns]),ce=react.useMemo(()=>e.cards.map(j=>({id:j.id,name:j.title,startDate:j.startDate?new Date(j.startDate):void 0,endDate:j.endDate?new Date(j.endDate):void 0,progress:j.progress||0,status:j.columnId,priority:j.priority?.toLowerCase(),dependencies:Array.isArray(j.dependencies)?j.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),be=react.useCallback(j=>{let{active:X}=j,z=e.cards.find(ve=>ve.id===X.id);z&&w({isDragging:true,draggedCardId:z.id,sourceColumnId:z.columnId,targetColumnId:z.columnId});},[e.cards,w]),Le=react.useCallback(j=>{let{active:X,over:z}=j;if(!z||!e.cards.find(Ie=>Ie.id===X.id))return;let se=null;z.data.current?.type==="column"?se=z.id:z.data.current?.type==="card"&&(se=e.cards.find(qe=>qe.id===z.id)?.columnId||null),se&&se!==N.targetColumnId&&w({...N,targetColumnId:se});},[e.cards,N,w]),A=react.useCallback(async j=>{let{active:X,over:z}=j;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!z)return;let ve=e.cards.find(Qe=>Qe.id===X.id);if(!ve)return;let se,Ie;if(z.data.current?.type==="column"){se=z.id;let Qe=re.get(se)||[];Ie=Fs(Qe,0);}else {let Qe=e.cards.find(lt=>lt.id===z.id);if(!Qe)return;se=Qe.columnId;let ie=re.get(se)||[],Xe=ie.findIndex(lt=>lt.id===z.id);Ie=Fs(ie,Xe);}let qe=e.columns.find(Qe=>Qe.id===se);if(qe&&qe.wipLimit&&qe.wipLimitType==="hard"){let Qe=re.get(se)||[];if(ve.columnId!==se&&Qe.length>=qe.wipLimit){t.onWipLimitExceeded?.(qe,ve);return}}(ve.columnId!==se||ve.position!==Ie)&&await t.onCardMove?.(ve.id,se,Ie);},[e.cards,e.columns,re,t,w]),R=react.useCallback(j=>{y(j),a?.(j),m?.(j.id);},[a,m]),L=react.useCallback(j=>{t.onCardUpdate?.(j.id,j),y(j);},[t]);return g?jsxRuntime.jsx("div",{className:d("asakaa-board",T,n),style:c,children:jsxRuntime.jsx(Yg,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:d("asakaa-board",T,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 i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(bd,{themeName:I,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ne,collisionDetection:core$1.closestCorners,onDragStart:be,onDragOver:Le,onDragEnd:A,children:[jsxRuntime.jsxs("div",{className:d("asakaa-board",T,n),style:c,"data-theme":I,children:[e.columns.sort((j,X)=>j.position-X.position).map(j=>{let X=re.get(j.id)||[],z=!te.includes(j.id);return jsxRuntime.jsx(To,{column:j,cards:X,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:R,onCardUpdate:W,onColumnRename:O,onColumnDelete:q,isDeletable:z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},j.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:N.draggedCardId?jsxRuntime.jsx(Dr,{card:e.cards.find(j=>j.id===N.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(no,{task:B,isOpen:!!B,onClose:()=>y(null),onCardUpdate:L,theme:P?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:b,attachments:B?v?.get(B.id)||[]:[],onUploadAttachments:k,onDeleteAttachment:C,availableTasks:ce,comments:h,onAddComment:f,currentUser:p,mentionableUsers:x})]})}function Yg({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 Qg={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)"},ef={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)"},tf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},af={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function rf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let g=i=>{t(i),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((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(i.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:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function of({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[c,g]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let v=k=>{i.current&&!i.current.contains(k.target)&&n(false);};return s&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(v=>v.handler),b=async(v,k)=>{if(k){g(v);try{await k();}catch(C){console.error(`Export ${v} failed:`,C);}finally{g(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,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:l.map((v,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(v.id,v.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:k<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===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 nf({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 Xs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:c,onExportExcel:g,translations:i}){let u=r==="dark"?Qg:ef,l={...o==="es"?tf:af,...i},b=n||c||g;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:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(of,{theme:u,t:l,onExportCSV:n,onExportJSON:c,onExportExcel:g}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(rf,{columns:e,onSelect:t,theme:u,t:l,createTaskLabel:a}):jsxRuntime.jsx(nf,{onClick:()=>t(),label:a||l.newTask}))]})})}function Zs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[c,g]=react.useState(""),i=react.useCallback(()=>{let b=c.trim();b&&(e(b),g(""),n(false));},[c,e]),u=react.useCallback(b=>{b.key==="Enter"?(b.preventDefault(),i()):b.key==="Escape"&&(g(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||n(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:d("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:b=>g(b.target.value),onKeyDown:u,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,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:()=>{g(""),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:d("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 Qs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:c="dark",locale:g="es"}){let[i,u]=react.useState(false),[l,b]=react.useState(false),[v,k]=react.useState(""),[C,h]=react.useState([]),[f,p]=react.useState(""),[x,m]=react.useState(""),[N,w]=react.useState(""),[B,y]=react.useState(false),[I,P]=react.useState(false),[T,W]=react.useState(false),O=react.useRef(null),q=react.useRef(null),te={placeholder:o||(g==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(g==="es"?"Agregar Tarea":"Add Task"),save:g==="es"?"Guardar":"Save",addAssignee:g==="es"?"Agregar asignado":"Add assignee",addDates:g==="es"?"Agregar fechas":"Add dates",addPriority:g==="es"?"Agregar prioridad":"Add priority",startDate:g==="es"?"Inicio":"Start",endDate:g==="es"?"Fin":"End",low:g==="es"?"Baja":"Low",medium:g==="es"?"Media":"Medium",high:g==="es"?"Alta":"High",urgent:g==="es"?"Urgente":"Urgent"},ne=react.useCallback(()=>{k(""),h([]),p(""),m(""),w(""),y(false),P(false),W(false),u(false);},[]);react.useEffect(()=>{i&&O.current&&O.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let A=R=>{q.current&&!q.current.contains(R.target)&&(v.trim()||ne());};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i,v,ne]);let re=react.useCallback(async()=>{let A=v.trim();if(!(!A||l)){b(true);try{await t({name:A,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:f?new Date(f):void 0,endDate:x?new Date(x):void 0,priority:N||void 0}),k(""),h([]),p(""),m(""),w(""),y(!1),P(!1),W(!1),O.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{b(false);}}},[v,e,C,f,x,N,t,l]),ce=react.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),re()):A.key==="Escape"&&ne();},[re,ne]),be=react.useCallback(A=>{h(R=>R.includes(A)?R.filter(L=>L!==A):[...R,A]);},[]),Le=c==="dark";return i?jsxRuntime.jsxs("div",{ref:q,className:d("rounded-lg overflow-hidden shadow-lg",Le?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:v,onChange:A=>k(A.target.value),onKeyDown:ce,placeholder:te.placeholder,disabled:l,className:d("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Le?"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:()=>y(!B),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||C.length>0?"bg-emerald-500/20 text-emerald-400":Le?"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"})]}),C.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:C.length})]}),jsxRuntime.jsx("button",{onClick:()=>P(!I),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||f||x?"bg-blue-500/20 text-blue-400":Le?"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:()=>W(!T),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Le?"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:re,disabled:!v.trim()||l,className:d("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),B&&a.length>0&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Le?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(A=>jsxRuntime.jsxs("button",{onClick:()=>be(A.id),className:d("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(A.id)?"bg-emerald-500 text-white":Le?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[A.avatar?jsxRuntime.jsx("img",{src:A.avatar,alt:A.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(A.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:A.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:A.name.split(" ")[0]})]},A.id))})}),I&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Le?"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:d("block text-[10px] uppercase tracking-wide mb-1",Le?"text-gray-500":"text-gray-400"),children:te.startDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:A=>p(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Le?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Le?"text-gray-500":"text-gray-400"),children:te.endDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:A=>m(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Le?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Le?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(A=>jsxRuntime.jsx("button",{onClick:()=>w(N===A?"":A),className:d("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===A?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[A]} text-white`:Le?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[A]},A))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Le?"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 Yo=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(Ur,{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 sc(e={}){return new Yo(e)}var Do=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 ei(e,t){let a=r=>jsxRuntime.jsx(Do,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ai({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:c,onOpenAIUsage:g,shortcut:i="k",className:u=""}){let[l,b]=react.useState(false),[v,k]=react.useState(""),[C,h]=react.useState("home"),[f,p]=react.useState(""),[x,m]=react.useState("");react.useEffect(()=>{let y=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),b(P=>!P)),I.key==="Escape"&&(b(false),h("home"),k(""));};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[i]),react.useEffect(()=>{l||(h("home"),k(""),p(""),m(""));},[l]);let N=react.useCallback(()=>{b(false);},[]),w=react.useCallback(y=>{let[I,P]=y.split(":");switch(I){case "create-card":h("create-card");break;case "create-card-in":p(P||"");break;case "navigate":P?(a?.(P),N()):h("navigate");break;case "search":r?.(v),N();break;case "priority":h("priority");break;case "set-priority":x&&P&&(o?.(x,P),N());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,P),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":g?.(),N();break;case "back":h("home");break;}},[v,x,t,a,r,o,s,n,c,g,N]),B=react.useCallback(()=>{f&&v.trim()&&(t?.(f,v.trim()),N());},[f,v,t,N]);return l?jsxRuntime.jsx(ft,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:y=>y.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:v,onValueChange:k,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:C==="create-card"&&f?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:y=>{y.key==="Enter"&&C==="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."}),C==="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:w,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:w,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:w,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:w,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(y=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${y.id}`,onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:y.priority==="URGENT"?"#EF4444":y.priority==="HIGH"?"#F59E0B":y.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:y.title}),y.labels&&y.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:y.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},y.id))})]}),C==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:w,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(y=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${y.id}`,onSelect:w,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:y.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[y.cardIds.length," cards"]})]},y.id))})]}),C==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:w,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(y=>{let I=e.columns.find(P=>P.id===y.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${y.id}`,onSelect:w,className:"command-palette-item",keywords:[y.title,y.description||"",...y.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:y.priority==="URGENT"?"#EF4444":y.priority==="HIGH"?"#F59E0B":y.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:y.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),y.labels&&y.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:y.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},y.id)})})]}),C==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:w,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:w,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:w,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:w,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 dc(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;
@@ -11,12 +11,12 @@
11
11
  justify-content: center !important;
12
12
  background: rgba(0, 0, 0, 0.95) !important;
13
13
  cursor: pointer !important;
14
- `;let m=document.createElement("img");m.src=e,m.alt=t,m.className="attachment-lightbox-image",m.style.cssText=`
14
+ `;let c=document.createElement("img");c.src=e,c.alt=t,c.className="attachment-lightbox-image",c.style.cssText=`
15
15
  max-width: 92vw !important;
16
16
  max-height: 92vh !important;
17
17
  object-fit: contain !important;
18
18
  cursor: default !important;
19
- `,m.onclick=d=>d.stopPropagation();let p=document.createElement("div");p.className="attachment-lightbox-hint",p.textContent="Click anywhere or press ESC to close",p.style.cssText=`
19
+ `,c.onclick=l=>l.stopPropagation();let g=document.createElement("div");g.className="attachment-lightbox-hint",g.textContent="Click anywhere or press ESC to close",g.style.cssText=`
20
20
  position: absolute !important;
21
21
  bottom: 24px !important;
22
22
  left: 50% !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 i=()=>{n.remove(),document.removeEventListener("keydown",u);},u=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let g=r>0?r-1:a.length-1;i(),o(g);}else if(d.key==="ArrowRight"&&a.length>1){let g=r<a.length-1?r+1:0;i(),o(g);}};if(n.onclick=i,document.addEventListener("keydown",u),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
27
+ `;let i=()=>{n.remove(),document.removeEventListener("keydown",u);},u=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let b=r>0?r-1:a.length-1;i(),o(b);}else if(l.key==="ArrowRight"&&a.length>1){let b=r<a.length-1?r+1:0;i(),o(b);}};if(n.onclick=i,document.addEventListener("keydown",u),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
28
28
  position: absolute !important;
29
29
  bottom: 48px !important;
30
30
  left: 50% !important;
@@ -34,15 +34,15 @@
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=C=>C.stopPropagation(),a.forEach((C,T)=>{let v=document.createElement("button");v.className=`attachment-lightbox-dot ${T===r?"active":""}`,v.style.cssText=`
37
+ `,l.onclick=k=>k.stopPropagation(),a.forEach((k,C)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${C===r?"active":""}`,h.style.cssText=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !important;
41
- background: ${T===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
41
+ background: ${C===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
42
42
  border: none !important;
43
43
  padding: 0 !important;
44
44
  cursor: pointer !important;
45
- `,v.onclick=y=>{y.stopPropagation(),i(),o(T);},d.appendChild(v);});let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",g.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>',g.style.cssText=`
45
+ `,h.onclick=f=>{f.stopPropagation(),i(),o(C);},l.appendChild(h);});let b=document.createElement("button");b.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",b.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>',b.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
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=C=>{C.stopPropagation();let T=r>0?r-1:a.length-1;i(),o(T);};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
+ `,b.onmouseenter=()=>{b.style.opacity="1";},b.onmouseleave=()=>{b.style.opacity="0.5";},b.onclick=k=>{k.stopPropagation();let C=r>0?r-1:a.length-1;i(),o(C);};let v=document.createElement("button");v.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",v.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>',v.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=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(h);}n.appendChild(m),n.appendChild(p),document.body.appendChild(n),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function og(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 ng(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 Os(e){return e.startsWith("image/")}function ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,m]=react.useState(false),[p,i]=react.useState(false),[u,d]=react.useState(null),g=react.useRef(null),h=react.useRef(e);h.current=e;let C=react.useCallback((b,D)=>{D.preventDefault(),D.stopPropagation();let M=h.current.filter($=>Os($.type)),w=M.findIndex($=>$.id===b.id),R=$=>{let K=h.current.filter(re=>Os(re.type)),te=K[$];te&&$d(te.url,te.name,K,$,R);};$d(b.url,b.name,M,w,R);},[]),T=react.useCallback(b=>{let D=[],M=[];return e.length+b.length>s?(M.push(`Maximum ${s} files allowed`),{valid:D,errors:M}):(b.forEach(w=>{if(w.size/1048576>r){M.push(`${w.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>w.type.match($))){M.push(`${w.name} has invalid file type`);return}D.push(w);}),{valid:D,errors:M})},[e.length,s,r,o]),v=react.useCallback(async b=>{let{valid:D,errors:M}=T(b);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(D.length!==0){i(true),d(null);try{await t?.(D);}catch(w){d(w instanceof Error?w.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),y=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(true);},[]),c=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);},[]),k=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),l=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);let D=Array.from(b.dataTransfer.files);v(D);},[v]),N=react.useCallback(b=>{let D=b.target.files?Array.from(b.target.files):[];v(D),g.current&&(g.current.value="");},[v]),x=react.useCallback(()=>{g.current?.click();},[]),B=react.useCallback(b=>{confirm("Are you sure you want to delete this attachment?")&&a?.(b);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${p?"uploading":""}`,onDragEnter:y,onDragLeave:c,onDragOver:k,onDrop:l,onClick:x,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children: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(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Os(b.type)&&b.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:D=>C(b,D),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:b.thumbnailUrl||b.url,alt:b.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:ng(b.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:b.name,children:b.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:og(b.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(b.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>B(b.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},b.id))})]})}function zs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],aiInsights:p=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:v,currentUserId:y="user-1"}){let[c,k]=react.useState("details"),[l,N]=react.useState(false),[x,B]=react.useState({}),[b,D]=react.useState(""),[M,w]=react.useState(false),[R,$]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{N(false),B({}),k("details"),D(""),$({}),a();},[a]),te=react.useCallback(()=>{r&&Object.keys(x).length>0&&(r(e.id,x),B({}),N(false));},[e.id,x,r]),re=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),ae=react.useCallback(()=>{u&&b.trim()&&(u(e.id,b.trim()),D(""));},[e.id,b,u]),pe=react.useCallback(async()=>{if(C){w(true);try{let L=await C(e);$(j=>({...j,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{w(false);}}},[e,C]),fe=react.useCallback(async()=>{if(T){w(true);try{let L=await T(e);$(j=>({...j,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{w(false);}}},[e,T]),Ie=react.useCallback(async()=>{if(v){w(true);try{let L=await v(e);$(j=>({...j,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{w(false);}}},[e,v]),F={...e,...x},O=s.filter(L=>F.assignedUserIds?.includes(L.id));return jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),l?jsxRuntime.jsx("input",{type:"text",value:x.title??F.title,onChange:L=>B({...x,title:L.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),B({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:re,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:K,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:()=>k("details"),className:`card-detail-tab ${c==="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:()=>k("comments"),className:`card-detail-tab ${c==="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:()=>k("activity"),className:`card-detail-tab ${c==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>k("attachments"),className:`card-detail-tab ${c==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>k("ai"),className:`card-detail-tab ${c==="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:[c==="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"}),l?jsxRuntime.jsx("textarea",{value:x.description??F.description??"",onChange:L=>B({...x,description:L.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),l?jsxRuntime.jsx("select",{multiple:true,value:x.assignedUserIds??F.assignedUserIds??[],onChange:L=>{let j=Array.from(L.target.selectedOptions,X=>X.value);B({...x,assignedUserIds:j});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(L=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:L.color},children:L.initials}),jsxRuntime.jsx("span",{children:L.name})]},L.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"}),l?jsxRuntime.jsxs("select",{value:x.priority??F.priority??"",onChange:L=>B({...x,priority:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(L=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:L},L)):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"}),l?jsxRuntime.jsx("input",{type:"date",value:x.startDate?new Date(x.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:L=>B({...x,startDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),l?jsxRuntime.jsx("input",{type:"date",value:x.endDate?new Date(x.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:L=>B({...x,endDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),l?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:x.estimatedTime??F.estimatedTime??"",onChange:L=>B({...x,estimatedTime:L.target.value?parseFloat(L.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(L=>{let j=typeof L=="string"?L:L.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",j.slice(-4)]},j)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),c==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:b,onChange:L=>D(L.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ae,disabled:!b.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(L=>{let j=s.find(X=>X.id===L.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[j&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:j.color},children:j.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:j?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(L.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:L.content})]},L.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"})]})})]}),c==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(L=>{let j=s.find(X=>X.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("COMMENT")&&"\u{1F4AC}",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",L.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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"})]})}),c==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(ur,{cardId:e.id,attachments:i,onUpload:g?L=>g(e.id,L):void 0,onDelete:h,currentUserId:y,maxSizeMB:10,maxFiles:20})}),c==="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:pe,disabled:M||!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:fe,disabled:M||!T,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:Ie,disabled:M||!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"]})]}),R.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),R.assignees.map((L,j)=>{let X=s.find(W=>W.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:L.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(L.confidence*100).toFixed(0),"%"]})]})]},j)})]}),R.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),R.subtasks.map((L,j)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},j))]}),R.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:[R.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(R.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(L=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!R.assignees&&!R.subtasks&&!R.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Ro({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[m,p]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,h=window.innerWidth,C=4,T=d.left;T+o>h-10&&(T=h-o-10),T<10&&(T=10);let v=g-d.bottom,y=d.top,c;return v>=s+C?c=d.bottom+C:y>=s+C?c=d.top-s-C:v>=y?c=d.bottom+C:c=Math.max(10,d.top-s-C),{top:c,left:T}},[e,o,s]);return react.useEffect(()=>{t&&p(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Je={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:"#9CA3AF",dependencyHover:"#6B7280",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:"#6B7280",dependencyHover:"#4B5563",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:"#78716C",dependencyHover:"#57534E",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 ug=["LOW","MEDIUM","HIGH","URGENT"],gg=["todo","in-progress","review","done"];function Ws({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],onAddComment:p,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:h,availableColumns:C=[],availableLabels:T=[],availableTags:v=[],onCreateTag:y,onUploadCoverImage:c,unsplashAccessKey:k,theme:l,onSubtasksChange:N,attachments:x=[],onUploadAttachments:B,onDeleteAttachment:b}){let D=io(),M=l||D?.themeName||"dark",[w,R]=react.useState(e),[$,K]=react.useState(false),[te,re]=react.useState(e?.subtasks||[]),[ae,pe]=react.useState(false),[fe,Ie]=react.useState(""),[F,O]=react.useState(""),[L,j]=react.useState("all"),[X,W]=react.useState(false),[ye,oe]=react.useState(false),[Le,Ye]=react.useState(false),[et,se]=react.useState(false),[Xe,dt]=react.useState(false),[kt,wt]=react.useState(false),z=react.useRef(null),ge=react.useRef(null),Se=react.useRef(null),Pe=react.useRef(null),_e=react.useRef(null),Ve=react.useRef(null),Mt=react.useRef(null),Me=react.useRef(null),Qt=react.useRef(null),Zt=react.useRef(null),Ft=react.useRef(null),bt=react.useRef(null);react.useEffect(()=>{e&&!w?(R({...e}),re(e.subtasks||[])):e&&w&&e.id!==w.id&&(R({...e}),re(e.subtasks||[]));},[e,w]),react.useEffect(()=>{let H=ne=>{let $e=ne.target;Pe.current&&!Pe.current.contains($e)&&W(false),_e.current&&!_e.current.contains($e)&&oe(false),Ve.current&&!Ve.current.contains($e)&&Ye(false),Mt.current&&!Mt.current.contains($e)&&se(false);};if(X||ye||Le||et)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[X,ye,Le,et]),react.useEffect(()=>{if(!t)return;let H=ne=>{let $e=ne.target,St=$e.tagName==="INPUT"||$e.tagName==="TEXTAREA"||$e.isContentEditable;if(ne.key==="Escape"){ne.preventDefault(),X||ye||Le||et||Xe||kt?(W(false),oe(false),Ye(false),se(false),dt(false),wt(false)):St||a();return}if(St&&ne.key!=="Escape")return;let tt=ne.metaKey||ne.ctrlKey;switch(ne.key.toLowerCase()){case "s":ne.preventDefault(),W(true);break;case "a":ne.preventDefault(),Ye(true);break;case "p":ne.preventDefault(),oe(true);break;case "l":ne.preventDefault(),se(true);break;case "d":tt||(ne.preventDefault(),dt(true),setTimeout(()=>Me.current?.focus(),0));break;case "e":tt||(ne.preventDefault(),wt(true));break;case "i":ne.preventDefault(),K(true),setTimeout(()=>ge.current?.focus(),0);break;case "t":ne.preventDefault(),pe(true);break;case "c":ne.preventDefault(),Se.current?.focus();break}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[t,a,X,ye,Le,et,Xe,kt]);let Ht=react.useCallback(H=>{let ne=H.currentTarget.textContent?.trim()||"";if(w&&ne!==w.title){let $e={...w,title:ne};R($e),r?.(w.id,{title:ne});}},[w,r]),ea=react.useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),H.currentTarget.blur()),H.key==="Escape"&&(H.preventDefault(),H.currentTarget.textContent=w?.title||"",H.currentTarget.blur());},[w]),Ce=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),K(false);},[w,e,r]),Ue=react.useCallback(H=>{if(w){let ne={...w,columnId:H};R(ne),r?.(w.id,{columnId:H}),W(false);}},[w,r]),ca=react.useCallback(H=>{if(w){let ne={...w,priority:H};R(ne),r?.(w.id,{priority:H}),oe(false);}},[w,r]),qe=react.useCallback(H=>{if(w){let ne=w.assignedUserIds||[],$e=ne.includes(H)?ne.filter(tt=>tt!==H):[...ne,H],St={...w,assignedUserIds:$e};R(St),r?.(w.id,{assignedUserIds:$e});}},[w,r]),We=react.useCallback(H=>{if(w){let ne=w.labels||[],$e=ne.includes(H)?ne.filter(tt=>tt!==H):[...ne,H],St={...w,labels:$e};R(St),r?.(w.id,{labels:$e});}},[w,r]),I=react.useCallback(H=>{if(w){let ne={...w,tags:H};R(ne),r?.(w.id,{tags:H});}},[w,r]),xe=react.useCallback(H=>{if(w){let ne=H.target.value,$e={...w,endDate:ne};R($e),r?.(w.id,{endDate:ne}),dt(false);}},[w,r]),J=react.useCallback(H=>{if(w){let ne={...w,estimatedTime:parseFloat(H)||0};R(ne),r?.(w.id,{estimatedTime:parseFloat(H)||0});}},[w,r]),he=react.useCallback(()=>{if(fe.trim()&&w){let H={id:`subtask-${Date.now()}`,title:fe.trim(),completed:false,createdAt:new Date},ne=[...te,H];re(ne),Ie(""),pe(false),N?.(w.id,ne);}},[fe,te,w,N]),ve=react.useCallback(H=>{let ne=te.map($e=>$e.id===H?{...$e,completed:!$e.completed,updatedAt:new Date}:$e);re(ne),w&&N?.(w.id,ne);},[te,w,N]),Be=react.useCallback(H=>{let ne=te.filter($e=>$e.id!==H);re(ne),w&&N?.(w.id,ne);},[te,w,N]),Ae=react.useCallback(()=>{F.trim()&&w&&p&&(p(w.id,F.trim()),O(""));},[F,w,p]),ot=react.useCallback(H=>{(H.metaKey||H.ctrlKey)&&H.key==="Enter"&&(H.preventDefault(),Ae());},[Ae]),U=H=>jsxRuntime.jsx(cg__default.default,{remarkPlugins:[mg__default.default],rehypePlugins:[pg__default.default],components:{a:({node:ne,...$e})=>jsxRuntime.jsx("a",{...$e,target:"_blank",rel:"noopener noreferrer"})},children:H}),Y=m.filter(H=>L==="comments"?H.type.includes("COMMENT"):L==="history"?!H.type.includes("COMMENT"):true);if(!t||!e)return null;let de=w||e,ze=s.filter(H=>de.assignedUserIds?.includes(H.id)),Re=te.filter(H=>H.completed).length;return jsxRuntime.jsx(mt,{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:H=>H.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":M,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:z,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ht,onKeyDown:ea,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:Pe,children:[jsxRuntime.jsxs("button",{ref:Qt,className:"modal-v2-field",onClick:()=>W(!X),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("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(Ro,{triggerRef:Qt,isOpen:X,onClose:()=>W(false),width:250,estimatedHeight:200,children:(C.length>0?C:gg.map(H=>({id:H,title:H}))).map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${de.columnId===H.id?"active":""}`,onClick:()=>Ue(H.id),children:H.title},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ve,children:[jsxRuntime.jsxs("button",{ref:Zt,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:ze.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ze.map(H=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:H.color},title:H.name,children:H.initials},H.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Ro,{triggerRef:Zt,isOpen:Le,onClose:()=>Ye(false),width:280,estimatedHeight:300,children:s.map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${de.assignedUserIds?.includes(H.id)?"active":""}`,onClick:()=>qe(H.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:H.color},children:H.initials}),H.name,de.assignedUserIds?.includes(H.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"})})]},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:_e,children:[jsxRuntime.jsxs("button",{ref:Ft,className:"modal-v2-field",onClick:()=>oe(!ye),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(Ro,{triggerRef:Ft,isOpen:ye,onClose:()=>oe(false),width:180,estimatedHeight:220,children:[ug.map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${H.toLowerCase()} ${de.priority===H?"active":""}`,onClick:()=>ca(H),children:H},H)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ca(""),children:"None"})]})]}),v.length>0||y?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(dr,{selectedTags:de.tags||[],availableTags:v,onChange:I,onCreateTag:y,theme:Je[M]||Je.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Mt,children:[jsxRuntime.jsxs("button",{ref:bt,className:"modal-v2-field",onClick:()=>se(!et),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(Ro,{triggerRef:bt,isOpen:et,onClose:()=>se(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${de.labels?.includes(H)?"active":""}`,onClick:()=>We(H),children:[H,de.labels?.includes(H)&&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"})})]},H))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{dt(!Xe),setTimeout(()=>Me.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:Me,type:"date",value:typeof de.endDate=="string"?de.endDate.split("T")[0]:de.endDate?(()=>{let H=new Date(de.endDate),ne=H.getUTCFullYear(),$e=String(H.getUTCMonth()+1).padStart(2,"0"),St=String(H.getUTCDate()).padStart(2,"0");return `${ne}-${$e}-${St}`})():"",onChange:xe,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>wt(!kt),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"})]}),kt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:de.estimatedTime||"",onChange:H=>J(H.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>wt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:de.description||"",onChange:H=>{if(w){let ne={...w,description:H.target.value};R(ne);}},onBlur:Ce,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:de.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:U(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"}),te.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Re,"/",te.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>pe(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(H=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${H.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ve(H.id),children:H.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:H.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Be(H.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"})]})})]},H.id)),ae&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:fe,onChange:H=>Ie(H.target.value),onKeyDown:H=>{H.key==="Enter"&&he(),H.key==="Escape"&&(pe(false),Ie(""));},onBlur:he,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(B||x.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"}),x.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:x.length})]}),jsxRuntime.jsx(ur,{cardId:de.id,attachments:x,onUpload:B?H=>B(de.id,H):void 0,onDelete:b,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 ${L==="all"?"active":""}`,onClick:()=>j("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>j("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>j("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:Se,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:H=>O(H.target.value),onKeyDown:ot,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:Ae,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Y.map(H=>{let ne=s.find(St=>St.id===H.userId);if(H.type.includes("COMMENT")){let St=n.find(tt=>tt.id===H.metadata?.commentId);return St?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ne&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ne.color},children:ne.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:ne?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:St.content})]})]},H.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.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:ne?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)}),Y.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 Cg({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 _s({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((m,p)=>m+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cg,{})}),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,m)=>n+m.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,m)=>n+m.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,m)=>n+(m.planned||0),0)})]})]})]})}function Fg({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 Vs({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,m=e[e.length-1]?.ideal||0,p=s>0?(s-n)/s*100:0,i=n<=m;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Fg,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#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:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Hg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},jd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Wg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,m=e+n*Math.cos(-a*(Math.PI/180)),p=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:p,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Kd({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 js({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,i)=>p+i.value,0),n=e.map(p=>({...p,totalValue:s,color:p.color||Hg[p.name]||jd[e.indexOf(p)%jd.length]})),m=n.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Wg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((p,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Kd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${p} (${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(Kd,{})}),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((p,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,i)=>i.value>p.value?i:p).name})]})]})]})}var wn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,m]=react.useState(false),[p,i]=react.useState(false),[u,d]=react.useState(false),[g,h]=react.useState(false);if(e.length===0)return null;let C=e.map(l=>l.id),T=l=>{r.onBulkUpdate?.(C,{priority:l}),m(false);},v=l=>{r.onBulkMove?.(C,l),i(false),a();},y=l=>{r.onBulkUpdate?.(C,{assignedUserIds:l}),d(false);},c=l=>{let N=new Set;e.forEach(B=>{B.labels?.forEach(b=>N.add(b));});let x=Array.from(new Set([...N,...l]));r.onBulkUpdate?.(C,{labels:x}),h(false);},k=()=>{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:()=>m(!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(l=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(l),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",l==="LOW"&&"bg-asakaa-priority-low",l==="MEDIUM"&&"bg-asakaa-priority-medium",l==="HIGH"&&"bg-asakaa-priority-high",l==="URGENT"&&"bg-asakaa-priority-urgent")}),l]},l))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(l=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(l.id),children:l.title},l.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(l=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([l.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:l.color},children:l.initials}),l.name]},l.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(l=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c([l]),children:l},l))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:k,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"})})]})]})})});wn.displayName="BulkOperationsToolbar";function Kg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,m,p,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(T=>T.id===h);n=`assignee-${h}`,m=C?.name||`User ${h}`,p=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:m,groupValue:h,cardIds:[],color:p,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",m="Unassigned",p="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:p,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={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];m=g.title,p=g.color,r.has(n)||r.set(n,{id:n,title:m,groupValue:s,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,m=h,p="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:h,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);}):(n="label-none",m="No Labels",p="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:p}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ks({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),m=react.useMemo(()=>Kg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Mr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[m.map(i=>{let u=s.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),g={...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&&p(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Mr,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),m.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Ys=[{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 qs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),m=Ys.find(i=>i.value===e)||Ys[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:f("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:f("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:Ys.map(i=>jsxRuntime.jsxs("button",{onClick:()=>p(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var $o=[{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(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&n&&m&&p}function Qd(e={}){let{shortcuts:t=$o,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(p=>{o.current=[...o.current,p];},[]),m=react.useCallback(p=>{o.current=o.current.filter(i=>i.action!==p);},[]);return react.useEffect(()=>{function p(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Xg(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:n,unregisterShortcut:m,isEnabled:a}}function Qg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Zg(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 ef(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Zg(e),r=t?Qg(t):"";return a?`${a} + ${r}`:r}function tf(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 Xs({shortcuts:e=$o,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let n=tf(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","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(([m,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:ef(i)})]},i.action))})]},m))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Js=[{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
+ `,v.onmouseenter=()=>{v.style.opacity="1";},v.onmouseleave=()=>{v.style.opacity="0.5";},v.onclick=k=>{k.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(b),n.appendChild(v);}n.appendChild(c),n.appendChild(g),document.body.appendChild(n),setTimeout(()=>{g.style.transition="opacity 0.5s ease",g.style.opacity="0";},2e3);}function pf(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 uf(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 oi(e){return e.startsWith("image/")}function xr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,c]=react.useState(false),[g,i]=react.useState(false),[u,l]=react.useState(null),b=react.useRef(null),v=react.useRef(e);v.current=e;let k=react.useCallback((y,I)=>{I.preventDefault(),I.stopPropagation();let P=v.current.filter(O=>oi(O.type)),T=P.findIndex(O=>O.id===y.id),W=O=>{let q=v.current.filter(ne=>oi(ne.type)),te=q[O];te&&dc(te.url,te.name,q,O,W);};dc(y.url,y.name,P,T,W);},[]),C=react.useCallback(y=>{let I=[],P=[];return e.length+y.length>s?(P.push(`Maximum ${s} files allowed`),{valid:I,errors:P}):(y.forEach(T=>{if(T.size/1048576>r){P.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}I.push(T);}),{valid:I,errors:P})},[e.length,s,r,o]),h=react.useCallback(async y=>{let{valid:I,errors:P}=C(y);if(P.length>0){l(P.join(", ")),setTimeout(()=>l(null),5e3);return}if(I.length!==0){i(true),l(null);try{await t?.(I);}catch(T){l(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),f=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(true);},[]),p=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);},[]),x=react.useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),m=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);let I=Array.from(y.dataTransfer.files);h(I);},[h]),N=react.useCallback(y=>{let I=y.target.files?Array.from(y.target.files):[];h(I),b.current&&(b.current.value="");},[h]),w=react.useCallback(()=>{b.current?.click();},[]),B=react.useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&a?.(y);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${g?"uploading":""}`,onDragEnter:f,onDragLeave:p,onDragOver:x,onDrop:m,onClick:w,children:[jsxRuntime.jsx("input",{ref:b,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:g?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(y=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:oi(y.type)&&y.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>k(y,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:y.thumbnailUrl||y.url,alt:y.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:uf(y.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:pf(y.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>B(y.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"})})})]},y.id))})]})}function ni({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],aiInsights:g=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:b,onDeleteAttachment:v,onSuggestAssignee:k,onGenerateSubtasks:C,onEstimateEffort:h,currentUserId:f="user-1"}){let[p,x]=react.useState("details"),[m,N]=react.useState(false),[w,B]=react.useState({}),[y,I]=react.useState(""),[P,T]=react.useState(false),[W,O]=react.useState({});if(!t||!e)return null;let q=react.useCallback(()=>{N(false),B({}),x("details"),I(""),O({}),a();},[a]),te=react.useCallback(()=>{r&&Object.keys(w).length>0&&(r(e.id,w),B({}),N(false));},[e.id,w,r]),ne=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),q());},[e.id,o,q]),re=react.useCallback(()=>{u&&y.trim()&&(u(e.id,y.trim()),I(""));},[e.id,y,u]),ce=react.useCallback(async()=>{if(k){T(true);try{let L=await k(e);O(j=>({...j,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{T(false);}}},[e,k]),be=react.useCallback(async()=>{if(C){T(true);try{let L=await C(e);O(j=>({...j,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{T(false);}}},[e,C]),Le=react.useCallback(async()=>{if(h){T(true);try{let L=await h(e);O(j=>({...j,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{T(false);}}},[e,h]),A={...e,...w},R=s.filter(L=>A.assignedUserIds?.includes(L.id));return jsxRuntime.jsx(ft,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:q,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:L=>L.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:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),m?jsxRuntime.jsx("input",{type:"text",value:w.title??A.title,onChange:L=>B({...w,title:L.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:A.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),B({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ne,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:q,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:()=>x("details"),className:`card-detail-tab ${p==="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:()=>x("comments"),className:`card-detail-tab ${p==="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:()=>x("activity"),className:`card-detail-tab ${p==="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:()=>x("attachments"),className:`card-detail-tab ${p==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>x("ai"),className:`card-detail-tab ${p==="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:[p==="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"}),m?jsxRuntime.jsx("textarea",{value:w.description??A.description??"",onChange:L=>B({...w,description:L.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:A.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),m?jsxRuntime.jsx("select",{multiple:true,value:w.assignedUserIds??A.assignedUserIds??[],onChange:L=>{let j=Array.from(L.target.selectedOptions,X=>X.value);B({...w,assignedUserIds:j});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(L=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:L.color},children:L.initials}),jsxRuntime.jsx("span",{children:L.name})]},L.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"}),m?jsxRuntime.jsxs("select",{value:w.priority??A.priority??"",onChange:L=>B({...w,priority:L.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:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:A.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:A.labels&&A.labels.length>0?A.labels.map(L=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:L},L)):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"}),m?jsxRuntime.jsx("input",{type:"date",value:w.startDate?new Date(w.startDate).toISOString().split("T")[0]:A.startDate?new Date(A.startDate).toISOString().split("T")[0]:"",onChange:L=>B({...w,startDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:A.startDate?new Date(A.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),m?jsxRuntime.jsx("input",{type:"date",value:w.endDate?new Date(w.endDate).toISOString().split("T")[0]:A.endDate?new Date(A.endDate).toISOString().split("T")[0]:"",onChange:L=>B({...w,endDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:A.endDate?new Date(A.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),m?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:w.estimatedTime??A.estimatedTime??"",onChange:L=>B({...w,estimatedTime:L.target.value?parseFloat(L.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:A.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:A.dependencies&&A.dependencies.length>0?A.dependencies.map(L=>{let j=typeof L=="string"?L:L.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",j.slice(-4)]},j)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:A.createdAt?new Date(A.createdAt).toLocaleString():"Unknown"})]})]}),p==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:y,onChange:L=>I(L.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:re,disabled:!y.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(L=>{let j=s.find(X=>X.id===L.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[j&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:j.color},children:j.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:j?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(L.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:L.content})]},L.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"})]})})]}),p==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(L=>{let j=s.find(X=>X.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("COMMENT")&&"\u{1F4AC}",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",L.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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"})]})}),p==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(xr,{cardId:e.id,attachments:i,onUpload:b?L=>b(e.id,L):void 0,onDelete:v,currentUserId:f,maxSizeMB:10,maxFiles:20})}),p==="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:ce,disabled:P||!k,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:be,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("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:Le,disabled:P||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((L,j)=>{let X=s.find(z=>z.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:L.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(L.confidence*100).toFixed(0),"%"]})]})]},j)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((L,j)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},j))]}),W.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),g.map(L=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&g.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 Xo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[c,g]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),b=window.innerHeight,v=window.innerWidth,k=4,C=l.left;C+o>v-10&&(C=v-o-10),C<10&&(C=10);let h=b-l.bottom,f=l.top,p;return h>=s+k?p=l.bottom+k:f>=s+k?p=l.top-s-k:h>=f?p=l.bottom+k:p=Math.max(10,l.top-s-k),{top:p,left:C}},[e,o,s]);return react.useEffect(()=>{t&&g(u());},[t,u]),react.useEffect(()=>{if(!t)return;let l=v=>{let k=v.target;i.current&&!i.current.contains(k)&&e.current&&!e.current.contains(k)&&a();},b=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(b),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(ft,{children:jsxRuntime.jsx("div",{ref:i,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 et={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:"#9CA3AF",dependencyHover:"#6B7280",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:"#6B7280",dependencyHover:"#4B5563",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:"#78716C",dependencyHover:"#57534E",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 kf=["LOW","MEDIUM","HIGH","URGENT"],wf=["todo","in-progress","review","done"];function li({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],onAddComment:g,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:b,onAIFindSimilar:v,availableColumns:k=[],availableLabels:C=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:p,unsplashAccessKey:x,theme:m,onSubtasksChange:N,attachments:w=[],onUploadAttachments:B,onDeleteAttachment:y}){let I=ko(),P=m||I?.themeName||"dark",[T,W]=react.useState(e),[O,q]=react.useState(false),[te,ne]=react.useState(e?.subtasks||[]),[re,ce]=react.useState(false),[be,Le]=react.useState(""),[A,R]=react.useState(""),[L,j]=react.useState("all"),[X,z]=react.useState(false),[ve,se]=react.useState(false),[Ie,qe]=react.useState(false),[Qe,ie]=react.useState(false),[Xe,lt]=react.useState(false),[kt,yt]=react.useState(false),$=react.useRef(null),fe=react.useRef(null),Ae=react.useRef(null),G=react.useRef(null),oe=react.useRef(null),xe=react.useRef(null),Oe=react.useRef(null),ye=react.useRef(null),it=react.useRef(null),Ue=react.useRef(null),wt=react.useRef(null),ut=react.useRef(null);react.useEffect(()=>{e&&!T?(W({...e}),ne(e.subtasks||[])):e&&T&&e.id!==T.id&&(W({...e}),ne(e.subtasks||[]));},[e,T]),react.useEffect(()=>{let H=le=>{let He=le.target;G.current&&!G.current.contains(He)&&z(false),oe.current&&!oe.current.contains(He)&&se(false),xe.current&&!xe.current.contains(He)&&qe(false),Oe.current&&!Oe.current.contains(He)&&ie(false);};if(X||ve||Ie||Qe)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[X,ve,Ie,Qe]),react.useEffect(()=>{if(!t)return;let H=le=>{let He=le.target,Ft=He.tagName==="INPUT"||He.tagName==="TEXTAREA"||He.isContentEditable;if(le.key==="Escape"){le.preventDefault(),X||ve||Ie||Qe||Xe||kt?(z(false),se(false),qe(false),ie(false),lt(false),yt(false)):Ft||a();return}if(Ft&&le.key!=="Escape")return;let rt=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),z(true);break;case "a":le.preventDefault(),qe(true);break;case "p":le.preventDefault(),se(true);break;case "l":le.preventDefault(),ie(true);break;case "d":rt||(le.preventDefault(),lt(true),setTimeout(()=>ye.current?.focus(),0));break;case "e":rt||(le.preventDefault(),yt(true));break;case "i":le.preventDefault(),q(true),setTimeout(()=>fe.current?.focus(),0);break;case "t":le.preventDefault(),ce(true);break;case "c":le.preventDefault(),Ae.current?.focus();break}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[t,a,X,ve,Ie,Qe,Xe,kt]);let Bt=react.useCallback(H=>{let le=H.currentTarget.textContent?.trim()||"";if(T&&le!==T.title){let He={...T,title:le};W(He),r?.(T.id,{title:le});}},[T,r]),jt=react.useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),H.currentTarget.blur()),H.key==="Escape"&&(H.preventDefault(),H.currentTarget.textContent=T?.title||"",H.currentTarget.blur());},[T]),Se=react.useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),q(false);},[T,e,r]),Ve=react.useCallback(H=>{if(T){let le={...T,columnId:H};W(le),r?.(T.id,{columnId:H}),z(false);}},[T,r]),ua=react.useCallback(H=>{if(T){let le={...T,priority:H};W(le),r?.(T.id,{priority:H}),se(false);}},[T,r]),Ze=react.useCallback(H=>{if(T){let le=T.assignedUserIds||[],He=le.includes(H)?le.filter(rt=>rt!==H):[...le,H],Ft={...T,assignedUserIds:He};W(Ft),r?.(T.id,{assignedUserIds:He});}},[T,r]),Ke=react.useCallback(H=>{if(T){let le=T.labels||[],He=le.includes(H)?le.filter(rt=>rt!==H):[...le,H],Ft={...T,labels:He};W(Ft),r?.(T.id,{labels:He});}},[T,r]),F=react.useCallback(H=>{if(T){let le={...T,tags:H};W(le),r?.(T.id,{tags:H});}},[T,r]),Te=react.useCallback(H=>{if(T){let le=H.target.value,He={...T,endDate:le};W(He),r?.(T.id,{endDate:le}),lt(false);}},[T,r]),Z=react.useCallback(H=>{if(T){let le={...T,estimatedTime:parseFloat(H)||0};W(le),r?.(T.id,{estimatedTime:parseFloat(H)||0});}},[T,r]),ke=react.useCallback(()=>{if(be.trim()&&T){let H={id:`subtask-${Date.now()}`,title:be.trim(),completed:false,createdAt:new Date},le=[...te,H];ne(le),Le(""),ce(false),N?.(T.id,le);}},[be,te,T,N]),Ce=react.useCallback(H=>{let le=te.map(He=>He.id===H?{...He,completed:!He.completed,updatedAt:new Date}:He);ne(le),T&&N?.(T.id,le);},[te,T,N]),$e=react.useCallback(H=>{let le=te.filter(He=>He.id!==H);ne(le),T&&N?.(T.id,le);},[te,T,N]),Be=react.useCallback(()=>{A.trim()&&T&&g&&(g(T.id,A.trim()),R(""));},[A,T,g]),st=react.useCallback(H=>{(H.metaKey||H.ctrlKey)&&H.key==="Enter"&&(H.preventDefault(),Be());},[Be]),U=H=>jsxRuntime.jsx(yf__default.default,{remarkPlugins:[vf__default.default],rehypePlugins:[xf__default.default],components:{a:({node:le,...He})=>jsxRuntime.jsx("a",{...He,target:"_blank",rel:"noopener noreferrer"})},children:H}),Y=c.filter(H=>L==="comments"?H.type.includes("COMMENT"):L==="history"?!H.type.includes("COMMENT"):true);if(!t||!e)return null;let pe=T||e,_e=s.filter(H=>pe.assignedUserIds?.includes(H.id)),ze=te.filter(H=>H.completed).length;return jsxRuntime.jsx(ft,{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:H=>H.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:Bt,onKeyDown:jt,children:pe.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:G,children:[jsxRuntime.jsxs("button",{ref:it,className:"modal-v2-field",onClick:()=>z(!X),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pe.columnId||"No status"})]}),jsxRuntime.jsx(Xo,{triggerRef:it,isOpen:X,onClose:()=>z(false),width:250,estimatedHeight:200,children:(k.length>0?k:wf.map(H=>({id:H,title:H}))).map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${pe.columnId===H.id?"active":""}`,onClick:()=>Ve(H.id),children:H.title},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:xe,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>qe(!Ie),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:_e.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:_e.map(H=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:H.color},title:H.name,children:H.initials},H.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Xo,{triggerRef:Ue,isOpen:Ie,onClose:()=>qe(false),width:280,estimatedHeight:300,children:s.map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pe.assignedUserIds?.includes(H.id)?"active":""}`,onClick:()=>Ze(H.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:H.color},children:H.initials}),H.name,pe.assignedUserIds?.includes(H.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"})})]},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:oe,children:[jsxRuntime.jsxs("button",{ref:wt,className:"modal-v2-field",onClick:()=>se(!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:pe.priority||"None"})]}),jsxRuntime.jsxs(Xo,{triggerRef:wt,isOpen:ve,onClose:()=>se(false),width:180,estimatedHeight:220,children:[kf.map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${H.toLowerCase()} ${pe.priority===H?"active":""}`,onClick:()=>ua(H),children:H},H)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ua(""),children:"None"})]})]}),h.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(br,{selectedTags:pe.tags||[],availableTags:h,onChange:F,onCreateTag:f,theme:et[P]||et.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Oe,children:[jsxRuntime.jsxs("button",{ref:ut,className:"modal-v2-field",onClick:()=>ie(!Qe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pe.labels&&pe.labels.length>0?jsxRuntime.jsx("span",{children:pe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Xo,{triggerRef:ut,isOpen:Qe,onClose:()=>ie(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pe.labels?.includes(H)?"active":""}`,onClick:()=>Ke(H),children:[H,pe.labels?.includes(H)&&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"})})]},H))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{lt(!Xe),setTimeout(()=>ye.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pe.endDate?new Date(pe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ye,type:"date",value:typeof pe.endDate=="string"?pe.endDate.split("T")[0]:pe.endDate?(()=>{let H=new Date(pe.endDate),le=H.getUTCFullYear(),He=String(H.getUTCMonth()+1).padStart(2,"0"),Ft=String(H.getUTCDate()).padStart(2,"0");return `${le}-${He}-${Ft}`})():"",onChange:Te,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>yt(!kt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pe.estimatedTime?`${pe.estimatedTime}h`:"Not set"})]}),kt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pe.estimatedTime||"",onChange:H=>Z(H.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>yt(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"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:pe.description||"",onChange:H=>{if(T){let le={...T,description:H.target.value};W(le);}},onBlur:Se,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>q(true),children:pe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:U(pe.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),te.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ze,"/",te.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>ce(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(H=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${H.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ce(H.id),children:H.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:H.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>$e(H.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"})]})})]},H.id)),re&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:be,onChange:H=>Le(H.target.value),onKeyDown:H=>{H.key==="Enter"&&ke(),H.key==="Escape"&&(ce(false),Le(""));},onBlur:ke,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(B||w.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"}),w.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:w.length})]}),jsxRuntime.jsx(xr,{cardId:pe.id,attachments:w,onUpload:B?H=>B(pe.id,H):void 0,onDelete:y,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 ${L==="all"?"active":""}`,onClick:()=>j("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>j("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>j("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:Ae,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:A,onChange:H=>R(H.target.value),onKeyDown:st,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:Be,disabled:!A.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Y.map(H=>{let le=s.find(Ft=>Ft.id===H.userId);if(H.type.includes("COMMENT")){let Ft=n.find(rt=>rt.id===H.metadata?.commentId);return Ft?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.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:le?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ft.content})]})]},H.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.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:le?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)}),Y.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 Af({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 ci({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,g)=>c+g.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(Af,{})}),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 zf({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 mi({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,g=s>0?(s-n)/s*100:0,i=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(zf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:g>=50?"#10B981":"#F59E0B"},children:[g.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children: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:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var qf={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},yc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Xf({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)),g=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:g,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vc({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 pi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((g,i)=>g+i.value,0),n=e.map(g=>({...g,totalValue:s,color:g.color||qf[g.name]||yc[e.indexOf(g)%yc.length]})),c=n.map(g=>g.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?Xf:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((g,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(g,i)=>{let u=i.payload,l=s>0?(u.value/s*100).toFixed(0):"0";return `${g} (${u.value} - ${l}%)`}})]}):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(vc,{})}),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((g,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children: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((g,i)=>i.value>g.value?i:g).name})]})]})]})}var Bn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,c]=react.useState(false),[g,i]=react.useState(false),[u,l]=react.useState(false),[b,v]=react.useState(false);if(e.length===0)return null;let k=e.map(m=>m.id),C=m=>{r.onBulkUpdate?.(k,{priority:m}),c(false);},h=m=>{r.onBulkMove?.(k,m),i(false),a();},f=m=>{r.onBulkUpdate?.(k,{assignedUserIds:m}),l(false);},p=m=>{let N=new Set;e.forEach(B=>{B.labels?.forEach(y=>N.add(y));});let w=Array.from(new Set([...N,...m]));r.onBulkUpdate?.(k,{labels:w}),v(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(k),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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(m=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(m),children:[jsxRuntime.jsx("span",{className:d("asakaa-priority-dot",m==="LOW"&&"bg-asakaa-priority-low",m==="MEDIUM"&&"bg-asakaa-priority-medium",m==="HIGH"&&"bg-asakaa-priority-high",m==="URGENT"&&"bg-asakaa-priority-urgent")}),m]},m))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!g),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(m=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(m.id),children:m.title},m.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(m=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([m.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:m.color},children:m.initials}),m.name]},m.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>v(!b),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),b&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(m=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>p([m]),children:m},m))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,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"})})]})]})})});Bn.displayName="BulkOperationsToolbar";function t0(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,c,g,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(v=>{let k=a?.find(C=>C.id===v);n=`assignee-${v}`,c=k?.name||`User ${v}`,g=k?.color,i=k?.avatar,r.has(n)||r.set(n,{id:n,title:c,groupValue:v,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",c="Unassigned",g="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let b={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=b.title,g=b.color,r.has(n)||r.set(n,{id:n,title:c,groupValue:s,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(v=>{n=`label-${v}`,c=v,g="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:v,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);}):(n="label-none",c="No Labels",g="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:g}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ui({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),c=react.useMemo(()=>t0(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),g=react.useCallback(i=>{n(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Ur,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:d("asakaa-swimlane-view",o),children:[c.map(i=>{let u=s.has(i.id),l=e.cards.filter(v=>i.cardIds.includes(v.id)),b={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&g(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Ur,{board:b,callbacks:r,availableUsers:a})})]},i.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 gi=[{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 fi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),c=gi.find(i=>i.value===e)||gi[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let g=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:d("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:d("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:gi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>g(i.value),className:d("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Jo=[{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 o0(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},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,g=o.meta?e.metaKey:true;return s&&n&&c&&g}function Tc(e={}){let{shortcuts:t=Jo,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(g=>{o.current=[...o.current,g];},[]),c=react.useCallback(g=>{o.current=o.current.filter(i=>i.action!==g);},[]);return react.useEffect(()=>{function g(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(o0(i,l)){r&&i.preventDefault();let b=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(b);break}}}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[r]),{registerShortcut:n,unregisterShortcut:c,isEnabled:a}}function s0(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function i0(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 l0(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=i0(e),r=t?s0(t):"";return a?`${a} + ${r}`:r}function d0(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 bi({shortcuts:e=Jo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(g){g.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let n=d0(e);return jsxRuntime.jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","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,g])=>g.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:g.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:l0(i)})]},i.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var hi=[{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,48 +108,48 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Qs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},p=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:f("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([i,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:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ei({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[p,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,v=await $l(e,p,T);Ol(v,p);},C=async T=>{let v=T.target.files?.[0];if(v){try{let y=await Hl(v),c=v.name.endsWith(".json")?"json":"csv",k=Ul(y,c);d(k),k.success&&r&&r(k,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:f("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:()=>m("export"),className:f("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:()=>m("import"),className:f("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(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",p===T?"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:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),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:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.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:f("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:f("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((T,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},v))})]})]})]})]})]})}var sf=["URGENT","HIGH","MEDIUM","LOW"],lf=[{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"}],df=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ti({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:p=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,v]=react.useState(true),y=react.useCallback(x=>{a({search:x.target.value});},[a]),c=react.useCallback(x=>{a({dateFilter:x.target.value});},[a]),k=react.useCallback(x=>{r({by:x.target.value});},[r]),l=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:x=>{x.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:T?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!T&&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"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:c,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:x=>{let B=x.target.value;a({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),sf.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:x=>{let B=x.target.value;a({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.name},x.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:x=>{let B=x.target.value;a({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),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:k,className:"filter-bar__select filter-bar__select--sm",children:lf.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:l,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:x=>C(x.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:df.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ai({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:p}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(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:()=>g(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:()=>g(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:()=>g(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>g(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>g(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:()=>g(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 ri={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"}},oi={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"}},ni={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"}},Xr={dark:ri,light:oi,neutral:ni},Tn="dark";var Nn=react.createContext(void 0),vf="asakaa-theme";function tc({children:e,defaultTheme:t=Tn,storageKey:a=vf}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,p=Xr[r];Object.entries(p.colors).forEach(([u,d])=>{d&&m.style.setProperty(`--theme-${xf(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 g=p.colors[u];g&&m.style.setProperty(d,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Xr};return jsxRuntime.jsx(Nn.Provider,{value:n,children:e})}function bo(){let e=react.useContext(Nn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function xf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function si({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=bo();return e?jsxRuntime.jsxs("div",{className:f("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(Xr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("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 ac(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Je[e]||Je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Je[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Je[e].bgSecondary),bgGrid:r("--theme-bg-card",Je[e].bgGrid),bgWeekend:r("--theme-bg-hover",Je[e].bgWeekend),border:r("--theme-border-primary",Je[e].border),borderLight:r("--theme-border-subtle",Je[e].borderLight),textPrimary:r("--theme-text-primary",Je[e].textPrimary),textSecondary:r("--theme-text-secondary",Je[e].textSecondary),textTertiary:r("--theme-text-tertiary",Je[e].textTertiary),accent:r("--theme-accent-primary",Je[e].accent),accentHover:r("--theme-accent-hover",Je[e].accentHover),accentLight:r("--theme-accent-primary",Je[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Je[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Je[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Je[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Je[e].dependency),dependencyHover:r("--theme-border-secondary",Je[e].dependencyHover),criticalPath:r("--theme-error",Je[e].criticalPath),criticalPathLight:r("--theme-error",Je[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Je[e].today):e==="neutral"?r("--theme-text-primary",Je[e].today):r("--theme-error",Je[e].today),todayLight:e==="light"?r("--theme-accent-primary",Je[e].todayLight):e==="neutral"?r("--theme-text-primary",Je[e].todayLight):r("--theme-error",Je[e].todayLight),milestone:r("--theme-warning",Je[e].milestone),milestoneLight:r("--theme-warning",Je[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Je[e].statusTodo),statusInProgress:r("--theme-accent-primary",Je[e].statusInProgress),statusCompleted:r("--theme-success",Je[e].statusCompleted),hoverBg:r("--theme-bg-hover",Je[e].hoverBg),focusRing:r("--theme-accent-primary",Je[e].focusRing)}}var Dn={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",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},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",week:"Week",clickToSetDates:"Click to set dates..."},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"}},rc={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",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},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",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},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"}},ii={en:Dn,es:rc};function oc(e){return ii[e]||ii.en}function li(e,t){let a=oc(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 vo=react.createContext(Dn);function Br(){return react.useContext(vo)}function Rf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,p]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=Br();if(react.useEffect(()=>{let v=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return m&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[m]),!(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(v=>v.handler),T=async(v,y)=>{if(y){u(v);try{await y();}catch(c){console.error(`Export ${v} failed:`,c);}finally{u(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:C.map((v,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(v.id,v.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===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 $f({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 Of({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 zf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Br();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],p=m.find(i=>i.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"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<m.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:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Uf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Br();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],p=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p||r?e.accentLight:e.bgSecondary,border:`1px solid ${p||r?e.accent:e.borderLight}`,color:p||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),p&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsxs(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-56 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:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),p&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function En({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:p,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:v,onExportExcel:y,onExportCSV:c,onExportJSON:k,onExportMSProject:l}){let N=Br(),x=T||v||y||c||k||l,B=[{value:"day",label:N.toolbar.day},{value:"week",label:N.toolbar.week},{value:"month",label:N.toolbar.month}],b=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Of,{options:B,value:t,onChange:D=>a(D),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(zf,{theme:e,value:m,onChange:p}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Uf,{theme:e,value:h,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,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||N.toolbar.createTask})]}),(x||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Rf,{theme:e,onExportPNG:T,onExportPDF:v,onExportExcel:y,onExportCSV:c,onExportJSON:k,onExportMSProject:l}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx($f,{options:b,value:s,onChange:D=>n(D),theme:e})]})]})}function Pn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{m.current&&!m.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let u=p.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(mt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${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"}),i.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 xo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[m,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,v=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(v=C-d-g,v<g&&(v=g)),p({x:T,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.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 i=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:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(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 $t={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 fc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:p,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=react.useRef(false),C=react.useCallback(k=>{h.current=k;},[]),T=react.useCallback(k=>{let l=[],N=x=>{for(let B of x)l.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&N(B.subtasks);};return N(k),l},[]),v=react.useCallback(()=>{let k=T(e);for(let l of k)if(t.has(l.id))return l;return null},[e,t,T]),y=react.useCallback((k,l)=>{let N=T(e);if(N.length===0)return;let x=v();if(!x){a(N[0].id,false);return}let B=N.findIndex(M=>M.id===x.id);if(B===-1)return;let b=k==="up"?B-1:B+1;if(b<0||b>=N.length)return;let D=N[b];a(D.id,l);},[e,v,T,a]),c=react.useCallback(k=>{if(!g)return;let l=k.target;if(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable||h.current){k.key==="Escape"&&(l.blur(),h.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,b=Array.from(t),D=v();if(k.key==="ArrowUp"){k.preventDefault(),y("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),y("down",k.shiftKey);return}if(D&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!D.isExpanded||k.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){b.length>0&&(k.preventDefault(),n(b,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){b.length>0&&(k.preventDefault(),m(b));return}if(k.key==="Tab"&&k.shiftKey){b.length>0&&(k.preventDefault(),p(b));return}if(k.key==="Enter"&&!k.shiftKey&&!B){D&&(k.preventDefault(),r(D.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!B){D&&(k.preventDefault(),r(D.id,"above"));return}if(k.key==="Enter"&&B){D&&(k.preventDefault(),d(D.id));return}if(k.key==="F2"){D&&(k.preventDefault(),i(D.id));return}if(k.key==="Delete"||k.key==="Backspace"&&B){b.length>0&&(k.preventDefault(),o(b));return}if(k.key==="d"&&B&&!k.shiftKey){b.length>0&&(k.preventDefault(),s(b));return}},[g,t,v,y,r,o,s,n,m,p,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c);}},[g,c]),{setIsEditing:C}}function bc(){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(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),v=Math.max(h,C),y=g.slice(T,v+1);t(new Set(y)),r(d);},[a,o]),m=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),p=react.useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=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:m,handleKeyboardSelection:p,clearSelection:i,isTaskSelected:u}}function ko(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function yc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=yc(a.subtasks,t);if(r)return r}}return null}function gi(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=gi(a.subtasks,t);if(r)return r}return null}function fi(e,t){if(t.length===0)return e;let a=ko(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let v=n(T.subtasks,g);T.subtasks=v.tasks,h.push(...v.removed);}return true}),removed:h}},m=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:m(C.subtasks,g,h)}:C),p=new Set(t),{tasks:i,removed:u}=n(e,p);return m(i,s.id,u)}function hi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=gi(a,r);if(!o)continue;let s=gi(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},m=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&m(h.subtasks,u,d);return i},p=n(a,o.id,r);p&&(s&&s.subtasks?m(s.subtasks,o.id,p):m(a,o.id,p));}return a}function bi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,p)=>{let i=n.findIndex(d=>d.id===m);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,m,p))return true;return false}let u=p==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function yi(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 vi(e,t){let a=[...e];for(let r of t){let o=n=>{let m=n.findIndex(u=>u.id===r);if(m===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let p=n[m],i={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function vc(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"},m=p=>{let i=p.findIndex(d=>d.id===t);if(i===-1){for(let d of p)if(d.subtasks&&m(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return p.splice(u,0,n),true};return m(r),{tasks:r,newTask:n}}function xi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:xi(r.subtasks,t,a)}:r)}function ki(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ki(a.subtasks,t)}:a)}function wi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,m=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,p],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:p}}function xc(e,t,a,r){if(t===a)return e;let o=yc(e,t);if(!o)return e;if(a){let m=(p,i)=>{if(!p.subtasks)return false;for(let u of p.subtasks)if(u.id===i||m(u,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=p=>p.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});n=m(n);}return n}function Fn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:p,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:v,onMultiTaskDelete:y,onTaskDuplicate:c,onTaskCreate:k,onTaskRename:l,onCreateSubtask:N,onOpenTaskModal:x,onDeleteRequest:B,onTaskReparent:b}){let D=react.useContext(vo),[M,w]=react.useState(null),[R,$]=react.useState(null),[K,te]=react.useState(""),re=react.useRef(null),[ae,pe]=react.useState(null),[fe,Ie]=react.useState(0),[F,O]=react.useState(0),[L,j]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[X,W]=react.useState(null),[ye,oe]=react.useState(null),[Le,Ye]=react.useState(null),et=react.useRef(0),se=5,Xe=react.useRef(false),[dt,kt]=react.useState(null),[wt,z]=react.useState(false),[ge,Se]=react.useState(null),[Pe,_e]=react.useState(false),Ve=react.useRef(null);react.useEffect(()=>{function U(Y){Ve.current&&!Ve.current.contains(Y.target)&&_e(false);}if(Pe)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[Pe]),react.useEffect(()=>{R&&re.current&&(re.current.focus(),re.current.select());},[R]),react.useEffect(()=>{if(!ae)return;let U=de=>{let ze=de.clientX-fe,Re=F+ze;g?.(ae,Re);},Y=()=>{pe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Y),document.body.style.cursor="",document.body.style.userSelect="";}},[ae,fe,F,g]);let{selectedTaskIds:Mt,handleTaskClick:Me,isTaskSelected:Qt}=bc(),{setIsEditing:Zt}=fc({tasks:e,selectedTaskIds:Mt,onTaskSelect:(U,Y)=>{let ze=ko(e).map(Re=>Re.id);Me(U,ze,Y||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:c||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:U=>{let Y=ko(e).find(de=>de.id===U);Y&&Ue(Y);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:U=>{let Y=ko(e).find(de=>de.id===U);Y&&x&&x(Y);},enableKeyboard:true}),Ft=(U,Y=0)=>{let de=[];for(let ze of U)de.push({task:ze,level:Y}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&de.push(...Ft(ze.subtasks,Y+1));return de},bt=Ft(e),Ht=48,ea=Math.max(bt.length*a,600-Ht),Ce=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Ue=U=>{$(U.id),te(U.name),Zt(true);},ca=U=>{K.trim()&&K!==e.find(Y=>Y.id===U)?.name&&l?.(U,K.trim()),$(null),te(""),Zt(false);},qe=()=>{$(null),te(""),Zt(false);},We=(U,Y)=>{Y.stopPropagation(),N?.(U.id);},I=(U,Y)=>{Y.preventDefault(),et.current=Y.clientY,W(U),Xe.current=false,z(false),kt({x:Y.clientX,y:Y.clientY});},xe=U=>{if(!X||(Math.abs(U.clientY-et.current)>se&&!Xe.current&&(Xe.current=true,z(true)),kt({x:U.clientX,y:U.clientY}),!Xe.current))return;let de=document.querySelectorAll("[data-task-row]"),ze=null,Re=null;de.forEach(H=>{let ne=H.getBoundingClientRect(),$e=H.getAttribute("data-task-row");if($e&&$e!==X&&U.clientY>=ne.top&&U.clientY<=ne.bottom){ze=$e;let St=U.clientY-ne.top,tt=ne.height;St<tt*.25?Re="above":St>tt*.75?Re="below":Re="child";}}),oe(ze),Ye(Re);},J=()=>{if(Xe.current&&X&&ye&&Le){if(Le==="child")b?.(X,ye);else if(Le==="above"||Le==="below"){let U=(ze,Re,H=null)=>{for(let ne of ze){if(ne.id===Re)return H;if(ne.subtasks){let $e=U(ne.subtasks,Re,ne.id);if($e!==void 0)return $e}}},Y=U(e,ye,null),de=(ze,Re)=>{let H=ze.findIndex(ne=>ne.id===Re);return Le==="below"?H+1:H};if(Y===null){let ze=de(e,ye);b?.(X,null,ze);}else {let ze=bt.find(Re=>Re.task.id===Y)?.task;if(ze?.subtasks){let Re=de(ze.subtasks,ye);b?.(X,Y,Re);}}}}W(null),oe(null),Ye(null),kt(null),Xe.current=false,z(false);};react.useEffect(()=>{if(X)return document.addEventListener("mousemove",xe),document.addEventListener("mouseup",J),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",J),document.body.style.cursor="",document.body.style.userSelect="";}},[X,ye,Le]);let he=(U,Y,de)=>{switch(U.id){case "name":let ze=R===Y.id,Re=M===Y.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${de*20}px`},children:[b&&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:Re?1:.3},onMouseDown:_=>I(Y.id,_),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),Y.subtasks&&Y.subtasks.length>0?jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),p?.(Y.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Y.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:Y.color||"#3B82F6",opacity:Y.parentId?.6:1,borderColor:Y.isMilestone?t.accent:"transparent",borderWidth:Y.isMilestone?"2px":"0px"},title:Y.isMilestone?"Milestone":Y.parentId?"Subtask":"Task"})}),ze?jsxRuntime.jsx("input",{ref:re,type:"text",value:K,onChange:_=>te(_.target.value),onKeyDown:_=>{_.key==="Enter"?ca(Y.id):_.key==="Escape"&&qe();},onBlur:()=>ca(Y.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:_=>_.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:Y.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Y.parentId?"13px":"14px",fontWeight:Y.isMilestone?600:Y.parentId?400:600,letterSpacing:Y.parentId?"0":"-0.01em"},title:Y.name,children:Y.name}),Re&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:_=>We(Y,_),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:_=>{_.stopPropagation(),Ue(Y);},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 ne=U.id==="startDate"?"startDate":"endDate",$e=Y[ne],St=ge?.taskId===Y.id&&ge?.field===ne,tt=_=>_?(typeof _=="string"?new Date(_):_).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:_=>_.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:_=>{if(St)Se(null);else {let De=_.currentTarget.getBoundingClientRect();Se({taskId:Y.id,field:ne,month:$e?typeof $e=="string"?new Date($e):$e:new Date,position:{top:De.bottom+4,left:De.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:tt($e)})]}),St&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Se(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:ge?.position.top,left:ge?.position.left},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let _=new Date,De=new Date(_);De.setDate(_.getDate()+1);let Ge=new Date(_);Ge.setDate(_.getDate()+7);let Tt=new Date(_);return Tt.setDate(_.getDate()+14),[{label:"Hoy",date:_},{label:"Ma\xF1ana",date:De},{label:"Pr\xF3xima semana",date:Ge},{label:"2 semanas",date:Tt}].map((Oe,ut)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(Y.id,{[ne]:Oe.date}),Se(null);},children:Oe.label},ut))})(),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:_=>_.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_=>_.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(Y.id,{[ne]:void 0}),Se(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:()=>Se(_=>_?{..._,month:new Date(_.month.getFullYear(),_.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:ge?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Se(_=>_?{..._,month:new Date(_.month.getFullYear(),_.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((_,De)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:_},De))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=ge?.month||new Date,De=_.getFullYear(),Ge=_.getMonth(),Tt=new Date(De,Ge,1).getDay(),ie=new Date(De,Ge+1,0).getDate(),Oe=new Date,ut=[];for(let ct=Tt-1;ct>=0;ct--)ut.push({day:new Date(De,Ge,-ct).getDate(),date:new Date(De,Ge-1,new Date(De,Ge,-ct).getDate()),isCurrentMonth:false});for(let ct=1;ct<=ie;ct++)ut.push({day:ct,date:new Date(De,Ge,ct),isCurrentMonth:true});let Fe=42-ut.length;for(let ct=1;ct<=Fe;ct++)ut.push({day:ct,date:new Date(De,Ge+1,ct),isCurrentMonth:false});return ut.map((ct,ha)=>{let ya=ct.date.toDateString()===Oe.toDateString(),He=($e?typeof $e=="string"?new Date($e):$e:null)?.toDateString()===ct.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:ct.isCurrentMonth?He?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:He?"#3B82F6":"transparent",boxShadow:ya&&!He?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(Y.id,{[ne]:ct.date}),Se(null);},children:ct.day},ha)})})()})]})]})]}),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:Ce(Y)})});case "assignees":let fa=r.filter(_=>Y.assignees?.some(De=>De.name===_.name||De.initials===_.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(_r,{assignedUsers:fa,availableUsers:r,onChange:_=>{let De=_.map(Ge=>({id:Ge.id,name:Ge.name,initials:Ge.initials,color:Ge.color}));h?.(Y.id,{assignees:De.length>0?De:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(sd,{status:Y.status||"todo",onChange:_=>{h?.(Y.id,{status:_,progress:_==="completed"?100:Y.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:`${Y.progress}%`,backgroundColor:Y.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:[Y.progress,"%"]})]});case "priority":let Ia={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},st={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},A=Ia[Y.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(Wr,{priority:A,onChange:_=>{_&&h?.(Y.id,{priority:st[_]||"medium"});}})});default:return null}},ve=U=>[{id:"hide",label:"Hide Column",icon:$t.Hide,onClick:()=>d(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:$t.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:$t.SortDesc,onClick:()=>{}}],Be=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{B?B(U.id,U.name):y?.([U.id]);}}]:[{id:"edit",label:D?.contextMenu?.editTask||"Edit Task",icon:$t.Pencil,onClick:()=>{n?.(U);}},{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:D?.contextMenu?.markIncomplete||"Mark Incomplete",icon:$t.MarkIncomplete,onClick:()=>{h?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:D?.contextMenu?.setInProgress||"Set In Progress",icon:$t.SetInProgress,onClick:()=>{h?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:D?.contextMenu?.markComplete||"Mark Complete",icon:$t.MarkComplete,onClick:()=>{h?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:D?.contextMenu?.splitTask||"Split Task",icon:$t.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{B?B(U.id,U.name):y?.([U.id]);}}],Ae=u.filter(U=>U.visible),ot=Ae.reduce((U,Y)=>U+Y.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ot},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Ht}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:Ae.map((U,Y)=>{let de=Y===Ae.length-1,ze=U.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${ze?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(ze?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:de?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Re=>{Re.preventDefault(),j({isOpen:true,x:Re.clientX,y:Re.clientY,type:"header",columnId:U.id});},onMouseEnter:Re=>{Re.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Re=>{Re.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:U.label,children:U.label}),U.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ae===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Re=>{Re.preventDefault(),Re.stopPropagation(),pe(U.id),Ie(Re.clientX),O(U.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},U.id)})}),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(Pn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>_e(!Pe),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"})}),Pe&&jsxRuntime.jsxs("div",{ref:Ve,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>_e(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:ea},children:bt.map(({task:U,level:Y},de)=>{let ze=Qt(U.id),Re=ye===U.id,H=Re&&Le==="above",ne=Re&&Le==="below",$e=Re&&Le==="child",St={};return $e&&(St.backgroundColor=`${t.accent}15`,St.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${X===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:$e?`${t.accent}15`:de%2===0?t.bgPrimary:t.bgGrid,...St},onMouseEnter:()=>w(U.id),onMouseLeave:()=>w(null),onClick:tt=>{let Ia=ko(e).map(_=>_.id),A=navigator.platform.toUpperCase().indexOf("MAC")>=0?tt.metaKey:tt.ctrlKey;Me(U.id,Ia,A,tt.shiftKey),s?.(U);},onDoubleClick:tt=>{tt.stopPropagation(),n?.(U);},onContextMenu:tt=>{tt.preventDefault(),j({isOpen:true,x:tt.clientX,y:tt.clientY,type:"task",task:U}),m?.(U,tt);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:[H&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ne&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ae.map((tt,fa)=>{let Ia=fa===Ae.length-1,st=tt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${st?"justify-start":"justify-center"}`,style:{width:`${tt.width}px`,minWidth:`${tt.minWidth??(st?200:60)}px`,maxWidth:`${tt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ia?"none":`1px solid ${M===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:he(tt,U,st?Y:0)},`${U.id}-${tt.id}`)})]},U.id)})}),jsxRuntime.jsx(xo,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?ve(L.columnId):L.type==="task"&&L.task?Be(L.task):[],onClose:()=>j({...L,isOpen:false}),theme:t}),wt&&dt&&X&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:dt.x+12,top:dt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=bt.find(Y=>Y.task.id===X)?.task;return U?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:U.name})}):null})()}),document.body)]})}function Nc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[p,i]=react.useState(t),[u,d]=react.useState(null),[g,h]=react.useState(null),[C,T]=react.useState(null),[v,y]=react.useState(null),[c,k]=react.useState(0),[l,N]=react.useState(0),[x,B]=react.useState(null),[b,D]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:p,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:v,setDraggedSegmentIndex:y,draggedSegmentStartX:c,setDraggedSegmentStartX:k,segmentDragOffsetX:l,setSegmentDragOffsetX:N,hoveredSegmentIndex:x,setHoveredSegmentIndex:B,isHovered:b,setIsHovered:D,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,te)=>{r("none"),d(null),h(null),m(K),i(te),N(0),y(null),k(0);}}}function Ln({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:p,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let v=Nc(t,r),y=react.useRef(null),c=react.useRef(null),k=react.useRef(null),{dragMode:l,setDragMode:N,dragOffset:x,setDragOffset:B,ghostX:b,setGhostX:D,ghostWidth:M,setGhostWidth:w,connectionLine:R,setConnectionLine:$,hoveredTaskId:K,setHoveredTaskId:te,activeZone:re,setActiveZone:ae,draggedSegmentIndex:pe,setDraggedSegmentIndex:fe,draggedSegmentStartX:Ie,setDraggedSegmentStartX:F,segmentDragOffsetX:O,setSegmentDragOffsetX:L,hoveredSegmentIndex:j,setHoveredSegmentIndex:X,isHovered:W,setIsHovered:ye,isDragging:oe,isResizing:Le,isConnecting:Ye,resetDragState:et}=v,se=32,Xe=8,dt=e.endDate&&e.endDate<new Date&&e.progress<100,kt=e.isCriticalPath,wt=o.name==="neutral"||o.today==="#1C1917",z=e.status==="completed"||e.progress===100,ge={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Pe=e.isCriticalPath||dt?"#DC2626":e.color?e.color:e.priority&&ge[e.priority]?ge[e.priority]:o.taskBarPrimary,Ve=(J=>J>=80?20:J>=60?15:J>=50?12:10)(r),Mt=r<50,Me=r<40;react.useEffect(()=>{if(T)if(W&&!oe&&!e.segments){let J=a<100;T({task:e,x:t,y:a,width:r,height:se,showBelow:J});}else T(null);},[W,oe,e,t,a,r,se,T]);let Qt=J=>J.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Zt=()=>{let J=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${J} day${J!==1?"s":""}`},Ft=J=>Math.round(J/s)*s,bt=J=>{let he=Math.round(J/s),ve=new Date(n);return ve.setDate(ve.getDate()+he),ve},Ht=(J,he)=>{for(let ve of h){if(ve.id===e.id)continue;let Be=5;if(J>=ve.x-Be&&J<=ve.x+ve.width+Be&&he>=ve.y-Be&&he<=ve.y+ve.height+Be)return ve.id}return null},ea=react.useCallback((J,he,ve)=>{J.preventDefault(),J.stopPropagation();let Be=y.current?.ownerSVGElement;if(!Be)return;let Ae=Be.createSVGPoint();Ae.x=J.clientX,Ae.y=J.clientY;let ot=Ae.matrixTransform(Be.getScreenCTM()?.inverse()),U=ve!==void 0?ve:t,Y=he;if(!Y){let de=ot.x-U;J.shiftKey?(Y="connect",$({x:t+r,y:a+se/2})):J.ctrlKey||J.metaKey?Y="move":J.altKey?Y=de<r/2?"resize-start":"resize-end":Me?de<r/2?Y="move":Y="resize-end":Mt?de<=Ve/2?Y="resize-start":de>=r-Ve/2?Y="resize-end":Y="move":de<=Ve?Y="resize-start":de>=r-Ve?Y="resize-end":Y="move";}N(Y),ye(false),ae(null),Y==="move"?B(ot.x-U):Y==="connect"?$({x:t+r,y:a+se/2}):B(0),D(U),w(r);},[t,r,a,se]),Ce=react.useCallback(J=>{let he=y.current?.ownerSVGElement;if(!he)return;let ve=he.closest(".gantt-timeline-scroll");if(!ve)return;let Be=ve.getBoundingClientRect(),Ae=60,ot=15,U=0;if(J.clientX<Be.left+Ae){let Y=Be.left+Ae-J.clientX;U=-Math.min(ot,Y/2);}else if(J.clientX>Be.right-Ae){let Y=J.clientX-(Be.right-Ae);U=Math.min(ot,Y/2);}return U!==0&&(ve.scrollLeft+=U),U!==0},[]),Ue=react.useCallback(J=>{if(l==="none")return;k.current=J;let he=y.current?.ownerSVGElement;if(!he)return;if(l==="move"||l==="resize-start"||l==="resize-end"){let Ae=Ce(J);Ae&&!c.current?c.current=window.setInterval(()=>{k.current&&(Ce(k.current),Ue(k.current));},16):!Ae&&c.current&&(window.clearInterval(c.current),c.current=null);}let ve=he.createSVGPoint();ve.x=J.clientX,ve.y=J.clientY;let Be=ve.matrixTransform(he.getScreenCTM()?.inverse());if(l==="connect"){$({x:Be.x,y:Be.y});let Ae=Ht(Be.x,Be.y);te(Ae);}else if(l==="move"){let Ae=Be.x-x,ot=Ft(Ae);D(ot),w(r);let U=Math.round((ot-t)/s);if(C?.(e.id,U,true),e.segments&&e.segments.length>0&&pe!==null){let Y=ot-Ie;L(Y);}}else if(l==="resize-start"){let Ae=Be.x,ot=Ft(Ae),U=t+r-ot;U>=s&&(D(ot),w(U));}else if(l==="resize-end"){let Ae=Be.x,U=Ft(Ae)-t;U>=s&&w(U);}},[l,t,r,s,x,e,Ft,pe,Ie,Ht,te,$,D,w,L,C,Ce]),ca=react.useCallback(()=>{if(c.current&&(window.clearInterval(c.current),c.current=null),k.current=null,l!=="none"){if(l==="connect")K&&g&&g(e,K),$(null),te(null);else {let J=e.endDate.getTime()-e.startDate.getTime(),he,ve,Be=true;if(l==="move"){if(he=bt(b),ve=new Date(he.getTime()+J),e.segments&&e.segments.length>0&&pe!==null){let Ae=Math.round(O/s),ot=e.segments.map((ze,Re)=>{if(Re===pe){let H=new Date(ze.startDate),ne=new Date(ze.endDate);return H.setDate(H.getDate()+Ae),ne.setDate(ne.getDate()+Ae),{startDate:H,endDate:ne}}return ze}),U=ot.flatMap(ze=>[ze.startDate,ze.endDate]),Y=new Date(Math.min(...U.map(ze=>ze.getTime()))),de=new Date(Math.max(...U.map(ze=>ze.getTime())));d?.({...e,segments:ot},Y,de),et(t,r);return}}else l==="resize-start"?(he=bt(b),ve=e.endDate,he>ve&&(console.warn("Invalid date range: start date must be before or equal to end date"),Be=false)):l==="resize-end"?(he=e.startDate,ve=bt(b+M),ve<he&&(console.warn("Invalid date range: end date must be after or equal to start date"),Be=false)):Be=false;Be&&he&&ve&&(ve.getTime()<he.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,he,ve));}C?.(e.id,0,false),et(t,r);}},[l,b,M,e,d,K,g,t,r,s,bt,O,pe,et,C]);react.useEffect(()=>{if(l==="none")return;let J=ve=>{Ue(ve);},he=()=>{ca();};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",he),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",he),c.current&&(window.clearInterval(c.current),c.current=null);}},[l,Ue,ca]);let qe=oe&&!Ye?b:t,We=oe&&!Ye?M:r,I=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!oe&&p?.(e),onDoubleClick:J=>{oe||(J.stopPropagation(),i?.(e));},onContextMenu:J=>{J.preventDefault(),u?.(e,J);},onMouseEnter:()=>!oe&&ye(true),onMouseLeave:()=>{oe||(ye(false),ae(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:se,fill:"transparent",style:{pointerEvents:"all"}}),W&&!oe&&!Mt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ve,height:se,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ae("resize-start"),onMouseDown:J=>ea(J,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ve,y:a,width:r-Ve*2,height:se,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ae("move"),onMouseDown:J=>ea(J,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ve,y:a,width:Ve,height:se,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ae("resize-end"),onMouseDown:J=>ea(J,"resize-end")})]}),W&&!oe&&Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:se,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ae("move"),onMouseDown:J=>ea(J,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:se,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ae("resize-end"),onMouseDown:J=>ea(J,"resize-end")}),W&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+se-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),oe&&!Ye&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:b,y:a,width:M,height:se,rx:Xe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:qe,y:a,width:We,height:se,rx:Xe,fill:Pe,"data-task-class":I,initial:{opacity:0,scale:.95},animate:{opacity:oe&&!Ye?.15:e.parentId?.6:W?.9:.8,scale:W&&!oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:J=>ea(J),style:{cursor:oe?Ye?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:qe,y:a,width:We*(e.progress/100),height:se,rx:Xe,fill:Pe,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((J,he)=>{let ve=(J.startDate.getTime()-n.getTime())/864e5*s,Ae=(J.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-ve+s,ot=oe&&l==="move"&&pe===he,U=j===he,Y=ot?ve+O:ve;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!oe&&X(he),onMouseLeave:()=>!oe&&X(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Y,y:a,width:Ae,height:se,rx:Xe,fill:Pe,initial:{opacity:0,scale:.95},animate:{opacity:ot||e.parentId?.6:U?.9:.8,scale:U&&!oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:de=>{de.stopPropagation(),fe(he),F(ve),ea(de,void 0,ve);},style:{cursor:oe?Ye?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Y,y:a,width:Ae*(e.progress/100),height:se,rx:Xe,fill:Pe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${he}`)}),wt&&(dt||kt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[kt&&!dt&&jsxRuntime.jsx("rect",{x:qe,y:a,width:We,height:se,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),dt&&jsxRuntime.jsx("rect",{x:qe,y:a,width:We,height:se,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),We>60&&!e.segments&&(()=>{let J=m.taskLabel(e),he=typeof J=="string"?J:e.name,ve=he.length>Math.floor(We/8)?`${he.substring(0,Math.floor(We/8))}...`:he;return jsxRuntime.jsx("text",{x:qe+12,y:a+se/2,dominantBaseline:"middle",fill:z?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:z?"line-through":"none"},children:ve})})(),We>100&&e.progress>0&&e.progress<100&&!oe&&!e.segments&&jsxRuntime.jsxs("text",{x:qe+We-12,y:a+se/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&&We>80&&!oe&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:qe+We-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:qe+We-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(W||Le)&&!Ye&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:qe-2,y:a,width:16,height:se,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ae("resize-start"),onMouseLeave:()=>ae(null),onMouseDown:J=>{J.stopPropagation(),ea(J,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:qe+4,y:a+8,width:3,height:se-16,rx:1.5,fill:re==="resize-start"||l==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:qe+We-14,y:a,width:16,height:se,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ae("resize-end"),onMouseLeave:()=>ae(null),onMouseDown:J=>{J.stopPropagation(),ea(J,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:qe+We-7,y:a+8,width:3,height:se-16,rx:1.5,fill:re==="resize-end"||l==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&!oe&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+se/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ae("connect"),onMouseLeave:()=>ae(null),onMouseDown:J=>{J.stopPropagation(),ea(J,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+se/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Ye&&R&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+se/2,x2:R.x,y2:R.y,stroke:K?o.statusCompleted:o.accent,strokeWidth:K?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:K?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:R.x,cy:R.y,r:K?8:6,fill:K?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),K&&jsxRuntime.jsx(framerMotion.motion.text,{x:R.x+15,y:R.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:R.x+10},animate:{opacity:1,x:R.x+15},transition:{duration:.2},children:"Connect"})]}),(W||oe)&&!Ye&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:qe-2,y:a-2,width:We+4,height:se+4,rx:Xe+2,fill:"none",stroke:oe?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:oe?.6:.4,initial:{opacity:0},animate:{opacity:oe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:b,y1:0,x2:b,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:b+M,y1:0,x2:b+M,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&!oe&&!e.segments&&!T&&(()=>{let ve=a<100,Be=ve?a+se+13:a-82-13,Ae=ve?`M ${qe+We/2-6} ${a+se+3} L ${qe+We/2} ${a+se+13} L ${qe+We/2+6} ${a+se+3}`:`M ${qe+We/2-6} ${a-13} L ${qe+We/2} ${a-3} L ${qe+We/2+6} ${a-13}`,ot=Be+22,U=Be+40,Y=Be+55,de=Be+70,ze=ve?Be+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ve?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ve?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ae,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:qe+We/2-120,y:Be,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:qe+We/2,y:ot,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:qe+We/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:qe+We/2-70,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.startDate)}),jsxRuntime.jsx("text",{x:qe+We/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:qe+We/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.endDate)}),jsxRuntime.jsx("text",{x:qe+We/2+10,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:qe+We/2+65,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Zt()}),jsxRuntime.jsx("text",{x:qe+We/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:qe+We/2+65,y:Y,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:qe+We/2-110,y:de,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:qe+We/2-50,y:de,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Re=>Re.name).join(", ").substring(0,30),e.assignees.map(Re=>Re.name).join(", ").length>30?"...":""]})]}),!ve&&jsxRuntime.jsx("text",{x:qe+We/2,y:ze,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Me?"Left: move \u2022 Right: resize":Mt?"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 Ec({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,p=82,i=13,u=m?o+n+i:o-p-i,d=m?`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}`,g=u+22,h=u+40,C=u+55,T=u+70,v=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),y=()=>{if(!a.startDate||!a.endDate)return "N/A";let l=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${l} day${l!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:g,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: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?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:y()}),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:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(l=>l.name).join(", ").substring(0,30),a.assignees.map(l=>l.name).join(", ").length>30?"...":""]})]})]})})}function $n({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:m=false}){let[p,i]=react.useState(false),[u,d]=react.useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,v=5,y=20,c=!C&&a<=e,k,l;if(C)if(l=(e+a)/2,n==="squared")k=`M ${e} ${t} L ${a} ${r}`;else {let re=Math.min(Math.abs(a-e)/3,30);k=`M ${e} ${t} C ${e+re} ${t}, ${a-re} ${r}, ${a} ${r}`;}else if(l=a-y,c){let ae=e+15,pe=a-y,fe=h?t+20:t-20;l=pe,n==="squared"?k=`M ${e} ${t} L ${ae} ${t} L ${ae} ${fe} L ${pe} ${fe} L ${pe} ${r} L ${a} ${r}`:h?k=`M ${e} ${t} L ${ae-v} ${t} Q ${ae} ${t} ${ae} ${t+v} L ${ae} ${fe-v} Q ${ae} ${fe} ${ae-v} ${fe} L ${pe+v} ${fe} Q ${pe} ${fe} ${pe} ${fe+v} L ${pe} ${r-v} Q ${pe} ${r} ${pe+v} ${r} L ${a} ${r}`:k=`M ${e} ${t} L ${ae-v} ${t} Q ${ae} ${t} ${ae} ${t-v} L ${ae} ${fe+v} Q ${ae} ${fe} ${ae-v} ${fe} L ${pe+v} ${fe} Q ${pe} ${fe} ${pe} ${fe-v} L ${pe} ${r+v} Q ${pe} ${r} ${pe+v} ${r} L ${a} ${r}`;}else n==="squared"?k=`M ${e} ${t} L ${l} ${t} L ${l} ${r} L ${a} ${r}`:h?k=`M ${e} ${t} L ${l-v} ${t} Q ${l} ${t} ${l} ${t+v} L ${l} ${r-v} Q ${l} ${r} ${l+v} ${r} L ${a} ${r}`:k=`M ${e} ${t} L ${l-v} ${t} Q ${l} ${t} ${l} ${t-v} L ${l} ${r+v} Q ${l} ${r} ${l+v} ${r} L ${a} ${r}`;let N=5,x=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,B=o.dependency,b=o.dependencyHover||B,D="#f87171",M="rgba(248, 113, 113, 0.15)",w=l,R=(t+r)/2;if(u)if(C)w=Math.max(e+10,Math.min(a-10,u.x)),R=t;else if(c){let re=e+15,ae=a-y,pe=h?t+20:t-20,fe=[[e,t,re,t],[re,t,re,pe],[re,pe,ae,pe],[ae,pe,ae,r],[ae,r,a,r]],Ie=1/0,F={x:w,y:R};for(let O of fe){let L=$(u.x,u.y,O[0],O[1],O[2],O[3]),j=Math.hypot(u.x-L.x,u.y-L.y);j<Ie&&(Ie=j,F=L);}w=F.x,R=F.y;}else {let re=[[e,t,l,t],[l,t,l,r],[l,r,a,r]],ae=1/0,pe={x:w,y:R};for(let fe of re){let Ie=$(u.x,u.y,fe[0],fe[1],fe[2],fe[3]),F=Math.hypot(u.x-Ie.x,u.y-Ie.y);F<ae&&(ae=F,pe=Ie);}w=pe.x,R=pe.y;}function $(re,ae,pe,fe,Ie,F){let O=Ie-pe,L=F-fe,j=O*O+L*L;if(j===0)return {x:pe,y:fe};let X=((re-pe)*O+(ae-fe)*L)/j;return X=Math.max(0,Math.min(1,X)),{x:pe+X*O,y:fe+X*L}}let K=re=>{let ae=re.currentTarget.ownerSVGElement;if(!ae)return;let pe=ae.getBoundingClientRect();d({x:re.clientX-pe.left,y:re.clientY-pe.top});},te=()=>{i(false),d(null);};return m?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:K,children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:b,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:b,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:b,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:b,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:re=>{re.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:w,cy:R,r:9,fill:M,stroke:D,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:w-3,y1:R-3,x2:w+3,y2:R+3,stroke:D,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:w+3,y1:R-3,x2:w-3,y2:R+3,stroke:D,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:p?b:B,strokeWidth:p?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:x,fill:"none",stroke:p?b:B,strokeWidth:p?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:p?4:3,fill:p?b:B,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),p&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:re=>{re.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:w,cy:R,r:9,fill:M,stroke:D,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:w-3,y1:R-3,x2:w+3,y2:R+3,stroke:D,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:w+3,y1:R-3,x2:w-3,y2:R+3,stroke:D,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function zn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,p=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ue={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(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,m=new Set,p=i=>{if(!n.has(i)){n.add(i),m.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&p(d))return true;if(m.has(d))return true}}return m.delete(i),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ue.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ue.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ue.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=ue.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=ue.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=ue.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)=>ue.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ue.findTaskById(e,t);return !a||!a.dependencies?[]:ue.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ue.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ue.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=ue.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=>ue.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=ue.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"]],m=s.map(p=>{let i=p.startDate&&p.endDate?ue.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?ue.formatDate(p.startDate):"N/A",p.endDate?ue.formatDate(p.endDate):"N/A",i>0?`${i} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:n,body:m,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ue.flattenTasks(e).map(p=>{let i=p.startDate&&p.endDate?ue.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?ue.formatDate(p.startDate):"","End Date":p.endDate?ue.formatDate(p.endDate):"","Duration (days)":i>0?i:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(u=>u.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),s=a.utils.json_to_sheet(o),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 m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ue.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=ue.getEarliestStartDate(e)||new Date,m=ue.getLatestEndDate(e)||new Date,p=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?ue.calculateDuration(g.startDate,g.endDate):0,v=(g.dependencies||[]).filter(y=>o.has(y)).map(y=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function yi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);},g=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:d("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:d("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(g).map(([i,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:i})}),jsxRuntime.jsx("div",{children:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function xi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,c]=react.useState("export"),[g,i]=react.useState("json"),[u,l]=react.useState(null),b=react.useRef(null);if(!t)return null;let v=async()=>{let C=o?.current||void 0,h=await dd(e,g,C);cd(h,g);},k=async C=>{let h=C.target.files?.[0];if(h){try{let f=await ud(h),p=h.name.endsWith(".json")?"json":"csv",x=pd(f,p);l(x),x.success&&r&&r(x,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}b.current&&(b.current.value="");}};return jsxRuntime.jsxs("div",{className:d("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:d("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:d("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(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:d("p-4 rounded-lg border-2 transition-all text-center",g===C?"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:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),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:v,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:b,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>b.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:d("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:d("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((C,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},h))})]})]})]})]})]})}var g0=["URGENT","HIGH","MEDIUM","LOW"],f0=[{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"}],b0=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ki({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:c,availableUsers:g=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:b=false,groupBy:v="none",onGroupByChange:k}){let[C,h]=react.useState(true),f=react.useCallback(w=>{a({search:w.target.value});},[a]),p=react.useCallback(w=>{a({dateFilter:w.target.value});},[a]),x=react.useCallback(w=>{r({by:w.target.value});},[r]),m=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${b?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:w=>{w.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:C?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!C&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),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:p,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:w=>{let B=w.target.value;a({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),g0.map(w=>jsxRuntime.jsx("option",{value:w,children:w},w))]})}),g.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:w=>{let B=w.target.value;a({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),g.map(w=>jsxRuntime.jsx("option",{value:w.id,children:w.name},w.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:w=>{let B=w.target.value;a({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(w=>jsxRuntime.jsx("option",{value:w,children:w},w))]})}),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:x,className:"filter-bar__select filter-bar__select--sm",children:f0.map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:v,onChange:w=>k(w.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:b0.map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function wi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:c,onExportGanttCSV:g}){let[i,u]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let v=k=>{l.current&&!l.current.contains(k.target)&&u(false);};return i&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v);}},[i]);let b=v=>{v(),u(false);};return jsxRuntime.jsxs("div",{className:d("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",v.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",v.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(()=>g?.()),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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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 Ci={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"}},Ti={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"}},Ni={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"}},lo={dark:Ci,light:Ti,neutral:Ni},On="dark";var $n=react.createContext(void 0),D0="asakaa-theme";function Sc({children:e,defaultTheme:t=On,storageKey:a=D0}){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,g=lo[r];Object.entries(g.colors).forEach(([u,l])=>{l&&c.style.setProperty(`--theme-${S0(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let b=g.colors[u];b&&c.style.setProperty(l,b);}),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:lo};return jsxRuntime.jsx($n.Provider,{value:n,children:e})}function Mo(){let e=react.useContext($n);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function S0(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Di({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Mo();return e?jsxRuntime.jsxs("div",{className:d("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(lo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:d("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 Ec(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var Un={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",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},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",week:"Week",clickToSetDates:"Click to set dates..."},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"}},Pc={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",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},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",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},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"}},Si={en:Un,es:Pc};function Mc(e){return Si[e]||Si.en}function Ei(e,t){let a=Mc(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 Fo=react.createContext(Un);function _r(){return react.useContext(Fo)}function G0({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[c,g]=react.useState(false),[i,u]=react.useState(null),l=react.useRef(null),b=_r();if(react.useEffect(()=>{let h=f=>{l.current&&!l.current.contains(f.target)&&g(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||a||r||o||s||n))return null;let k=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(h=>h.handler),C=async(h,f)=>{if(f){u(h);try{await f();}catch(p){console.error(`Export ${h} failed:`,p);}finally{u(null),g(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(!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:b.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:k.map((h,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<k.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:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function _0({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 V0({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 j0({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=_r();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],g=c.find(i=>i.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"}: ${g}`,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((i,u)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:u<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function K0({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=_r();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],g=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:g||r?e.accentLight:e.bgSecondary,border:`1px solid ${g||r?e.accent:e.borderLight}`,color:g||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),g&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsxs(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-56 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:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:c.map((i,u)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:l?e.accent:e.border,backgroundColor:l?e.accent:"transparent"},children:l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:l?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),g&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function Hn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:c,onRowDensityChange:g,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:b,taskFilter:v="all",onTaskFilterChange:k,onExportPNG:C,onExportPDF:h,onExportExcel:f,onExportCSV:p,onExportJSON:x,onExportMSProject:m}){let N=_r(),w=C||h||f||p||x||m,B=[{value:"day",label:N.toolbar.day},{value:"week",label:N.toolbar.week},{value:"month",label:N.toolbar.month}],y=[{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(V0,{options:B,value:t,onChange:I=>a(I),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(j0,{theme:e,value:c,onChange:g}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(K0,{theme:e,value:v,onChange:k})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||N.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(G0,{theme:e,onExportPNG:C,onExportPDF:h,onExportExcel:f,onExportCSV:p,onExportJSON:x,onExportMSProject:m}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(_0,{options:y,value:s,onChange:I=>n(I),theme:e})]})]})}function Wn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),c=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:g,onClick:()=>{if(!r&&g.current){let u=g.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(ft,{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"}),i.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:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.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 Lo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[c,g]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,b=8,v=window.innerWidth,k=window.innerHeight,C=t,h=a;t+u+b>v&&(C=t-u,C<b&&(C=b)),a+l+b>k&&(h=k-l-b,h<b&&(h=b)),g({x:C,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=b=>{n.current&&!n.current.contains(b.target)&&o();},l=b=>{b.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=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:i(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:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.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 Wt={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 Hc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:c,onTaskOutdent:g,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:b=true}){let v=react.useRef(false),k=react.useCallback(x=>{v.current=x;},[]),C=react.useCallback(x=>{let m=[],N=w=>{for(let B of w)m.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&N(B.subtasks);};return N(x),m},[]),h=react.useCallback(()=>{let x=C(e);for(let m of x)if(t.has(m.id))return m;return null},[e,t,C]),f=react.useCallback((x,m)=>{let N=C(e);if(N.length===0)return;let w=h();if(!w){a(N[0].id,false);return}let B=N.findIndex(P=>P.id===w.id);if(B===-1)return;let y=x==="up"?B-1:B+1;if(y<0||y>=N.length)return;let I=N[y];a(I.id,m);},[e,h,C,a]),p=react.useCallback(x=>{if(!b)return;let m=x.target;if(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable||v.current){x.key==="Escape"&&(m.blur(),v.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,y=Array.from(t),I=h();if(x.key==="ArrowUp"){x.preventDefault(),f("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),f("down",x.shiftKey);return}if(I&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!I.isExpanded||x.key==="ArrowLeft"&&I.isExpanded)&&u(I.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){y.length>0&&(x.preventDefault(),n(y,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){y.length>0&&(x.preventDefault(),c(y));return}if(x.key==="Tab"&&x.shiftKey){y.length>0&&(x.preventDefault(),g(y));return}if(x.key==="Enter"&&!x.shiftKey&&!B){I&&(x.preventDefault(),r(I.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!B){I&&(x.preventDefault(),r(I.id,"above"));return}if(x.key==="Enter"&&B){I&&(x.preventDefault(),l(I.id));return}if(x.key==="F2"){I&&(x.preventDefault(),i(I.id));return}if(x.key==="Delete"||x.key==="Backspace"&&B){y.length>0&&(x.preventDefault(),o(y));return}if(x.key==="d"&&B&&!x.shiftKey){y.length>0&&(x.preventDefault(),s(y));return}},[b,t,h,f,r,o,s,n,c,g,i,u,l]);return react.useEffect(()=>{if(b)return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p);}},[b,p]),{setIsEditing:k}}function Gc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(b=>{let v=new Set(b);return v.has(l)?v.delete(l):v.add(l),v}),r(l);},[]),n=react.useCallback((l,b)=>{if(!a){o(l);return}let v=b.indexOf(a),k=b.indexOf(l);if(v===-1||k===-1){o(l);return}let C=Math.min(v,k),h=Math.max(v,k),f=b.slice(C,h+1);t(new Set(f)),r(l);},[a,o]),c=react.useCallback((l,b,v,k)=>{k?n(l,b):v?s(l):o(l);},[o,s,n]),g=react.useCallback((l,b)=>{b?t(v=>{let k=new Set(v);return k.add(l),k}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:c,handleKeyboardSelection:g,clearSelection:i,isTaskSelected:u}}function Io(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 _c(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=_c(a.subtasks,t);if(r)return r}}return null}function Ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ii(a.subtasks,t);if(r)return r}return null}function Bi(e,t){if(t.length===0)return e;let a=Io(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,b)=>{let v=[];return {tasks:l.filter(C=>{if(b.has(C.id))return v.push(C),false;if(C.subtasks){let h=n(C.subtasks,b);C.subtasks=h.tasks,v.push(...h.removed);}return true}),removed:v}},c=(l,b,v)=>l.map(k=>k.id===b?{...k,subtasks:[...k.subtasks||[],...v],isExpanded:true}:k.subtasks?{...k,subtasks:c(k.subtasks,b,v)}:k),g=new Set(t),{tasks:i,removed:u}=n(e,g);return c(i,s.id,u)}function Ri(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ii(a,r);if(!o)continue;let s=Ii(a,o.id),n=(i,u,l)=>{for(let b=0;b<i.length;b++){let v=i[b];if(v.id===u&&v.subtasks){let k=v.subtasks.findIndex(C=>C.id===l);if(k!==-1){let[C]=v.subtasks.splice(k,1);return C}}if(v.subtasks){let k=n(v.subtasks,u,l);if(k)return k}}return null},c=(i,u,l)=>{let b=i.findIndex(v=>v.id===u);if(b!==-1)return i.splice(b+1,0,l),i;for(let v of i)v.subtasks&&c(v.subtasks,u,l);return i},g=n(a,o.id,r);g&&(s&&s.subtasks?c(s.subtasks,o.id,g):c(a,o.id,g));}return a}function Oi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,c,g)=>{let i=n.findIndex(l=>l.id===c);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,c,g))return true;return false}let u=g==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function $i(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 Ui(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 g=n[c],i={...g,id:`${g.id}-copy-${Date.now()}`,name:`${g.name} (Copy)`,subtasks:g.subtasks?s(g.subtasks):void 0};return n.splice(c+1,0,i),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 Vc(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=g=>{let i=g.findIndex(l=>l.id===t);if(i===-1){for(let l of g)if(l.subtasks&&c(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return g.splice(u,0,n),true};return c(r),{tasks:r,newTask:n}}function zi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:zi(r.subtasks,t,a)}:r)}function Hi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Hi(a.subtasks,t)}:a)}function Wi(e,t){let a=u=>{for(let l of u){if(l.id===t)return l;if(l.subtasks){let b=a(l.subtasks);if(b)return b}}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,g={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(c),color:r?.color||"#3B82F6"},i=u=>u.map(l=>{if(l.id===t){let b=l.subtasks||[];return {...l,subtasks:[...b,g],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:g}}function jc(e,t,a,r){if(t===a)return e;let o=_c(e,t);if(!o)return e;if(a){let c=(g,i)=>{if(!g.subtasks)return false;for(let u of g.subtasks)if(u.id===i||c(u,i))return true;return false};if(c(o,a))return e}let s=c=>c.filter(g=>g.id!==t).map(g=>g.subtasks&&g.subtasks.length>0?{...g,subtasks:s(g.subtasks)}:g),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=g=>g.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,b=[...u];return b.splice(l,0,{...o,parentId:a}),{...i,subtasks:b,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});n=c(n);}return n}function Vn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:c,onTaskToggle:g,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:b,onTaskUpdate:v,onTaskIndent:k,onTaskOutdent:C,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:p,onTaskCreate:x,onTaskRename:m,onCreateSubtask:N,onOpenTaskModal:w,onDeleteRequest:B,onTaskReparent:y}){let I=react.useContext(Fo),[P,T]=react.useState(null),[W,O]=react.useState(null),[q,te]=react.useState(""),ne=react.useRef(null),[re,ce]=react.useState(null),[be,Le]=react.useState(0),[A,R]=react.useState(0),[L,j]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[X,z]=react.useState(null),[ve,se]=react.useState(null),[Ie,qe]=react.useState(null),Qe=react.useRef(0),ie=5,Xe=react.useRef(false),[lt,kt]=react.useState(null),[yt,$]=react.useState(false),[fe,Ae]=react.useState(null),[G,oe]=react.useState(false),xe=react.useRef(null);react.useEffect(()=>{function U(Y){xe.current&&!xe.current.contains(Y.target)&&oe(false);}if(G)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[G]),react.useEffect(()=>{W&&ne.current&&(ne.current.focus(),ne.current.select());},[W]),react.useEffect(()=>{if(!re)return;let U=pe=>{let _e=pe.clientX-be,ze=A+_e;b?.(re,ze);},Y=()=>{ce(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Y),document.body.style.cursor="",document.body.style.userSelect="";}},[re,be,A,b]);let{selectedTaskIds:Oe,handleTaskClick:ye,isTaskSelected:it}=Gc(),{setIsEditing:Ue}=Hc({tasks:e,selectedTaskIds:Oe,onTaskSelect:(U,Y)=>{let _e=Io(e).map(ze=>ze.id);ye(U,_e,Y||false,false);},onTaskCreate:x||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:p||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:U=>{let Y=Io(e).find(pe=>pe.id===U);Y&&Ve(Y);},onTaskToggleExpand:g||(()=>{}),onOpenTaskModal:U=>{let Y=Io(e).find(pe=>pe.id===U);Y&&w&&w(Y);},enableKeyboard:true}),wt=(U,Y=0)=>{let pe=[];for(let _e of U)pe.push({task:_e,level:Y}),_e.subtasks&&_e.subtasks.length>0&&_e.isExpanded&&pe.push(...wt(_e.subtasks,Y+1));return pe},ut=wt(e),Bt=48,jt=Math.max(ut.length*a,600-Bt),Se=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Ve=U=>{O(U.id),te(U.name),Ue(true);},ua=U=>{q.trim()&&q!==e.find(Y=>Y.id===U)?.name&&m?.(U,q.trim()),O(null),te(""),Ue(false);},Ze=()=>{O(null),te(""),Ue(false);},Ke=(U,Y)=>{Y.stopPropagation(),N?.(U.id);},F=(U,Y)=>{Y.preventDefault(),Qe.current=Y.clientY,z(U),Xe.current=false,$(false),kt({x:Y.clientX,y:Y.clientY});},Te=U=>{if(!X||(Math.abs(U.clientY-Qe.current)>ie&&!Xe.current&&(Xe.current=true,$(true)),kt({x:U.clientX,y:U.clientY}),!Xe.current))return;let pe=document.querySelectorAll("[data-task-row]"),_e=null,ze=null;pe.forEach(H=>{let le=H.getBoundingClientRect(),He=H.getAttribute("data-task-row");if(He&&He!==X&&U.clientY>=le.top&&U.clientY<=le.bottom){_e=He;let Ft=U.clientY-le.top,rt=le.height;Ft<rt*.25?ze="above":Ft>rt*.75?ze="below":ze="child";}}),se(_e),qe(ze);},Z=()=>{if(Xe.current&&X&&ve&&Ie){if(Ie==="child")y?.(X,ve);else if(Ie==="above"||Ie==="below"){let U=(_e,ze,H=null)=>{for(let le of _e){if(le.id===ze)return H;if(le.subtasks){let He=U(le.subtasks,ze,le.id);if(He!==void 0)return He}}},Y=U(e,ve,null),pe=(_e,ze)=>{let H=_e.findIndex(le=>le.id===ze);return Ie==="below"?H+1:H};if(Y===null){let _e=pe(e,ve);y?.(X,null,_e);}else {let _e=ut.find(ze=>ze.task.id===Y)?.task;if(_e?.subtasks){let ze=pe(_e.subtasks,ve);y?.(X,Y,ze);}}}}z(null),se(null),qe(null),kt(null),Xe.current=false,$(false);};react.useEffect(()=>{if(X)return document.addEventListener("mousemove",Te),document.addEventListener("mouseup",Z),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Te),document.removeEventListener("mouseup",Z),document.body.style.cursor="",document.body.style.userSelect="";}},[X,ve,Ie]);let ke=(U,Y,pe)=>{switch(U.id){case "name":let _e=W===Y.id,ze=P===Y.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pe*20}px`},children:[y&&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:ze?1:.3},onMouseDown:V=>F(Y.id,V),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),Y.subtasks&&Y.subtasks.length>0?jsxRuntime.jsx("button",{onClick:V=>{V.stopPropagation(),g?.(Y.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Y.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:Y.color||"#3B82F6",opacity:Y.parentId?.6:1,borderColor:Y.isMilestone?t.accent:"transparent",borderWidth:Y.isMilestone?"2px":"0px"},title:Y.isMilestone?"Milestone":Y.parentId?"Subtask":"Task"})}),_e?jsxRuntime.jsx("input",{ref:ne,type:"text",value:q,onChange:V=>te(V.target.value),onKeyDown:V=>{V.key==="Enter"?ua(Y.id):V.key==="Escape"&&Ze();},onBlur:()=>ua(Y.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:V=>V.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:Y.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Y.parentId?"13px":"14px",fontWeight:Y.isMilestone?600:Y.parentId?400:600,letterSpacing:Y.parentId?"0":"-0.01em"},title:Y.name,children:Y.name}),ze&&!_e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:V=>V.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:V=>Ke(Y,V),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:V=>{V.stopPropagation(),Ve(Y);},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 le=U.id==="startDate"?"startDate":"endDate",He=Y[le],Ft=fe?.taskId===Y.id&&fe?.field===le,rt=V=>V?(typeof V=="string"?new Date(V):V).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:V=>V.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:V=>{if(Ft)Ae(null);else {let Me=V.currentTarget.getBoundingClientRect();Ae({taskId:Y.id,field:le,month:He?typeof He=="string"?new Date(He):He:new Date,position:{top:Me.bottom+4,left:Me.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:rt(He)})]}),Ft&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ae(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:fe?.position.top,left:fe?.position.left},onClick:V=>V.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let V=new Date,Me=new Date(V);Me.setDate(V.getDate()+1);let Ye=new Date(V);Ye.setDate(V.getDate()+7);let Pt=new Date(V);return Pt.setDate(V.getDate()+14),[{label:"Hoy",date:V},{label:"Ma\xF1ana",date:Me},{label:"Pr\xF3xima semana",date:Ye},{label:"2 semanas",date:Pt}].map((Ge,vt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Re=>Re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Re=>Re.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(Y.id,{[le]:Ge.date}),Ae(null);},children:Ge.label},vt))})(),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:V=>V.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:V=>V.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(Y.id,{[le]:void 0}),Ae(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:()=>Ae(V=>V?{...V,month:new Date(V.month.getFullYear(),V.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:fe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ae(V=>V?{...V,month:new Date(V.month.getFullYear(),V.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((V,Me)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:V},Me))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let V=fe?.month||new Date,Me=V.getFullYear(),Ye=V.getMonth(),Pt=new Date(Me,Ye,1).getDay(),de=new Date(Me,Ye+1,0).getDate(),Ge=new Date,vt=[];for(let gt=Pt-1;gt>=0;gt--)vt.push({day:new Date(Me,Ye,-gt).getDate(),date:new Date(Me,Ye-1,new Date(Me,Ye,-gt).getDate()),isCurrentMonth:false});for(let gt=1;gt<=de;gt++)vt.push({day:gt,date:new Date(Me,Ye,gt),isCurrentMonth:true});let Re=42-vt.length;for(let gt=1;gt<=Re;gt++)vt.push({day:gt,date:new Date(Me,Ye+1,gt),isCurrentMonth:false});return vt.map((gt,va)=>{let ka=gt.date.toDateString()===Ge.toDateString(),je=(He?typeof He=="string"?new Date(He):He:null)?.toDateString()===gt.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:gt.isCurrentMonth?je?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:je?"#3B82F6":"transparent",boxShadow:ka&&!je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{v?.(Y.id,{[le]:gt.date}),Ae(null);},children:gt.day},va)})})()})]})]})]}),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:Se(Y)})});case "assignees":let ya=r.filter(V=>Y.assignees?.some(Me=>Me.name===V.name||Me.initials===V.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:V=>V.stopPropagation(),children:jsxRuntime.jsx(ao,{assignedUsers:ya,availableUsers:r,onChange:V=>{let Me=V.map(Ye=>({id:Ye.id,name:Ye.name,initials:Ye.initials,color:Ye.color}));v?.(Y.id,{assignees:Me.length>0?Me:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:V=>V.stopPropagation(),children:jsxRuntime.jsx(Fd,{status:Y.status||"todo",onChange:V=>{v?.(Y.id,{status:V,progress:V==="completed"?100:Y.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:`${Y.progress}%`,backgroundColor:Y.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:[Y.progress,"%"]})]});case "priority":let $a={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ct={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},M=$a[Y.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:V=>V.stopPropagation(),children:jsxRuntime.jsx(eo,{priority:M,onChange:V=>{V&&v?.(Y.id,{priority:ct[V]||"medium"});}})});default:return null}},Ce=U=>[{id:"hide",label:"Hide Column",icon:Wt.Hide,onClick:()=>l(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Wt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Wt.SortDesc,onClick:()=>{}}],$e=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{B?B(U.id,U.name):f?.([U.id]);}}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:Wt.Pencil,onClick:()=>{n?.(U);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:I?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Wt.MarkIncomplete,onClick:()=>{v?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:I?.contextMenu?.setInProgress||"Set In Progress",icon:Wt.SetInProgress,onClick:()=>{v?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:I?.contextMenu?.markComplete||"Mark Complete",icon:Wt.MarkComplete,onClick:()=>{v?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:Wt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{B?B(U.id,U.name):f?.([U.id]);}}],Be=u.filter(U=>U.visible),st=Be.reduce((U,Y)=>U+Y.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:st},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Bt}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:Be.map((U,Y)=>{let pe=Y===Be.length-1,_e=U.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_e?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(_e?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),j({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:U.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.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:U.label,children:U.label}),U.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:re===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),ce(U.id),Le(ze.clientX),R(U.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},U.id)})}),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(Wn,{columns:u,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>oe(!G),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"})}),G&&jsxRuntime.jsxs("div",{ref:xe,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>oe(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:jt},children:ut.map(({task:U,level:Y},pe)=>{let _e=it(U.id),ze=ve===U.id,H=ze&&Ie==="above",le=ze&&Ie==="below",He=ze&&Ie==="child",Ft={};return He&&(Ft.backgroundColor=`${t.accent}15`,Ft.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${X===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_e?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_e?t.accentLight:He?`${t.accent}15`:pe%2===0?t.bgPrimary:t.bgGrid,...Ft},onMouseEnter:()=>T(U.id),onMouseLeave:()=>T(null),onClick:rt=>{let $a=Io(e).map(V=>V.id),M=navigator.platform.toUpperCase().indexOf("MAC")>=0?rt.metaKey:rt.ctrlKey;ye(U.id,$a,M,rt.shiftKey),s?.(U);},onDoubleClick:rt=>{rt.stopPropagation(),n?.(U);},onContextMenu:rt=>{rt.preventDefault(),j({isOpen:true,x:rt.clientX,y:rt.clientY,type:"task",task:U}),c?.(U,rt);},whileHover:{backgroundColor:_e?t.accentLight:t.hoverBg},children:[H&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((rt,ya)=>{let $a=ya===Be.length-1,ct=rt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${ct?"justify-start":"justify-center"}`,style:{width:`${rt.width}px`,minWidth:`${rt.minWidth??(ct?200:60)}px`,maxWidth:`${rt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:$a?"none":`1px solid ${P===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ke(rt,U,ct?Y:0)},`${U.id}-${rt.id}`)})]},U.id)})}),jsxRuntime.jsx(Lo,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?Ce(L.columnId):L.type==="task"&&L.task?$e(L.task):[],onClose:()=>j({...L,isOpen:false}),theme:t}),yt&&lt&&X&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:lt.x+12,top:lt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=ut.find(Y=>Y.task.id===X)?.task;return U?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:U.name})}):null})()}),document.body)]})}function Jc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,c]=react.useState(e),[g,i]=react.useState(t),[u,l]=react.useState(null),[b,v]=react.useState(null),[k,C]=react.useState(null),[h,f]=react.useState(null),[p,x]=react.useState(0),[m,N]=react.useState(0),[w,B]=react.useState(null),[y,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:c,ghostWidth:g,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:b,setHoveredTaskId:v,activeZone:k,setActiveZone:C,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:p,setDraggedSegmentStartX:x,segmentDragOffsetX:m,setSegmentDragOffsetX:N,hoveredSegmentIndex:w,setHoveredSegmentIndex:B,isHovered:y,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(q,te)=>{r("none"),l(null),v(null),c(q),i(te),N(0),f(null),x(0);}}}function Kn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:c,onClick:g,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:b,allTaskPositions:v=[],onDragMove:k,onHoverChange:C}){let h=Jc(t,r),f=react.useRef(null),p=react.useRef(null),x=react.useRef(null),{dragMode:m,setDragMode:N,dragOffset:w,setDragOffset:B,ghostX:y,setGhostX:I,ghostWidth:P,setGhostWidth:T,connectionLine:W,setConnectionLine:O,hoveredTaskId:q,setHoveredTaskId:te,activeZone:ne,setActiveZone:re,draggedSegmentIndex:ce,setDraggedSegmentIndex:be,draggedSegmentStartX:Le,setDraggedSegmentStartX:A,segmentDragOffsetX:R,setSegmentDragOffsetX:L,hoveredSegmentIndex:j,setHoveredSegmentIndex:X,isHovered:z,setIsHovered:ve,isDragging:se,isResizing:Ie,isConnecting:qe,resetDragState:Qe}=h,ie=32,Xe=8,lt=e.endDate&&e.endDate<new Date&&e.progress<100,kt=e.isCriticalPath,yt=o.name==="neutral"||o.today==="#1C1917",$=e.status==="completed"||e.progress===100,fe={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},G=e.isCriticalPath||lt?"#DC2626":e.color?e.color:e.priority&&fe[e.priority]?fe[e.priority]:o.taskBarPrimary,xe=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),Oe=r<50,ye=r<40;react.useEffect(()=>{if(C)if(z&&!se&&!e.segments){let Z=a<100;C({task:e,x:t,y:a,width:r,height:ie,showBelow:Z});}else C(null);},[z,se,e,t,a,r,ie,C]);let it=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ue=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},wt=Z=>Math.round(Z/s)*s,ut=Z=>{let ke=Math.round(Z/s),Ce=new Date(n);return Ce.setDate(Ce.getDate()+ke),Ce},Bt=(Z,ke)=>{for(let Ce of v){if(Ce.id===e.id)continue;let $e=5;if(Z>=Ce.x-$e&&Z<=Ce.x+Ce.width+$e&&ke>=Ce.y-$e&&ke<=Ce.y+Ce.height+$e)return Ce.id}return null},jt=react.useCallback((Z,ke,Ce)=>{Z.preventDefault(),Z.stopPropagation();let $e=f.current?.ownerSVGElement;if(!$e)return;let Be=$e.createSVGPoint();Be.x=Z.clientX,Be.y=Z.clientY;let st=Be.matrixTransform($e.getScreenCTM()?.inverse()),U=Ce!==void 0?Ce:t,Y=ke;if(!Y){let pe=st.x-U;Z.shiftKey?(Y="connect",O({x:t+r,y:a+ie/2})):Z.ctrlKey||Z.metaKey?Y="move":Z.altKey?Y=pe<r/2?"resize-start":"resize-end":ye?pe<r/2?Y="move":Y="resize-end":Oe?pe<=xe/2?Y="resize-start":pe>=r-xe/2?Y="resize-end":Y="move":pe<=xe?Y="resize-start":pe>=r-xe?Y="resize-end":Y="move";}N(Y),ve(false),re(null),Y==="move"?B(st.x-U):Y==="connect"?O({x:t+r,y:a+ie/2}):B(0),I(U),T(r);},[t,r,a,ie]),Se=react.useCallback(Z=>{let ke=f.current?.ownerSVGElement;if(!ke)return;let Ce=ke.closest(".gantt-timeline-scroll");if(!Ce)return;let $e=Ce.getBoundingClientRect(),Be=60,st=15,U=0;if(Z.clientX<$e.left+Be){let Y=$e.left+Be-Z.clientX;U=-Math.min(st,Y/2);}else if(Z.clientX>$e.right-Be){let Y=Z.clientX-($e.right-Be);U=Math.min(st,Y/2);}return U!==0&&(Ce.scrollLeft+=U),U!==0},[]),Ve=react.useCallback(Z=>{if(m==="none")return;x.current=Z;let ke=f.current?.ownerSVGElement;if(!ke)return;if(m==="move"||m==="resize-start"||m==="resize-end"){let Be=Se(Z);Be&&!p.current?p.current=window.setInterval(()=>{x.current&&(Se(x.current),Ve(x.current));},16):!Be&&p.current&&(window.clearInterval(p.current),p.current=null);}let Ce=ke.createSVGPoint();Ce.x=Z.clientX,Ce.y=Z.clientY;let $e=Ce.matrixTransform(ke.getScreenCTM()?.inverse());if(m==="connect"){O({x:$e.x,y:$e.y});let Be=Bt($e.x,$e.y);te(Be);}else if(m==="move"){let Be=$e.x-w,st=wt(Be);I(st),T(r);let U=Math.round((st-t)/s);if(k?.(e.id,U,true),e.segments&&e.segments.length>0&&ce!==null){let Y=st-Le;L(Y);}}else if(m==="resize-start"){let Be=$e.x,st=wt(Be),U=t+r-st;U>=s&&(I(st),T(U));}else if(m==="resize-end"){let Be=$e.x,U=wt(Be)-t;U>=s&&T(U);}},[m,t,r,s,w,e,wt,ce,Le,Bt,te,O,I,T,L,k,Se]),ua=react.useCallback(()=>{if(p.current&&(window.clearInterval(p.current),p.current=null),x.current=null,m!=="none"){if(m==="connect")q&&b&&b(e,q),O(null),te(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),ke,Ce,$e=true;if(m==="move"){if(ke=ut(y),Ce=new Date(ke.getTime()+Z),e.segments&&e.segments.length>0&&ce!==null){let Be=Math.round(R/s),st=e.segments.map((_e,ze)=>{if(ze===ce){let H=new Date(_e.startDate),le=new Date(_e.endDate);return H.setDate(H.getDate()+Be),le.setDate(le.getDate()+Be),{startDate:H,endDate:le}}return _e}),U=st.flatMap(_e=>[_e.startDate,_e.endDate]),Y=new Date(Math.min(...U.map(_e=>_e.getTime()))),pe=new Date(Math.max(...U.map(_e=>_e.getTime())));l?.({...e,segments:st},Y,pe),Qe(t,r);return}}else m==="resize-start"?(ke=ut(y),Ce=e.endDate,ke>Ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),$e=false)):m==="resize-end"?(ke=e.startDate,Ce=ut(y+P),Ce<ke&&(console.warn("Invalid date range: end date must be after or equal to start date"),$e=false)):$e=false;$e&&ke&&Ce&&(Ce.getTime()<ke.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,ke,Ce));}k?.(e.id,0,false),Qe(t,r);}},[m,y,P,e,l,q,b,t,r,s,ut,R,ce,Qe,k]);react.useEffect(()=>{if(m==="none")return;let Z=Ce=>{Ve(Ce);},ke=()=>{ua();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",ke),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",ke),p.current&&(window.clearInterval(p.current),p.current=null);}},[m,Ve,ua]);let Ze=se&&!qe?y:t,Ke=se&&!qe?P:r,F=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:f,"data-task-bar":"true",onClick:()=>!se&&g?.(e),onDoubleClick:Z=>{se||(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!se&&ve(true),onMouseLeave:()=>{se||(ve(false),re(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:ie,fill:"transparent",style:{pointerEvents:"all"}}),z&&!se&&!Oe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:xe,height:ie,fill:ne==="resize-start"?o.accent:"transparent",opacity:ne==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:Z=>jt(Z,"resize-start")}),jsxRuntime.jsx("rect",{x:t+xe,y:a,width:r-xe*2,height:ie,fill:ne==="move"?o.accent:"transparent",opacity:ne==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:Z=>jt(Z,"move")}),jsxRuntime.jsx("rect",{x:t+r-xe,y:a,width:xe,height:ie,fill:ne==="resize-end"?o.accent:"transparent",opacity:ne==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:Z=>jt(Z,"resize-end")})]}),z&&!se&&ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ie,fill:ne==="move"?o.accent:"transparent",opacity:ne==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:Z=>jt(Z,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ie,fill:ne==="resize-end"?o.accent:"transparent",opacity:ne==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:Z=>jt(Z,"resize-end")}),z&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ie-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!qe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:y,y:a,width:P,height:ie,rx:Xe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze,y:a,width:Ke,height:ie,rx:Xe,fill:G,"data-task-class":F,initial:{opacity:0,scale:.95},animate:{opacity:se&&!qe?.15:e.parentId?.6:z?.9:.8,scale:z&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>jt(Z),style:{cursor:se?qe?"crosshair":Ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ze,y:a,width:Ke*(e.progress/100),height:ie,rx:Xe,fill:G,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Z,ke)=>{let Ce=(Z.startDate.getTime()-n.getTime())/864e5*s,Be=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ce+s,st=se&&m==="move"&&ce===ke,U=j===ke,Y=st?Ce+R:Ce;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!se&&X(ke),onMouseLeave:()=>!se&&X(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Y,y:a,width:Be,height:ie,rx:Xe,fill:G,initial:{opacity:0,scale:.95},animate:{opacity:st||e.parentId?.6:U?.9:.8,scale:U&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),be(ke),A(Ce),jt(pe,void 0,Ce);},style:{cursor:se?qe?"crosshair":Ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Y,y:a,width:Be*(e.progress/100),height:ie,rx:Xe,fill:G,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ke}`)}),yt&&(lt||kt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[kt&&!lt&&jsxRuntime.jsx("rect",{x:Ze,y:a,width:Ke,height:ie,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),lt&&jsxRuntime.jsx("rect",{x:Ze,y:a,width:Ke,height:ie,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ke>60&&!e.segments&&(()=>{let Z=c.taskLabel(e),ke=typeof Z=="string"?Z:e.name,Ce=ke.length>Math.floor(Ke/8)?`${ke.substring(0,Math.floor(Ke/8))}...`:ke;return jsxRuntime.jsx("text",{x:Ze+12,y:a+ie/2,dominantBaseline:"middle",fill:$?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:$?"line-through":"none"},children:Ce})})(),Ke>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxRuntime.jsxs("text",{x:Ze+Ke-12,y:a+ie/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&&Ke>80&&!se&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ze+Ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ze+Ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(z||Ie)&&!qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ze-2,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-start"),onMouseLeave:()=>re(null),onMouseDown:Z=>{Z.stopPropagation(),jt(Z,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze+4,y:a+8,width:3,height:ie-16,rx:1.5,fill:ne==="resize-start"||m==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ze+Ke-14,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-end"),onMouseLeave:()=>re(null),onMouseDown:Z=>{Z.stopPropagation(),jt(Z,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze+Ke-7,y:a+8,width:3,height:ie-16,rx:1.5,fill:ne==="resize-end"||m==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&!se&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+ie/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>re("connect"),onMouseLeave:()=>re(null),onMouseDown:Z=>{Z.stopPropagation(),jt(Z,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ie/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ne==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),qe&&W&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ie/2,x2:W.x,y2:W.y,stroke:q?o.statusCompleted:o.accent,strokeWidth:q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:q?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:W.x,cy:W.y,r:q?8:6,fill:q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),q&&jsxRuntime.jsx(framerMotion.motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(z||se)&&!qe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze-2,y:a-2,width:Ke+4,height:ie+4,rx:Xe+2,fill:"none",stroke:se?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:y,y1:0,x2:y,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:y+P,y1:0,x2:y+P,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&!se&&!e.segments&&!C&&(()=>{let Ce=a<100,$e=Ce?a+ie+13:a-82-13,Be=Ce?`M ${Ze+Ke/2-6} ${a+ie+3} L ${Ze+Ke/2} ${a+ie+13} L ${Ze+Ke/2+6} ${a+ie+3}`:`M ${Ze+Ke/2-6} ${a-13} L ${Ze+Ke/2} ${a-3} L ${Ze+Ke/2+6} ${a-13}`,st=$e+22,U=$e+40,Y=$e+55,pe=$e+70,_e=Ce?$e+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Be,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ze+Ke/2-120,y:$e,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:Ze+Ke/2,y:st,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:Ze+Ke/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ze+Ke/2-70,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.startDate)}),jsxRuntime.jsx("text",{x:Ze+Ke/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ze+Ke/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.endDate)}),jsxRuntime.jsx("text",{x:Ze+Ke/2+10,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ze+Ke/2+65,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue()}),jsxRuntime.jsx("text",{x:Ze+Ke/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ze+Ke/2+65,y:Y,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:Ze+Ke/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ze+Ke/2-50,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!Ce&&jsxRuntime.jsx("text",{x:Ze+Ke/2,y:_e,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ye?"Left: move \u2022 Right: resize":Oe?"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 em({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:c}=e,g=82,i=13,u=c?o+n+i:o-g-i,l=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}`,b=u+22,v=u+40,k=u+55,C=u+70,h=m=>m.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),f=()=>{if(!a.startDate||!a.endDate)return "N/A";let m=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${m} day${m!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:g,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:b,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:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?h(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?h(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:f()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:k,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:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(m=>m.name).join(", ").substring(0,30),a.assignees.map(m=>m.name).join(", ").length>30?"...":""]})]})]})})}function Xn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:c=false}){let[g,i]=react.useState(false),[u,l]=react.useState(null),b=r-t,v=b>0,k=Math.abs(b)<5,h=5,f=20,p=!k&&a<=e,x,m;if(k)if(m=(e+a)/2,n==="squared")x=`M ${e} ${t} L ${a} ${r}`;else {let ne=Math.min(Math.abs(a-e)/3,30);x=`M ${e} ${t} C ${e+ne} ${t}, ${a-ne} ${r}, ${a} ${r}`;}else if(m=a-f,p){let re=e+15,ce=a-f,be=v?t+20:t-20;m=ce,n==="squared"?x=`M ${e} ${t} L ${re} ${t} L ${re} ${be} L ${ce} ${be} L ${ce} ${r} L ${a} ${r}`:v?x=`M ${e} ${t} L ${re-h} ${t} Q ${re} ${t} ${re} ${t+h} L ${re} ${be-h} Q ${re} ${be} ${re-h} ${be} L ${ce+h} ${be} Q ${ce} ${be} ${ce} ${be+h} L ${ce} ${r-h} Q ${ce} ${r} ${ce+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${re-h} ${t} Q ${re} ${t} ${re} ${t-h} L ${re} ${be+h} Q ${re} ${be} ${re-h} ${be} L ${ce+h} ${be} Q ${ce} ${be} ${ce} ${be-h} L ${ce} ${r+h} Q ${ce} ${r} ${ce+h} ${r} L ${a} ${r}`;}else n==="squared"?x=`M ${e} ${t} L ${m} ${t} L ${m} ${r} L ${a} ${r}`:v?x=`M ${e} ${t} L ${m-h} ${t} Q ${m} ${t} ${m} ${t+h} L ${m} ${r-h} Q ${m} ${r} ${m+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${m-h} ${t} Q ${m} ${t} ${m} ${t-h} L ${m} ${r+h} Q ${m} ${r} ${m+h} ${r} L ${a} ${r}`;let N=5,w=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,B=o.dependency,y=o.dependencyHover||B,I="#f87171",P="rgba(248, 113, 113, 0.15)",T=m,W=(t+r)/2;if(u)if(k)T=Math.max(e+10,Math.min(a-10,u.x)),W=t;else if(p){let ne=e+15,re=a-f,ce=v?t+20:t-20,be=[[e,t,ne,t],[ne,t,ne,ce],[ne,ce,re,ce],[re,ce,re,r],[re,r,a,r]],Le=1/0,A={x:T,y:W};for(let R of be){let L=O(u.x,u.y,R[0],R[1],R[2],R[3]),j=Math.hypot(u.x-L.x,u.y-L.y);j<Le&&(Le=j,A=L);}T=A.x,W=A.y;}else {let ne=[[e,t,m,t],[m,t,m,r],[m,r,a,r]],re=1/0,ce={x:T,y:W};for(let be of ne){let Le=O(u.x,u.y,be[0],be[1],be[2],be[3]),A=Math.hypot(u.x-Le.x,u.y-Le.y);A<re&&(re=A,ce=Le);}T=ce.x,W=ce.y;}function O(ne,re,ce,be,Le,A){let R=Le-ce,L=A-be,j=R*R+L*L;if(j===0)return {x:ce,y:be};let X=((ne-ce)*R+(re-be)*L)/j;return X=Math.max(0,Math.min(1,X)),{x:ce+X*R,y:be+X*L}}let q=ne=>{let re=ne.currentTarget.ownerSVGElement;if(!re)return;let ce=re.getBoundingClientRect();l({x:ne.clientX-ce.left,y:ne.clientY-ce.top});},te=()=>{i(false),l(null);};return c?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:q,children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:y,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:w,fill:"none",stroke:y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:y,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ne=>{ne.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:T,cy:W,r:9,fill:P,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:T-3,y1:W-3,x2:T+3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:T+3,y1:W-3,x2:T-3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:q,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:x,fill:"none",stroke:g?y:B,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:w,fill:"none",stroke:g?y:B,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:g?4:3,fill:g?y:B,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),g&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ne=>{ne.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:T,cy:W,r:9,fill:P,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:T-3,y1:W-3,x2:T+3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:T+3,y1:W-3,x2:T-3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Zn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),c=16,g=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",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:g(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 he={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(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,g=i=>{if(!n.has(i)){n.add(i),c.add(i);let u=r.get(i)||[];for(let l of u){if(!n.has(l)&&g(l))return true;if(c.has(l))return true}}return c.delete(i),false};return g(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=he.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=he.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=he.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=he.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=he.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=he.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)=>he.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=he.findTaskById(e,t);return !a||!a.dependencies?[]:he.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>he.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>he.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=he.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=>he.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=he.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(g=>{let i=g.startDate&&g.endDate?he.calculateDuration(g.startDate,g.endDate):0;return [g.name,g.startDate?he.formatDate(g.startDate):"N/A",g.endDate?he.formatDate(g.endDate):"N/A",i>0?`${i} days`:"N/A",`${g.progress}%`,g.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=he.flattenTasks(e).map(g=>{let i=g.startDate&&g.endDate?he.calculateDuration(g.startDate,g.endDate):0;return {"Task ID":g.id,"Task Name":g.name,"Start Date":g.startDate?he.formatDate(g.startDate):"","End Date":g.endDate?he.formatDate(g.endDate):"","Duration (days)":i>0?i:"","Progress (%)":g.progress,Status:g.status||"",Assignees:g.assignees?.map(u=>u.name).join(", ")||"",Dependencies:g.dependencies?.join(", ")||"","Is Milestone":g.isMilestone?"Yes":"No","Parent ID":g.parentId||"",Level:g.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=he.flattenTasks(e),o=new Map;r.forEach((b,v)=>{o.set(b.id,v+1);});let s=b=>b.toISOString().replace("Z",""),n=he.getEarliestStartDate(e)||new Date,c=he.getLatestEndDate(e)||new Date,g=r.map((b,v)=>{let k=o.get(b.id),C=b.startDate&&b.endDate?he.calculateDuration(b.startDate,b.endDate):0,h=(b.dependencies||[]).filter(f=>o.has(f)).map(f=>`
113
113
  <PredecessorLink>
114
- <PredecessorUID>${o.get(y)}</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>${C}</UID>
122
- <ID>${h+1}</ID>
123
- <Name>${g.name.replace(/[<>&'"]/g,y=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[y]||y)}</Name>
121
+ <UID>${k}</UID>
122
+ <ID>${v+1}</ID>
123
+ <Name>${b.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>
127
- <WBS>${h+1}</WBS>
128
- <OutlineNumber>${h+1}</OutlineNumber>
129
- <OutlineLevel>${g.level||0}</OutlineLevel>
127
+ <WBS>${v+1}</WBS>
128
+ <OutlineNumber>${v+1}</OutlineNumber>
129
+ <OutlineLevel>${b.level||0}</OutlineLevel>
130
130
  <Priority>500</Priority>
131
- <Start>${g.startDate?s(g.startDate):""}</Start>
132
- <Finish>${g.endDate?s(g.endDate):""}</Finish>
133
- <Duration>PT${T*8}H0M0S</Duration>
131
+ <Start>${b.startDate?s(b.startDate):""}</Start>
132
+ <Finish>${b.endDate?s(b.endDate):""}</Finish>
133
+ <Duration>PT${C*8}H0M0S</Duration>
134
134
  <DurationFormat>7</DurationFormat>
135
- <Work>PT${T*8}H0M0S</Work>
136
- <Stop>${g.endDate?s(g.endDate):""}</Stop>
137
- <Resume>${g.startDate?s(g.startDate):""}</Resume>
135
+ <Work>PT${C*8}H0M0S</Work>
136
+ <Stop>${b.endDate?s(b.endDate):""}</Stop>
137
+ <Resume>${b.startDate?s(b.startDate):""}</Resume>
138
138
  <ResumeValid>0</ResumeValid>
139
139
  <EffortDriven>1</EffortDriven>
140
140
  <Recurring>0</Recurring>
141
141
  <OverAllocated>0</OverAllocated>
142
142
  <Estimated>0</Estimated>
143
- <Milestone>${g.isMilestone?"1":"0"}</Milestone>
144
- <Summary>${g.subtasks&&g.subtasks.length>0?"1":"0"}</Summary>
145
- <Critical>${g.isCriticalPath?"1":"0"}</Critical>
143
+ <Milestone>${b.isMilestone?"1":"0"}</Milestone>
144
+ <Summary>${b.subtasks&&b.subtasks.length>0?"1":"0"}</Summary>
145
+ <Critical>${b.isCriticalPath?"1":"0"}</Critical>
146
146
  <IsSubproject>0</IsSubproject>
147
147
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
148
148
  <ExternalTask>0</ExternalTask>
149
- <EarlyStart>${g.startDate?s(g.startDate):""}</EarlyStart>
150
- <EarlyFinish>${g.endDate?s(g.endDate):""}</EarlyFinish>
151
- <LateStart>${g.startDate?s(g.startDate):""}</LateStart>
152
- <LateFinish>${g.endDate?s(g.endDate):""}</LateFinish>
149
+ <EarlyStart>${b.startDate?s(b.startDate):""}</EarlyStart>
150
+ <EarlyFinish>${b.endDate?s(b.endDate):""}</EarlyFinish>
151
+ <LateStart>${b.startDate?s(b.startDate):""}</LateStart>
152
+ <LateFinish>${b.endDate?s(b.endDate):""}</LateFinish>
153
153
  <StartVariance>0</StartVariance>
154
154
  <FinishVariance>0</FinishVariance>
155
155
  <WorkVariance>0</WorkVariance>
@@ -157,22 +157,22 @@
157
157
  <TotalSlack>0</TotalSlack>
158
158
  <FixedCost>0</FixedCost>
159
159
  <FixedCostAccrual>3</FixedCostAccrual>
160
- <PercentComplete>${g.progress}</PercentComplete>
161
- <PercentWorkComplete>${g.progress}</PercentWorkComplete>
160
+ <PercentComplete>${b.progress}</PercentComplete>
161
+ <PercentWorkComplete>${b.progress}</PercentWorkComplete>
162
162
  <Cost>0</Cost>
163
163
  <OvertimeCost>0</OvertimeCost>
164
164
  <OvertimeWork>PT0H0M0S</OvertimeWork>
165
- <ActualStart>${g.progress>0&&g.startDate?s(g.startDate):""}</ActualStart>
166
- <ActualFinish>${g.progress===100&&g.endDate?s(g.endDate):""}</ActualFinish>
167
- <ActualDuration>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualDuration>
165
+ <ActualStart>${b.progress>0&&b.startDate?s(b.startDate):""}</ActualStart>
166
+ <ActualFinish>${b.progress===100&&b.endDate?s(b.endDate):""}</ActualFinish>
167
+ <ActualDuration>PT${Math.round(C*b.progress/100)*8}H0M0S</ActualDuration>
168
168
  <ActualCost>0</ActualCost>
169
169
  <ActualOvertimeCost>0</ActualOvertimeCost>
170
- <ActualWork>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualWork>
170
+ <ActualWork>PT${Math.round(C*b.progress/100)*8}H0M0S</ActualWork>
171
171
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
172
- <RegularWork>PT${T*8}H0M0S</RegularWork>
173
- <RemainingDuration>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
172
+ <RegularWork>PT${C*8}H0M0S</RegularWork>
173
+ <RemainingDuration>PT${Math.round(C*(100-b.progress)/100)*8}H0M0S</RemainingDuration>
174
174
  <RemainingCost>0</RemainingCost>
175
- <RemainingWork>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingWork>
175
+ <RemainingWork>PT${Math.round(C*(100-b.progress)/100)*8}H0M0S</RemainingWork>
176
176
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
177
177
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
178
178
  <ACWP>0</ACWP>
@@ -191,17 +191,17 @@
191
191
  <PhysicalPercentComplete>0</PhysicalPercentComplete>
192
192
  <EarnedValueMethod>0</EarnedValueMethod>
193
193
  <IsPublished>1</IsPublished>
194
- <CommitmentType>0</CommitmentType>${v}
194
+ <CommitmentType>0</CommitmentType>${h}
195
195
  </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
196
196
  <Project xmlns="http://schemas.microsoft.com/project">
197
197
  <SaveVersion>14</SaveVersion>
198
- <Name>${t.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Name>
199
- <Title>${t.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Title>
198
+ <Name>${t.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Name>
199
+ <Title>${t.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Title>
200
200
  <CreationDate>${s(new Date)}</CreationDate>
201
201
  <LastSaved>${s(new Date)}</LastSaved>
202
202
  <ScheduleFromStart>1</ScheduleFromStart>
203
203
  <StartDate>${s(n)}</StartDate>
204
- <FinishDate>${s(m)}</FinishDate>
204
+ <FinishDate>${s(c)}</FinishDate>
205
205
  <FYStartDate>1</FYStartDate>
206
206
  <CriticalSlackLimit>0</CriticalSlackLimit>
207
207
  <CurrencyDigits>2</CurrencyDigits>
@@ -337,11 +337,11 @@
337
337
  </WeekDays>
338
338
  </Calendar>
339
339
  </Calendars>
340
- <Tasks>${p}
340
+ <Tasks>${g}
341
341
  </Tasks>
342
- </Project>`,u=new Blob([i],{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=ue.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?ue.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,m=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?ue.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){m(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(m);let p=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&p.push(i.id);}}return p},calculateSlack:(e,t)=>{let a=ue.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ue.calculateCriticalPath(e).includes(t))return 0;let o=ue.getDependentTasks(e,t);if(o.length===0){let m=ue.getLatestEndDate(e);if(!m)return null;let p=ue.calculateDuration(a.endDate,m);return Math.max(0,p)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,p)=>m-p)[0];if(!s)return null;let n=ue.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ue.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ue.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ue.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=ue.calculateDuration(n.startDate,n.endDate),p;a!==void 0?(p=new Date(n.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let i=ue.calculateEndDate(p,m),u=d=>d.map(g=>g.id===n.id?{...g,startDate:p,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=ue.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let p=[],i=o.getTime(),u=1e3*60*60*24,d=ue.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let v=ue.getDependentTasks(e,h);for(let y of v){if(!y.startDate||!y.endDate)continue;let c=r.findIndex(w=>w.id===y.id);if(c===-1)continue;let k=y.startDate.getTime(),N=(y.endDate.getTime()-k)/u,B=(k-i)/u*s,b=B+C*s,D=Math.max(N*s,s),M=m+c*n+12;p.push({taskId:y.id,taskName:y.name,originalX:B,previewX:b,width:D,y:M,rowIndex:c,daysDelta:C,color:y.color}),g(y.id,C,T);}};return g(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ue.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:m,segments:p}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Hn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:m="en",templates:p,dependencyLineStyle:i="curved",onTaskClick:u,onTaskDblClick:d,onTaskContextMenu:g,onTaskDateChange:h,onDependencyCreate:C,onDependencyDelete:T}){let y=Br(),[c,k]=react.useState([]),[l,N]=react.useState(null),x=react.useCallback(F=>{N(F);},[]),B=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),b=r==="day"?60:r==="week"?20:8,D=B*b*n,M=F=>{let O=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),L=O.getUTCDay()||7;O.setUTCDate(O.getUTCDate()+4-L);let j=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-j.getTime())/864e5+1)/7)},w=F=>{let O=F.getDay();return O===0||O===6},R=react.useCallback(F=>{let O=Math.round(F/(b*n)),L=new Date(o);return L.setDate(L.getDate()+O),L},[o,b,n]),$=react.useCallback((F,O)=>{if(O.startDate&&O.endDate)return;let L=F.currentTarget.ownerSVGElement;if(!L)return;let j=L.createSVGPoint();j.x=F.clientX,j.y=F.clientY;let X=j.matrixTransform(L.getScreenCTM()?.inverse()),W=R(X.x),ye=new Date(W);ye.setDate(ye.getDate()+1),h?.(O,W,ye);},[R,h]),K=react.useMemo(()=>{let F=X=>X.map(W=>{if(W.subtasks&&W.subtasks.length>0){let ye=F(W.subtasks),oe=ye.filter(Le=>Le.startDate&&Le.endDate);if(oe.length>0){let Le=oe.map(Xe=>Xe.startDate.getTime()),Ye=oe.map(Xe=>Xe.endDate.getTime()),et=new Date(Math.min(...Le)),se=new Date(Math.max(...Ye));return {...W,subtasks:ye,startDate:et,endDate:se}}return {...W,subtasks:ye}}return W}),O=(X,W=[])=>{for(let ye of X)W.push(ye),ye.subtasks&&ye.subtasks.length>0&&(ye.isExpanded===void 0||ye.isExpanded)&&O(ye.subtasks,W);return W},L=F(e);return O(L)},[e]),te=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let O=F.startDate.getTime(),L=F.endDate.getTime(),j=o.getTime(),X=(O-j)/(1e3*60*60*24),W=(L-O)/(1e3*60*60*24),ye=X*b*n,oe=Math.max(b*n,40),Le=Math.max(W*b*n,oe);return {x:ye,width:Le}},[o,b,n]),re=react.useMemo(()=>K.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:O,width:L}=te(F),X=K.findIndex(W=>W.id===F.id)*a+12;return {id:F.id,x:O,y:X,width:L,height:32}}),[K,te]),ae=react.useCallback((F,O,L)=>{if(!L||O===0){k([]);return}let j=ue.calculateCascadePreview(e,F,O,K,o,b*n,a,48);k(j);},[e,K,o,b,n,a,48]),pe=react.useMemo(()=>{let F=[],O=new Date(o);for(;O<=s;){let X=(O.getTime()-o.getTime())/864e5*b*n;if(r==="day")F.push({date:new Date(O),label:O.toLocaleDateString(m,{day:"numeric",month:"short"}),x:X}),O.setDate(O.getDate()+1);else if(r==="week"){let W=M(O);F.push({date:new Date(O),label:`${y.labels.week} ${W}`,x:X}),O.setDate(O.getDate()+7);}else F.push({date:new Date(O),label:O.toLocaleDateString(m,{month:"short",year:"numeric"}),x:X}),O.setMonth(O.getMonth()+1);}return F},[o,s,r,b,n,m,y.labels.week]),fe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*b*n,[o,b,n]),Ie=Math.max(K.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},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(D,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(D,1e3),height:48,fill:t.bgGrid}),pe.map((F,O)=>jsxRuntime.jsxs("g",{children:[O>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${O}`)),fe>=0&&fe<=D&&jsxRuntime.jsx("circle",{cx:fe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(D,1e3),height:Ie,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(D,1e3),height:Ie,fill:t.bgPrimary}),pe.map((F,O)=>{let L=pe[O+1]?.x||D,j=w(F.date);return jsxRuntime.jsxs("g",{children:[j&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:L-F.x,height:K.length*a,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:K.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),K.map((F,O)=>{let L=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:D,height:a,fill:O%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:D,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>$(j,F),onMouseEnter:j=>{j.currentTarget.setAttribute("fill",t.accentLight),j.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:j=>{j.currentTarget.setAttribute("fill","transparent"),j.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:fe>0?fe:100,y:O*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),K.map((F,O)=>{if(!F.startDate||!F.endDate)return null;let{x:L,width:j}=te(F),X=O*a+12,W=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(zn,{task:F,x:L+j/2,y:X+16,theme:t,onClick:u},F.id):W?jsxRuntime.jsxs("g",{onClick:()=>u?.(F),onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),g?.(F,ye);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:L,y:X,width:j,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:L,y1:X,x2:L+j,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:X,x2:L,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L+j,y1:X,x2:L+j,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:X+32,x2:L+j,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),j>60&&jsxRuntime.jsx("text",{x:L+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(Ln,{task:F,x:L,y:X,width:j,theme:t,dayWidth:b*n,startDate:o,templates:p,onClick:u,onDoubleClick:d,onContextMenu:g,onDateChange:h,onDependencyCreate:C,allTaskPositions:re,onDragMove:ae,onHoverChange:x},F.id)}),K.map((F,O)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(L=>{let j=K.find(se=>se.id===L);if(!j||!j.startDate||!j.endDate)return null;let X=K.findIndex(se=>se.id===L),W=te(j),ye=te(F),oe=W.x+W.width,Le=X*a+28,Ye=ye.x,et=O*a+28;return jsxRuntime.jsx($n,{x1:oe,y1:Le,x2:Ye,y2:et,theme:t,lineStyle:i,onDelete:()=>T?.(F.id,L)},`dep-${L}-${F.id}`)})),c.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),fe>=0&&fe<=D&&jsxRuntime.jsx("line",{x1:fe,y1:0,x2:fe,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),l&&jsxRuntime.jsx(Ec,{tooltipData:l,theme:t})]})]})}var P0=['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"'],Fc=()=>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"})]}),M0=()=>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"})}),A0=()=>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"})}),F0=()=>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 Wn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:p}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState([]),[T,v]=react.useState(""),[y,c]=react.useState(false),[k,l]=react.useState(true),N=react.useRef(null),x=react.useRef(null),B=react.useRef(null),{enabled:b=true,placeholder:D='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:w,suggestions:R=P0,maxHistory:$=50,persistHistory:K}=a,te=K?.storageKey||"gantt-ai-history",re=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let O=localStorage.getItem(te);if(O){let j=JSON.parse(O).map(X=>({...X,timestamp:new Date(X.timestamp)}));C(j.slice(-re));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[K?.enabled,te,re]),react.useEffect(()=>{if(K?.enabled&&h.length>0)try{let O=h.filter(L=>!L.isLoading).slice(-re);localStorage.setItem(te,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[h,K?.enabled,te,re]),react.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,d]);let ae=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&n?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&m?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&p?.(O.taskId,O.dependencyFrom);break}},[o,s,n,m,p]),pe=react.useCallback(async O=>{if(!O.trim()||y)return;let L={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};C(X=>[...X.slice(-($-1)),L]),v(""),l(false),c(true);let j={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(X=>[...X,j]);try{if(w){let X=await w(O,e);C(W=>{let ye=W.filter(Le=>!Le.isLoading),oe={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...ye,oe]}),ae(X);}else C(X=>[...X.filter(ye=>!ye.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(X){C(W=>[...W.filter(oe=>!oe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{c(false);}},[y,$,w,e,ae]),fe=O=>{O.preventDefault(),pe(T);},Ie=O=>{v(O),N.current?.focus();};if(react.useEffect(()=>{let O=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),u(j=>!j),i||g(false)),L.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=j=>{let X=j.target;B.current&&!B.current.contains(X)&&u(false);},L=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(L),document.removeEventListener("mousedown",O);}},[i]),!b)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[M]} 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(Fc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref: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 ${F[M]} 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(Fc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(F0,{})}),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(A0,{})})]})]}),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&&k&&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:R.slice(0,4).map((O,L)=>jsxRuntime.jsx("button",{onClick:()=>Ie(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},L))})]}),h.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(I0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:x})]}),jsxRuntime.jsxs("form",{onSubmit:fe,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,type:"text",value:T,onChange:O=>v(O.target.value),placeholder:D,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(M0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ic(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),p=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Lc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=m?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&p&&n.key==="y"){n.preventDefault(),t();return}if(m&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var $0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ue.formatDate(e.startDate)} - ${ue.formatDate(e.endDate)}`);let a=ue.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=>ue.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Bc(e){return {...$0,...e}}var V0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Oc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:p=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:v,showCreateTaskButton:y=false,createTaskLabel:c,onCreateTask:k,taskFilter:l,onTaskFilterChange:N,onThemeChange:x,onTaskClick:B,onTaskDblClick:b,onTaskContextMenu:D,onTaskUpdate:M,onProgressChange:w,onTaskEdit:R,onTaskAddSubtask:$,onTaskMarkIncomplete:K,onTaskSetInProgress:te,onDependencyCreate:re,onDependencyDelete:ae,onBeforeTaskAdd:pe,onAfterTaskAdd:fe,onBeforeTaskUpdate:Ie,onAfterTaskUpdate:F,onBeforeTaskDelete:O,onAfterTaskDelete:L}=a,X=react.useContext(Nn)?.theme,[W,ye]=react.useState(X||s||"dark"),[oe,Le]=react.useState(n),[Ye,et]=react.useState(m),[se,Xe]=react.useState(1),[dt,kt]=react.useState("all"),wt=l??dt,z=N??kt,[ge,Se]=react.useState(0),[Pe,_e]=react.useState(false),[Ve,Mt]=react.useState(null),[Me,Qt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Zt,Ft]=react.useState(null),[bt,Ht]=react.useState(null);react.useEffect(()=>{X&&X!==W&&ye(X);},[X]),react.useEffect(()=>{s&&s!==W&&ye(s);},[s]);let ea=react.useCallback(E=>{ye(E),x?.(E);},[x]),{state:Ce,setState:Ue,undo:ca,redo:qe,canUndo:We,canRedo:I,clearHistory:xe}=Ic(t,50),J=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),he=react.useRef(new Map),ve=react.useRef(false);if(!ve.current&&h){ve.current=true;let E=typeof h=="string"?h:"gantt-expanded-tasks";try{let P=localStorage.getItem(E);if(P){let V=JSON.parse(P);Array.isArray(V)&&(he.current=new Map(V));}}catch(P){console.warn("[GanttBoard] Error loading expanded state from localStorage:",P);}}let Be=react.useCallback(()=>{let E=J();if(E)try{let P=Array.from(he.current.entries());localStorage.setItem(E,JSON.stringify(P));}catch(P){console.warn("[GanttBoard] Error saving expanded state to localStorage:",P);}},[J]);react.useEffect(()=>{let E=P=>P.map(V=>{let ee=he.current.get(V.id),ce=ee!==void 0?{...V,isExpanded:ee}:V;return ce.subtasks?.length?{...ce,subtasks:E(ce.subtasks)}:ce});he.current.size>0?Ue(E(t)):Ue(t);},[t,Ue]);let Ae=react.useRef(t),ot=react.useRef(true);react.useEffect(()=>{if(ot.current){ot.current=false,Ae.current=Ce;return}if(!r)return;let E=JSON.stringify(Ae.current),P=JSON.stringify(Ce);E!==P&&(Ae.current=Ce,r(Ce));},[Ce,r]);let U=react.useMemo(()=>li(T,v),[T,v]),Y=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[de,ze]=react.useState(()=>Y(U));react.useEffect(()=>{ze(E=>E.map(P=>({...P,label:U.columns[P.id==="name"?"taskName":P.id]||P.label})));},[U]);let Re=react.useMemo(()=>de.filter(P=>P.visible).reduce((P,V)=>P+V.width,0),[de]),H=react.useRef(de.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=de.filter(ee=>ee.visible),P=E.map(ee=>ee.id).join(","),V=H.current;if(P!==V){let ee=E.some(Te=>Te.id!=="name"),ce=V.includes(",");ee?!ce&&ee&&Mt(null):Mt(null),H.current=P;}},[de]);let ne=60,$e=.6,St=react.useMemo(()=>{let P=Re+ne,V=typeof window<"u"?window.innerWidth*$e:800,ee=Math.max(P,V);return Ve!==null?Math.max(200,Math.min(Ve,ee)):Math.max(200,P)},[Ve,Re]),tt=react.useRef(null),fa=react.useRef(null),Ia=react.useRef(null),st=react.useMemo(()=>ac(W),[W]),A=react.useMemo(()=>({theme:st,themeName:W}),[st,W]),_=react.useMemo(()=>Bc(d),[d]),De=react.useMemo(()=>{if(!g)return Ce;let E=ue.calculateCriticalPath(Ce),P=V=>V.map(ee=>({...ee,isCriticalPath:E.includes(ee.id),subtasks:ee.subtasks?P(ee.subtasks):void 0}));return P(Ce)},[Ce,g]),Ge=react.useMemo(()=>{if(wt==="all")return De;let E=P=>{let V=[];for(let ee of P){let ce=ee.subtasks?.length?E(ee.subtasks):void 0,Te=false;switch(wt){case "incomplete":Te=ee.progress<100;break;case "in_progress":Te=ee.progress>0&&ee.progress<100;break;case "completed":Te=ee.progress===100;break}(Te||ce&&ce.length>0)&&V.push({...ee,subtasks:ce});}return V};return E(De)},[De,wt]),Tt=V0(Ye);Lc({undo:ca,redo:qe,canUndo:We,canRedo:I,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>ue.findTaskById(Ce,E),addTask:(E,P)=>{Ue(V=>{if(!P)return [...V,{...E,level:0}];let ee=ce=>ce.map(Te=>Te.id===P?{...Te,subtasks:[...Te.subtasks||[],{...E,parentId:P,level:(Te.level||0)+1}],isExpanded:true}:Te.subtasks?{...Te,subtasks:ee(Te.subtasks)}:Te);return ee(V)});},updateTask:(E,P)=>{Ue(V=>{let ee=ce=>ce.map(Te=>Te.id===E?{...Te,...P}:Te.subtasks?{...Te,subtasks:ee(Te.subtasks)}:Te);return ee(V)});},deleteTask:E=>{Ue(P=>{let V=ee=>ee.filter(ce=>ce.id===E?false:(ce.subtasks&&(ce.subtasks=V(ce.subtasks)),true));return V(P)});},deleteTasks:E=>{Ue(P=>yi(P,E));},duplicateTask:E=>{Ue(P=>vi(P,[E]));},splitTask:(E,P,V=3)=>{Ue(ee=>ue.splitTask(ee,E,P,V));},calculateEndDate:ue.calculateEndDate,calculateDuration:ue.calculateDuration,validateDependency:(E,P)=>!ue.validateDependencies(Ce,E,P),getAllTasks:()=>ue.flattenTasks(Ce),getTasksByStatus:E=>ue.flattenTasks(Ce).filter(P=>P.status===E),getTasksByParent:E=>E?ue.findTaskById(Ce,E)?.subtasks||[]:Ce.filter(V=>!V.parentId),getCriticalPath:()=>ue.flattenTasks(Ce).filter(E=>E.isCriticalPath),indentTask:E=>{Ue(P=>fi(P,[E]));},outdentTask:E=>{Ue(P=>hi(P,[E]));},moveTask:(E,P)=>{Ue(V=>bi(V,[E],P));},createSubtask:async E=>{let{tasks:P,newTask:V}=wi(Ce,E);if(pe){let ee=pe({...V,parentId:E});if((ee instanceof Promise?await ee:ee)===false)return}Ue(P),fe&&fe({...V,parentId:E});},scrollToTask:E=>{let V=ue.flattenTasks(Ce).findIndex(ee=>ee.id===E);if(V!==-1&&tt.current){let ee=V*Tt;tt.current.scrollTo({top:ee,behavior:"smooth"}),fa.current&&fa.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(E,P=2e3)=>{},expandTask:E=>{Ue(P=>{let V=ee=>ee.map(ce=>ce.id===E?{...ce,isExpanded:true}:ce.subtasks?{...ce,subtasks:V(ce.subtasks)}:ce);return V(P)});},collapseTask:E=>{Ue(P=>{let V=ee=>ee.map(ce=>ce.id===E?{...ce,isExpanded:false}:ce.subtasks?{...ce,subtasks:V(ce.subtasks)}:ce);return V(P)});},expandAll:()=>{Ue(E=>{let P=V=>V.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?P(ee.subtasks):void 0}));return P(E)});},collapseAll:()=>{Ue(E=>{let P=V=>V.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?P(ee.subtasks):void 0}));return P(E)});},undo:ca,redo:qe,canUndo:()=>We,canRedo:()=>I,clearHistory:xe,exportToPNG:async()=>{if(!Ia.current||!tt.current||!fa.current)throw new Error("Gantt container not found");let E=Ia.current,P=tt.current.querySelector(".gantt-grid-scroll"),V=fa.current,ee=P?.scrollTop||0,ce=V.scrollTop,Te=E.style.overflow,Et=E.style.height;try{let it=P?.querySelector(".gantt-taskgrid-content"),_t=V.querySelector("svg"),va=it?.scrollHeight||P?.scrollHeight||600,Ca=_t?.getBoundingClientRect().height||V.scrollHeight,zr=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(va,Ca)+20;P&&(P.scrollTop=0),V.scrollTop=0,E.style.overflow="visible",E.style.height=`${zr}px`,await new Promise(Tr=>setTimeout(Tr,100));let lr=await $c__default.default(E,{backgroundColor:st.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Tr=>{let so=window.getComputedStyle(Tr),Ur=parseInt(so.zIndex,10);return !isNaN(Ur)&&Ur>=50||so.position==="fixed"}});return new Promise((Tr,so)=>{lr.toBlob(Ur=>{Ur?Tr(Ur):so(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=Te,E.style.height=Et,P&&(P.scrollTop=ee),V.scrollTop=ce;}},exportToPDF:async E=>{await ue.exportToPDF(Ce,E);},exportToExcel:async E=>{await ue.exportToExcel(Ce,E);},exportToJSON:()=>ue.exportToJSON(Ce),exportToCSV:()=>ue.exportToCSV(Ce),importFromJSON:E=>{let P=ue.importFromJSON(E);Ue(P);},getTasks:()=>Ce,refresh:()=>{Ue(E=>[...E]);},clearAll:()=>{Ue([]);}}),[Ce,ca,qe,We,I,xe,st,Tt]);let ie=react.useCallback(E=>{ze(P=>P.map(V=>V.id===E?{...V,visible:!V.visible}:V));},[]),Oe=react.useCallback((E,P)=>{ze(V=>V.map(ee=>{if(ee.id!==E)return ee;let ce=ee.minWidth??100,Te=ee.maxWidth??800,Et=Math.max(ce,Math.min(Te,P));return {...ee,width:Et}}));},[]),ut=react.useCallback(E=>{Ue(P=>{let V=ki(P,E),ee=ce=>{for(let Te of ce){if(Te.id===E){he.current.set(E,Te.isExpanded??true);return}Te.subtasks?.length&&ee(Te.subtasks);}};return ee(V),Be(),V}),a.onTaskToggleExpand?.(E);},[a,Be]),Fe=react.useCallback((E,P)=>{if(Ie&&Ie(E,P)===false)return;let ee=ue.findTaskById(Ce,E)?.progress,ce=Et=>Et.map(it=>it.id===E?{...it,...P}:it.subtasks?{...it,subtasks:ce(it.subtasks)}:it);Ue(ce(Ce));let Te=ue.findTaskById(ce(Ce),E);Te&&(M?.(Te),F?.(Te),P.progress!==void 0&&ee!==void 0&&P.progress!==ee&&w?.(E,ee,P.progress));},[Ce,M,Ie,F,w]),ct=react.useCallback(E=>{E.length!==0&&(Ue(P=>fi(P,E)),a.onTaskIndent?.(E[0]));},[a]),ha=react.useCallback(E=>{E.length!==0&&(Ue(P=>hi(P,E)),a.onTaskOutdent?.(E[0]));},[a]),ya=react.useCallback((E,P,V)=>{Ue(ee=>xc(ee,E,P,V)),a.onTaskReparent?.(E,P,V);},[a]),Wt=react.useCallback((E,P)=>{E.length!==0&&(Ue(V=>bi(V,E,P)),a.onTaskMove?.(E[0],P));},[a]),He=react.useCallback(async E=>{let P=[];for(let V of E)O&&await Promise.resolve(O(V))===false||P.push(V);P.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(P):(Ue(V=>yi(V,P)),P.forEach(V=>a.onTaskDelete?.(V))),L&&P.forEach(V=>L(V)));},[a,O,L]),Gt=react.useCallback(E=>{Ue(P=>vi(P,E)),E.forEach(P=>a.onTaskDuplicate?.(P));},[a]),ma=react.useCallback((E,P)=>{Ue(V=>{let{tasks:ee,newTask:ce}=vc(V,E,P);return pe&&pe(ce)===false?V:(a.onTaskCreate?.(ce.parentId,ce.position||0),fe?.(ce),ee)});},[a,pe,fe]),wr=react.useCallback((E,P)=>{Ue(V=>xi(V,E,P)),a.onTaskRename?.(E,P);},[a]),ns=react.useCallback(E=>{Ue(P=>{let{tasks:V}=wi(P,E);return a.onTaskCreate?.(E,0),V});},[a]),rp=react.useCallback((E,P,V)=>{let ee=E.startDate?Math.round((P.getTime()-E.startDate.getTime())/864e5):0,ce=it=>it.map(_t=>_t.id===E.id?{..._t,startDate:P,endDate:V,...E.segments&&{segments:E.segments}}:_t.subtasks?{..._t,subtasks:ce(_t.subtasks)}:_t),Te=ce(Ce);Te=ue.autoScheduleDependents(Te,E.id,ee),Ue(Te);let Et={...E,startDate:P,endDate:V};M?.(Et);},[Ce,M]),op=react.useCallback((E,P)=>{D?.(E,P),Qt({isOpen:true,x:P.clientX,y:P.clientY,task:E});},[D]),np=react.useCallback((E,P)=>{let V=ue.splitTask(Ce,E.id,P);Ue(V),Qt({isOpen:false,x:0,y:0,task:null});},[Ce]),Tl=react.useCallback(E=>{let P=ue.findTaskById(Ce,E.id)||E;b?.(P),R||Ft(P);},[Ce,b,R]),Nl=react.useCallback((E,P,V)=>{let ee=new Map,ce=va=>{va.forEach(Ca=>{Ca.dependencies&&ee.set(Ca.id,Ca.dependencies),Ca.subtasks&&ce(Ca.subtasks);});};ce(V);let Te=ee.get(P)||[];ee.set(P,[...Te,E]);let Et=new Set,it=new Set,_t=va=>{if(!Et.has(va)){Et.add(va),it.add(va);let Ca=ee.get(va)||[];for(let Cr of Ca){if(!Et.has(Cr)&&_t(Cr))return true;if(it.has(Cr))return true}}return it.delete(va),false};return _t(P)},[]),Dl=react.useCallback((E,P)=>{if(Nl(E.id,P,Ce)){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([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=he.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let v of i.dependencies){let k=t.find(C=>C.id===v);if(k){o(k);let C=r.get(v)?.ef||0;l=Math.max(l,C);}}let b=l+u;r.set(i.id,{es:l,ef:b});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,c=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,l=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),b=s;if(l.length>0)for(let k of l){c(k);let C=n.get(k.id)?.ls||0;b=Math.min(b,C);}let v=b-u;n.set(i.id,{ls:v,lf:b});};a.forEach(c);let g=[];for(let i of a){let u=r.get(i.id),l=n.get(i.id);if(u&&l){let b=l.ls-u.es;Math.abs(b)<.01&&g.push(i.id);}}return g},calculateSlack:(e,t)=>{let a=he.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(he.calculateCriticalPath(e).includes(t))return 0;let o=he.getDependentTasks(e,t);if(o.length===0){let c=he.getLatestEndDate(e);if(!c)return null;let g=he.calculateDuration(a.endDate,c);return Math.max(0,g)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,g)=>c-g)[0];if(!s)return null;let n=he.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>he.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=he.findTaskById(e,t);if(!r||!r.endDate)return e;let o=he.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=he.calculateDuration(n.startDate,n.endDate),g;a!==void 0?(g=new Date(n.startDate),g.setDate(g.getDate()+a)):(g=new Date(r.endDate),g.setDate(g.getDate()+1));let i=he.calculateEndDate(g,c),u=l=>l.map(b=>b.id===n.id?{...b,startDate:g,endDate:i}:b.subtasks?{...b,subtasks:u(b.subtasks)}:b);s=u(s),s=he.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,c)=>{if(a===0)return [];let g=[],i=o.getTime(),u=1e3*60*60*24,l=he.findTaskById(e,t);if(!l||!l.endDate)return [];let b=(v,k,C=new Set)=>{if(C.has(v))return;C.add(v);let h=he.getDependentTasks(e,v);for(let f of h){if(!f.startDate||!f.endDate)continue;let p=r.findIndex(T=>T.id===f.id);if(p===-1)continue;let x=f.startDate.getTime(),N=(f.endDate.getTime()-x)/u,B=(x-i)/u*s,y=B+k*s,I=Math.max(N*s,s),P=c+p*n+12;g.push({taskId:f.id,taskName:f.name,originalX:B,previewX:y,width:I,y:P,rowIndex:p,daysDelta:k,color:f.color}),b(f.id,k,C);}};return b(t,a),g},splitTask:(e,t,a,r=3)=>{let o=he.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 g=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:c}],i=u=>u.map(l=>l.id===o.id?{...l,endDate:c,segments:g}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function es({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:c="en",templates:g,dependencyLineStyle:i="curved",onTaskClick:u,onTaskDblClick:l,onTaskContextMenu:b,onTaskDateChange:v,onDependencyCreate:k,onDependencyDelete:C}){let f=_r(),[p,x]=react.useState([]),[m,N]=react.useState(null),w=react.useCallback(A=>{N(A);},[]),B=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),y=r==="day"?60:r==="week"?20:8,I=B*y*n,P=A=>{let R=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),L=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-L);let j=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-j.getTime())/864e5+1)/7)},T=A=>{let R=A.getDay();return R===0||R===6},W=react.useCallback(A=>{let R=Math.round(A/(y*n)),L=new Date(o);return L.setDate(L.getDate()+R),L},[o,y,n]),O=react.useCallback((A,R)=>{if(R.startDate&&R.endDate)return;let L=A.currentTarget.ownerSVGElement;if(!L)return;let j=L.createSVGPoint();j.x=A.clientX,j.y=A.clientY;let X=j.matrixTransform(L.getScreenCTM()?.inverse()),z=W(X.x),ve=new Date(z);ve.setDate(ve.getDate()+1),v?.(R,z,ve);},[W,v]),q=react.useMemo(()=>{let A=X=>X.map(z=>{if(z.subtasks&&z.subtasks.length>0){let ve=A(z.subtasks),se=ve.filter(Ie=>Ie.startDate&&Ie.endDate);if(se.length>0){let Ie=se.map(Xe=>Xe.startDate.getTime()),qe=se.map(Xe=>Xe.endDate.getTime()),Qe=new Date(Math.min(...Ie)),ie=new Date(Math.max(...qe));return {...z,subtasks:ve,startDate:Qe,endDate:ie}}return {...z,subtasks:ve}}return z}),R=(X,z=[])=>{for(let ve of X)z.push(ve),ve.subtasks&&ve.subtasks.length>0&&(ve.isExpanded===void 0||ve.isExpanded)&&R(ve.subtasks,z);return z},L=A(e);return R(L)},[e]),te=react.useCallback(A=>{if(!A.startDate||!A.endDate)return {x:0,width:0};let R=A.startDate.getTime(),L=A.endDate.getTime(),j=o.getTime(),X=(R-j)/(1e3*60*60*24),z=(L-R)/(1e3*60*60*24),ve=X*y*n,se=Math.max(y*n,40),Ie=Math.max(z*y*n,se);return {x:ve,width:Ie}},[o,y,n]),ne=react.useMemo(()=>q.filter(A=>A.startDate&&A.endDate).map(A=>{let{x:R,width:L}=te(A),X=q.findIndex(z=>z.id===A.id)*a+12;return {id:A.id,x:R,y:X,width:L,height:32}}),[q,te]),re=react.useCallback((A,R,L)=>{if(!L||R===0){x([]);return}let j=he.calculateCascadePreview(e,A,R,q,o,y*n,a,48);x(j);},[e,q,o,y,n,a,48]),ce=react.useMemo(()=>{let A=[],R=new Date(o);for(;R<=s;){let X=(R.getTime()-o.getTime())/864e5*y*n;if(r==="day")A.push({date:new Date(R),label:R.toLocaleDateString(c,{day:"numeric",month:"short"}),x:X}),R.setDate(R.getDate()+1);else if(r==="week"){let z=P(R);A.push({date:new Date(R),label:`${f.labels.week} ${z}`,x:X}),R.setDate(R.getDate()+7);}else A.push({date:new Date(R),label:R.toLocaleDateString(c,{month:"short",year:"numeric"}),x:X}),R.setMonth(R.getMonth()+1);}return A},[o,s,r,y,n,c,f.labels.week]),be=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*y*n,[o,y,n]),Le=Math.max(q.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},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(I,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:48,fill:t.bgGrid}),ce.map((A,R)=>jsxRuntime.jsxs("g",{children:[R>0&&jsxRuntime.jsx("line",{x1:A.x,y1:0,x2:A.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:A.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:A.label})]},`header-${R}`)),be>=0&&be<=I&&jsxRuntime.jsx("circle",{cx:be,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(I,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(I,1e3),height:Le,fill:t.bgPrimary}),ce.map((A,R)=>{let L=ce[R+1]?.x||I,j=T(A.date);return jsxRuntime.jsxs("g",{children:[j&&jsxRuntime.jsx("rect",{x:A.x,y:0,width:L-A.x,height:q.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsxRuntime.jsx("line",{x1:A.x,y1:0,x2:A.x,y2:q.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),q.map((A,R)=>{let L=A.startDate&&A.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:I,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${A.id}`),!L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:I,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>O(j,A),onMouseEnter:j=>{j.currentTarget.setAttribute("fill",t.accentLight),j.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:j=>{j.currentTarget.setAttribute("fill","transparent"),j.currentTarget.setAttribute("opacity","1");}},`clickable-${A.id}`),jsxRuntime.jsx("text",{x:be>0?be:100,y:R*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:f.labels.clickToSetDates},`placeholder-${A.id}`)]})]},`row-group-${A.id}`)}),q.map((A,R)=>{if(!A.startDate||!A.endDate)return null;let{x:L,width:j}=te(A),X=R*a+12,z=A.subtasks&&A.subtasks.length>0&&!A.isMilestone;return A.isMilestone?jsxRuntime.jsx(Zn,{task:A,x:L+j/2,y:X+16,theme:t,onClick:u},A.id):z?jsxRuntime.jsxs("g",{onClick:()=>u?.(A),onContextMenu:ve=>{ve.preventDefault(),ve.stopPropagation(),b?.(A,ve);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:L,y:X,width:j,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:L,y1:X,x2:L+j,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:X,x2:L,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L+j,y1:X,x2:L+j,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:X+32,x2:L+j,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),j>60&&jsxRuntime.jsx("text",{x:L+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:A.name})]},A.id):jsxRuntime.jsx(Kn,{task:A,x:L,y:X,width:j,theme:t,dayWidth:y*n,startDate:o,templates:g,onClick:u,onDoubleClick:l,onContextMenu:b,onDateChange:v,onDependencyCreate:k,allTaskPositions:ne,onDragMove:re,onHoverChange:w},A.id)}),q.map((A,R)=>!A.dependencies||A.dependencies.length===0||!A.startDate||!A.endDate?null:A.dependencies.map(L=>{let j=q.find(ie=>ie.id===L);if(!j||!j.startDate||!j.endDate)return null;let X=q.findIndex(ie=>ie.id===L),z=te(j),ve=te(A),se=z.x+z.width,Ie=X*a+28,qe=ve.x,Qe=R*a+28;return jsxRuntime.jsx(Xn,{x1:se,y1:Ie,x2:qe,y2:Qe,theme:t,lineStyle:i,onDelete:()=>C?.(A.id,L)},`dep-${L}-${A.id}`)})),p.map(A=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:A.previewX,y:A.y-48,width:A.width,height:32,rx:8,fill:A.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(A.daysDelta)>0&&jsxRuntime.jsx("text",{x:A.previewX+A.width/2,y:A.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:A.daysDelta>0?`+${A.daysDelta}d`:`${A.daysDelta}d`})]},`cascade-preview-${A.taskId}`)),be>=0&&be<=I&&jsxRuntime.jsx("line",{x1:be,y1:0,x2:be,y2:Le,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),m&&jsxRuntime.jsx(em,{tooltipData:m,theme:t})]})]})}var Rb=['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"'],om=()=>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"})]}),Ob=()=>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"})}),$b=()=>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"})}),Ub=()=>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"})}),zb=()=>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 ts({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:c,onDependencyDelete:g}){let[i,u]=react.useState(false),[l,b]=react.useState(false),[v,k]=react.useState([]),[C,h]=react.useState(""),[f,p]=react.useState(false),[x,m]=react.useState(true),N=react.useRef(null),w=react.useRef(null),B=react.useRef(null),{enabled:y=true,placeholder:I='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:T,suggestions:W=Rb,maxHistory:O=50,persistHistory:q}=a,te=q?.storageKey||"gantt-ai-history",ne=q?.maxMessages??5;react.useEffect(()=>{if(q?.enabled)try{let R=localStorage.getItem(te);if(R){let j=JSON.parse(R).map(X=>({...X,timestamp:new Date(X.timestamp)}));k(j.slice(-ne));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[q?.enabled,te,ne]),react.useEffect(()=>{if(q?.enabled&&v.length>0)try{let R=v.filter(L=>!L.isLoading).slice(-ne);localStorage.setItem(te,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[v,q?.enabled,te,ne]),react.useEffect(()=>{w.current&&w.current.scrollIntoView({behavior:"smooth"});},[v]),react.useEffect(()=>{i&&!l&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,l]);let re=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&c?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&g?.(R.taskId,R.dependencyFrom);break}},[o,s,n,c,g]),ce=react.useCallback(async R=>{if(!R.trim()||f)return;let L={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};k(X=>[...X.slice(-(O-1)),L]),h(""),m(false),p(true);let j={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(X=>[...X,j]);try{if(T){let X=await T(R,e);k(z=>{let ve=z.filter(Ie=>!Ie.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...ve,se]}),re(X);}else k(X=>[...X.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(X){k(z=>[...z.filter(se=>!se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{p(false);}},[f,O,T,e,re]),be=R=>{R.preventDefault(),ce(C);},Le=R=>{h(R),N.current?.focus();};if(react.useEffect(()=>{let R=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),u(j=>!j),i||b(false)),L.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),react.useEffect(()=>{if(!i)return;let R=j=>{let X=j.target;B.current&&!B.current.contains(X)&&u(false);},L=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(L),document.removeEventListener("mousedown",R);}},[i]),!y)return null;let A={"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(ft,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${A[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(om,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:B,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${A[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(om,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>b(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ub,{})}),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($b,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[v.length===0&&x&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((R,L)=>jsxRuntime.jsx("button",{onClick:()=>Le(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},L))})]}),v.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(zb,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:w})]}),jsxRuntime.jsxs("form",{onSubmit:be,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,type:"text",value:C,onChange:R=>h(R.target.value),placeholder:I,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!C.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ob,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function nm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(l=>{let b=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:b};if(!u)return {...l,present:b};let v=[...l.past,l.present];return v.length>t&&v.shift(),{past:v,present:b,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),c=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),g=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:g}}function sm({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,g=c?n.metaKey:n.ctrlKey;if(g&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!c&&g&&n.key==="y"){n.preventDefault(),t();return}if(c&&g&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var _b={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${he.formatDate(e.startDate)} - ${he.formatDate(e.endDate)}`);let a=he.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=>he.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function im(e){return {..._b,...e}}var Zb=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},cm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:c="comfortable",showThemeSelector:g=true,showExportButton:i=true,availableUsers:u=[],templates:l,enableAutoCriticalPath:b=true,persistExpandedState:v,aiAssistant:k,locale:C="en",customTranslations:h,showCreateTaskButton:f=false,createTaskLabel:p,onCreateTask:x,taskFilter:m,onTaskFilterChange:N,onThemeChange:w,onTaskClick:B,onTaskDblClick:y,onTaskContextMenu:I,onTaskUpdate:P,onProgressChange:T,onTaskEdit:W,onTaskAddSubtask:O,onTaskMarkIncomplete:q,onTaskSetInProgress:te,onDependencyCreate:ne,onDependencyDelete:re,onBeforeTaskAdd:ce,onAfterTaskAdd:be,onBeforeTaskUpdate:Le,onAfterTaskUpdate:A,onBeforeTaskDelete:R,onAfterTaskDelete:L}=a,X=react.useContext($n)?.theme,[z,ve]=react.useState(X||s||"dark"),[se,Ie]=react.useState(n),[qe,Qe]=react.useState(c),[ie,Xe]=react.useState(1),[lt,kt]=react.useState("all"),yt=m??lt,$=N??kt,[fe,Ae]=react.useState(0),[G,oe]=react.useState(false),[xe,Oe]=react.useState(null),[ye,it]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ue,wt]=react.useState(null),[ut,Bt]=react.useState(null);react.useEffect(()=>{X&&X!==z&&ve(X);},[X]),react.useEffect(()=>{s&&s!==z&&ve(s);},[s]);let jt=react.useCallback(S=>{ve(S),w?.(S);},[w]),{state:Se,setState:Ve,undo:ua,redo:Ze,canUndo:Ke,canRedo:F,clearHistory:Te}=nm(t,50),Z=react.useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ke=react.useRef(new Map),Ce=react.useRef(false);if(!Ce.current&&v){Ce.current=true;let S=typeof v=="string"?v:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let K=JSON.parse(E);Array.isArray(K)&&(ke.current=new Map(K));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let $e=react.useCallback(()=>{let S=Z();if(S)try{let E=Array.from(ke.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[Z]);react.useEffect(()=>{let S=E=>E.map(K=>{let ae=ke.current.get(K.id),ue=ae!==void 0?{...K,isExpanded:ae}:K;return ue.subtasks?.length?{...ue,subtasks:S(ue.subtasks)}:ue});ke.current.size>0?Ve(S(t)):Ve(t);},[t,Ve]);let Be=react.useRef(t),st=react.useRef(true);react.useEffect(()=>{if(st.current){st.current=false,Be.current=Se;return}if(!r)return;let S=JSON.stringify(Be.current),E=JSON.stringify(Se);S!==E&&(Be.current=Se,r(Se));},[Se,r]);let U=react.useMemo(()=>Ei(C,h),[C,h]),Y=react.useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[pe,_e]=react.useState(()=>Y(U));react.useEffect(()=>{_e(S=>S.map(E=>({...E,label:U.columns[E.id==="name"?"taskName":E.id]||E.label})));},[U]);let ze=react.useMemo(()=>pe.filter(E=>E.visible).reduce((E,K)=>E+K.width,0),[pe]),H=react.useRef(pe.filter(S=>S.visible).map(S=>S.id).join(","));react.useEffect(()=>{let S=pe.filter(ae=>ae.visible),E=S.map(ae=>ae.id).join(","),K=H.current;if(E!==K){let ae=S.some(Ee=>Ee.id!=="name"),ue=K.includes(",");ae?!ue&&ae&&Oe(null):Oe(null),H.current=E;}},[pe]);let le=60,He=.6,Ft=react.useMemo(()=>{let E=ze+le,K=typeof window<"u"?window.innerWidth*He:800,ae=Math.max(E,K);return xe!==null?Math.max(200,Math.min(xe,ae)):Math.max(200,E)},[xe,ze]),rt=react.useRef(null),ya=react.useRef(null),$a=react.useRef(null),ct=react.useMemo(()=>Ec(z),[z]),M=react.useMemo(()=>({theme:ct,themeName:z}),[ct,z]),V=react.useMemo(()=>im(l),[l]),Me=react.useMemo(()=>{if(!b)return Se;let S=he.calculateCriticalPath(Se),E=K=>K.map(ae=>({...ae,isCriticalPath:S.includes(ae.id),subtasks:ae.subtasks?E(ae.subtasks):void 0}));return E(Se)},[Se,b]),Ye=react.useMemo(()=>{if(yt==="all")return Me;let S=E=>{let K=[];for(let ae of E){let ue=ae.subtasks?.length?S(ae.subtasks):void 0,Ee=false;switch(yt){case "incomplete":Ee=ae.progress<100;break;case "in_progress":Ee=ae.progress>0&&ae.progress<100;break;case "completed":Ee=ae.progress===100;break}(Ee||ue&&ue.length>0)&&K.push({...ae,subtasks:ue});}return K};return S(Me)},[Me,yt]),Pt=Zb(qe);sm({undo:ua,redo:Ze,canUndo:Ke,canRedo:F,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>he.findTaskById(Se,S),addTask:(S,E)=>{Ve(K=>{if(!E)return [...K,{...S,level:0}];let ae=ue=>ue.map(Ee=>Ee.id===E?{...Ee,subtasks:[...Ee.subtasks||[],{...S,parentId:E,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:ae(Ee.subtasks)}:Ee);return ae(K)});},updateTask:(S,E)=>{Ve(K=>{let ae=ue=>ue.map(Ee=>Ee.id===S?{...Ee,...E}:Ee.subtasks?{...Ee,subtasks:ae(Ee.subtasks)}:Ee);return ae(K)});},deleteTask:S=>{Ve(E=>{let K=ae=>ae.filter(ue=>ue.id===S?false:(ue.subtasks&&(ue.subtasks=K(ue.subtasks)),true));return K(E)});},deleteTasks:S=>{Ve(E=>$i(E,S));},duplicateTask:S=>{Ve(E=>Ui(E,[S]));},splitTask:(S,E,K=3)=>{Ve(ae=>he.splitTask(ae,S,E,K));},calculateEndDate:he.calculateEndDate,calculateDuration:he.calculateDuration,validateDependency:(S,E)=>!he.validateDependencies(Se,S,E),getAllTasks:()=>he.flattenTasks(Se),getTasksByStatus:S=>he.flattenTasks(Se).filter(E=>E.status===S),getTasksByParent:S=>S?he.findTaskById(Se,S)?.subtasks||[]:Se.filter(K=>!K.parentId),getCriticalPath:()=>he.flattenTasks(Se).filter(S=>S.isCriticalPath),indentTask:S=>{Ve(E=>Bi(E,[S]));},outdentTask:S=>{Ve(E=>Ri(E,[S]));},moveTask:(S,E)=>{Ve(K=>Oi(K,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:K}=Wi(Se,S);if(ce){let ae=ce({...K,parentId:S});if((ae instanceof Promise?await ae:ae)===false)return}Ve(E),be&&be({...K,parentId:S});},scrollToTask:S=>{let K=he.flattenTasks(Se).findIndex(ae=>ae.id===S);if(K!==-1&&rt.current){let ae=K*Pt;rt.current.scrollTo({top:ae,behavior:"smooth"}),ya.current&&ya.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{Ve(E=>{let K=ae=>ae.map(ue=>ue.id===S?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue);return K(E)});},collapseTask:S=>{Ve(E=>{let K=ae=>ae.map(ue=>ue.id===S?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue);return K(E)});},expandAll:()=>{Ve(S=>{let E=K=>K.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?E(ae.subtasks):void 0}));return E(S)});},collapseAll:()=>{Ve(S=>{let E=K=>K.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?E(ae.subtasks):void 0}));return E(S)});},undo:ua,redo:Ze,canUndo:()=>Ke,canRedo:()=>F,clearHistory:Te,exportToPNG:async()=>{if(!$a.current||!rt.current||!ya.current)throw new Error("Gantt container not found");let S=$a.current,E=rt.current.querySelector(".gantt-grid-scroll"),K=ya.current,ae=E?.scrollTop||0,ue=K.scrollTop,Ee=S.style.overflow,Lt=S.style.height;try{let mt=E?.querySelector(".gantt-taskgrid-content"),qt=K.querySelector("svg"),wa=mt?.scrollHeight||E?.scrollHeight||600,Sa=qt?.getBoundingClientRect().height||K.scrollHeight,Jr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(wa,Sa)+20;E&&(E.scrollTop=0),K.scrollTop=0,S.style.overflow="visible",S.style.height=`${Jr}px`,await new Promise(Lr=>setTimeout(Lr,100));let fr=await dm__default.default(S,{backgroundColor:ct.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Lr=>{let xo=window.getComputedStyle(Lr),Zr=parseInt(xo.zIndex,10);return !isNaN(Zr)&&Zr>=50||xo.position==="fixed"}});return new Promise((Lr,xo)=>{fr.toBlob(Zr=>{Zr?Lr(Zr):xo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=Ee,S.style.height=Lt,E&&(E.scrollTop=ae),K.scrollTop=ue;}},exportToPDF:async S=>{await he.exportToPDF(Se,S);},exportToExcel:async S=>{await he.exportToExcel(Se,S);},exportToJSON:()=>he.exportToJSON(Se),exportToCSV:()=>he.exportToCSV(Se),importFromJSON:S=>{let E=he.importFromJSON(S);Ve(E);},getTasks:()=>Se,refresh:()=>{Ve(S=>[...S]);},clearAll:()=>{Ve([]);}}),[Se,ua,Ze,Ke,F,Te,ct,Pt]);let de=react.useCallback(S=>{_e(E=>E.map(K=>K.id===S?{...K,visible:!K.visible}:K));},[]),Ge=react.useCallback((S,E)=>{_e(K=>K.map(ae=>{if(ae.id!==S)return ae;let ue=ae.minWidth??100,Ee=ae.maxWidth??800,Lt=Math.max(ue,Math.min(Ee,E));return {...ae,width:Lt}}));},[]),vt=react.useCallback(S=>{Ve(E=>{let K=Hi(E,S),ae=ue=>{for(let Ee of ue){if(Ee.id===S){ke.current.set(S,Ee.isExpanded??true);return}Ee.subtasks?.length&&ae(Ee.subtasks);}};return ae(K),$e(),K}),a.onTaskToggleExpand?.(S);},[a,$e]),Re=react.useCallback((S,E)=>{if(Le&&Le(S,E)===false)return;let ae=he.findTaskById(Se,S)?.progress,ue=Lt=>Lt.map(mt=>mt.id===S?{...mt,...E}:mt.subtasks?{...mt,subtasks:ue(mt.subtasks)}:mt);Ve(ue(Se));let Ee=he.findTaskById(ue(Se),S);Ee&&(P?.(Ee),A?.(Ee),E.progress!==void 0&&ae!==void 0&&E.progress!==ae&&T?.(S,ae,E.progress));},[Se,P,Le,A,T]),gt=react.useCallback(S=>{S.length!==0&&(Ve(E=>Bi(E,S)),a.onTaskIndent?.(S[0]));},[a]),va=react.useCallback(S=>{S.length!==0&&(Ve(E=>Ri(E,S)),a.onTaskOutdent?.(S[0]));},[a]),ka=react.useCallback((S,E,K)=>{Ve(ae=>jc(ae,S,E,K)),a.onTaskReparent?.(S,E,K);},[a]),Kt=react.useCallback((S,E)=>{S.length!==0&&(Ve(K=>Oi(K,S,E)),a.onTaskMove?.(S[0],E));},[a]),je=react.useCallback(async S=>{let E=[];for(let K of S)R&&await Promise.resolve(R(K))===false||E.push(K);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Ve(K=>$i(K,E)),E.forEach(K=>a.onTaskDelete?.(K))),L&&E.forEach(K=>L(K)));},[a,R,L]),Yt=react.useCallback(S=>{Ve(E=>Ui(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),ga=react.useCallback((S,E)=>{Ve(K=>{let{tasks:ae,newTask:ue}=Vc(K,S,E);return ce&&ce(ue)===false?K:(a.onTaskCreate?.(ue.parentId,ue.position||0),be?.(ue),ae)});},[a,ce,be]),Ar=react.useCallback((S,E)=>{Ve(K=>zi(K,S,E)),a.onTaskRename?.(S,E);},[a]),Ns=react.useCallback(S=>{Ve(E=>{let{tasks:K}=Wi(E,S);return a.onTaskCreate?.(S,0),K});},[a]),cu=react.useCallback((S,E,K)=>{let ae=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,ue=mt=>mt.map(qt=>qt.id===S.id?{...qt,startDate:E,endDate:K,...S.segments&&{segments:S.segments}}:qt.subtasks?{...qt,subtasks:ue(qt.subtasks)}:qt),Ee=ue(Se);Ee=he.autoScheduleDependents(Ee,S.id,ae),Ve(Ee);let Lt={...S,startDate:E,endDate:K};P?.(Lt);},[Se,P]),mu=react.useCallback((S,E)=>{I?.(S,E),it({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[I]),pu=react.useCallback((S,E)=>{let K=he.splitTask(Se,S.id,E);Ve(K),it({isOpen:false,x:0,y:0,task:null});},[Se]),Xl=react.useCallback(S=>{let E=he.findTaskById(Se,S.id)||S;y?.(E),W||wt(E);},[Se,y,W]),Jl=react.useCallback((S,E,K)=>{let ae=new Map,ue=wa=>{wa.forEach(Sa=>{Sa.dependencies&&ae.set(Sa.id,Sa.dependencies),Sa.subtasks&&ue(Sa.subtasks);});};ue(K);let Ee=ae.get(E)||[];ae.set(E,[...Ee,S]);let Lt=new Set,mt=new Set,qt=wa=>{if(!Lt.has(wa)){Lt.add(wa),mt.add(wa);let Sa=ae.get(wa)||[];for(let Fr of Sa){if(!Lt.has(Fr)&&qt(Fr))return true;if(mt.has(Fr))return true}}return mt.delete(wa),false};return qt(E)},[]),Zl=react.useCallback((S,E)=>{if(Jl(S.id,E,Se)){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 V=ee=>ee.map(ce=>{if(ce.id===P){let Te=ce.dependencies||[];if(!Te.includes(E.id))return {...ce,dependencies:[...Te,E.id]}}return ce.subtasks?{...ce,subtasks:V(ce.subtasks)}:ce});Ue(V(Ce)),re?.(E.id,P);},[Ce,re,Nl]),Sl=react.useCallback((E,P)=>{let V=ee=>ee.map(ce=>{if(ce.id===E&&ce.dependencies){let Te=ce.dependencies.filter(Et=>Et!==P);return {...ce,dependencies:Te}}return ce.subtasks?{...ce,subtasks:V(ce.subtasks)}:ce});Ue(V(Ce)),ae?.(E,P);},[Ce,ae]),{startDate:an,endDate:sp}=react.useMemo(()=>{let E=Ce.filter(Te=>Te.startDate&&Te.endDate);if(E.length===0){let Te=new Date,Et=new Date(Te);Et.setDate(Et.getDate()-30);let it=new Date(Te);return it.setDate(it.getDate()+60),{startDate:Et,endDate:it}}let P=E.flatMap(Te=>[Te.startDate,Te.endDate]).filter(Te=>Te!==void 0),V=new Date(Math.min(...P.map(Te=>Te.getTime()))),ee=new Date(Math.max(...P.map(Te=>Te.getTime()))),ce=oe==="day"?7:oe==="week"?14:30;return V.setDate(V.getDate()-ce),ee.setDate(ee.getDate()+ce),{startDate:V,endDate:ee}},[Ce,oe]),ip=react.useCallback(async()=>{if(!Ia.current||!tt.current||!fa.current)return;await new Promise(zr=>setTimeout(zr,200));let E=Ia.current,P=tt.current.querySelector(".gantt-grid-scroll"),V=fa.current,ee=P?.scrollTop||0,ce=P?.scrollLeft||0,Te=V.scrollTop,Et=V.scrollLeft,it=E.style.overflow,_t=E.style.height,va=P?.style.overflow||"",Ca=V.style.overflow,Cr=E.style.width,rn=V.style.width;try{let zr=P?.querySelector(".gantt-taskgrid-content"),lr=V.querySelector("svg"),Tr=lr?.getAttribute("height")?parseInt(lr.getAttribute("height"),10):lr?.getBoundingClientRect().height||0,so=zr?.scrollHeight||P?.scrollHeight||600,Ur=Math.max(Tr,V.scrollHeight),Ml=lr?.getAttribute("width")?parseInt(lr.getAttribute("width"),10):lr?.getBoundingClientRect().width||V.scrollWidth,fp=E.querySelector('[class*="h-12"]')?.offsetHeight||48,is=Math.max(so,Ur,Tr),ls=fp+is+50,ds=(P?.offsetWidth||300)+Ml+10;P&&(P.scrollTop=0,P.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,E.style.overflow="visible",E.style.height=`${ls}px`,E.style.width=`${ds}px`,P&&(P.style.overflow="visible",P.style.height=`${is+50}px`),V.style.overflow="visible",V.style.height=`${is+50}px`,V.style.width=`${Ml+10}px`,await new Promise(ms=>setTimeout(ms,150));let hp=await $c__default.default(E,{backgroundColor:st.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ds,height:ls,windowWidth:ds+100,windowHeight:ls+100,scrollX:0,scrollY:0,ignoreElements:ms=>{let Al=window.getComputedStyle(ms),Fl=parseInt(Al.zIndex,10);return !isNaN(Fl)&&Fl>=50||Al.position==="fixed"}}),cs=document.createElement("a");cs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,cs.href=hp.toDataURL("image/png"),cs.click();}finally{E.style.overflow=it,E.style.height=_t,E.style.width=Cr,P&&(P.style.overflow=va,P.style.height="",P.scrollTop=ee,P.scrollLeft=ce),V.style.overflow=Ca,V.style.height="",V.style.width=rn,V.scrollTop=Te,V.scrollLeft=Et;}},[st]),lp=react.useCallback(async()=>{await ue.exportToPDF(Ce);},[Ce]),dp=react.useCallback(async()=>{await ue.exportToExcel(Ce);},[Ce]),cp=react.useCallback(()=>{let E=ue.exportToCSV(Ce),P=new Blob([E],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(P),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[Ce]),mp=react.useCallback(()=>{let E=ue.exportToJSON(Ce),P=new Blob([E],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(P),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[Ce]),pp=react.useCallback(()=>{ue.exportToMSProject(Ce,"Gantt Project","project.xml");},[Ce]),up=E=>{E.preventDefault(),_e(true);},no=react.useRef(false),[ss,El]=react.useState(false),Do=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=fa.current,P=tt.current?.querySelector(".gantt-grid-scroll");if(!E||!P)return;let V=()=>{if(no.current)return;no.current=true;let it=E.scrollTop;Se(it),P.scrollTop=it,requestAnimationFrame(()=>{no.current=false;});},ee=()=>{if(no.current)return;no.current=true;let it=P.scrollTop;Se(it),E.scrollTop=it,requestAnimationFrame(()=>{no.current=false;});},ce=it=>{if(Pe&&P){let va=P.parentElement?.getBoundingClientRect()?.left||0,Ca=it.clientX-va,Cr=200,rn=Re+ne,zr=window.innerWidth*$e,lr=Math.max(rn,zr);Ca>=Cr&&Ca<=lr&&Mt(Ca);}if(ss&&E){let _t=it.clientX-Do.current.x,va=it.clientY-Do.current.y;E.scrollLeft=Do.current.scrollLeft-_t,E.scrollTop=Do.current.scrollTop-va;}},Te=()=>{_e(false),El(false);},Et=it=>{if(it.button!==0)return;let _t=it.target;_t.closest("[data-task-bar]")||_t.closest("[data-dependency-line]")||_t.closest("button")||_t.closest('[role="button"]')||_t.tagName==="rect"&&_t.getAttribute("data-clickable")==="true"||(El(true),Do.current={x:it.clientX,y:it.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},it.preventDefault());};return E.addEventListener("scroll",V),P.addEventListener("scroll",ee),E.addEventListener("mousedown",Et),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Te),()=>{E.removeEventListener("scroll",V),P.removeEventListener("scroll",ee),E.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Te);}},[Pe,ss,Re]);let Pl=react.useRef(false),gp=react.useRef(null);return react.useLayoutEffect(()=>{if(Pl.current||Ce.length===0||!fa.current)return;Pl.current=true,gp.current=an;let E=fa.current,P=new Date,V=oe==="day"?60:oe==="week"?20:8,ee=(P.getTime()-an.getTime())/(1e3*60*60*24),ce=E.clientWidth,Et=ee*V*se-ce/2;ee>=0&&ce>0&&(E.scrollLeft=Math.max(0,Et));},[Ce.length,an,oe,se]),jsxRuntime.jsx(vo.Provider,{value:U,children:jsxRuntime.jsx(hs.Provider,{value:A,children:jsxRuntime.jsxs("div",{ref:Ia,className:"flex flex-col h-full w-full",style:{backgroundColor:st.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(En,{theme:st,timeScale:oe,onTimeScaleChange:Le,zoom:se,onZoomChange:Xe,currentTheme:W,onThemeChange:ea,rowDensity:Ye,onRowDensityChange:et,showThemeSelector:p,showCreateTaskButton:y,createTaskLabel:c,onCreateTask:k,taskFilter:wt,onTaskFilterChange:z,onExportPNG:i?ip:void 0,onExportPDF:i?lp:void 0,onExportExcel:i?dp:void 0,onExportCSV:i?cp:void 0,onExportJSON:i?mp:void 0,onExportMSProject:i?pp:void 0}),jsxRuntime.jsxs("div",{ref:tt,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:St,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Fn,{tasks:Ge,theme:st,rowHeight:Tt,availableUsers:u,templates:_,onTaskClick:B,onTaskDblClick:Tl,onTaskContextMenu:D,onTaskToggle:ut,scrollTop:ge,columns:de,onToggleColumn:ie,onColumnResize:Oe,onTaskUpdate:Fe,onTaskIndent:ct,onTaskOutdent:ha,onTaskMove:Wt,onMultiTaskDelete:He,onTaskDuplicate:Gt,onTaskCreate:ma,onTaskRename:wr,onCreateSubtask:ns,onOpenTaskModal:B?E=>B(E):void 0,onDeleteRequest:(E,P)=>Ht({taskId:E,taskName:P}),onTaskReparent:ya})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:st.border,zIndex:15},onMouseDown:up}),jsxRuntime.jsx("div",{ref:fa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ss?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Hn,{tasks:Ge,theme:st,rowHeight:Tt,timeScale:oe,startDate:an,endDate:sp,zoom:se,locale:T,templates:_,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:B,onTaskDblClick:Tl,onTaskContextMenu:op,onTaskDateChange:rp,onDependencyCreate:Dl,onDependencyDelete:Sl})})]}),Me.task&&jsxRuntime.jsx(xo,{isOpen:Me.isOpen,x:Me.x,y:Me.y,theme:st,onClose:()=>Qt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Me.task;if(!E)return [];let P=ue.findTaskById(Ce,E.id)||E;return P.subtasks&&P.subtasks.length>0?[{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{$?$(P):ns(P.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{Ht({taskId:P.id,taskName:P.name});}}]:[{id:"edit",label:U.contextMenu?.editTask||"Edit Task",icon:$t.Pencil,onClick:()=>{R?R(P):Ft(P);}},{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{$?$(P):ns(P.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:U.contextMenu?.markIncomplete||"Mark Incomplete",icon:$t.MarkIncomplete,onClick:()=>{K?K(P):Fe(P.id,{status:"todo",progress:0});},disabled:P.status==="todo"},{id:"setInProgress",label:U.contextMenu?.setInProgress||"Set In Progress",icon:$t.SetInProgress,onClick:()=>{te?te(P):Fe(P.id,{status:"in-progress"});},disabled:P.status==="in-progress"},{id:"markComplete",label:U.contextMenu?.markComplete||"Mark Complete",icon:$t.MarkComplete,onClick:()=>{Fe(P.id,{status:"completed",progress:100});},disabled:P.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:U.contextMenu?.splitTask||"Split Task",icon:$t.Split,onClick:()=>{if(!P.startDate||!P.endDate){console.warn("Cannot split task without dates");return}let ee=P.startDate.getTime(),ce=P.endDate.getTime(),Te=ee+(ce-ee)/2,Et=new Date(Te);np(P,Et);},disabled:!P.startDate||!P.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{Ht({taskId:P.id,taskName:P.name});}}]})()}),jsxRuntime.jsx(Kr,{task:Zt,isOpen:!!Zt,onClose:()=>Ft(null),onTaskUpdate:E=>{Zt&&(Fe(Zt.id,E),Ft(null));},theme:W==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:bt&&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:()=>Ht(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:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:st.bgSecondary,border:`1px solid ${st.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${st.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:st.textPrimary,fontFamily:"Inter, sans-serif"},children:[U.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:st.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="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:st.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:st.textPrimary},children:['"',bt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:st.bgPrimary,borderTop:`1px solid ${st.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ht(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:st.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=st.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{He([bt.taskId]),Ht(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:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Wn,{tasks:Ce,theme:st,config:C,onTasksUpdate:Ue,onTaskUpdate:Fe,onTaskCreate:E=>{Ue(P=>[...P,E]);},onTaskDelete:E=>{He([E]);},onDependencyCreate:(E,P)=>{let V=ue.findTaskById(Ce,E);V&&Dl(V,P);},onDependencyDelete:Sl})]})})})});var Ei=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Pi=[{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 Hc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:p="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...Ei,...i.filter(z=>!Ei.some(ge=>ge.id===z.id))],v=Je[p]||Je.dark,[y,c]=react.useState(false),[k,l]=react.useState(false),[N,x]=react.useState(false),[B,b]=react.useState(false),[D,M]=react.useState({top:0,left:0}),[w,R]=react.useState(null),[$,K]=react.useState(new Date),[te,re]=react.useState({top:0,left:0}),[ae,pe]=react.useState(false),[fe,Ie]=react.useState([]),F=react.useRef(null),O=react.useRef(null),L=react.useRef(null),j=react.useRef(null),X=react.useRef(null),[W,ye]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[oe,Le]=react.useState({});react.useEffect(()=>{a?(ye({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)&&pe(true)):(ye({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),pe(false),Ie([]));},[a,e]),react.useEffect(()=>{let z=ge=>{F.current&&!F.current.contains(ge.target)&&c(false),O.current&&!O.current.contains(ge.target)&&l(false),L.current&&!L.current.contains(ge.target)&&x(false),j.current&&!j.current.contains(ge.target)&&b(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let Ye=()=>{let z={};return W.name.trim()||(z.name="El nombre es requerido"),W.startDate&&W.endDate&&W.startDate>W.endDate&&(z.endDate="La fecha de fin debe ser posterior a la de inicio"),Le(z),Object.keys(z).length===0},et=async z=>{if(z.preventDefault(),!!Ye())try{let ge=m==="create"&&fe.length>0?{...W,pendingFiles:fe}:W;await s(ge),Ie([]),t();}catch(ge){console.error("Error submitting task:",ge);}},se=(z,ge)=>{ye(Se=>{let Pe={...Se,[z]:ge};if(z==="status"){let _e=ge;_e==="todo"?Pe.progress=0:_e==="in-progress"?(Se.progress===0||Se.progress===100)&&(Pe.progress=50):_e==="completed"||_e==="closed"?Pe.progress=100:(_e==="in-review"||_e==="review")&&(Pe.progress=75);}if(z==="progress"){let _e=typeof ge=="number"?ge:parseInt(ge,10);_e===100&&Se.status!=="completed"?Pe.status="completed":_e>0&&_e<100&&Se.status==="todo"?Pe.status="in-progress":_e===0&&Se.status!=="todo"&&(Pe.status="todo");}return Pe}),oe[z]&&Le(Se=>{let Pe={...Se};return delete Pe[z],Pe});},Xe=T.find(z=>z.id===W.status)??Ei[0],dt=Pi.find(z=>z.id===W.priority)??Pi[1],kt=cr.find(z=>z.value===W.color)??cr[0],wt={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":p,style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},onClick:z=>z.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:Xe.color||v.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:v.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:v.textTertiary},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=v.hoverBg,z.currentTarget.style.color=v.textPrimary;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent",z.currentTarget.style.color=v.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:et,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:W.name,onChange:z=>se("name",z.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}),oe.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"}),oe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:W.description||"",onChange:z=>se("description",z.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:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&c(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...wt,borderColor:Xe.color,backgroundColor:`${Xe.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Xe.color}}),jsxRuntime.jsx("span",{style:{color:Xe.color},children:Xe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Xe.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},children:T.map(z=>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:ge=>ge.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{se("status",z.id),c(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:z.color}}),z.title,W.status===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:v.accent}})]},z.id))})})]}),jsxRuntime.jsxs("div",{ref:O,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&l(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:wt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:dt.color}}),jsxRuntime.jsx("span",{children:dt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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:Pi.map(z=>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:ge=>ge.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{se("priority",z.id),l(false);},children:[jsxRuntime.jsx("span",{children:z.icon}),z.label,W.priority===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:v.accent}})]},z.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:L,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:wt,disabled:n,children:[W.assignees&&W.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,3).map((z,ge)=>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:z.color||v.accent,borderColor:v.bgSecondary},children:z.initials},ge))}),W.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:v.textTertiary},children:["+",W.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:N&&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(z=>{let ge=W.assignees?.some(Se=>Se.name===z.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:Se=>Se.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Se=ge?(W.assignees||[]).filter(Pe=>Pe.name!==z.name):[...W.assignees||[],{name:z.name,avatar:z.avatar,initials:z.name.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),color:v.accent}];se("assignees",Se);},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:z.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:z.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ge&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:v.accent}})})]},z.id)})})})]}),jsxRuntime.jsxs("div",{ref:j,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(B)b(false);else {if(j.current){let z=j.current.getBoundingClientRect(),ge=window.innerHeight,Se=120,_e=ge-z.bottom<Se?z.top-Se-8:z.bottom+8;M({top:_e,left:z.left});}b(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:wt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:W.color}}),jsxRuntime.jsx("span",{children:kt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>b(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:`${D.top}px`,left:`${D.left}px`,zIndex:99999,backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:z=>z.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:cr.slice(0,18).map(z=>{let ge=W.color===z.value;return jsxRuntime.jsx("button",{type:"button",onClick:Se=>{Se.preventDefault(),Se.stopPropagation(),se("color",z.value),b(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:z.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:z.value,outline:ge?`2px solid ${z.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},z.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(dr,{selectedTags:W.tags||[],availableTags:u,onChange:z=>se("tags",z),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:X,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!W.isMilestone)if(w==="start")R(null);else {if(X.current){let z=X.current.getBoundingClientRect(),ge=window.innerHeight,Se=320,_e=ge-z.bottom<Se?z.top-Se-8:z.bottom+8;re({top:_e,left:z.left});}R("start"),K(W.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...wt,opacity:W.isMilestone?.5:1,cursor:W.isMilestone?"not-allowed":"pointer"},disabled:n||W.isMilestone,children:W.startDate?W.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&&!W.isMilestone)if(w==="end")R(null);else {if(X.current){let z=X.current.getBoundingClientRect(),ge=window.innerHeight,Se=320,_e=ge-z.bottom<Se?z.top-Se-8:z.bottom+8;re({top:_e,left:z.left});}R("end"),K(W.endDate||W.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...wt,opacity:W.isMilestone?.5:1,cursor:W.isMilestone?"not-allowed":"pointer"},disabled:n||W.isMilestone,children:W.endDate?W.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>R(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:v.bgPrimary,border:`1px solid ${v.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${v.border}`},children:[(()=>{let z=new Date,ge=new Date(z);ge.setDate(z.getDate()+1);let Se=new Date(z);Se.setDate(z.getDate()+7);let Pe=new Date(z);return Pe.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:ge},{label:"Pr\xF3xima semana",date:Se},{label:"2 semanas",date:Pe}].map((Ve,Mt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:v.textPrimary},onMouseEnter:Me=>Me.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:Me=>Me.currentTarget.style.backgroundColor="transparent",onClick:()=>{w==="start"?(se("startDate",Ve.date),(!W.endDate||Ve.date>W.endDate)&&se("endDate",Ve.date),R("end")):(se("endDate",Ve.date),(!W.startDate||Ve.date<W.startDate)&&se("startDate",Ve.date),R(null));},children:Ve.label},Mt))})(),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:z=>z.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{se("startDate",void 0),se("endDate",void 0),R(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:()=>K(new Date($.getFullYear(),$.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:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date($.getFullYear(),$.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((z,ge)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:v.textTertiary},children:z},ge))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let z=$.getFullYear(),ge=$.getMonth(),Se=new Date(z,ge,1).getDay(),Pe=new Date(z,ge+1,0).getDate(),_e=new Date,Ve=[];for(let Me=Se-1;Me>=0;Me--)Ve.push({day:new Date(z,ge,-Me).getDate(),date:new Date(z,ge-1,new Date(z,ge,-Me).getDate()),isCurrentMonth:false});for(let Me=1;Me<=Pe;Me++)Ve.push({day:Me,date:new Date(z,ge,Me),isCurrentMonth:true});let Mt=42-Ve.length;for(let Me=1;Me<=Mt;Me++)Ve.push({day:Me,date:new Date(z,ge+1,Me),isCurrentMonth:false});return Ve.map((Me,Qt)=>{let Zt=Me.date.toDateString()===_e.toDateString(),Ft=W.startDate?.toDateString()===Me.date.toDateString(),bt=W.endDate?.toDateString()===Me.date.toDateString(),Ht=W.startDate&&W.endDate&&Me.date>=W.startDate&&Me.date<=W.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:Me.isCurrentMonth?Ft||bt?"#FFF":v.textPrimary:v.textTertiary,backgroundColor:Ft?"#3B82F6":bt?"#7C3AED":Ht?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Zt&&!Ft&&!bt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{w==="start"?(se("startDate",Me.date),W.endDate&&Me.date>W.endDate&&se("endDate",Me.date),R("end")):(se("endDate",Me.date),W.startDate&&Me.date<W.startDate&&se("startDate",Me.date),R(null));},children:Me.day},Qt)})})()})]})]})]})})]}),oe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:oe.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:W.progress,onChange:z=>se("progress",parseInt(z.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:v.bgSecondary,accentColor:W.progress<30?"#EF4444":W.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:`${W.progress<30?"#EF4444":W.progress<70?"#F59E0B":"#10B981"}20`,color:W.progress<30?"#EF4444":W.progress<70?"#F59E0B":"#10B981"},children:[W.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>pe(!ae),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 ${ae?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&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||g.length>0||m==="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 ",m==="create"?fe.length>0&&`(${fe.length})`:g.length>0&&`(${g.length})`]})]}),m==="create"?jsxRuntime.jsx(ur,{cardId:"pending",attachments:fe.map((z,ge)=>({id:`pending-${ge}`,cardId:"pending",name:z.name,size:z.size,type:z.type,url:URL.createObjectURL(z),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:z=>Ie(ge=>[...ge,...z]),onDelete:z=>{let ge=parseInt(z.replace("pending-",""),10);Ie(Se=>Se.filter((Pe,_e)=>_e!==ge));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(ur,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?z=>h(a.id,z):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),m==="create"&&fe.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:v.textTertiary},children:[fe.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:W.isMilestone,onChange:z=>se("isMilestone",z.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(z=>z.id!==a?.id).map(z=>{let ge=W.dependencies?.includes(z.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Se=ge?(W.dependencies||[]).filter(Pe=>Pe!==z.id):[...W.dependencies||[],z.id];se("dependencies",Se);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ge?`${v.accent}30`:v.bgPrimary,color:ge?v.accent:v.textSecondary,border:`1px solid ${ge?v.accent:v.borderLight}`},disabled:n,children:z.name},z.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:z=>z.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:z=>z.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:z=>!n&&(z.currentTarget.style.opacity="0.9"),onMouseLeave:z=>!n&&(z.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:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Wc=`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 K=ae=>ae.map(ue=>{if(ue.id===E){let Ee=ue.dependencies||[];if(!Ee.includes(S.id))return {...ue,dependencies:[...Ee,S.id]}}return ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue});Ve(K(Se)),ne?.(S.id,E);},[Se,ne,Jl]),Ql=react.useCallback((S,E)=>{let K=ae=>ae.map(ue=>{if(ue.id===S&&ue.dependencies){let Ee=ue.dependencies.filter(Lt=>Lt!==E);return {...ue,dependencies:Ee}}return ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue});Ve(K(Se)),re?.(S,E);},[Se,re]),{startDate:bn,endDate:uu}=react.useMemo(()=>{let S=Se.filter(Ee=>Ee.startDate&&Ee.endDate);if(S.length===0){let Ee=new Date,Lt=new Date(Ee);Lt.setDate(Lt.getDate()-30);let mt=new Date(Ee);return mt.setDate(mt.getDate()+60),{startDate:Lt,endDate:mt}}let E=S.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),K=new Date(Math.min(...E.map(Ee=>Ee.getTime()))),ae=new Date(Math.max(...E.map(Ee=>Ee.getTime()))),ue=se==="day"?7:se==="week"?14:30;return K.setDate(K.getDate()-ue),ae.setDate(ae.getDate()+ue),{startDate:K,endDate:ae}},[Se,se]),gu=react.useCallback(async()=>{if(!$a.current||!rt.current||!ya.current)return;await new Promise(Jr=>setTimeout(Jr,200));let S=$a.current,E=rt.current.querySelector(".gantt-grid-scroll"),K=ya.current,ae=E?.scrollTop||0,ue=E?.scrollLeft||0,Ee=K.scrollTop,Lt=K.scrollLeft,mt=S.style.overflow,qt=S.style.height,wa=E?.style.overflow||"",Sa=K.style.overflow,Fr=S.style.width,hn=K.style.width;try{let Jr=E?.querySelector(".gantt-taskgrid-content"),fr=K.querySelector("svg"),Lr=fr?.getAttribute("height")?parseInt(fr.getAttribute("height"),10):fr?.getBoundingClientRect().height||0,xo=Jr?.scrollHeight||E?.scrollHeight||600,Zr=Math.max(Lr,K.scrollHeight),ad=fr?.getAttribute("width")?parseInt(fr.getAttribute("width"),10):fr?.getBoundingClientRect().width||K.scrollWidth,wu=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Ss=Math.max(xo,Zr,Lr),Es=wu+Ss+50,Ps=(E?.offsetWidth||300)+ad+10;E&&(E.scrollTop=0,E.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Es}px`,S.style.width=`${Ps}px`,E&&(E.style.overflow="visible",E.style.height=`${Ss+50}px`),K.style.overflow="visible",K.style.height=`${Ss+50}px`,K.style.width=`${ad+10}px`,await new Promise(As=>setTimeout(As,150));let Cu=await dm__default.default(S,{backgroundColor:ct.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ps,height:Es,windowWidth:Ps+100,windowHeight:Es+100,scrollX:0,scrollY:0,ignoreElements:As=>{let rd=window.getComputedStyle(As),od=parseInt(rd.zIndex,10);return !isNaN(od)&&od>=50||rd.position==="fixed"}}),Ms=document.createElement("a");Ms.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ms.href=Cu.toDataURL("image/png"),Ms.click();}finally{S.style.overflow=mt,S.style.height=qt,S.style.width=Fr,E&&(E.style.overflow=wa,E.style.height="",E.scrollTop=ae,E.scrollLeft=ue),K.style.overflow=Sa,K.style.height="",K.style.width=hn,K.scrollTop=Ee,K.scrollLeft=Lt;}},[ct]),fu=react.useCallback(async()=>{await he.exportToPDF(Se);},[Se]),bu=react.useCallback(async()=>{await he.exportToExcel(Se);},[Se]),hu=react.useCallback(()=>{let S=he.exportToCSV(Se),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(E),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[Se]),yu=react.useCallback(()=>{let S=he.exportToJSON(Se),E=new Blob([S],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(E),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[Se]),vu=react.useCallback(()=>{he.exportToMSProject(Se,"Gantt Project","project.xml");},[Se]),xu=S=>{S.preventDefault(),oe(true);},vo=react.useRef(false),[Ds,ed]=react.useState(false),zo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let S=ya.current,E=rt.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let K=()=>{if(vo.current)return;vo.current=true;let mt=S.scrollTop;Ae(mt),E.scrollTop=mt,requestAnimationFrame(()=>{vo.current=false;});},ae=()=>{if(vo.current)return;vo.current=true;let mt=E.scrollTop;Ae(mt),S.scrollTop=mt,requestAnimationFrame(()=>{vo.current=false;});},ue=mt=>{if(G&&E){let wa=E.parentElement?.getBoundingClientRect()?.left||0,Sa=mt.clientX-wa,Fr=200,hn=ze+le,Jr=window.innerWidth*He,fr=Math.max(hn,Jr);Sa>=Fr&&Sa<=fr&&Oe(Sa);}if(Ds&&S){let qt=mt.clientX-zo.current.x,wa=mt.clientY-zo.current.y;S.scrollLeft=zo.current.scrollLeft-qt,S.scrollTop=zo.current.scrollTop-wa;}},Ee=()=>{oe(false),ed(false);},Lt=mt=>{if(mt.button!==0)return;let qt=mt.target;qt.closest("[data-task-bar]")||qt.closest("[data-dependency-line]")||qt.closest("button")||qt.closest('[role="button"]')||qt.tagName==="rect"&&qt.getAttribute("data-clickable")==="true"||(ed(true),zo.current={x:mt.clientX,y:mt.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},mt.preventDefault());};return S.addEventListener("scroll",K),E.addEventListener("scroll",ae),S.addEventListener("mousedown",Lt),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Ee),()=>{S.removeEventListener("scroll",K),E.removeEventListener("scroll",ae),S.removeEventListener("mousedown",Lt),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Ee);}},[G,Ds,ze]);let td=react.useRef(false),ku=react.useRef(null);return react.useLayoutEffect(()=>{if(td.current||Se.length===0||!ya.current)return;td.current=true,ku.current=bn;let S=ya.current,E=new Date,K=se==="day"?60:se==="week"?20:8,ae=(E.getTime()-bn.getTime())/(1e3*60*60*24),ue=S.clientWidth,Lt=ae*K*ie-ue/2;ae>=0&&ue>0&&(S.scrollLeft=Math.max(0,Lt));},[Se.length,bn,se,ie]),jsxRuntime.jsx(Fo.Provider,{value:U,children:jsxRuntime.jsx(Rs.Provider,{value:M,children:jsxRuntime.jsxs("div",{ref:$a,className:"flex flex-col h-full w-full",style:{backgroundColor:ct.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Hn,{theme:ct,timeScale:se,onTimeScaleChange:Ie,zoom:ie,onZoomChange:Xe,currentTheme:z,onThemeChange:jt,rowDensity:qe,onRowDensityChange:Qe,showThemeSelector:g,showCreateTaskButton:f,createTaskLabel:p,onCreateTask:x,taskFilter:yt,onTaskFilterChange:$,onExportPNG:i?gu:void 0,onExportPDF:i?fu:void 0,onExportExcel:i?bu:void 0,onExportCSV:i?hu:void 0,onExportJSON:i?yu:void 0,onExportMSProject:i?vu:void 0}),jsxRuntime.jsxs("div",{ref:rt,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:Ft,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Vn,{tasks:Ye,theme:ct,rowHeight:Pt,availableUsers:u,templates:V,onTaskClick:B,onTaskDblClick:Xl,onTaskContextMenu:I,onTaskToggle:vt,scrollTop:fe,columns:pe,onToggleColumn:de,onColumnResize:Ge,onTaskUpdate:Re,onTaskIndent:gt,onTaskOutdent:va,onTaskMove:Kt,onMultiTaskDelete:je,onTaskDuplicate:Yt,onTaskCreate:ga,onTaskRename:Ar,onCreateSubtask:Ns,onOpenTaskModal:B?S=>B(S):void 0,onDeleteRequest:(S,E)=>Bt({taskId:S,taskName:E}),onTaskReparent:ka})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ct.border,zIndex:15},onMouseDown:xu}),jsxRuntime.jsx("div",{ref:ya,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ds?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(es,{tasks:Ye,theme:ct,rowHeight:Pt,timeScale:se,startDate:bn,endDate:uu,zoom:ie,locale:C,templates:V,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:B,onTaskDblClick:Xl,onTaskContextMenu:mu,onTaskDateChange:cu,onDependencyCreate:Zl,onDependencyDelete:Ql})})]}),ye.task&&jsxRuntime.jsx(Lo,{isOpen:ye.isOpen,x:ye.x,y:ye.y,theme:ct,onClose:()=>it({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=ye.task;if(!S)return [];let E=he.findTaskById(Se,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{O?O(E):Ns(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{Bt({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:U.contextMenu?.editTask||"Edit Task",icon:Wt.Pencil,onClick:()=>{W?W(E):wt(E);}},{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{O?O(E):Ns(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:U.contextMenu?.markIncomplete||"Mark Incomplete",icon:Wt.MarkIncomplete,onClick:()=>{q?q(E):Re(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:U.contextMenu?.setInProgress||"Set In Progress",icon:Wt.SetInProgress,onClick:()=>{te?te(E):Re(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:U.contextMenu?.markComplete||"Mark Complete",icon:Wt.MarkComplete,onClick:()=>{Re(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:U.contextMenu?.splitTask||"Split Task",icon:Wt.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let ae=E.startDate.getTime(),ue=E.endDate.getTime(),Ee=ae+(ue-ae)/2,Lt=new Date(Ee);pu(E,Lt);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{Bt({taskId:E.id,taskName:E.name});}}]})()}),jsxRuntime.jsx(no,{task:Ue,isOpen:!!Ue,onClose:()=>wt(null),onTaskUpdate:S=>{Ue&&(Re(Ue.id,S),wt(null));},theme:z==="light"?"light":"dark",locale:C==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ut&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Bt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:S=>S.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ct.bgSecondary,border:`1px solid ${ct.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ct.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:ct.textPrimary,fontFamily:"Inter, sans-serif"},children:[U.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ct.textSecondary,fontFamily:"Inter, sans-serif"},children:C==="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:ct.textSecondary,fontFamily:"Inter, sans-serif"},children:[C==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ct.textPrimary},children:['"',ut.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ct.bgPrimary,borderTop:`1px solid ${ct.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Bt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ct.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=ct.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:C==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{je([ut.taskId]),Bt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),C==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsxRuntime.jsx(ts,{tasks:Se,theme:ct,config:k,onTasksUpdate:Ve,onTaskUpdate:Re,onTaskCreate:S=>{Ve(E=>[...E,S]);},onTaskDelete:S=>{je([S]);},onDependencyCreate:(S,E)=>{let K=he.findTaskById(Se,S);K&&Zl(K,E);},onDependencyDelete:Ql})]})})})});var Yi=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],qi=[{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 um({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:c=a?"edit":"create",theme:g="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:l,attachments:b=[],onUploadAttachments:v,onDeleteAttachment:k}){let C=[...Yi,...i.filter($=>!Yi.some(fe=>fe.id===$.id))],h=et[g]||et.dark,[f,p]=react.useState(false),[x,m]=react.useState(false),[N,w]=react.useState(false),[B,y]=react.useState(false),[I,P]=react.useState({top:0,left:0}),[T,W]=react.useState(null),[O,q]=react.useState(new Date),[te,ne]=react.useState({top:0,left:0}),[re,ce]=react.useState(false),[be,Le]=react.useState([]),A=react.useRef(null),R=react.useRef(null),L=react.useRef(null),j=react.useRef(null),X=react.useRef(null),[z,ve]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[se,Ie]=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)&&ce(true)):(ve({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ce(false),Le([]));},[a,e]),react.useEffect(()=>{let $=fe=>{A.current&&!A.current.contains(fe.target)&&p(false),R.current&&!R.current.contains(fe.target)&&m(false),L.current&&!L.current.contains(fe.target)&&w(false),j.current&&!j.current.contains(fe.target)&&y(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let qe=()=>{let $={};return z.name.trim()||($.name="El nombre es requerido"),z.startDate&&z.endDate&&z.startDate>z.endDate&&($.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie($),Object.keys($).length===0},Qe=async $=>{if($.preventDefault(),!!qe())try{let fe=c==="create"&&be.length>0?{...z,pendingFiles:be}:z;await s(fe),Le([]),t();}catch(fe){console.error("Error submitting task:",fe);}},ie=($,fe)=>{ve(Ae=>{let G={...Ae,[$]:fe};if($==="status"){let oe=fe;oe==="todo"?G.progress=0:oe==="in-progress"?(Ae.progress===0||Ae.progress===100)&&(G.progress=50):oe==="completed"||oe==="closed"?G.progress=100:(oe==="in-review"||oe==="review")&&(G.progress=75);}if($==="progress"){let oe=typeof fe=="number"?fe:parseInt(fe,10);oe===100&&Ae.status!=="completed"?G.status="completed":oe>0&&oe<100&&Ae.status==="todo"?G.status="in-progress":oe===0&&Ae.status!=="todo"&&(G.status="todo");}return G}),se[$]&&Ie(Ae=>{let G={...Ae};return delete G[$],G});},Xe=C.find($=>$.id===z.status)??Yi[0],lt=qi.find($=>$.id===z.priority)??qi[1],kt=hr.find($=>$.value===z.color)??hr[0],yt={backgroundColor:h.bgSecondary,border:`1px solid ${h.borderLight}`,color:h.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":g,style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${h.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Xe.color||h.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=h.hoverBg,$.currentTarget.style.color=h.textPrimary;},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=h.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Qe,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:$=>ie("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:h.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),se.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"}),se.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:z.description||"",onChange:$=>ie("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:h.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:A,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&p(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...yt,borderColor:Xe.color,backgroundColor:`${Xe.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Xe.color}}),jsxRuntime.jsx("span",{style:{color:Xe.color},children:Xe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Xe.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:h.bgPrimary,border:`1px solid ${h.border}`},children:C.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("status",$.id),p(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:$.color}}),$.title,z.status===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},$.id))})})]}),jsxRuntime.jsxs("div",{ref:R,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&m(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:yt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:lt.color}}),jsxRuntime.jsx("span",{children:lt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.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-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:qi.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("priority",$.id),m(false);},children:[jsxRuntime.jsx("span",{children:$.icon}),$.label,z.priority===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},$.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:L,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:yt,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(($,fe)=>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||h.accent,borderColor:h.bgSecondary},children:$.initials},fe))}),z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&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:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map($=>{let fe=z.assignees?.some(Ae=>Ae.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:h.textPrimary},onMouseEnter:Ae=>Ae.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Ae=>Ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Ae=fe?(z.assignees||[]).filter(G=>G.name!==$.name):[...z.assignees||[],{name:$.name,avatar:$.avatar,initials:$.name.split(" ").map(G=>G[0]).join("").toUpperCase().slice(0,2),color:h.accent}];ie("assignees",Ae);},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:h.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:fe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},$.id)})})})]}),jsxRuntime.jsxs("div",{ref:j,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(B)y(false);else {if(j.current){let $=j.current.getBoundingClientRect(),fe=window.innerHeight,Ae=120,oe=fe-$.bottom<Ae?$.top-Ae-8:$.bottom+8;P({top:oe,left:$.left});}y(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:yt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:z.color}}),jsxRuntime.jsx("span",{children:kt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(ft,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>y(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:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.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:hr.slice(0,18).map($=>{let fe=z.color===$.value;return jsxRuntime.jsx("button",{type:"button",onClick:Ae=>{Ae.preventDefault(),Ae.stopPropagation(),ie("color",$.value),y(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:fe?`2px solid ${$.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},$.value)})})})})]})})]}),u.length>0||l?jsxRuntime.jsx(br,{selectedTags:z.tags||[],availableTags:u,onChange:$=>ie("tags",$),onCreateTag:l,theme:h,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxRuntime.jsxs("div",{ref:X,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(T==="start")W(null);else {if(X.current){let $=X.current.getBoundingClientRect(),fe=window.innerHeight,Ae=320,oe=fe-$.bottom<Ae?$.top-Ae-8:$.bottom+8;ne({top:oe,left:$.left});}W("start"),q(z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...yt,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:h.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(T==="end")W(null);else {if(X.current){let $=X.current.getBoundingClientRect(),fe=window.innerHeight,Ae=320,oe=fe-$.bottom<Ae?$.top-Ae-8:$.bottom+8;ne({top:oe,left:$.left});}W("end"),q(z.endDate||z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...yt,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:T&&jsxRuntime.jsxs(ft,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(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:h.bgPrimary,border:`1px solid ${h.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${h.border}`},children:[(()=>{let $=new Date,fe=new Date($);fe.setDate($.getDate()+1);let Ae=new Date($);Ae.setDate($.getDate()+7);let G=new Date($);return G.setDate($.getDate()+14),[{label:"Hoy",date:$},{label:"Ma\xF1ana",date:fe},{label:"Pr\xF3xima semana",date:Ae},{label:"2 semanas",date:G}].map((xe,Oe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(ie("startDate",xe.date),(!z.endDate||xe.date>z.endDate)&&ie("endDate",xe.date),W("end")):(ie("endDate",xe.date),(!z.startDate||xe.date<z.startDate)&&ie("startDate",xe.date),W(null));},children:xe.label},Oe))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.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=h.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("startDate",void 0),ie("endDate",void 0),W(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:()=>q(new Date(O.getFullYear(),O.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary},children:O.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>q(new Date(O.getFullYear(),O.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map(($,fe)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:$},fe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=O.getFullYear(),fe=O.getMonth(),Ae=new Date($,fe,1).getDay(),G=new Date($,fe+1,0).getDate(),oe=new Date,xe=[];for(let ye=Ae-1;ye>=0;ye--)xe.push({day:new Date($,fe,-ye).getDate(),date:new Date($,fe-1,new Date($,fe,-ye).getDate()),isCurrentMonth:false});for(let ye=1;ye<=G;ye++)xe.push({day:ye,date:new Date($,fe,ye),isCurrentMonth:true});let Oe=42-xe.length;for(let ye=1;ye<=Oe;ye++)xe.push({day:ye,date:new Date($,fe+1,ye),isCurrentMonth:false});return xe.map((ye,it)=>{let Ue=ye.date.toDateString()===oe.toDateString(),wt=z.startDate?.toDateString()===ye.date.toDateString(),ut=z.endDate?.toDateString()===ye.date.toDateString(),Bt=z.startDate&&z.endDate&&ye.date>=z.startDate&&ye.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:ye.isCurrentMonth?wt||ut?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:wt?"#3B82F6":ut?"#7C3AED":Bt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ue&&!wt&&!ut?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(ie("startDate",ye.date),z.endDate&&ye.date>z.endDate&&ie("endDate",ye.date),W("end")):(ie("endDate",ye.date),z.startDate&&ye.date<z.startDate&&ie("startDate",ye.date),W(null));},children:ye.day},it)})})()})]})]})]})})]}),se.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:se.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:h.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:$=>ie("progress",parseInt($.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.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:()=>ce(!re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:h.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&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:[(v||b.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:h.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:h.textTertiary},children:["Adjuntos ",c==="create"?be.length>0&&`(${be.length})`:b.length>0&&`(${b.length})`]})]}),c==="create"?jsxRuntime.jsx(xr,{cardId:"pending",attachments:be.map(($,fe)=>({id:`pending-${fe}`,cardId:"pending",name:$.name,size:$.size,type:$.type,url:URL.createObjectURL($),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:$=>Le(fe=>[...fe,...$]),onDelete:$=>{let fe=parseInt($.replace("pending-",""),10);Le(Ae=>Ae.filter((G,oe)=>oe!==fe));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(xr,{cardId:a?.id||"new",attachments:b,onUpload:v&&a?.id?$=>v(a.id,$):void 0,onDelete:k,maxSizeMB:10,maxFiles:20}),c==="create"&&be.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[be.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:$=>ie("isMilestone",$.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:h.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:h.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:h.bgSecondary},children:r.filter($=>$.id!==a?.id).map($=>{let fe=z.dependencies?.includes($.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Ae=fe?(z.dependencies||[]).filter(G=>G!==$.id):[...z.dependencies||[],$.id];ie("dependencies",Ae);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:fe?`${h.accent}30`:h.bgPrimary,color:fe?h.accent:h.textSecondary,border:`1px solid ${fe?h.accent:h.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 ${h.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:h.textSecondary},onMouseEnter:$=>$.currentTarget.style.backgroundColor=h.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:h.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 gm=`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,39 +382,39 @@ 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 Gc(e){return `CURRENT TASKS:
386
- ${_c(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 fm(e){return `CURRENT TASKS:
386
+ ${bm(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 _c(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function kr(e,t){let a=_c(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(m=>{let p=m.name.toLowerCase();return n.every(i=>p.includes(i))})}function Mi(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}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),T=C.getDay(),v=h-T;return v<=0&&(v+=7),C.setDate(C.getDate()+v),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 g=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+g):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+g*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let g=parseInt(m[1],10),h=parseInt(m[2],10)-1,C=parseInt(m[3],10);return new Date(C,h,g)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),h=p[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,g)}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 g=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,h)}return null}function Ai(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 Fi(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 Vc(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 jc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),d=kr(t,i),g=Mi(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)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(g);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=kr(t,i),g=Ai(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!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()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${g} 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 i=s[1].trim(),u=s[2].trim(),d=kr(t,i),g=Fi(u);return d?g===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:g},message:`Set "${d.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,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 i=n[1].trim(),u=n[2].trim(),d=kr(t,i);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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),u=m[2].trim(),d=kr(t,i),g=kr(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let i=p[1].trim(),u=kr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Kc(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 ah(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 rh(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function _n(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.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=>_n(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},m=n(e.startDate),p=n(e.endDate),i=e.metadata?.isMilestone===true||m&&p&&Math.abs(p.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:p,progress:e.progress||0,status:ah(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:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Yc(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:rh(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function qc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>_n(r,e,t))}var Ii={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"}},Li={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"}},Vn={en:Ii,es:Li};function Bi(e){return Vn[e]||Vn.en}function jn(e,t){let a=Bi(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 Zc(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(...Zc(r.subtasks,t+1));return a}function ph({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 em({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:m="dark",locale:p="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=jn(p,i),h=m==="dark",[C,T]=react.useState("startDate"),[v,y]=react.useState("asc"),[c,k]=react.useState(""),l=react.useMemo(()=>{let D=new Set;function M(w){for(let R of w)R.subtasks?.length&&(R.isExpanded!==false&&D.add(R.id),M(R.subtasks));}return M(e),D},[e]),N=react.useCallback(D=>{a.onTaskToggleExpand?.(D);},[a]),x=react.useCallback(D=>{C===D?y(M=>M==="asc"?"desc":"asc"):(T(D),y("asc")),a.onSortChange?.({column:D,direction:v==="asc"?"desc":"asc"});},[C,v,a]),B=react.useMemo(()=>{let D=Zc(e);if(c.trim()){let w=c.toLowerCase();D=D.filter(R=>R.name.toLowerCase().includes(w));}let M=[];for(let w of D){let R=w.level===0;w.level>0&&(R=true),(R||c.trim())&&M.push(w);}return c.trim()&&M.sort((w,R)=>{let $,K;switch(C){case "name":$=w.name.toLowerCase(),K=R.name.toLowerCase();break;case "startDate":$=w.startDate?.getTime()||0,K=R.startDate?.getTime()||0;break;case "endDate":$=w.endDate?.getTime()||0,K=R.endDate?.getTime()||0;break;case "progress":$=w.progress||0,K=R.progress||0;break;case "status":$=w.status||"todo",K=R.status||"todo";break;default:return 0}return $<K?v==="asc"?-1:1:$>K?v==="asc"?1:-1:0}),M},[e,c,C,v]),b=D=>D?(D instanceof Date?D:new Date(D)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:f("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:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("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:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("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:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:f("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:f("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:c,onChange:D=>k(D.target.value),placeholder:g.toolbar.searchPlaceholder,className:f("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:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[B.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:f("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:()=>x("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>x("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B.map((D,M)=>{let w=l.has(D.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:M*.02},className:f("grid grid-cols-12 gap-4 px-6 py-4 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+D.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&D.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),N(D.id);},className:f("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:w?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!D.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...D,progress:D.progress===100?0:100,status:D.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(ph,{status:D.status,progress:D.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",h?"text-white":"text-gray-900",D.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:D.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:f("text-sm",h?"text-[#94A3B8]":"text-gray-500"),children:D.progress===100||D.status==="completed"?g.status.completed:D.progress&&D.progress>0||D.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsx("div",{className:f("col-span-2 flex items-center text-sm",h?"text-[#94A3B8]":"text-gray-500"),children:b(D.startDate)}),jsxRuntime.jsx("div",{className:f("col-span-2 flex items-center text-sm",h?"text-[#94A3B8]":"text-gray-500"),children:b(D.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:f("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",D.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${D.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[D.progress||0,"%"]})]})})]},D.id)})}),B.length===0&&c&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var $i={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"},Oi={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"},zi={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"},Kn={dark:$i,light:Oi,neutral:zi};function tm(e){return Kn[e]||Kn.dark}var Ui={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"}},Hi={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"}},Yn={en:Ui,es:Hi};function jo(e){return Yn[e]||Yn.en}function qn(e,t){let a=jo(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 am(e){let t=jo(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 rm(e,t=0,a=true){let r=jo(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 Ah(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 Ki(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 lm({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 cm({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:m,availableTags:p=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:h,mentionableUsers:C,onTaskOpen:T}){let{theme:v="dark",locale:y="en",customTranslations:c}=t,k=qn(y,c),l=v==="dark",N={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[x,B]=react.useState(r||new Date),[b,D]=react.useState(null),[M,w]=react.useState(null),[R,$]=react.useState(null),[K,te]=react.useState(new Date),[re,ae]=react.useState({}),pe=4,fe=3,[Ie,F]=react.useState(false),[O,L]=react.useState(false),[j,X]=react.useState(false),[W,ye]=react.useState(false),[oe,Le]=react.useState(null),[Ye,et]=react.useState(""),[se,Xe]=react.useState(void 0),[dt,kt]=react.useState(null),[wt,z]=react.useState(false),[ge,Se]=react.useState(false),[Pe,_e]=react.useState(null),[Ve,Mt]=react.useState(false),[Me,Qt]=react.useState(new Date),[Zt,Ft]=react.useState(false),[bt,Ht]=react.useState(false),[ea,Ce]=react.useState(false),[Ue,ca]=react.useState(""),[qe,We]=react.useState(false),[I,xe]=react.useState(""),[J,he]=react.useState(false),ve=react.useCallback(()=>{B(new Date(x.getFullYear(),x.getMonth()-1,1));},[x]),Be=react.useCallback(()=>{B(new Date(x.getFullYear(),x.getMonth()+1,1));},[x]),Ae=react.useCallback(()=>{B(new Date);},[]),ot=react.useMemo(()=>{let A=x.getFullYear(),_=x.getMonth(),De=new Date(A,_,1),Ge=new Date(A,_+1,0),Tt=De.getDay(),ie=Ge.getDate(),Oe=Ah(e),ut=new Date;ut.setHours(0,0,0,0);let Fe=[],ct=Tt,ha=new Date(A,_,0).getDate();for(let Wt=ct-1;Wt>=0;Wt--){let He=new Date(A,_-1,ha-Wt);Fe.push({date:He,isCurrentMonth:false,isToday:false,isWeekend:He.getDay()===0||He.getDay()===6,events:Oe.filter(Gt=>Ki(He,Gt)).map(Gt=>({id:Gt.id,title:Gt.name,start:Gt.startDate,end:Gt.endDate,task:Gt}))});}for(let Wt=1;Wt<=ie;Wt++){let He=new Date(A,_,Wt),Gt=He.getTime()===ut.getTime();Fe.push({date:He,isCurrentMonth:true,isToday:Gt,isWeekend:He.getDay()===0||He.getDay()===6,events:Oe.filter(ma=>Ki(He,ma)).map(ma=>({id:ma.id,title:ma.name,start:ma.startDate,end:ma.endDate,task:ma}))});}let ya=42-Fe.length;for(let Wt=1;Wt<=ya;Wt++){let He=new Date(A,_+1,Wt);Fe.push({date:He,isCurrentMonth:false,isToday:false,isWeekend:He.getDay()===0||He.getDay()===6,events:Oe.filter(Gt=>Ki(He,Gt)).map(Gt=>({id:Gt.id,title:Gt.name,start:Gt.startDate,end:Gt.endDate,task:Gt}))});}return Fe},[x,e]),U=y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Y=x.toLocaleDateString(y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),de=react.useCallback((A,_)=>{if(!b)return;let De={...b,[A]:_};D(De),a.onTaskUpdate?.(De);},[b,a]),ze=react.useCallback(A=>{if(!b)return;let _=b.progress||0;A==="completed"?_=100:A==="todo"&&(_=0);let De={...b,status:A,progress:_};D(De),a.onTaskUpdate?.(De),F(false);},[b,a]),Re=react.useCallback((A,_)=>{if(!b)return;let De={...b,startDate:A,endDate:_};D(De),a.onTaskUpdate?.(De);},[b,a]),H=react.useCallback(()=>{F(false),L(false),X(false),$(null),Ce(false),ca(""),We(false);},[]),ne=react.useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),Ft(false),!b||!a.onUploadAttachments)return;let _=Array.from(A.dataTransfer.files);if(_.length!==0){Ht(true);try{await a.onUploadAttachments(b.id,_);}finally{Ht(false);}}},[b,a]),$e=react.useCallback(async A=>{if(!b||!a.onUploadAttachments||!A.target.files)return;let _=Array.from(A.target.files);if(_.length!==0){Ht(true);try{await a.onUploadAttachments(b.id,_);}finally{Ht(false);}A.target.value="";}},[b,a]),St=react.useCallback(A=>{A.preventDefault(),A.stopPropagation(),Ft(true);},[]),tt=react.useCallback(A=>{A.preventDefault(),A.stopPropagation(),Ft(false);},[]),fa=react.useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),Ia=react.useCallback(A=>A.startsWith("image/")?lucideReact.Image:A.includes("pdf")||A.includes("document")?lucideReact.FileText:lucideReact.File,[]),st=react.useMemo(()=>!b||!u?[]:u.get(b.id)||[],[b,u]);return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:m,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:f("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:Y}),jsxRuntime.jsx("button",{onClick:Ae,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ve,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Be,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",l?"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:U.map(A=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:A},A))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:ot.map((A,_)=>{let De=A.date.getDay()===0||A.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?De?"bg-[#1C1F26]":A.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":De?"bg-gray-100":A.isCurrentMonth?"bg-white":"bg-gray-50",A.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ge=re[_]||pe,Tt=A.events.slice(0,Ge),ie=A.events.length-Ge;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Tt.map(Oe=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{D(Oe.task),a.onEventClick?.(Oe),T?.(Oe.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Oe.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(lm,{task:Oe.task}),jsxRuntime.jsx("span",{className:"truncate",children:Oe.title})]})},Oe.id)),ie>0&&jsxRuntime.jsxs("button",{onClick:Oe=>{Oe.stopPropagation(),ae(ut=>({...ut,[_]:Ge+fe}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ie," ",y==="es"?"M\xC1S":"MORE"]}),Ge>pe&&A.events.length>pe&&jsxRuntime.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),ae(ut=>({...ut,[_]:pe}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:y==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ge=_>=28,Tt=_%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),oe===_?Le(null):(Le(_),et(""),Xe(void 0),kt(null),_e(null),z(false),Se(false),Mt(false),Qt(A.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",oe===_?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",oe===_&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:oe===_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),et(""),Xe(void 0),kt(null),_e(null),z(false),Se(false),Mt(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ge?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ge?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",Ge?"bottom-full mb-1":"top-full mt-1",Tt?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ie=>{ie.stopPropagation(),z(false),Se(false),Mt(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Ye,onChange:ie=>et(ie.target.value),placeholder:y==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ie=>{if(ie.key==="Enter"&&Ye.trim()){let Oe=t.availableUsers?.find(Fe=>Fe.id===dt),ut=Pe||A.date;a.onTaskCreate?.({name:Ye.trim(),startDate:ut,endDate:ut,priority:se,assignees:Oe?[Oe]:void 0}),et(""),Xe(void 0),kt(null),_e(null),Le(null);}ie.key==="Escape"&&(Le(null),et(""),Xe(void 0),kt(null),_e(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",l?"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:ie=>{ie.stopPropagation(),z(!wt),Se(false);},className:f("p-1 rounded transition-colors",se?se==="urgent"||se==="high"?"text-red-400 bg-red-500/20":se==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"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:wt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ie=>ie.stopPropagation(),children:[{id:"urgent",label:y==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:y==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:y==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:y==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:y==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ie=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(ie.id),z(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",se===ie.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",ie.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ie.label})]},ie.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ie=>{ie.stopPropagation(),Mt(!Ve),z(false),Se(false),Qt(Pe||A.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Pe?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"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"}),(Pe||A.date).toLocaleDateString(y==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let ie=new Date,Oe=new Date(ie);Oe.setDate(ie.getDate()+1);let ut=new Date(ie);ut.setDate(ie.getDate()+((6-ie.getDay()+7)%7||7));let Fe=new Date(ie);Fe.setDate(ie.getDate()+((1-ie.getDay()+7)%7||7));let ct=new Date(ie);ct.setDate(ie.getDate()+14);let ha=new Date(ie);return ha.setDate(ie.getDate()+28),[{label:y==="es"?"Hoy":"Today",date:ie,display:ie.toLocaleDateString(y==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:y==="es"?"Ma\xF1ana":"Tomorrow",date:Oe,display:Oe.toLocaleDateString(y==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:y==="es"?"Este fin de semana":"This weekend",date:ut,display:y==="es"?"s\xE1b.":"sat."},{label:y==="es"?"Pr\xF3xima semana":"Next week",date:Fe,display:y==="es"?"lun.":"mon."},{label:y==="es"?"2 semanas":"2 weeks",date:ct,display:ct.toLocaleDateString(y==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:y==="es"?"4 semanas":"4 weeks",date:ha,display:ha.toLocaleDateString(y==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Wt,He)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{_e(Wt.date),Mt(false);},children:[jsxRuntime.jsx("span",{children:Wt.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:Wt.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:f("text-xs font-medium",l?"text-white":"text-gray-900"),children:Me.toLocaleDateString(y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Qt(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:y==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Qt(new Date(Me.getFullYear(),Me.getMonth()-1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Qt(new Date(Me.getFullYear(),Me.getMonth()+1)),className:f("p-0.5 rounded",l?"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:(y==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ie=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:ie},ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Me.getFullYear(),Oe=Me.getMonth(),ut=new Date(ie,Oe,1).getDay(),Fe=new Date(ie,Oe+1,0).getDate(),ct=new Date(ie,Oe,0).getDate(),ha=new Date,ya=[];for(let He=ut-1;He>=0;He--)ya.push({dayNum:ct-He,isCurrentMonth:false,date:new Date(ie,Oe-1,ct-He)});for(let He=1;He<=Fe;He++)ya.push({dayNum:He,isCurrentMonth:true,date:new Date(ie,Oe,He)});let Wt=42-ya.length;for(let He=1;He<=Wt;He++)ya.push({dayNum:He,isCurrentMonth:false,date:new Date(ie,Oe+1,He)});return ya.map((He,Gt)=>{let ma=He.date.toDateString()===ha.toDateString(),wr=(Pe||A.date).toDateString()===He.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!He.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),He.isCurrentMonth&&(l?"text-white":"text-gray-900"),ma&&"ring-1 ring-[#3B82F6]",wr&&"bg-[#7C3AED] text-white",!wr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{_e(He.date),Mt(false);},children:He.dayNum},Gt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),Se(!ge),z(false);},className:f("p-1 rounded transition-colors",dt?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:dt?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(ie=>ie.id===dt)?.color||"#7C3AED"},children:t.availableUsers?.find(ie=>ie.id===dt)?.initials||t.availableUsers?.find(ie=>ie.id===dt)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{kt(null),Se(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!dt&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:y==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ie=>jsxRuntime.jsxs("button",{onClick:()=>{kt(ie.id),Se(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",dt===ie.id&&(l?"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:ie.color||"#7C3AED"},children:ie.initials||ie.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ie.name})]},ie.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:y==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Ye.trim()){let ie=t.availableUsers?.find(ut=>ut.id===dt),Oe=Pe||A.date;a.onTaskCreate?.({name:Ye.trim(),startDate:Oe,endDate:Oe,priority:se,assignees:ie?[ie]:void 0}),et(""),Xe(void 0),kt(null),_e(null),Le(null);}},disabled:!Ye.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ye.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:y==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",A.isToday?"text-[#3B82F6]":A.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:A.date.getDate()})]})]},_)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{D(null),xe("");},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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[y==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:b.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"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:f("p-1.5 rounded transition-colors",l?"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:f("p-1.5 rounded transition-colors",l?"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:()=>{D(null),xe("");},className:f("p-1.5 rounded transition-colors",l?"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 A=b.progress===100?0:100,De={...b,progress:A,status:A===100?"completed":"todo"};D(De),a.onTaskUpdate?.(De);},className:f("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",b.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:b.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:f("text-xl font-semibold flex-1",b.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:b.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:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{H(),F(!Ie);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.progress===100||b.status==="completed"?"bg-green-500/20 text-green-400":b.progress&&b.progress>0||b.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:b.progress===100||b.status==="completed"?y==="es"?"COMPLETADO":"DONE":b.progress&&b.progress>0||b.status==="in-progress"?y==="es"?"EN PROGRESO":"IN PROGRESS":y==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>F(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:y==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:y==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:y==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(A=>jsxRuntime.jsxs("button",{onClick:()=>ze(A.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(b.status===A.id||A.id==="completed"&&b.progress===100||A.id==="in-progress"&&b.progress&&b.progress>0&&b.progress<100||A.id==="todo"&&(!b.progress||b.progress===0)&&b.status!=="in-progress"&&b.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",A.id==="completed"?"bg-green-500":A.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{F(false),L(false),$(null),X(!j);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[b.assignees&&b.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[b.assignees.slice(0,3).map((A,_)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},_)),b.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",b.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:y==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(A=>{let _=b.assignees?.some(De=>De.name===A.name);return jsxRuntime.jsxs("button",{onClick:()=>{let De=b.assignees||[],Ge;_?Ge=De.filter(Tt=>Tt.name!==A.name):Ge=[...De,{name:A.name,avatar:A.avatar,initials:A.initials||A.name.slice(0,2).toUpperCase(),color:A.color||"#8B5CF6"}],de("assignees",Ge);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",_&&(l?"bg-white/5":"bg-gray-50")),children:[A.avatar?jsxRuntime.jsx("img",{src:A.avatar,alt:A.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:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left",l?"text-white":"text-gray-900"),children:A.name}),_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},A.id||A.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:y==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{$(R?null:"start"),te(b.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[b.startDate?.toLocaleDateString(y==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(y==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),b.endDate?.toLocaleDateString(y==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(y==="es"?"Fin":"End"),(b.startDate||b.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:A=>{A.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,_=new Date(A);_.setDate(A.getDate()+1);let De=new Date(A);De.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let Ge=new Date(A);Ge.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let Tt=new Date(A);Tt.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let ie=new Date(A);ie.setDate(A.getDate()+14);let Oe=new Date(A);return Oe.setDate(A.getDate()+28),[{label:y==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(y==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:y==="es"?"Ma\xF1ana":"Tomorrow",date:_,display:_.toLocaleDateString(y==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:y==="es"?"Este fin de semana":"This weekend",date:De,display:y==="es"?"s\xE1b.":"sat."},{label:y==="es"?"Pr\xF3xima semana":"Next week",date:Ge,display:y==="es"?"lun.":"mon."},{label:y==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Tt,display:Tt.toLocaleDateString(y==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:y==="es"?"2 semanas":"2 weeks",date:ie,display:ie.toLocaleDateString(y==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:y==="es"?"4 semanas":"4 weeks",date:Oe,display:Oe.toLocaleDateString(y==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Fe,ct)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(R==="start"){let ha=b.endDate&&Fe.date>b.endDate?Fe.date:b.endDate;Re(Fe.date,ha),$("end");}else {let ha=b.startDate&&Fe.date<b.startDate?Fe.date:b.startDate;Re(ha,Fe.date),$(null);}},children:[jsxRuntime.jsx("span",{children:Fe.label}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Fe.display})]},ct))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Re(void 0,void 0),$(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:y==="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:f("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:R==="start"?y==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":y==="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:f("font-medium",l?"text-white":"text-gray-900"),children:K.toLocaleDateString(y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>te(new Date),className:f("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:y==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>te(new Date(K.getFullYear(),K.getMonth()-1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>te(new Date(K.getFullYear(),K.getMonth()+1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(y==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=K.getFullYear(),_=K.getMonth(),De=new Date(A,_,1).getDay(),Ge=new Date(A,_+1,0).getDate(),Tt=new Date(A,_,0).getDate(),ie=new Date,Oe=[];for(let Fe=De-1;Fe>=0;Fe--)Oe.push({day:Tt-Fe,isCurrentMonth:false,date:new Date(A,_-1,Tt-Fe)});for(let Fe=1;Fe<=Ge;Fe++)Oe.push({day:Fe,isCurrentMonth:true,date:new Date(A,_,Fe)});let ut=42-Oe.length;for(let Fe=1;Fe<=ut;Fe++)Oe.push({day:Fe,isCurrentMonth:false,date:new Date(A,_+1,Fe)});return Oe.map((Fe,ct)=>{let ha=Fe.date.toDateString()===ie.toDateString(),ya=b.startDate?.toDateString()===Fe.date.toDateString(),Wt=b.endDate?.toDateString()===Fe.date.toDateString(),He=ya||Wt,Gt=b.startDate&&b.endDate&&Fe.date>=b.startDate&&Fe.date<=b.endDate;return jsxRuntime.jsx("button",{className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Fe.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Fe.isCurrentMonth&&(l?"text-white":"text-gray-900"),ha&&"ring-2 ring-[#3B82F6]",ya&&"bg-[#3B82F6] text-white",Wt&&!ya&&"bg-[#7C3AED] text-white",Gt&&!He&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!He&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ma=new Date(Fe.date);if(R==="start"){let wr=b.endDate&&ma>b.endDate?ma:b.endDate;Re(ma,wr),$("end");}else {let wr=b.startDate&&ma<b.startDate?ma:b.startDate;Re(wr,ma),$(null);}},children:Fe.day},ct)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{H(),L(!O);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.priority==="high"||b.priority==="urgent"?"bg-red-500/20 text-red-400":b.priority==="medium"?"bg-yellow-500/20 text-yellow-400":b.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:b.priority?b.priority==="high"||b.priority==="urgent"?y==="es"?"Urgente":"Urgent":b.priority==="medium"?y==="es"?"Media":"Medium":y==="es"?"Baja":"Low":y==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:y==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:y==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:y==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:y==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:y==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxRuntime.jsxs("button",{onClick:()=>{de("priority",A.id),L(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",b.priority===A.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",A.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:b.startDate&&b.endDate?`${Math.ceil((b.endDate.getTime()-b.startDate.getTime())/(1e3*60*60*24))} ${y==="es"?"d\xEDas":"days"}`:y==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[W?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:b.progress||0,onChange:A=>{let _=parseInt(A.target.value),De=b.status;_===100?De="completed":_>0?De="in-progress":De="todo";let Ge={...b,progress:_,status:De};D(Ge),a.onTaskUpdate?.(Ge);},onBlur:()=>ye(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ye(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",b.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${b.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[b.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(dr,{selectedTags:b.tags||[],availableTags:p,onChange:A=>{de("tags",A);},onCreateTag:i,theme:N})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[b.dependencies&&b.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:b.dependencies.map(A=>{let _=e.find(De=>De.id===A);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[_?.name||A.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let De=(b.dependencies||[]).filter(Ge=>Ge!==A);de("dependencies",De);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},A)})}),jsxRuntime.jsxs("button",{onClick:()=>{H(),Ce(!ea);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"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:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ea&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ce(false),ca("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Ue,onChange:A=>ca(A.target.value),placeholder:y==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",l?"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(A=>A.id!==b.id).filter(A=>Ue===""||A.name.toLowerCase().includes(Ue.toLowerCase())).map(A=>{let _=b.dependencies?.includes(A.id);return jsxRuntime.jsxs("button",{onClick:()=>{let De=b.dependencies||[],Ge;_?Ge=De.filter(Tt=>Tt!==A.id):Ge=[...De,A.id],de("dependencies",Ge);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",_&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",_?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:_&&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:f("block truncate",l?"text-white":"text-gray-900"),children:A.name}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:y==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{H(),We(!qe);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"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:b.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:cr.find(A=>A.value===b.color)?.name||(y==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"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:cr.map(A=>{let _=b.color===A.value;return jsxRuntime.jsx("button",{onClick:()=>{de("color",A.value),We(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",_&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:_?A.value:void 0},title:A.name,children:_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:b.isMilestone||false,onChange:A=>de("isMilestone",A.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",b.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:y==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:y==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:b.description||"",onChange:A=>de("description",A.target.value),placeholder:y==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"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:f("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),y==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:y==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"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"}),y==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:y==="es"?"Agregar subtarea":"Add subtask"}),b.subtasks&&b.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:b.subtasks.map(A=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",A.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",A.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:A.name})]},A.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"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"}),y==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:y==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",l?"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:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"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"}),y==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[y==="es"?"Adjuntos":"Attachments",st.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",st.length,")"]})]}),st.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:st.map(A=>{let _=Ia(A.type),De=A.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[De&&A.thumbnailUrl?jsxRuntime.jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(_,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:A.name}),jsxRuntime.jsx("p",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:fa(A.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(A.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:y==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxRuntime.jsxs("div",{onDragOver:St,onDragLeave:tt,onDrop:ne,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Zt?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",bt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:$e,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||bt}),bt?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:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:y==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",Zt?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:Zt?y==="es"?"Suelta los archivos aqu\xED":"Drop files here":y==="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:f("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:y==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[y==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(A=>{let _=(()=>{let De=new Date,Ge=new Date(A.createdAt),Tt=De.getTime()-Ge.getTime(),ie=Math.floor(Tt/6e4),Oe=Math.floor(ie/60),ut=Math.floor(Oe/24);return ie<1?y==="es"?"ahora":"now":ie<60?y==="es"?`hace ${ie}m`:`${ie}m ago`:Oe<24?y==="es"?`hace ${Oe}h`:`${Oe}h ago`:y==="es"?`hace ${ut}d`:`${ut}d ago`})();return 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:"#8B5CF6"},children:A.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:f("text-sm font-medium",l?"text-white":"text-gray-900"),children:A.user?.name||(y==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:_})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:A.content})]})]},A.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:y==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[h&&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:h.color||"#8B5CF6"},children:h.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:I,onChange:A=>xe(A.target.value),onKeyDown:async A=>{if(A.key==="Enter"&&!A.shiftKey&&b&&I.trim()&&g){A.preventDefault(),he(true);try{await g(b.id,I.trim()),xe("");}finally{he(false);}}},placeholder:y==="es"?"Escribe un comentario...":"Write a comment...",disabled:J||!g,className:f("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(J||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(b&&I.trim()&&g){he(true);try{await g(b.id,I.trim()),xe("");}finally{he(false);}}},disabled:J||!I.trim()||!g,className:f("p-1.5 rounded transition-colors",I.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",J&&"opacity-50 cursor-not-allowed"),children:J?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"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>w(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:f("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:M.date.toLocaleDateString(y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>w(null),className:f("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:M.events.map(A=>jsxRuntime.jsxs("button",{onClick:()=>{w(null),D(A.task),T?.(A.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(lm,{task:A.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:A.title}),A.task.priority==="high"||A.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},A.id))})]})]})})]})}var Yi={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"},qi={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"},Xi={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"},Jn={dark:Yi,light:qi,neutral:Xi};function mm(e){return Jn[e]||Jn.dark}function Ih({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:m}){let[p,i]=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(y=>y.assignedUserIds||[])).size,T=u.map(y=>y.priority).filter(Boolean),v=new Set(u.flatMap(y=>y.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:T,labels:v}},[u]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:g,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:f("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"]})]}),p&&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 um={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function qo(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 Xo(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 gm(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 fm({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:m}){let p=react.useMemo(()=>({...um,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let c=new Map;return e.forEach(k=>{let l=k.timestamp.toISOString().split("T")[0],N=c.get(l);N?N.push(k):c.set(l,[k]);}),Array.from(c.entries()).sort((k,l)=>l[0].localeCompare(k[0])).map(([k,l])=>({date:new Date(k),events:l.sort((N,x)=>x.timestamp.getTime()-N.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=react.useMemo(()=>{let c=new Set,k=new Set;return e.forEach(l=>{c.add(l.userId),k.add(l.type);}),{uniqueUsers:Array.from(c),uniqueTypes:Array.from(k)}},[e]),T=c=>{u(k=>{let l=new Set(k);return l.has(c)?l.delete(c):l.add(c),l});},v=c=>{let l=new Date().getTime()-c.getTime(),N=Math.floor(l/6e4),x=Math.floor(l/36e5),B=Math.floor(l/864e5);return N<1?"just now":N<60?`${N}m ago`:x<24?`${x}h ago`:B<7?`${B}d ago`:c.toLocaleDateString()},y=react.useMemo(()=>{let c=0;return t.types&&t.types.length>0&&c++,t.users&&t.users.length>0&&c++,t.dateRange&&c++,t.searchTerm&&c++,c},[t]);return react.useEffect(()=>{if(s&&d.current){let c=d.current.querySelector(`[data-event-id="${s}"]`);c&&c.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",m),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:f("history-timeline",p.compact&&"compact",m),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:c=>{let k=c.target.value;a({...t,types:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),C.map(c=>jsxRuntime.jsxs("option",{value:c,children:[Xo(c)," ",c.replace("_"," ")]},c))]}),h.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:c=>{let k=c.target.value;a({...t,users:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),h.map(c=>jsxRuntime.jsx("option",{value:c,children:c},c))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:c=>a({...t,searchTerm:c.target.value})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(c=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&c.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:c.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[c.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:c.events.map((k,l)=>{let N=i.has(k.id),x=s===k.id,B=gm(k.type);return jsxRuntime.jsxs("div",{"data-event-id":k.id,className:f("history-timeline-event",N&&"expanded",x&&"selected"),onClick:()=>o?.(k),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Xo(k.type)})}),l<c.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:[p.showAvatars&&k.userAvatar&&jsxRuntime.jsx("img",{src:k.userAvatar,alt:k.userName||k.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:k.userName||k.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:qo(k)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?v(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:b=>{b.stopPropagation(),T(k.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([b,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[b,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},b)),k.metadata&&Object.keys(k.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(k.metadata).map(([b,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[b,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},b))]})]})]})]},k.id)})})]},c.date?.toISOString()||"all"))})]})}function bm({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:m,onSpeedChange:p,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Xo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&qo(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=>m(parseInt(h.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>m(C),title:qo(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:f("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>p(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:f("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Ji(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 Qi(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 ym(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 vm(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function zh(e,t,a,r,o,s=100){let n=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(n.map(p=>[p.id,p]));for(let p=0;p<s;p++){let i=1-p/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,T=u.y-h.y,v=Math.sqrt(C*C+T*T)||1,y=o.chargeStrength*i/(v*v);u.vx+=C/v*y,u.vy+=T/v*y;});}),t.forEach(u=>{let d=m.get(typeof u.source=="string"?u.source:u.source.id),g=m.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let h=g.x-d.x,C=g.y-d.y,T=Math.sqrt(h*h+C*C)||1,v=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=h*v,d.vy+=C*v,g.vx-=h*v,g.vy-=C*v;}),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 xm({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:m,className:p}){let i=react.useRef(null),[u,d]=react.useState([]),[g,h]=react.useState(null),[C,T]=react.useState(null),[v,y]=react.useState(null),[c,k]=react.useState(1),[l,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=zh(e,t,a.width,a.height,a,150);d($);},[e,t,a]);let x=react.useCallback(($,K)=>{a.enableDragging&&(K.stopPropagation(),h($));},[a.enableDragging]),B=react.useCallback($=>{if(!g||!i.current)return;let te=i.current.getBoundingClientRect(),re=($.clientX-te.left-l.x)/c,ae=($.clientY-te.top-l.y)/c;d(pe=>pe.map(fe=>fe.id===g?{...fe,x:re,y:ae,fx:re,fy:ae}:fe));},[g,c,l]),b=react.useCallback(()=>{h(null);},[]),D=react.useCallback(($,K)=>{K.stopPropagation(),m?.({type:"node-click",node:$,position:{x:K.clientX,y:K.clientY}});},[m]),M=react.useCallback(($,K)=>{K.stopPropagation(),m?.({type:"edge-click",edge:$,position:{x:K.clientX,y:K.clientY}});},[m]),w=react.useCallback($=>{let K=u.find(te=>te.id===$);return K?{x:K.x,y:K.y}:{x:0,y:0}},[u]),R=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=$.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("relationships-graph-empty",p),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:f("relationships-graph",p),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children: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:()=>k($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(c*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Ji($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[ym($)," ",Qi($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:B,onMouseUp:b,onMouseLeave:b,children:[jsxRuntime.jsxs("g",{transform:`translate(${l.x}, ${l.y}) scale(${c})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let K=w(typeof $.source=="string"?$.source:$.source.id),te=w(typeof $.target=="string"?$.target:$.target.id),re=vm($.type),ae=v===$.id,pe=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",ae&&"hovered",pe&&"critical"),onMouseEnter:()=>y($.id),onMouseLeave:()=>y(null),onClick:fe=>M($,fe),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:te.x,y2:te.y,stroke:Ji($.type),strokeWidth:pe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ae?1:.6,markerEnd:re?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ae&&jsxRuntime.jsx("text",{x:(K.x+te.x)/2,y:(K.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qi($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map($=>{let K=C===$.id,te=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",K&&"hovered",te&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:re=>x($.id,re),onMouseEnter:()=>T($.id),onMouseLeave:()=>T(null),onClick:re=>D($,re),children:[jsxRuntime.jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:R($),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.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 Cm({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[m,p]=react.useState(false),[i,u]=react.useState(null),[d,g]=react.useState(null),h=react.useRef(null),C=m||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let c=k=>{k.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},v=async()=>{if(!(!s.trim()||C)){p(true),u(null),g(null);try{let c=await r(s.trim());g(c);}catch(c){u(c instanceof Error?c.message:"Failed to generate plan");}finally{p(false);}}},y=()=>{d&&(a(d),T());};return e?jsxRuntime.jsxs(mt,{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-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:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("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:T,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((c,k)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:c.title},k))})]}),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((c,k)=>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:c.title}),c.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:c.description})]}),c.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${c.priority==="URGENT"?"bg-red-500/20 text-red-400":c.priority==="HIGH"?"bg-orange-500/20 text-orange-400":c.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:c.priority})]})},k)),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:c=>n(c.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled: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."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((c,k)=>jsxRuntime.jsx("button",{onClick:()=>n(c),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:c},k))})]})]})}),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:T,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:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,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 Zi={"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}},Wh={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 Gh(e,t,a){let r=Zi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Jo(e){return `$${e.toFixed(4)}`}var el=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Gh(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,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),m=a.filter(d=>d.success),p=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?p/r:0,successRate:r>0?m.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let m=this.operations.filter(u=>u.timestamp>=n).length,p=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:p,percentUsed:i,isExceeded:m>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},to=new el;function Dm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(to.getStats()),[s,n]=react.useState(to.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(to.getStats()),n(to.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let m=to.getRecentOperations(5);return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Jo(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,i])=>{let u=r.costsByFeature[p]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Jo(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}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:m.map(p=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Jo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Pm({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,m]=react.useState(""),[p,i]=react.useState(""),[u,d]=react.useState(""),[g,h]=react.useState(false),[C,T]=react.useState(null),[v,y]=react.useState(null),[c,k]=react.useState(null),l=react.useRef(null),N=g||o;react.useEffect(()=>{e&&l.current&&l.current.focus();},[e]),react.useEffect(()=>{let M=w=>{w.key==="Escape"&&!N&&x();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,N]);let x=()=>{N||(m(""),i(""),d(""),T(null),y(null),k(null),t());},B=async()=>{if(!(!n.trim()||N)){h(true),T(null),y(null),k(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:u||void 0});y(M.tasks.tasks),k({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){T(M instanceof Error?M.message:"Failed to generate tasks");}finally{h(false);}}},b=()=>{v&&(a(v),x());};if(!e)return null;let D=c?.similarity?((c.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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.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:x,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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:[c?.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"}),c?.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 (",D,"% 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:[c?.tokens_used||0," tokens"]}),c?.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:[c.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((M,w)=>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:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:M.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"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.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:l,value:n,onChange:M=>m(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),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((M,w)=>jsxRuntime.jsx("button",{onClick:()=>m(M),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsxRuntime.jsx("button",{onClick:b,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()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function es({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&ln(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,c,k)=>{console.warn(`Retry attempt ${c} after ${k}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=react.useCallback(async(v,y,c)=>{r(k=>{let l=k.cards.find(M=>M.id===v);if(!l)return k;let N=l.columnId,x={...l,columnId:y,position:c},B=k.cards.map(M=>M.id===v?x:M),b=k.columns.map(M=>{if(M.id===N)return {...M,cardIds:M.cardIds.filter(w=>w!==v)};if(M.id===y){let w=B.filter(R=>R.columnId===y).sort((R,$)=>R.position-$.position);return {...M,cardIds:w.map(R=>R.id)}}return M}),D={...k,cards:B,columns:b};return o(D),D});},[o]),n=react.useCallback(async(v,y)=>{r(c=>{let k=c.cards.map(N=>N.id===v?{...N,...y}:N),l={...c,cards:k};return o(l),l});},[o]),m=react.useCallback(async v=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(c=>{let k={...v,id:y},l=c.columns.map(x=>x.id===v.columnId?{...x,cardIds:[...x.cardIds,y]}:x),N={...c,cards:[...c.cards,k],columns:l};return o(N),N});},[o]),p=react.useCallback(async v=>{r(y=>{let c=y.cards.find(x=>x.id===v);if(!c)return y;let k=y.cards.filter(x=>x.id!==v),l=y.columns.map(x=>x.id===c.columnId?{...x,cardIds:x.cardIds.filter(B=>B!==v)}:x),N={...y,cards:k,columns:l};return o(N),N});},[o]),i=react.useCallback(async v=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(c=>{let k={...v,id:y,cardIds:[]},l={...c,columns:[...c.columns,k]};return o(l),l});},[o]),u=react.useCallback(async(v,y)=>{r(c=>{let k=c.columns.map(N=>N.id===v?{...N,...y}:N),l={...c,columns:k};return o(l),l});},[o]),d=react.useCallback(async v=>{r(y=>{let c=y.cards.filter(N=>N.columnId!==v),k=y.columns.filter(N=>N.id!==v),l={...y,cards:c,columns:k};return o(l),l});},[o]),g=react.useCallback(v=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(v),y},[m]),h=react.useCallback(v=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),y},[i]),C=react.useCallback(()=>{r(v=>{let y={...v,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:m,onCardDelete:p,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:h,deleteCard:p,deleteColumn:d,clearBoard:C}}}function Am({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=es({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(p,i,u={})=>{s.addCard({title:i,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...u});},addColumn:(p,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:i??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 Qo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Im={by:"none",order:"asc"};function Lm({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Qo,...e}),[s,n]=react.useState({...Im,...t}),m=react.useCallback(T=>{o(v=>({...v,...T}));},[]),p=react.useCallback(T=>{n(v=>({...v,...T}));},[]),i=react.useCallback(()=>{o(Qo),n(Im);},[]),u=react.useCallback(()=>{a&&o({...Qo,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Qo,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Qo,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(T=>{let v=[...T];if(r.search){let y=r.search.toLowerCase();v=v.filter(c=>c.title.toLowerCase().includes(y)||c.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,c=y.getFullYear(),k=String(y.getMonth()+1).padStart(2,"0"),l=String(y.getDate()).padStart(2,"0"),N=`${c}-${k}-${l}`;v=v.filter(x=>{if(!x.endDate&&!x.dueDate)return false;let B=x.endDate||x.dueDate;if(!B)return false;let b;if(typeof B=="string")b=B.split("T")[0]||B;else {let D=B.getUTCFullYear(),M=String(B.getUTCMonth()+1).padStart(2,"0"),w=String(B.getUTCDate()).padStart(2,"0");b=`${D}-${M}-${w}`;}switch(r.dateFilter){case "overdue":return b<N;case "today":return b===N;case "this-week":let D=new Date(N+"T00:00:00"),M=new Date(b+"T00:00:00"),w=new Date(D);return w.setDate(w.getDate()+7),M>=D&&M<=w;case "custom":if(r.dateRange){let R=typeof B=="string"?new Date(B):B;return R>=r.dateRange.start&&R<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(v=v.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(v=v.filter(y=>y.labels&&y.labels.some(c=>r.labels.includes(c)))),r.columns.length>0&&(v=v.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&v.sort((y,c)=>{let k=0;switch(s.by){case "created":let l=y.createdAt?new Date(y.createdAt).getTime():0,N=c.createdAt?new Date(c.createdAt).getTime():0;k=l-N;break;case "priority":let x={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=x[y.priority||"LOW"],b=x[c.priority||"LOW"];k=B-b;break;case "dueDate":let D=y.endDate||y.dueDate,M=c.endDate||c.dueDate;if(!D)return 1;if(!M)return -1;let w=typeof D=="string"?new Date(D).getTime():D.getTime(),R=typeof M=="string"?new Date(M).getTime():M.getTime();k=w-R;break;case "title":k=y.title.localeCompare(c.title);break;case "estimate":let $=y.estimatedTime||0,K=c.estimatedTime||0;k=$-K;break;default:k=0;}return s.order==="asc"?k:-k}),v},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:p,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:h}}var Rm,$m;if(typeof window<"u")try{let e=on("ai");Rm=e.generateObject,$m=e.generateText;}catch{}function Om(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Rm&&$m&&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(g){let h=g instanceof Error?g:new Error("Failed to generate plan");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("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let h=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),p=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(g){let h=g instanceof Error?g:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),i=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(g){let h=g instanceof Error?g: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(g){let h=g instanceof Error?g:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:m,onPredictRisks:p,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function al(){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 zm(e){let{cards:t}=e,[a,r]=al(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=g.ctrlKey||g.metaKey,C=g.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(y=>y.id===d),v=t.find(y=>y.id===a.lastSelectedCardId);if(T&&v&&T.columnId===v.columnId){let y=t.filter(b=>b.columnId===T.columnId).sort((b,D)=>b.position-D.position),c=y.findIndex(b=>b.id===a.lastSelectedCardId),k=y.findIndex(b=>b.id===d),[l,N]=c<k?[c,k]:[k,c],x=y.slice(l,N+1).map(b=>b.id),B=Array.from(new Set([...a.selectedCardIds,...x]));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(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=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:m,selectAll:p,toggleCard:i,getSelectedCards:u}}var Um={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Hm(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Um,...a}),[a]),[s,n]=react.useState([]),m=react.useCallback((T,v,y,c,k)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let l={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:v,columnId:y,strategy:c,color:k,isExpanded:true,position:s.filter(N=>N.columnId===y).length,createdAt:new Date};n(N=>[...N,l]);},[o.minCardsPerStack,s]),p=react.useCallback(T=>{n(v=>v.filter(y=>y.id!==T));},[]),i=react.useCallback(T=>{n(v=>v.map(y=>y.id===T?{...y,isExpanded:!y.isExpanded}:y));},[]),u=react.useCallback((T,v)=>{n(y=>y.map(c=>c.id===T&&!c.cardIds.includes(v)?{...c,cardIds:[...c.cardIds,v]}:c));},[]),d=react.useCallback((T,v)=>{n(y=>y.map(c=>{if(c.id===T){let k=c.cardIds.filter(l=>l!==v);return k.length<o.minCardsPerStack?null:{...c,cardIds:k}}return c}).filter(c=>c!==null));},[o.minCardsPerStack]),g=react.useCallback(T=>s.filter(v=>v.columnId===T).sort((v,y)=>v.position-y.position),[s]),h=react.useCallback(async T=>{let v=t.filter(N=>N.columnId===T);if(v.length<o.minCardsPerStack*2)return [];let y=[],c=new Map;v.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(x=>{c.has(x)||c.set(x,[]),c.get(x).push(N);});}),c.forEach((N,x)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${x}`,cardIds:N.map(B=>B.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${x}"`,confidence:.85});});let k=new Map;v.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(x=>{k.has(x)||k.set(x,[]),k.get(x).push(N);});}),k.forEach((N,x)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${x.slice(-4)}`,cardIds:N.map(B=>B.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let l=new Map;if(v.forEach(N=>{N.priority&&(l.has(N.priority)||l.set(N.priority,[]),l.get(N.priority).push(N));}),l.forEach((N,x)=>{if(N.length>=o.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[x.toLowerCase()]||"\u26AA";y.push({stack:{title:`${B} ${x} Priority`,cardIds:N.map(b=>b.id),columnId:T,strategy:"priority",color:x==="high"||x==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${x} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of v){let B=(await r.findSimilar(N,v)).filter(b=>b.similarity>=o.autoStackConfidenceThreshold);if(B.length>=o.minCardsPerStack-1){let b=[N.id,...B.map(M=>M.card.id)],D=B.reduce((M,w)=>M+w.similarity,0)/B.length;y.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:b,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:D});}}return y.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,x)=>x.confidence-N.confidence).slice(0,5)},[t,o,r]),C=react.useCallback(T=>{m(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let y=await h(v),c=y[0];y.length>0&&c&&c.confidence>=.9&&C(c);});},[]),{stacks:s,createStack:m,deleteStack:p,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:h,applySuggestion:C,config:o}}var Wm=react.createContext(null);function Gm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(p=>{let{Column:i}=on("@libxai/core");s.set(p.id,new i(p));}),t?.cards?.forEach(p=>{let{Card:i}=on("@libxai/core");n.set(p.id,new i(p));});let m=null;if(t?.board){let{Board:p}=on("@libxai/core");m=new p(t.board);}r.current=new core.BoardStore({board:m,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Wm.Provider,{value:{store:o},children:e})}function ts(){let e=react.useContext(Wm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function en(){let e=ts(),[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 m=react.useCallback(c=>{e.updateBoard(c);},[e]),p=react.useCallback(c=>{e.addColumn(c);},[e]),i=react.useCallback((c,k)=>{e.updateColumn(c,k);},[e]),u=react.useCallback(c=>{e.deleteColumn(c);},[e]),d=react.useCallback(c=>e.getColumn(c),[e]),g=react.useCallback(c=>{e.addCard(c);},[e]),h=react.useCallback((c,k)=>{e.updateCard(c,k);},[e]),C=react.useCallback(c=>{e.deleteCard(c);},[e]),T=react.useCallback((c,k,l)=>{e.moveCard(c,k,l);},[e]),v=react.useCallback(c=>e.getCard(c),[e]),y=react.useCallback(c=>e.getCardsByColumn(c),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:p,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:h,deleteCard:C,moveCard:T,getCard:v,getCardsByColumn:y}}function Vm(e){let{cards:t}=en();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 jm(e="position",t="asc"){let{cards:a}=en();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?m[o.priority]:0,i=s.priority?m[s.priority]:0;n=p-i;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 as=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Bl.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 m=await Promise.resolve(n.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{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);}},sb=new as;function Ym({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:m=0,getItemKey:p}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:m}),d=u.getVirtualItems(),g={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:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:h,children:d.map(C=>{let T=e[C.index];if(!T)return null;let v=p?p(T,C.index):C.index,y={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:y,"data-index":C.index,children:r(T,C.index)},v)})})})}function qm(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 Jm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:m=16,getItemKey:p,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:m}),g=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:g.map(T=>{let v=e[T.index];if(!v)return null;let y=p?p(v,T.index):T.index,c={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsxRuntime.jsx("div",{style:c,"data-index":T.index,children:o(v,T.index)},y)})})})}function Qm(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 Zm(e,t=10){return e>t}var sl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},il={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ll={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},dl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},cl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},ml={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pl={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ul={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)"},gl={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)"},fl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},hl={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}},bl={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}},rs={spacing:sl,borderRadius:il,fontSize:ll,fontWeight:dl,lineHeight:cl,zIndex:ml,duration:pl,easing:ul,shadows:gl,opacity:fl,kanban:hl,gantt:bl};function ep(e,t,a){return e[t]??a}function yl(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)?yl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function db(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vl(e="asakaa"){let t=yl(rs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=db(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Mr(e,t){let a=bm(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 g=c.name.toLowerCase();return n.every(i=>g.includes(i))})}function Xi(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 b=new Date(r);return b.setDate(b.getDate()+1),b}if(a==="yesterday"||a==="ayer"){let b=new Date(r);return b.setDate(b.getDate()-1),b}if(a==="next week"||a==="la pr\xF3xima semana"){let b=new Date(r);return b.setDate(b.getDate()+7),b}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 v={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(v!==void 0){let k=new Date(r),C=k.getDay(),h=v-C;return h<=0&&(h+=7),k.setDate(k.getDate()+h),k}}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 b=parseInt(s[1],10),v=s[2].toLowerCase(),k=new Date(r);return v==="day"||v==="d\xEDa"||v==="dias"?k.setDate(k.getDate()+b):v==="week"||v==="semana"||v==="semanas"?k.setDate(k.getDate()+b*7):(v==="month"||v==="mes"||v==="meses")&&k.setMonth(k.getMonth()+b),k}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 b=parseInt(c[1],10),v=parseInt(c[2],10)-1,k=parseInt(c[3],10);return new Date(k,v,b)}let g={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let b=parseInt(i[1],10),v=g[i[2].toLowerCase()],k=i[3]?parseInt(i[3],10):r.getFullYear();if(v!==void 0)return new Date(k,v,b)}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},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let b=u[l[1].toLowerCase()],v=parseInt(l[2],10),k=l[3]?parseInt(l[3],10):r.getFullYear();if(b!==void 0)return new Date(k,b,v)}return null}function Ji(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 Zi(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 hm(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 ym(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),l=Mr(t,i),b=Xi(u);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!b)return {type:"move_task",taskId:l.id,taskName:l.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 v=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,k=new Date(b);return k.setDate(k.getDate()+v),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:b,endDate:k},message:`Moved "${l.name}" to ${b.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),l=Mr(t,i),b=Ji(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!b||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let v=new Date(l.endDate);return v.setDate(v.getDate()+b),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:v},message:`Extended "${l.name}" by ${b} days. New end date: ${v.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 i=s[1].trim(),u=s[2].trim(),l=Mr(t,i),b=Zi(u);return l?b===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:b},message:`Set "${l.name}" progress to ${b}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,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 i=n[1].trim(),u=n[2].trim(),l=Mr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,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 i=c[1].trim(),u=c[2].trim(),l=Mr(t,i),b=Mr(t,u);return l?b?{type:"link_tasks",taskId:b.id,taskName:b.name,dependencyFrom:l.id,dependencyTo:b.id,message:`Linked "${l.name}" \u2192 "${b.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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let g=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(g&&g[1]){let i=g[1].trim(),u=Mr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function vm(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 dh(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 ch(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(b=>b.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>rs(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),g=n(e.endDate),i=e.metadata?.isMilestone===true||c&&g&&Math.abs(g.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:g,progress:e.progress||0,status:dh(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:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function xm(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:ch(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function km(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rs(r,e,t))}var Qi={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"}},el={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"}},os={en:Qi,es:el};function tl(e){return os[e]||os.en}function ns(e,t){let a=tl(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}var al=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let b=v=>{c.current&&!c.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]);let g=al[0],i=al.find(b=>b.value===e)??g,u=i.icon,l=b=>{switch(b){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(u,{className:d("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(u,{className:d("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(b=>{let v=b.icon;return jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),t(b.value),n(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===b.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(v,{className:d("w-4 h-4",b.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(b.value)})]},b.value)})})]})}var rl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Tm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let u=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let g=rl.find(u=>u.value===e)??rl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:rl.map(u=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===u.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function ls(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ds(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Dm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,c]=react.useState(false),[g,i]=react.useState(""),u=react.useRef(null);react.useEffect(()=>{let k=C=>{u.current&&!u.current.contains(C.target)&&(c(false),i(""));};return n&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let l=t.filter(k=>k.name.toLowerCase().includes(g.toLowerCase())||k.email?.toLowerCase().includes(g.toLowerCase())),b=k=>e.some(C=>C.name===k),v=k=>{if(a)if(b(k.name))a(e.filter(C=>C.name!==k.name));else {let C={name:k.name,initials:ls(k.name),color:k.color||ds(k.name).replace("bg-","").replace("-500",""),avatar:k.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((k,C)=>jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!k.avatar&&ds(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,title:k.name,children:k.avatar?jsxRuntime.jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||ls(k.name)},`${k.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),c(!n);},className:d("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:d("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((k,C)=>jsxRuntime.jsx("div",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!k.avatar&&ds(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,children:k.avatar?jsxRuntime.jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||ls(k.name)},`${k.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:d("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:g,onChange:k=>i(k.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:d("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:k=>k.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(k=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),v(k);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!k.avatarUrl&&ds(k.name)),children:k.avatarUrl?jsxRuntime.jsx("img",{src:k.avatarUrl,alt:k.name,className:"w-full h-full rounded-full object-cover"}):ls(k.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:k.name}),k.email&&jsxRuntime.jsx("div",{className:d("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:k.email})]}),b(k.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},k.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((k,C)=>jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[k.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(f=>f.name!==k.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${k.name}-${C}`))})]})]})}var Ih={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Bh={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function cs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[c,g]=react.useState(()=>{if(e){let h=e instanceof Date?e:new Date(e);return new Date(h.getFullYear(),h.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),u=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let h=f=>{i.current&&!i.current.contains(f.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let b=h=>h?h.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",v=(h,f)=>new Date(h,f+1,0).getDate(),k=(h,f)=>new Date(h,f,1).getDay(),C=()=>{let h=c.getFullYear(),f=c.getMonth(),p=v(h,f),x=k(h,f),m=new Date,N=[];for(let w=0;w<x;w++)N.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${w}`));for(let w=1;w<=p;w++){let B=new Date(h,f,w),y=u&&u.getDate()===w&&u.getMonth()===f&&u.getFullYear()===h,I=m.getDate()===w&&m.getMonth()===f&&m.getFullYear()===h;N.push(jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),t?.(B),n(false);},className:d("w-8 h-8 rounded-full text-sm transition-colors",y?"bg-[#3B82F6] text-white":I?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:w},w));}return N};return o||!t?jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:b(u)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:d("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:b(u)})]}),s&&jsxRuntime.jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(c.getFullYear(),c.getMonth()-1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Ih[l][c.getMonth()]," ",c.getFullYear()]}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(c.getFullYear(),c.getMonth()+1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Bh[l].map(h=>jsxRuntime.jsx("div",{className:d("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:h},h))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),t?.(new Date),n(false);},className:d("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation();let f=new Date;f.setDate(f.getDate()+1),t?.(f),n(false);},className:d("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Mm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),c=s.clientX-n.left,g=Math.round(c/n.width*100),i=Math.max(0,Math.min(100,g));t(i);},className:d("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:d("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:d("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Lm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[c,g]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{g(e);},[e]);let u=()=>{c!==e&&t?.(c),n(false);},l=b=>{b.key==="Enter"?u():b.key==="Escape"&&(g(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:d("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:c,onChange:b=>g(b.target.value),onBlur:u,onKeyDown:l,onClick:b=>b.stopPropagation(),className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),n(true);},className:d("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Rm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[c,g]=react.useState(false),[i,u]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{c&&l.current&&(l.current.focus(),l.current.select());},[c]),react.useEffect(()=>{u(e?.toString()||"");},[e]);let b=()=>{let k=parseFloat(i);if(!isNaN(k)){let C=k;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}g(false);},v=k=>{k.key==="Enter"?b():k.key==="Escape"&&(u(e?.toString()||""),g(false));};return n||!t?jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):c?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:k=>u(k.target.value),onBlur:b,onKeyDown:v,onClick:k=>k.stopPropagation(),min:o,max:s,className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),g(true);},className:d("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Om({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,c]=react.useState(false),g=react.useRef(null);return react.useEffect(()=>{let i=u=>{g.current&&!g.current.contains(u.target)&&c(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:g,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),c(!n);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:d("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),c(false);},className:d("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:d("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Wm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:d("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:d("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ry(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function oy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function jm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:c,onColumnHide:g,onColumnSort:i,availableUsers:u=[]}){let l=react.useRef(null),b=r==="es"?_m.es:_m.en;if(react.useEffect(()=>{let f=x=>{l.current&&!l.current.contains(x.target)&&t();},p=x=>{x.key==="Escape"&&t();};return document.addEventListener("mousedown",f),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",p);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let f=[];return o&&f.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),f.push({id:"sep1",label:"",icon:null,separator:true}),c&&(f.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),f.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),u.length>0&&f.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(p=>({id:`assign-${p.id}`,label:p.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:p.name.charAt(0).toUpperCase()}),onClick:()=>{let x=e.task.assignees||[],N=x.some(w=>w.name===p.name)?x.filter(w=>w.name!==p.name):[...x,{name:p.name,initials:ry(p.name),color:p.color||oy(p.name),avatar:p.avatarUrl}];c({...e.task,assignees:N}),t();}}))})),f.push({id:"sep2",label:"",icon:null,separator:true}),s&&f.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&f.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),f},k=()=>{if(!e.columnId)return [];let f=[];return i&&(f.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),f.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),g&&e.columnId!=="name"&&(f.push({id:"sep-hide",label:"",icon:null,separator:true}),f.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{g(e.columnId),t();}})),f},C=e.type==="task"?v():k(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:h,className:d("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:C.map(f=>f.separator?jsxRuntime.jsx("div",{className:d("my-1 h-px",a?"bg-white/10":"bg-gray-200")},f.id):f.submenu?jsxRuntime.jsx(ny,{item:f,isDark:a},f.id):jsxRuntime.jsxs("button",{onClick:f.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",f.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:d(f.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:f.icon}),f.label]},f.id))})}function ny({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:d("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(c=>jsxRuntime.jsxs("button",{onClick:c.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var _m={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var qm={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},ky=["name","status","priority","assignees","startDate","endDate","progress","tags"];function Jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:c}){let[g,i]=react.useState(""),u=react.useRef(null),l=c==="es"?Xm.es:Xm.en;if(react.useEffect(()=>{let f=x=>{u.current&&!u.current.contains(x.target)&&t();},p=x=>{x.key==="Escape"&&t();};return e&&(document.addEventListener("mousedown",f),document.addEventListener("keydown",p)),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",p);}},[e,t]),!e)return null;let b=f=>l.columns[f]||f,v=f=>{if(f==="name")return;let p=a.map(x=>x.id===f?{...x,visible:!x.visible}:x);o(p);},k=(f,p)=>{let x=a.find(N=>N.type===f&&(!p||N.customFieldId===p));if(x){v(x.id);return}let m={id:p||f,type:f,label:p?r.find(N=>N.id===p)?.name||f:b(f),width:120,visible:true,sortable:true,resizable:true,customFieldId:p};o([...a,m]);},C=ky.filter(f=>b(f).toLowerCase().includes(g.toLowerCase())),h=r.filter(f=>f.name.toLowerCase().includes(g.toLowerCase()));return jsxRuntime.jsxs("div",{ref:u,className:d("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:d("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:d("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:g,onChange:f=>i(f.target.value),placeholder:l.searchPlaceholder,className:d("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(f=>{let p=a.find(N=>N.type===f&&!N.customFieldId),x=p?.visible??false,m=f==="name";return jsxRuntime.jsxs("button",{onClick:()=>!m&&v(p?.id||f),disabled:m,className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",m&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[f]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:b(f)})]},f)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:h.map(f=>{let x=a.find(m=>m.customFieldId===f.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>k(f.type,f.id),className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[f.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:f.name})]},f.id)})})]}),s&&jsxRuntime.jsx("div",{className:d("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:d("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Xm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var My=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function ep({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[c,g]=react.useState("text"),[i,u]=react.useState([""]),l=o==="es"?Qm.es:Qm.en;react.useEffect(()=>{e&&(n(""),g("text"),u([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let b=()=>{if(!s.trim())return;let h={name:s.trim(),type:c};c==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},v=()=>{u([...i,""]);},k=(h,f)=>{let p=[...i];p[h]=f,u(p);},C=h=>{i.length>1&&u(i.filter((f,p)=>p!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:d("relative w-full max-w-md rounded-xl shadow-2xl",r?"bg-[#1F2937]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:d("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:d("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:d("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:l.fieldNamePlaceholder,className:d("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:My.map(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.type),className:d("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===h.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:c===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:d("text-xs",c===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[h.type]})]},h.type))})]}),c==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:p=>k(f,p.target.value),placeholder:`${l.option} ${f+1}`,className:d("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(f),className:d("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:v,className:d("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:d("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:d("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:b,disabled:!s.trim(),className:d("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Qm={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Wy=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function rp(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(...rp(r.subtasks,t+1));return a}function Gy({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 op({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:c=[],customFields:g=[]}){let{theme:i="dark",locale:u="en",customTranslations:l,showSearch:b=true,showHierarchy:v=true,tableColumns:k,allowColumnCustomization:C=true,allowColumnResize:h=true,enableContextMenu:f=true}=t,p=ns(u,l),x=i==="dark",[m,N]=react.useState("startDate"),[w,B]=react.useState("asc"),[y,I]=react.useState(""),[P,T]=react.useState(k||Wy),[W,O]=react.useState(false),[q,te]=react.useState(false),[ne,re]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ce,be]=react.useState(null),[Le,A]=react.useState(0),[R,L]=react.useState(0),j=react.useRef(null);react.useEffect(()=>{k&&T(k);},[k]);let X=react.useMemo(()=>{let G=new Set;function oe(xe){for(let Oe of xe)Oe.subtasks?.length&&(Oe.isExpanded!==false&&G.add(Oe.id),oe(Oe.subtasks));}return oe(e),G},[e]),z=react.useMemo(()=>P.filter(G=>G.visible),[P]),ve=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),se=react.useCallback(G=>{m===G?B(oe=>oe==="asc"?"desc":"asc"):(N(G),B("asc")),a.onSortChange?.({column:G,direction:w==="asc"?"desc":"asc"});},[m,w,a]),Ie=react.useCallback(G=>{T(G),a.onColumnsChange?.(G);},[a]),qe=react.useCallback(G=>{let oe=P.map(xe=>xe.id===G?{...xe,visible:false}:xe);Ie(oe);},[P,Ie]),Qe=react.useCallback((G,oe)=>{N(G),B(oe);},[]),ie=react.useCallback((G,oe,xe)=>{f&&(G.preventDefault(),re({isOpen:true,x:G.clientX,y:G.clientY,type:oe?"task":"header",task:oe,columnId:xe}));},[f]),Xe=react.useCallback(()=>{re(G=>({...G,isOpen:false}));},[]),lt=react.useCallback((G,oe)=>{if(!h)return;G.preventDefault(),G.stopPropagation();let xe=P.find(Oe=>Oe.id===oe);xe&&(be(oe),A(G.clientX),L(xe.width));},[P,h]);react.useEffect(()=>{if(!ce)return;let G=xe=>{let Oe=xe.clientX-Le,ye=Math.max(50,R+Oe),it=P.map(Ue=>Ue.id===ce?{...Ue,width:ye}:Ue);T(it);},oe=()=>{ce&&a.onColumnsChange?.(P),be(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",oe),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",oe);}},[ce,Le,R,P,a]);let kt=react.useCallback(async G=>{if(a.onCreateCustomField){let oe={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(oe);}te(false);},[a]),yt=react.useMemo(()=>{let G=rp(e);if(y.trim()){let oe=y.toLowerCase();G=G.filter(xe=>xe.name.toLowerCase().includes(oe));}return G.sort((oe,xe)=>{let Oe,ye;switch(m){case "name":Oe=oe.name.toLowerCase(),ye=xe.name.toLowerCase();break;case "startDate":Oe=oe.startDate?.getTime()||0,ye=xe.startDate?.getTime()||0;break;case "endDate":Oe=oe.endDate?.getTime()||0,ye=xe.endDate?.getTime()||0;break;case "progress":Oe=oe.progress||0,ye=xe.progress||0;break;case "status":Oe=oe.status||"todo",ye=xe.status||"todo";break;case "priority":let it={urgent:0,high:1,medium:2,low:3,none:4};Oe=it[oe.priority]??4,ye=it[xe.priority]??4;break;default:return 0}return Oe<ye?w==="asc"?-1:1:Oe>ye?w==="asc"?1:-1:0}),G},[e,y,m,w]),$=react.useCallback((G,oe)=>{let xe=it=>{a.onTaskUpdate?.({...G,...it});},Oe=it=>it?G.customFields?.find(wt=>wt.fieldId===it)?.value:void 0,ye=(it,Ue)=>{if(!it)return;let ut=[...G.customFields||[]],Bt=ut.findIndex(jt=>jt.fieldId===it);Bt>=0?ut[Bt]={fieldId:it,value:Ue}:ut.push({fieldId:it,value:Ue}),xe({customFields:ut});};switch(oe.type){case "name":return null;case "status":return jsxRuntime.jsx(wm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:Ue=>{xe({status:Ue,progress:Ue==="completed"?100:Ue==="in-progress"?50:0});},isDark:x,locale:u,translations:p.status});case "priority":return jsxRuntime.jsx(Tm,{value:G.priority,onChange:Ue=>xe({priority:Ue}),isDark:x,locale:u});case "assignees":return jsxRuntime.jsx(Dm,{value:G.assignees||[],availableUsers:c,onChange:Ue=>xe({assignees:Ue}),isDark:x,locale:u});case "startDate":return jsxRuntime.jsx(cs,{value:G.startDate,onChange:Ue=>xe({startDate:Ue}),isDark:x,locale:u});case "endDate":return jsxRuntime.jsx(cs,{value:G.endDate,onChange:Ue=>xe({endDate:Ue}),isDark:x,locale:u});case "progress":return jsxRuntime.jsx(Mm,{value:G.progress||0,onChange:Ue=>{let wt=Ue===100?"completed":Ue>0?"in-progress":"todo";xe({progress:Ue,status:wt});},isDark:x});case "tags":return jsxRuntime.jsx(Wm,{value:G.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Lm,{value:Oe(oe.customFieldId)||"",onChange:Ue=>ye(oe.customFieldId,Ue),isDark:x});case "number":return jsxRuntime.jsx(Rm,{value:Oe(oe.customFieldId)||0,onChange:Ue=>ye(oe.customFieldId,Ue),isDark:x});case "date":let it=Oe(oe.customFieldId);return jsxRuntime.jsx(cs,{value:it?new Date(it):void 0,onChange:Ue=>ye(oe.customFieldId,Ue),isDark:x,locale:u});case "dropdown":return jsxRuntime.jsx(Om,{value:Oe(oe.customFieldId)||"",options:oe.options||[],onChange:Ue=>ye(oe.customFieldId,Ue),isDark:x});case "checkbox":return jsxRuntime.jsx(Um,{value:Oe(oe.customFieldId)||false,onChange:Ue=>ye(oe.customFieldId,Ue),isDark:x});default:return jsxRuntime.jsx("span",{className:d("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,u,c,p]),fe=react.useCallback(G=>({name:p.columns.name,status:p.columns.status,priority:p.columns.priority,assignees:p.columns.assignees,startDate:p.columns.startDate,endDate:p.columns.endDate,progress:p.columns.progress})[G.type]||G.label,[p]),Ae=react.useMemo(()=>z.reduce((G,oe)=>G+oe.width,0)+(C?48:0),[z,C]);return r?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",x?"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:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[p.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",x?"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:d("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",x?"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:d("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:p.empty.noTasks}),jsxRuntime.jsx("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:p.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:j,className:d("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",ce&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[b&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:y,onChange:G=>I(G.target.value),placeholder:p.toolbar.searchPlaceholder,className:d("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"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:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[yt.length," ",p.pagination.tasks]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Ae},children:[jsxRuntime.jsxs("div",{className:d("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[z.map(G=>jsxRuntime.jsxs("div",{className:d("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:oe=>ie(oe,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>se(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[fe(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:d("w-3 h-3",m===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:fe(G)}),h&&G.resizable&&jsxRuntime.jsx("div",{className:d("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",ce===G.id&&"bg-[#3B82F6]"),onMouseDown:oe=>lt(oe,G.id)})]},G.id)),C&&jsxRuntime.jsx("div",{className:"flex items-center justify-center px-3 py-3",children:jsxRuntime.jsx("button",{onClick:()=>O(true),className:d("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),title:u==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:yt.map((G,oe)=>{let xe=X.has(G.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:oe*.02},className:d("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Oe=>ie(Oe,G),children:[z.map(Oe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Oe.width,minWidth:Oe.minWidth},children:Oe.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[v&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),v&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:ye=>{ye.stopPropagation(),ve(G.id);},className:d("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),v&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:ye=>{ye.stopPropagation(),a.onTaskUpdate?.({...G,progress:G.progress===100?0:100,status:G.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Gy,{status:G.status,progress:G.progress})}),jsxRuntime.jsx("span",{className:d("truncate font-medium",x?"text-white":"text-gray-900",G.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):$(G,Oe)},Oe.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),yt.length===0&&y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:d("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d(x?"text-[#9CA3AF]":"text-gray-600"),children:p.empty.noResults})]})})]})}),jsxRuntime.jsx(jm,{state:ne,onClose:Xe,isDark:x,locale:u,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:qe,onColumnSort:Qe,availableUsers:c}),jsxRuntime.jsx(Jm,{isOpen:W,onClose:()=>O(false),columns:P,customFields:g,onColumnsChange:Ie,onCreateCustomField:()=>{O(false),te(true);},isDark:x,locale:u}),jsxRuntime.jsx(ep,{isOpen:q,onClose:()=>te(false),onSave:kt,isDark:x,locale:u})]})}var np=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],sp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],ip=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var dl={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"},cl={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"},ml={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"},us={dark:dl,light:cl,neutral:ml};function lp(e){return us[e]||us.dark}var pl={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"}},ul={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"}},gs={en:pl,es:ul};function nn(e){return gs[e]||gs.en}function fs(e,t){let a=nn(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 dp(e){let t=nn(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 cp(e,t=0,a=true){let r=nn(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 lv(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 vl(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 fp({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 hp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:c,availableTags:g=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:b,currentUser:v,mentionableUsers:k,onTaskOpen:C}){let{theme:h="dark",locale:f="en",customTranslations:p}=t,x=fs(f,p),m=h==="dark",N={textTertiary:m?"#6B7280":"#9CA3AF",textSecondary:m?"#9CA3AF":"#6B7280",textPrimary:m?"#FFFFFF":"#111827",borderLight:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:m?"#1A1D25":"#FFFFFF",bgSecondary:m?"#0F1117":"#F9FAFB",hoverBg:m?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[w,B]=react.useState(r||new Date),[y,I]=react.useState(null),[P,T]=react.useState(null),[W,O]=react.useState(null),[q,te]=react.useState(new Date),[ne,re]=react.useState({}),ce=4,be=3,[Le,A]=react.useState(false),[R,L]=react.useState(false),[j,X]=react.useState(false),[z,ve]=react.useState(false),[se,Ie]=react.useState(null),[qe,Qe]=react.useState(""),[ie,Xe]=react.useState(void 0),[lt,kt]=react.useState(null),[yt,$]=react.useState(false),[fe,Ae]=react.useState(false),[G,oe]=react.useState(null),[xe,Oe]=react.useState(false),[ye,it]=react.useState(new Date),[Ue,wt]=react.useState(false),[ut,Bt]=react.useState(false),[jt,Se]=react.useState(false),[Ve,ua]=react.useState(""),[Ze,Ke]=react.useState(false),[F,Te]=react.useState(""),[Z,ke]=react.useState(false),Ce=react.useCallback(()=>{B(new Date(w.getFullYear(),w.getMonth()-1,1));},[w]),$e=react.useCallback(()=>{B(new Date(w.getFullYear(),w.getMonth()+1,1));},[w]),Be=react.useCallback(()=>{B(new Date);},[]),st=react.useMemo(()=>{let M=w.getFullYear(),V=w.getMonth(),Me=new Date(M,V,1),Ye=new Date(M,V+1,0),Pt=Me.getDay(),de=Ye.getDate(),Ge=lv(e),vt=new Date;vt.setHours(0,0,0,0);let Re=[],gt=Pt,va=new Date(M,V,0).getDate();for(let Kt=gt-1;Kt>=0;Kt--){let je=new Date(M,V-1,va-Kt);Re.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Ge.filter(Yt=>vl(je,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}for(let Kt=1;Kt<=de;Kt++){let je=new Date(M,V,Kt),Yt=je.getTime()===vt.getTime();Re.push({date:je,isCurrentMonth:true,isToday:Yt,isWeekend:je.getDay()===0||je.getDay()===6,events:Ge.filter(ga=>vl(je,ga)).map(ga=>({id:ga.id,title:ga.name,start:ga.startDate,end:ga.endDate,task:ga}))});}let ka=42-Re.length;for(let Kt=1;Kt<=ka;Kt++){let je=new Date(M,V+1,Kt);Re.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Ge.filter(Yt=>vl(je,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}return Re},[w,e]),U=f==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Y=w.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),pe=react.useCallback((M,V)=>{if(!y)return;let Me={...y,[M]:V};I(Me),a.onTaskUpdate?.(Me);},[y,a]),_e=react.useCallback(M=>{if(!y)return;let V=y.progress||0;M==="completed"?V=100:M==="todo"&&(V=0);let Me={...y,status:M,progress:V};I(Me),a.onTaskUpdate?.(Me),A(false);},[y,a]),ze=react.useCallback((M,V)=>{if(!y)return;let Me={...y,startDate:M,endDate:V};I(Me),a.onTaskUpdate?.(Me);},[y,a]),H=react.useCallback(()=>{A(false),L(false),X(false),O(null),Se(false),ua(""),Ke(false);},[]),le=react.useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),wt(false),!y||!a.onUploadAttachments)return;let V=Array.from(M.dataTransfer.files);if(V.length!==0){Bt(true);try{await a.onUploadAttachments(y.id,V);}finally{Bt(false);}}},[y,a]),He=react.useCallback(async M=>{if(!y||!a.onUploadAttachments||!M.target.files)return;let V=Array.from(M.target.files);if(V.length!==0){Bt(true);try{await a.onUploadAttachments(y.id,V);}finally{Bt(false);}M.target.value="";}},[y,a]),Ft=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),wt(true);},[]),rt=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),wt(false);},[]),ya=react.useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),$a=react.useCallback(M=>M.startsWith("image/")?lucideReact.Image:M.includes("pdf")||M.includes("document")?lucideReact.FileText:lucideReact.File,[]),ct=react.useMemo(()=>!y||!u?[]:u.get(y.id)||[],[y,u]);return o?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",m?"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:d("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[x.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",m?"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:d("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",m?"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:d("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:x.labels.noEvents}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:x.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:d("flex-1 flex flex-col w-full h-full overflow-auto",m?"bg-[#0F1117]":"bg-white",n),style:c,children:[jsxRuntime.jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",m?"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:d("text-xl font-semibold capitalize",m?"text-white":"text-gray-900"),children:Y}),jsxRuntime.jsx("button",{onClick:Be,className:d("px-3 py-1.5 text-sm rounded-lg transition-colors",m?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:x.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ce,className:d("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:$e,className:d("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-5 h-5",m?"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:U.map(M=>jsxRuntime.jsx("div",{className:d("py-2 text-center text-xs font-medium uppercase",m?"text-[#9CA3AF]":"text-gray-500"),children:M},M))}),jsxRuntime.jsx("div",{className:d("grid grid-cols-7 auto-rows-min gap-px rounded-lg",m?"bg-[#2D2D2D]":"bg-gray-300"),children:st.map((M,V)=>{let Me=M.date.getDay()===0||M.date.getDay()===6;return jsxRuntime.jsxs("div",{className:d("min-h-[120px] p-2 transition-colors flex flex-col relative group",m?Me?"bg-[#1C1F26]":M.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Me?"bg-gray-100":M.isCurrentMonth?"bg-white":"bg-gray-50",M.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ye=ne[V]||ce,Pt=M.events.slice(0,Ye),de=M.events.length-Ye;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Pt.map(Ge=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{I(Ge.task),a.onEventClick?.(Ge),C?.(Ge.task.id);},whileHover:{scale:1.02},className:d("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ge.task.progress===100?m?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":m?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(fp,{task:Ge.task}),jsxRuntime.jsx("span",{className:"truncate",children:Ge.title})]})},Ge.id)),de>0&&jsxRuntime.jsxs("button",{onClick:Ge=>{Ge.stopPropagation(),re(vt=>({...vt,[V]:Ye+be}));},className:d("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",m?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",de," ",f==="es"?"M\xC1S":"MORE"]}),Ye>ce&&M.events.length>ce&&jsxRuntime.jsx("button",{onClick:Ge=>{Ge.stopPropagation(),re(vt=>({...vt,[V]:ce}));},className:d("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",m?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:f==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ye=V>=28,Pt=V%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),se===V?Ie(null):(Ie(V),Qe(""),Xe(void 0),kt(null),oe(null),$(false),Ae(false),Oe(false),it(M.date));},className:d("w-5 h-5 rounded flex items-center justify-center transition-all",se===V?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",m?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:d("w-3.5 h-3.5 transition-transform",se===V&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se===V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(null),Qe(""),Xe(void 0),kt(null),oe(null),$(false),Ae(false),Oe(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ye?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ye?-5:5,scale:.95},transition:{duration:.12},className:d("absolute w-[320px] rounded-lg shadow-2xl z-50",Ye?"bottom-full mb-1":"top-full mt-1",Pt?"right-0":"left-0",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>{de.stopPropagation(),$(false),Ae(false),Oe(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:qe,onChange:de=>Qe(de.target.value),placeholder:f==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:d("w-full bg-transparent text-sm outline-none placeholder:opacity-40",m?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:de=>{if(de.key==="Enter"&&qe.trim()){let Ge=t.availableUsers?.find(Re=>Re.id===lt),vt=G||M.date;a.onTaskCreate?.({name:qe.trim(),startDate:vt,endDate:vt,priority:ie,assignees:Ge?[Ge]:void 0}),Qe(""),Xe(void 0),kt(null),oe(null),Ie(null);}de.key==="Escape"&&(Ie(null),Qe(""),Xe(void 0),kt(null),oe(null));}})}),jsxRuntime.jsxs("div",{className:d("px-2.5 py-2 flex items-center justify-between border-t",m?"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:de=>{de.stopPropagation(),$(!yt),Ae(false);},className:d("p-1 rounded transition-colors",ie?ie==="urgent"||ie==="high"?"text-red-400 bg-red-500/20":ie==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":m?"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:yt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>de.stopPropagation(),children:[{id:"urgent",label:f==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:f==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:f==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:f==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:f==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(de=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(de.id),$(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",ie===de.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",de.color)}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:de.label})]},de.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:de=>{de.stopPropagation(),Oe(!xe),$(false),Ae(false),it(G||M.date);},className:d("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",G?"bg-[#7C3AED]/20 text-[#7C3AED]":m?"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"}),(G||M.date).toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsx("div",{className:d("w-40 py-2 border-r",m?"border-white/10":"border-gray-200"),children:(()=>{let de=new Date,Ge=new Date(de);Ge.setDate(de.getDate()+1);let vt=new Date(de);vt.setDate(de.getDate()+((6-de.getDay()+7)%7||7));let Re=new Date(de);Re.setDate(de.getDate()+((1-de.getDay()+7)%7||7));let gt=new Date(de);gt.setDate(de.getDate()+14);let va=new Date(de);return va.setDate(de.getDate()+28),[{label:f==="es"?"Hoy":"Today",date:de,display:de.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Ma\xF1ana":"Tomorrow",date:Ge,display:Ge.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Este fin de semana":"This weekend",date:vt,display:f==="es"?"s\xE1b.":"sat."},{label:f==="es"?"Pr\xF3xima semana":"Next week",date:Re,display:f==="es"?"lun.":"mon."},{label:f==="es"?"2 semanas":"2 weeks",date:gt,display:gt.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:f==="es"?"4 semanas":"4 weeks",date:va,display:va.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Kt,je)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{oe(Kt.date),Oe(false);},children:[jsxRuntime.jsx("span",{children:Kt.label}),jsxRuntime.jsx("span",{className:d("text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:Kt.display})]},je))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:d("text-xs font-medium",m?"text-white":"text-gray-900"),children:ye.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>it(new Date),className:d("px-1.5 py-0.5 rounded text-[10px] transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:f==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>it(new Date(ye.getFullYear(),ye.getMonth()-1)),className:d("p-0.5 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>it(new Date(ye.getFullYear(),ye.getMonth()+1)),className:d("p-0.5 rounded",m?"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:(f==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(de=>jsxRuntime.jsx("div",{className:d("w-6 h-6 flex items-center justify-center text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:de},de))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=ye.getFullYear(),Ge=ye.getMonth(),vt=new Date(de,Ge,1).getDay(),Re=new Date(de,Ge+1,0).getDate(),gt=new Date(de,Ge,0).getDate(),va=new Date,ka=[];for(let je=vt-1;je>=0;je--)ka.push({dayNum:gt-je,isCurrentMonth:false,date:new Date(de,Ge-1,gt-je)});for(let je=1;je<=Re;je++)ka.push({dayNum:je,isCurrentMonth:true,date:new Date(de,Ge,je)});let Kt=42-ka.length;for(let je=1;je<=Kt;je++)ka.push({dayNum:je,isCurrentMonth:false,date:new Date(de,Ge+1,je)});return ka.map((je,Yt)=>{let ga=je.date.toDateString()===va.toDateString(),Ar=(G||M.date).toDateString()===je.date.toDateString();return jsxRuntime.jsx("button",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!je.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),je.isCurrentMonth&&(m?"text-white":"text-gray-900"),ga&&"ring-1 ring-[#3B82F6]",Ar&&"bg-[#7C3AED] text-white",!Ar&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{oe(je.date),Oe(false);},children:je.dayNum},Yt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),Ae(!fe),$(false);},className:d("p-1 rounded transition-colors",lt?"text-[#7C3AED] bg-[#7C3AED]/20":m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:lt?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(de=>de.id===lt)?.color||"#7C3AED"},children:t.availableUsers?.find(de=>de.id===lt)?.initials||t.availableUsers?.find(de=>de.id===lt)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:fe&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{kt(null),Ae(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",!lt&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded-full flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:m?"text-[#9CA3AF]":"text-gray-500",children:f==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(de=>jsxRuntime.jsxs("button",{onClick:()=>{kt(de.id),Ae(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",lt===de.id&&(m?"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:de.color||"#7C3AED"},children:de.initials||de.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:de.name})]},de.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:d("px-3 py-2 text-xs",m?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(qe.trim()){let de=t.availableUsers?.find(vt=>vt.id===lt),Ge=G||M.date;a.onTaskCreate?.({name:qe.trim(),startDate:Ge,endDate:Ge,priority:ie,assignees:de?[de]:void 0}),Qe(""),Xe(void 0),kt(null),oe(null),Ie(null);}},disabled:!qe.trim(),className:d("px-2.5 py-1 rounded text-xs font-medium transition-colors",qe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":m?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:f==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:d("text-sm font-medium",M.isToday?"text-[#3B82F6]":M.isCurrentMonth?m?"text-white":"text-gray-900":m?"text-[#6B7280]":"text-gray-400"),children:M.date.getDate()})]})]},V)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{I(null),Te("");},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:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",m?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:d("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[f==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:d("text-xs font-mono",m?"text-[#6B7280]":"text-gray-400"),children:y.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:d("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",m?"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:d("p-1.5 rounded transition-colors",m?"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:d("p-1.5 rounded transition-colors",m?"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:()=>{I(null),Te("");},className:d("p-1.5 rounded transition-colors",m?"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 M=y.progress===100?0:100,Me={...y,progress:M,status:M===100?"completed":"todo"};I(Me),a.onTaskUpdate?.(Me);},className:d("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",y.progress===100?"bg-green-500 border-green-500":m?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:y.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:d("text-xl font-semibold flex-1",y.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:y.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:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{H(),A(!Le);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.progress===100||y.status==="completed"?"bg-green-500/20 text-green-400":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/20 text-blue-400":m?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.progress===100||y.status==="completed"?f==="es"?"COMPLETADO":"DONE":y.progress&&y.progress>0||y.status==="in-progress"?f==="es"?"EN PROGRESO":"IN PROGRESS":f==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:f==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:f==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:f==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(M=>jsxRuntime.jsxs("button",{onClick:()=>_e(M.id),className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",(y.status===M.id||M.id==="completed"&&y.progress===100||M.id==="in-progress"&&y.progress&&y.progress>0&&y.progress<100||M.id==="todo"&&(!y.progress||y.progress===0)&&y.status!=="in-progress"&&y.status!=="completed")&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",M.id==="completed"?"bg-green-500":M.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{A(false),L(false),O(null),X(!j);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[y.assignees&&y.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[y.assignees.slice(0,3).map((M,V)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},V)),y.assignees.length>3&&jsxRuntime.jsxs("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:["+",y.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",m?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(M=>{let V=y.assignees?.some(Me=>Me.name===M.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Me=y.assignees||[],Ye;V?Ye=Me.filter(Pt=>Pt.name!==M.name):Ye=[...Me,{name:M.name,avatar:M.avatar,initials:M.initials||M.name.slice(0,2).toUpperCase(),color:M.color||"#8B5CF6"}],pe("assignees",Ye);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50",V&&(m?"bg-white/5":"bg-gray-50")),children:[M.avatar?jsxRuntime.jsx("img",{src:M.avatar,alt:M.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:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:d("flex-1 text-left",m?"text-white":"text-gray-900"),children:M.name}),V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},M.id||M.name)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{O(W?null:"start"),te(y.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[y.startDate?.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(f==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:d("mx-1",m?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),y.endDate?.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(f==="es"?"Fin":"End"),(y.startDate||y.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:M=>{M.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:d("w-44 py-2 border-r",m?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,V=new Date(M);V.setDate(M.getDate()+1);let Me=new Date(M);Me.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Ye=new Date(M);Ye.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let Pt=new Date(M);Pt.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let de=new Date(M);de.setDate(M.getDate()+14);let Ge=new Date(M);return Ge.setDate(M.getDate()+28),[{label:f==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Este fin de semana":"This weekend",date:Me,display:f==="es"?"s\xE1b.":"sat."},{label:f==="es"?"Pr\xF3xima semana":"Next week",date:Ye,display:f==="es"?"lun.":"mon."},{label:f==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Pt,display:Pt.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:f==="es"?"2 semanas":"2 weeks",date:de,display:de.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:f==="es"?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,gt)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(W==="start"){let va=y.endDate&&Re.date>y.endDate?Re.date:y.endDate;ze(Re.date,va),O("end");}else {let va=y.startDate&&Re.date<y.startDate?Re.date:y.startDate;ze(va,Re.date),O(null);}},children:[jsxRuntime.jsx("span",{children:Re.label}),jsxRuntime.jsx("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},gt))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ze(void 0,void 0),O(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:f==="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:d("text-xs mb-3 px-2 py-1 rounded",m?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:W==="start"?f==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":f==="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:d("font-medium",m?"text-white":"text-gray-900"),children:q.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>te(new Date),className:d("p-1 rounded text-sm transition-colors",m?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:f==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>te(new Date(q.getFullYear(),q.getMonth()-1)),className:d("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>te(new Date(q.getFullYear(),q.getMonth()+1)),className:d("p-1 rounded",m?"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:(f==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(M=>jsxRuntime.jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",m?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let M=q.getFullYear(),V=q.getMonth(),Me=new Date(M,V,1).getDay(),Ye=new Date(M,V+1,0).getDate(),Pt=new Date(M,V,0).getDate(),de=new Date,Ge=[];for(let Re=Me-1;Re>=0;Re--)Ge.push({day:Pt-Re,isCurrentMonth:false,date:new Date(M,V-1,Pt-Re)});for(let Re=1;Re<=Ye;Re++)Ge.push({day:Re,isCurrentMonth:true,date:new Date(M,V,Re)});let vt=42-Ge.length;for(let Re=1;Re<=vt;Re++)Ge.push({day:Re,isCurrentMonth:false,date:new Date(M,V+1,Re)});return Ge.map((Re,gt)=>{let va=Re.date.toDateString()===de.toDateString(),ka=y.startDate?.toDateString()===Re.date.toDateString(),Kt=y.endDate?.toDateString()===Re.date.toDateString(),je=ka||Kt,Yt=y.startDate&&y.endDate&&Re.date>=y.startDate&&Re.date<=y.endDate;return jsxRuntime.jsx("button",{className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Re.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),Re.isCurrentMonth&&(m?"text-white":"text-gray-900"),va&&"ring-2 ring-[#3B82F6]",ka&&"bg-[#3B82F6] text-white",Kt&&!ka&&"bg-[#7C3AED] text-white",Yt&&!je&&(m?"bg-[#7C3AED]/20":"bg-purple-100"),!je&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ga=new Date(Re.date);if(W==="start"){let Ar=y.endDate&&ga>y.endDate?ga:y.endDate;ze(ga,Ar),O("end");}else {let Ar=y.startDate&&ga<y.startDate?ga:y.startDate;ze(Ar,ga),O(null);}},children:Re.day},gt)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{H(),L(!R);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.priority==="high"||y.priority==="urgent"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":y.priority==="low"?"bg-green-500/20 text-green-400":m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:y.priority?y.priority==="high"||y.priority==="urgent"?f==="es"?"Urgente":"Urgent":y.priority==="medium"?f==="es"?"Media":"Medium":f==="es"?"Baja":"Low":f==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&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:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:f==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:f==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:f==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:f==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:f==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{pe("priority",M.id),L(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",y.priority===M.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",m?"text-white":"text-gray-900"),children:y.startDate&&y.endDate?`${Math.ceil((y.endDate.getTime()-y.startDate.getTime())/(1e3*60*60*24))} ${f==="es"?"d\xEDas":"days"}`:f==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded-full border-2",m?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[z?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:y.progress||0,onChange:M=>{let V=parseInt(M.target.value),Me=y.status;V===100?Me="completed":V>0?Me="in-progress":Me="todo";let Ye={...y,progress:V,status:Me};I(Ye),a.onTaskUpdate?.(Ye);},onBlur:()=>ve(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",m?"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:()=>ve(true),className:d("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:d("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium min-w-[40px]",m?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(br,{selectedTags:y.tags||[],availableTags:g,onChange:M=>{pe("tags",M);},onCreateTag:i,theme:N})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24 mt-1",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[y.dependencies&&y.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:y.dependencies.map(M=>{let V=e.find(Me=>Me.id===M);return jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",m?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[V?.name||M.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Me=(y.dependencies||[]).filter(Ye=>Ye!==M);pe("dependencies",Me);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},M)})}),jsxRuntime.jsxs("button",{onClick:()=>{H(),Se(!jt);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"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:d("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Se(false),ua("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("p-2 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Ve,onChange:M=>ua(M.target.value),placeholder:f==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",m?"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(M=>M.id!==y.id).filter(M=>Ve===""||M.name.toLowerCase().includes(Ve.toLowerCase())).map(M=>{let V=y.dependencies?.includes(M.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Me=y.dependencies||[],Ye;V?Ye=Me.filter(Pt=>Pt!==M.id):Ye=[...Me,M.id],pe("dependencies",Ye);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",V&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",V?"bg-blue-500 border-blue-500":m?"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:d("block truncate",m?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-500"),children:f==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{H(),Ke(!Ze);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"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:y.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:d("text-sm",m?"text-white":"text-gray-900"),children:hr.find(M=>M.value===y.color)?.name||(f==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ke(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",m?"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:hr.map(M=>{let V=y.color===M.value;return jsxRuntime.jsx("button",{onClick:()=>{pe("color",M.value),Ke(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",V&&"ring-2 ring-offset-2",m?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:V?M.value:void 0},title:M.name,children:V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:y.isMilestone||false,onChange:M=>pe("isMilestone",M.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",y.isMilestone?"bg-purple-500 border-purple-500":m?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:d("text-sm",m?"text-white":"text-gray-900"),children:f==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",m?"text-white":"text-gray-900"),children:f==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:y.description||"",onChange:M=>pe("description",M.target.value),placeholder:f==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",m?"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:d("flex items-center gap-2 text-sm mt-2 transition-colors",m?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),f==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:f==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"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"}),f==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:f==="es"?"Agregar subtarea":"Add subtask"}),y.subtasks&&y.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:y.subtasks.map(M=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",M.progress===100?"bg-green-500 border-green-500":m?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:d("text-sm",M.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:M.name})]},M.id))}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"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"}),f==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",m?"text-white":"text-gray-900"),children:f==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:d("p-1 rounded transition-colors",m?"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:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"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"}),f==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:[f==="es"?"Adjuntos":"Attachments",ct.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",ct.length,")"]})]}),ct.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:ct.map(M=>{let V=$a(M.type),Me=M.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Me&&M.thumbnailUrl?jsxRuntime.jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(V,{className:d("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",m?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("p",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:ya(M.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(M.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",m?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:f==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},M.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ft,onDragLeave:rt,onDrop:le,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ue?m?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":m?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ut&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:He,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||ut}),ut?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:d("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:d("w-6 h-6 mx-auto mb-2",Ue?"text-blue-500":m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:Ue?f==="es"?"Suelta los archivos aqu\xED":"Drop files here":f==="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:d("text-xs mt-1",m?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:d("w-80 border-l flex flex-col",m?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",m?"text-white":"text-gray-900"),children:[f==="es"?"Actividad":"Activity",l&&l.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",l.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:l&&l.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:l.map(M=>{let V=(()=>{let Me=new Date,Ye=new Date(M.createdAt),Pt=Me.getTime()-Ye.getTime(),de=Math.floor(Pt/6e4),Ge=Math.floor(de/60),vt=Math.floor(Ge/24);return de<1?f==="es"?"ahora":"now":de<60?f==="es"?`hace ${de}m`:`${de}m ago`:Ge<24?f==="es"?`hace ${Ge}h`:`${Ge}h ago`:f==="es"?`hace ${vt}d`:`${vt}d ago`})();return 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:"#8B5CF6"},children:M.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:d("text-sm font-medium",m?"text-white":"text-gray-900"),children:M.user?.name||(f==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:V})]}),jsxRuntime.jsx("p",{className:d("text-sm break-words",m?"text-[#9CA3AF]":"text-gray-600"),children:M.content})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:d("w-10 h-10 mb-3",m?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#6B7280]":"text-gray-500"),children:f==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("p-4 border-t",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[v&&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:v.color||"#8B5CF6"},children:v.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:d("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",m?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:F,onChange:M=>Te(M.target.value),onKeyDown:async M=>{if(M.key==="Enter"&&!M.shiftKey&&y&&F.trim()&&b){M.preventDefault(),ke(true);try{await b(y.id,F.trim()),Te("");}finally{ke(false);}}},placeholder:f==="es"?"Escribe un comentario...":"Write a comment...",disabled:Z||!b,className:d("flex-1 bg-transparent text-sm outline-none",m?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(Z||!b)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(y&&F.trim()&&b){ke(true);try{await b(y.id,F.trim()),Te("");}finally{ke(false);}}},disabled:Z||!F.trim()||!b,className:d("p-1.5 rounded transition-colors",F.trim()&&b?"bg-blue-500 text-white hover:bg-blue-600":m?"text-[#6B7280]":"text-gray-400",Z&&"opacity-50 cursor-not-allowed"),children:Z?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"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>T(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:d("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",m?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:d("px-4 py-3 border-b flex items-center justify-between",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:d("font-medium",m?"text-white":"text-gray-900"),children:P.date.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>T(null),className:d("p-1 rounded",m?"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:P.events.map(M=>jsxRuntime.jsxs("button",{onClick:()=>{T(null),I(M.task),C?.(M.task.id);},className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(fp,{task:M.task}),jsxRuntime.jsx("span",{className:d("text-sm truncate flex-1",m?"text-white":"text-gray-900"),children:M.title}),M.task.priority==="high"||M.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},M.id))})]})]})})]})}var xl={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"},kl={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"},wl={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"},hs={dark:xl,light:kl,neutral:wl};function yp(e){return hs[e]||hs.dark}function cv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:c}){let[g,i]=react.useState(false),u=react.useMemo(()=>t.filter(v=>e.cardIds.includes(v.id)),[t,e.cardIds]),l=react.useMemo(()=>{let v=u.length,k=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,C=u.map(f=>f.priority).filter(Boolean),h=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:v,uniqueAssignees:k,priorities:C,labels:h}},[u]),b=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:d("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:b,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:d("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),g&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:v=>{v.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:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children: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(v=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(v),children:a(v)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(v),children:[jsxRuntime.jsx("h4",{children:v.title}),v.description&&jsxRuntime.jsxs("p",{children:[v.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:k=>{k.stopPropagation(),s?.(e.id,v.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"})]})})]},v.id))})})]})}var xp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function dn(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 cn(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 kp(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 wp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:c}){let g=react.useMemo(()=>({...xp,...n}),[n]),[i,u]=react.useState(new Set),l=react.useRef(null),b=react.useMemo(()=>{if(!g.groupByDay)return [{date:null,events:e}];let p=new Map;return e.forEach(x=>{let m=x.timestamp.toISOString().split("T")[0],N=p.get(m);N?N.push(x):p.set(m,[x]);}),Array.from(p.entries()).sort((x,m)=>m[0].localeCompare(x[0])).map(([x,m])=>({date:new Date(x),events:m.sort((N,w)=>w.timestamp.getTime()-N.timestamp.getTime())}))},[e,g.groupByDay]),{uniqueUsers:v,uniqueTypes:k}=react.useMemo(()=>{let p=new Set,x=new Set;return e.forEach(m=>{p.add(m.userId),x.add(m.type);}),{uniqueUsers:Array.from(p),uniqueTypes:Array.from(x)}},[e]),C=p=>{u(x=>{let m=new Set(x);return m.has(p)?m.delete(p):m.add(p),m});},h=p=>{let m=new Date().getTime()-p.getTime(),N=Math.floor(m/6e4),w=Math.floor(m/36e5),B=Math.floor(m/864e5);return N<1?"just now":N<60?`${N}m ago`:w<24?`${w}h ago`:B<7?`${B}d ago`:p.toLocaleDateString()},f=react.useMemo(()=>{let p=0;return t.types&&t.types.length>0&&p++,t.users&&t.users.length>0&&p++,t.dateRange&&p++,t.searchTerm&&p++,p},[t]);return react.useEffect(()=>{if(s&&l.current){let p=l.current.querySelector(`[data-event-id="${s}"]`);p&&p.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:d("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:d("history-timeline",g.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:p=>{let x=p.target.value;a({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),k.map(p=>jsxRuntime.jsxs("option",{value:p,children:[cn(p)," ",p.replace("_"," ")]},p))]}),v.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:p=>{let x=p.target.value;a({...t,users:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),v.map(p=>jsxRuntime.jsx("option",{value:p,children:p},p))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:p=>a({...t,searchTerm:p.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:l,children:b.map(p=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[g.groupByDay&&p.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:p.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[p.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:p.events.map((x,m)=>{let N=i.has(x.id),w=s===x.id,B=kp(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:d("history-timeline-event",N&&"expanded",w&&"selected"),onClick:()=>o?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:g.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:cn(x.type)})}),m<p.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:[g.showAvatars&&x.userAvatar&&jsxRuntime.jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:dn(x)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:g.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:y=>{y.stopPropagation(),C(x.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([y,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[y,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},y)),x.metadata&&Object.keys(x.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(x.metadata).map(([y,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[y,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},y))]})]})]})]},x.id)})})]},p.date?.toISOString()||"all"))})]})}function Tp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:c,onSpeedChange:g,className:i}){let u=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),b=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:d("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:d("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&cn(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&dn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:v=>c(parseInt(v.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${b}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((v,k)=>jsxRuntime.jsx("div",{className:d("history-replay-progress-marker",k===e.currentIndex&&"active"),style:{left:`${k/(e.totalEvents-1)*100}%`},onClick:()=>c(k),title:dn(v)},v.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(v=>jsxRuntime.jsxs("button",{className:d("history-replay-speed-btn",e.speed===v&&"active"),onClick:()=>g(v),children:[v,"x"]},v))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(v=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:v},v))})]})]})]})]}):jsxRuntime.jsxs("div",{className:d("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Cl(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 Tl(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 Np(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 Dp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function bv(e,t,a,r,o,s=100){let n=e.map(g=>({...g,x:g.x??a/2+Math.random()*100-50,y:g.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(n.map(g=>[g.id,g]));for(let g=0;g<s;g++){let i=1-g/s;n.forEach(u=>{let l=a/2,b=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(b-u.y)*o.centerForce*i,n.forEach(v=>{if(u.id===v.id)return;let k=u.x-v.x,C=u.y-v.y,h=Math.sqrt(k*k+C*C)||1,f=o.chargeStrength*i/(h*h);u.vx+=k/h*f,u.vy+=C/h*f;});}),t.forEach(u=>{let l=c.get(typeof u.source=="string"?u.source:u.source.id),b=c.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!b)return;let v=b.x-l.x,k=b.y-l.y,C=Math.sqrt(v*v+k*k)||1,h=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=v*h,l.vy+=k*h,b.vx-=v*h,b.vy-=k*h;}),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 Sp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:c,className:g}){let i=react.useRef(null),[u,l]=react.useState([]),[b,v]=react.useState(null),[k,C]=react.useState(null),[h,f]=react.useState(null),[p,x]=react.useState(1),[m,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=bv(e,t,a.width,a.height,a,150);l(O);},[e,t,a]);let w=react.useCallback((O,q)=>{a.enableDragging&&(q.stopPropagation(),v(O));},[a.enableDragging]),B=react.useCallback(O=>{if(!b||!i.current)return;let te=i.current.getBoundingClientRect(),ne=(O.clientX-te.left-m.x)/p,re=(O.clientY-te.top-m.y)/p;l(ce=>ce.map(be=>be.id===b?{...be,x:ne,y:re,fx:ne,fy:re}:be));},[b,p,m]),y=react.useCallback(()=>{v(null);},[]),I=react.useCallback((O,q)=>{q.stopPropagation(),c?.({type:"node-click",node:O,position:{x:q.clientX,y:q.clientY}});},[c]),P=react.useCallback((O,q)=>{q.stopPropagation(),c?.({type:"edge-click",edge:O,position:{x:q.clientX,y:q.clientY}});},[c]),T=react.useCallback(O=>{let q=u.find(te=>te.id===O);return q?{x:q.x,y:q.y}:{x:0,y:0}},[u]),W=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let q=O.card.priority;return q==="URGENT"?"#ef4444":q==="HIGH"?"#f59e0b":q==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:d("relationships-graph-empty",g),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:d("relationships-graph",g),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:()=>x(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(p*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Cl(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Np(O)," ",Tl(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:B,onMouseUp:y,onMouseLeave:y,children:[jsxRuntime.jsxs("g",{transform:`translate(${m.x}, ${m.y}) scale(${p})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let q=T(typeof O.source=="string"?O.source:O.source.id),te=T(typeof O.target=="string"?O.target:O.target.id),ne=Dp(O.type),re=h===O.id,ce=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-edge",re&&"hovered",ce&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:be=>P(O,be),children:[jsxRuntime.jsx("line",{x1:q.x,y1:q.y,x2:te.x,y2:te.y,stroke:Cl(O.type),strokeWidth:ce?a.edgeWidth*2:a.edgeWidth,strokeOpacity:re?1:.6,markerEnd:ne?"url(#arrowhead)":void 0}),a.showEdgeLabels&&re&&jsxRuntime.jsx("text",{x:(q.x+te.x)/2,y:(q.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Tl(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let q=k===O.id,te=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-node",q&&"hovered",te&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:ne=>w(O.id,ne),onMouseEnter:()=>C(O.id),onMouseLeave:()=>C(null),onClick:ne=>I(O,ne),children:[jsxRuntime.jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:W(O),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:q?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.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 Mp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[c,g]=react.useState(false),[i,u]=react.useState(null),[l,b]=react.useState(null),v=react.useRef(null),k=c||o;react.useEffect(()=>{e&&v.current&&v.current.focus();},[e]),react.useEffect(()=>{let p=x=>{x.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,k]);let C=()=>{k||(n(""),u(null),b(null),t());},h=async()=>{if(!(!s.trim()||k)){g(true),u(null),b(null);try{let p=await r(s.trim());b(p);}catch(p){u(p instanceof Error?p.message:"Failed to generate plan");}finally{g(false);}}},f=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(ft,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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: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("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:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((p,x)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:p.title},x))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((p,x)=>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:p.title}),p.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:p.description})]}),p.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${p.priority==="URGENT"?"bg-red-500/20 text-red-400":p.priority==="HIGH"?"bg-orange-500/20 text-orange-400":p.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:p.priority})]})},x)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:v,value:s,onChange:p=>n(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:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((p,x)=>jsxRuntime.jsx("button",{onClick:()=>n(p),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:p},x))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?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:h,disabled:!s.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Nl={"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 yv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},vv={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 xv(e,t,a){let r=Nl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function mn(e){return `$${e.toFixed(4)}`}var Dl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=xv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,b)=>l+b.cost,0),s=a.reduce((l,b)=>l+b.inputTokens,0),n=a.reduce((l,b)=>l+b.outputTokens,0),c=a.filter(l=>l.success),g=a.reduce((l,b)=>l+b.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?g/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,g=Math.max(0,o-c),i=c/o*100;return {used:c,limit:o,remaining:g,percentUsed:i,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)}},fo=new Dl;function Lp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(fo.getStats()),[s,n]=react.useState(fo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let g=setInterval(()=>{o(fo.getStats()),n(fo.checkLimit(a));},1e3);return ()=>clearInterval(g)},[e,a]),react.useEffect(()=>{let g=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]),!e)return null;let c=fo.getRecentOperations(5);return jsxRuntime.jsxs(ft,{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:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.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:mn(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(([g,i])=>{let u=r.costsByFeature[g]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:g.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mn(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:`${l}%`}})})]},g)})})]}),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(g=>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:g.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(g.timestamp).toLocaleTimeString()," \u2022"," ",g.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[g.inputTokens+g.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mn(g.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${g.success?"bg-green-400":"bg-red-400"}`})]})]},g.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 Rp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,c]=react.useState(""),[g,i]=react.useState(""),[u,l]=react.useState(""),[b,v]=react.useState(false),[k,C]=react.useState(null),[h,f]=react.useState(null),[p,x]=react.useState(null),m=react.useRef(null),N=b||o;react.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),react.useEffect(()=>{let P=T=>{T.key==="Escape"&&!N&&w();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,N]);let w=()=>{N||(c(""),i(""),l(""),C(null),f(null),x(null),t());},B=async()=>{if(!(!n.trim()||N)){v(true),C(null),f(null),x(null);try{let P=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:g||void 0,endDate:u||void 0});f(P.tasks.tasks),x({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){C(P instanceof Error?P.message:"Failed to generate tasks");}finally{v(false);}}},y=()=>{h&&(a(h),w());};if(!e)return null;let I=p?.similarity?((p.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ft,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:w,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[p?.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"}),p?.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 (",I,"% 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:[p?.tokens_used||0," tokens"]}),p?.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:[p.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((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:m,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:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:P=>i(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:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,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:N})]})]}),k&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:k}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,T)=>jsxRuntime.jsx("button",{onClick:()=>c(P),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children: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:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:w,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:B,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function xs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&kn(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,p,x)=>{console.warn(`Retry attempt ${p} after ${x}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,p)=>{r(x=>{let m=x.cards.find(P=>P.id===h);if(!m)return x;let N=m.columnId,w={...m,columnId:f,position:p},B=x.cards.map(P=>P.id===h?w:P),y=x.columns.map(P=>{if(P.id===N)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===f){let T=B.filter(W=>W.columnId===f).sort((W,O)=>W.position-O.position);return {...P,cardIds:T.map(W=>W.id)}}return P}),I={...x,cards:B,columns:y};return o(I),I});},[o]),n=react.useCallback(async(h,f)=>{r(p=>{let x=p.cards.map(N=>N.id===h?{...N,...f}:N),m={...p,cards:x};return o(m),m});},[o]),c=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(p=>{let x={...h,id:f},m=p.columns.map(w=>w.id===h.columnId?{...w,cardIds:[...w.cardIds,f]}:w),N={...p,cards:[...p.cards,x],columns:m};return o(N),N});},[o]),g=react.useCallback(async h=>{r(f=>{let p=f.cards.find(w=>w.id===h);if(!p)return f;let x=f.cards.filter(w=>w.id!==h),m=f.columns.map(w=>w.id===p.columnId?{...w,cardIds:w.cardIds.filter(B=>B!==h)}:w),N={...f,cards:x,columns:m};return o(N),N});},[o]),i=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(p=>{let x={...h,id:f,cardIds:[]},m={...p,columns:[...p.columns,x]};return o(m),m});},[o]),u=react.useCallback(async(h,f)=>{r(p=>{let x=p.columns.map(N=>N.id===h?{...N,...f}:N),m={...p,columns:x};return o(m),m});},[o]),l=react.useCallback(async h=>{r(f=>{let p=f.cards.filter(N=>N.columnId!==h),x=f.columns.filter(N=>N.id!==h),m={...f,cards:p,columns:x};return o(m),m});},[o]),b=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),f},[c]),v=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),k=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:c,onCardDelete:g,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:b,addColumn:v,deleteCard:g,deleteColumn:l,clearBoard:k}}}function $p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=xs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(g,i,u={})=>{s.addCard({title:i,columnId:g,position:r.cards.filter(l=>l.columnId===g).length,...u});},addColumn:(g,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:g,position:i??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 pn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},zp={by:"none",order:"asc"};function Hp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...pn,...e}),[s,n]=react.useState({...zp,...t}),c=react.useCallback(C=>{o(h=>({...h,...C}));},[]),g=react.useCallback(C=>{n(h=>({...h,...C}));},[]),i=react.useCallback(()=>{o(pn),n(zp);},[]),u=react.useCallback(()=>{a&&o({...pn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...pn,dateFilter:"overdue"});},[]),b=react.useCallback(()=>{o({...pn,priorities:["HIGH","URGENT"]});},[]),v=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]),k=react.useCallback(C=>{let h=[...C];if(r.search){let f=r.search.toLowerCase();h=h.filter(p=>p.title.toLowerCase().includes(f)||p.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,p=f.getFullYear(),x=String(f.getMonth()+1).padStart(2,"0"),m=String(f.getDate()).padStart(2,"0"),N=`${p}-${x}-${m}`;h=h.filter(w=>{if(!w.endDate&&!w.dueDate)return false;let B=w.endDate||w.dueDate;if(!B)return false;let y;if(typeof B=="string")y=B.split("T")[0]||B;else {let I=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),T=String(B.getUTCDate()).padStart(2,"0");y=`${I}-${P}-${T}`;}switch(r.dateFilter){case "overdue":return y<N;case "today":return y===N;case "this-week":let I=new Date(N+"T00:00:00"),P=new Date(y+"T00:00:00"),T=new Date(I);return T.setDate(T.getDate()+7),P>=I&&P<=T;case "custom":if(r.dateRange){let W=typeof B=="string"?new Date(B):B;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(p=>r.labels.includes(p)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,p)=>{let x=0;switch(s.by){case "created":let m=f.createdAt?new Date(f.createdAt).getTime():0,N=p.createdAt?new Date(p.createdAt).getTime():0;x=m-N;break;case "priority":let w={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=w[f.priority||"LOW"],y=w[p.priority||"LOW"];x=B-y;break;case "dueDate":let I=f.endDate||f.dueDate,P=p.endDate||p.dueDate;if(!I)return 1;if(!P)return -1;let T=typeof I=="string"?new Date(I).getTime():I.getTime(),W=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-W;break;case "title":x=f.title.localeCompare(p.title);break;case "estimate":let O=f.estimatedTime||0,q=p.estimatedTime||0;x=O-q;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:g,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:b,applyFilters:k,hasActiveFilters:v}}var Gp,_p;if(typeof window<"u")try{let e=yn("ai");Gp=e.generateObject,_p=e.generateText;}catch{}function Vp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Gp&&_p&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(b){let v=b instanceof Error?b:new Error("Failed to generate plan");throw o(v),v}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(b){let v=b instanceof Error?b:new Error("Failed to suggest assignee");throw o(v),v}finally{a(false);}},[s]),g=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(b){let v=b instanceof Error?b:new Error("Failed to predict risks");throw o(v),v}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(b){let v=b instanceof Error?b:new Error("Failed to generate subtasks");throw o(v),v}finally{a(false);}},[s]),u=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(b){let v=b instanceof Error?b:new Error("Failed to estimate effort");throw o(v),v}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:c,onPredictRisks:g,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function El(){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 jp(e){let{cards:t}=e,[a,r]=El(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,b)=>{if(!b){r({selectedCardIds:[l],lastSelectedCardId:l});return}let v=b.ctrlKey||b.metaKey,k=b.shiftKey;if(v)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(k&&a.lastSelectedCardId){let C=t.find(f=>f.id===l),h=t.find(f=>f.id===a.lastSelectedCardId);if(C&&h&&C.columnId===h.columnId){let f=t.filter(y=>y.columnId===C.columnId).sort((y,I)=>y.position-I.position),p=f.findIndex(y=>y.id===a.lastSelectedCardId),x=f.findIndex(y=>y.id===l),[m,N]=p<x?[p,x]:[x,p],w=f.slice(m,N+1).map(y=>y.id),B=Array.from(new Set([...a.selectedCardIds,...w]));r({selectedCardIds:B,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),g=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:c,selectAll:g,toggleCard:i,getSelectedCards:u}}var Kp={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(()=>({...Kp,...a}),[a]),[s,n]=react.useState([]),c=react.useCallback((C,h,f,p,x)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let m={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:h,columnId:f,strategy:p,color:x,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,m]);},[o.minCardsPerStack,s]),g=react.useCallback(C=>{n(h=>h.filter(f=>f.id!==C));},[]),i=react.useCallback(C=>{n(h=>h.map(f=>f.id===C?{...f,isExpanded:!f.isExpanded}:f));},[]),u=react.useCallback((C,h)=>{n(f=>f.map(p=>p.id===C&&!p.cardIds.includes(h)?{...p,cardIds:[...p.cardIds,h]}:p));},[]),l=react.useCallback((C,h)=>{n(f=>f.map(p=>{if(p.id===C){let x=p.cardIds.filter(m=>m!==h);return x.length<o.minCardsPerStack?null:{...p,cardIds:x}}return p}).filter(p=>p!==null));},[o.minCardsPerStack]),b=react.useCallback(C=>s.filter(h=>h.columnId===C).sort((h,f)=>h.position-f.position),[s]),v=react.useCallback(async C=>{let h=t.filter(N=>N.columnId===C);if(h.length<o.minCardsPerStack*2)return [];let f=[],p=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(w=>{p.has(w)||p.set(w,[]),p.get(w).push(N);});}),p.forEach((N,w)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${w}`,cardIds:N.map(B=>B.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${w}"`,confidence:.85});});let x=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(w=>{x.has(w)||x.set(w,[]),x.get(w).push(N);});}),x.forEach((N,w)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${w.slice(-4)}`,cardIds:N.map(B=>B.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let m=new Map;if(h.forEach(N=>{N.priority&&(m.has(N.priority)||m.set(N.priority,[]),m.get(N.priority).push(N));}),m.forEach((N,w)=>{if(N.length>=o.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[w.toLowerCase()]||"\u26AA";f.push({stack:{title:`${B} ${w} Priority`,cardIds:N.map(y=>y.id),columnId:C,strategy:"priority",color:w==="high"||w==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${w} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let B=(await r.findSimilar(N,h)).filter(y=>y.similarity>=o.autoStackConfidenceThreshold);if(B.length>=o.minCardsPerStack-1){let y=[N.id,...B.map(P=>P.card.id)],I=B.reduce((P,T)=>P+T.similarity,0)/B.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:y,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:I});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,w)=>w.confidence-N.confidence).slice(0,5)},[t,o,r]),k=react.useCallback(C=>{c(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await v(h),p=f[0];f.length>0&&p&&p.confidence>=.9&&k(p);});},[]),{stacks:s,createStack:c,deleteStack:g,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:b,getSuggestions:v,applySuggestion:k,config:o}}var qp=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(g=>{let{Column:i}=yn("@libxai/core");s.set(g.id,new i(g));}),t?.cards?.forEach(g=>{let{Card:i}=yn("@libxai/core");n.set(g.id,new i(g));});let c=null;if(t?.board){let{Board:g}=yn("@libxai/core");c=new g(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(qp.Provider,{value:{store:o},children:e})}function ks(){let e=react.useContext(qp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gn(){let e=ks(),[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(p=>{e.updateBoard(p);},[e]),g=react.useCallback(p=>{e.addColumn(p);},[e]),i=react.useCallback((p,x)=>{e.updateColumn(p,x);},[e]),u=react.useCallback(p=>{e.deleteColumn(p);},[e]),l=react.useCallback(p=>e.getColumn(p),[e]),b=react.useCallback(p=>{e.addCard(p);},[e]),v=react.useCallback((p,x)=>{e.updateCard(p,x);},[e]),k=react.useCallback(p=>{e.deleteCard(p);},[e]),C=react.useCallback((p,x,m)=>{e.moveCard(p,x,m);},[e]),h=react.useCallback(p=>e.getCard(p),[e]),f=react.useCallback(p=>e.getCardsByColumn(p),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:g,updateColumn:i,deleteColumn:u,getColumn:l,addCard:b,updateCard:v,deleteCard:k,moveCard:C,getCard:h,getCardsByColumn:f}}function Zp(e){let{cards:t}=gn();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 Qp(e="position",t="asc"){let{cards:a}=gn();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},g=o.priority?c[o.priority]:0,i=s.priority?c[s.priority]:0;n=g-i;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 ws=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=id.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);}},Ov=new ws;function tu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:c=0,getItemKey:g}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:c}),l=u.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},v=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:b,className:o,children:jsxRuntime.jsx("div",{style:v,children:l.map(k=>{let C=e[k.index];if(!C)return null;let h=g?g(C,k.index):k.index,f={position:"absolute",top:n?0:k.start,left:n?k.start:0,width:n?k.size:"100%",height:n?"100%":k.size};return jsxRuntime.jsx("div",{style:f,"data-index":k.index,children:r(C,k.index)},h)})})})}function au(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 ou({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:c=16,getItemKey:g,horizontal:i=true}){let u=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:c}),b=l.getVirtualItems(),v={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},k={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:v,className:s,children:jsxRuntime.jsx("div",{style:k,children:b.map(C=>{let h=e[C.index];if(!h)return null;let f=g?g(h,C.index):C.index,p={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:p,"data-index":C.index,children:o(h,C.index)},f)})})})}function nu(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 su(e,t=10){return e>t}var Fl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ll={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Il={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Bl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ol={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$l={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ul={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)"},zl={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)"},Hl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wl={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}},Gl={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}},Cs={spacing:Fl,borderRadius:Ll,fontSize:Il,fontWeight:Bl,lineHeight:Rl,zIndex:Ol,duration:$l,easing:Ul,shadows:zl,opacity:Hl,kanban:Wl,gantt:Gl};function iu(e,t,a){return e[t]??a}function _l(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)?_l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vl(e="asakaa"){let t=_l(Cs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=zv(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
- }`}function tn(e,t="asakaa"){let a=[],r=yl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
392
+ }`}function fn(e,t="asakaa"){let a=[],r=_l(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
393
393
  ${a.join(`
394
394
  `)}
395
- }`}var os={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"}},xl={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"}},kl={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 wl(e=os,t="asakaa"){let a=vl(t),r=tn(e,t);return `${a}
395
+ }`}var Ts={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"}},jl={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"}},Kl={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 Yl(e=Ts,t="asakaa"){let a=Vl(t),r=fn(e,t);return `${a}
396
396
 
397
- ${r}`}function tp(){return `/**
397
+ ${r}`}function lu(){return `/**
398
398
  * ASAKAA Design Tokens
399
399
  * Auto-generated from design-tokens.ts
400
400
  * Do not edit this file directly
401
401
  */
402
402
 
403
- ${wl(os)}
403
+ ${Yl(Ts)}
404
404
 
405
405
  /* Light theme */
406
406
  [data-theme="light"] {
407
- ${tn(xl,"asakaa").split(`
407
+ ${fn(jl,"asakaa").split(`
408
408
  `).slice(1,-1).join(`
409
409
  `)}
410
410
  }
411
411
 
412
412
  /* Neutral theme */
413
413
  [data-theme="neutral"] {
414
- ${tn(kl,"asakaa").split(`
414
+ ${fn(Kl,"asakaa").split(`
415
415
  `).slice(1,-1).join(`
416
416
  `)}
417
417
  }
418
- `}var cb=({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 ap({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=bo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,m])=>{let p=n,i=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":i,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(cb,{theme:p})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},p)})})}
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=Dm;exports.AI_FEATURES=Wh;exports.AI_MODELS=Zi;exports.AddCardButton=Is;exports.AddColumnButton=Fs;exports.AttachmentUploader=ur;exports.BoardProvider=Gm;exports.BulkOperationsToolbar=wn;exports.BurnDownChart=Vs;exports.CalendarBoard=cm;exports.Card=br;exports.CardDetailModal=zs;exports.CardDetailModalV2=Ws;exports.CardHistoryReplay=bm;exports.CardHistoryTimeline=fm;exports.CardRelationshipsGraph=xm;exports.CardStack=Ih;exports.CardTemplateSelector=Qs;exports.CircuitBreaker=us;exports.Column=mo;exports.ColumnManager=Pn;exports.CommandPalette=Rs;exports.ConfigMenu=ai;exports.ContextMenu=xo;exports.DEFAULT_SHORTCUTS=$o;exports.DEFAULT_TEMPLATES=Js;exports.DateRangePicker=So;exports.DependenciesSelector=Po;exports.DependencyLine=$n;exports.DistributionCharts=js;exports.EditableColumnTitle=ks;exports.ErrorBoundary=uo;exports.ExportImportModal=ei;exports.FilterBar=ti;exports.GANTT_AI_SYSTEM_PROMPT=Wc;exports.GanttAIAssistant=Wn;exports.GanttBoard=Oc;exports.GanttI18nContext=vo;exports.GanttMilestone=zn;exports.GanttToolbar=En;exports.GenerateGanttTasksDialog=Pm;exports.GeneratePlanModal=Cm;exports.GroupBySelector=qs;exports.KanbanBoard=Mr;exports.KanbanToolbar=Ms;exports.KanbanViewAdapter=Lo;exports.KeyboardShortcutsHelp=Xs;exports.ListView=em;exports.MenuIcons=$t;exports.PluginManager=as;exports.PrioritySelector=Wr;exports.RATE_LIMITS=Hh;exports.SwimlaneBoardView=Ks;exports.TagBadge=Cs;exports.TagList=bd;exports.TagPicker=dr;exports.TaskBar=Ln;exports.TaskDetailModal=Kr;exports.TaskFormModal=Hc;exports.TaskGrid=Fn;exports.ThemeModal=si;exports.ThemeProvider=tc;exports.ThemeSwitcher=ap;exports.Timeline=Hn;exports.UserAssignmentSelector=_r;exports.VelocityChart=_s;exports.VirtualGrid=Jm;exports.VirtualList=Ym;exports.aiUsageTracker=to;exports.borderRadius=il;exports.calculatePosition=sn;exports.calendarDarkTheme=Yi;exports.calendarEnTranslations=Ui;exports.calendarEsTranslations=Hi;exports.calendarLightTheme=qi;exports.calendarNeutralTheme=Xi;exports.calendarThemes=Jn;exports.calendarTranslations=Yn;exports.cardToGanttTask=_n;exports.cardsToGanttTasks=qc;exports.cn=f;exports.createKanbanView=Ld;exports.createRetryWrapper=Cp;exports.darkTheme=ri;exports.darkTokenTheme=os;exports.defaultTheme=Tn;exports.designTokens=rs;exports.duration=pl;exports.easing=ul;exports.exportTokensToCSS=tp;exports.findTaskByName=kr;exports.fontSize=ll;exports.fontWeight=dl;exports.formatCost=Jo;exports.ganttEnTranslations=Dn;exports.ganttEsTranslations=rc;exports.ganttTaskToCardUpdate=Yc;exports.ganttThemes=Je;exports.ganttTokens=bl;exports.ganttTranslations=ii;exports.ganttUtils=ue;exports.generateCSSVariables=vl;exports.generateCompleteCSS=wl;exports.generateInitialPositions=vp;exports.generateTasksContext=Gc;exports.generateThemeVariables=tn;exports.getCalendarTheme=mm;exports.getCalendarTranslations=jo;exports.getListViewTheme=tm;exports.getListViewTranslations=Bi;exports.getMonthNames=am;exports.getToken=ep;exports.getTranslations=oc;exports.getWeekdayNames=rm;exports.kanbanTokens=hl;exports.lightTheme=oi;exports.lightTokenTheme=xl;exports.lineHeight=cl;exports.listViewDarkTheme=$i;exports.listViewEnTranslations=Ii;exports.listViewEsTranslations=Li;exports.listViewLightTheme=Oi;exports.listViewNeutralTheme=zi;exports.listViewThemes=Kn;exports.listViewTranslations=Vn;exports.mergeCalendarTranslations=qn;exports.mergeListViewTranslations=jn;exports.mergeTranslations=li;exports.neutralTheme=ni;exports.neutralTokenTheme=kl;exports.opacity=fl;exports.parseLocalCommand=jc;exports.parseNaturalDate=Mi;exports.parseNaturalDuration=Ai;exports.parseProgress=Fi;exports.parseStatus=Vc;exports.pluginManager=sb;exports.retrySyncOperation=wp;exports.retryWithBackoff=ln;exports.shadows=gl;exports.shouldVirtualizeGrid=Zm;exports.spacing=sl;exports.themes=Xr;exports.useAI=Om;exports.useBoard=Am;exports.useBoardCore=en;exports.useBoardStore=ts;exports.useCardStacking=Hm;exports.useDragState=Es;exports.useFilteredCards=Vm;exports.useFilters=Lm;exports.useGanttI18n=Br;exports.useKanbanState=es;exports.useKeyboardShortcuts=Qd;exports.useMultiSelect=zm;exports.useSelectionState=al;exports.useSortedCards=jm;exports.useTheme=bo;exports.useVirtualGrid=Qm;exports.useVirtualList=qm;exports.validateAIResponse=Kc;exports.withErrorBoundary=Ls;exports.wouldCreateCircularDependency=cn;exports.zIndex=ml;//# sourceMappingURL=index.cjs.map
418
+ `}var Hv=({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 du({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Mo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,c])=>{let g=n,i=g===r;return jsxRuntime.jsxs("button",{onClick:()=>o(g),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Hv,{theme:g})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},g)})})}
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=Lp;exports.AI_FEATURES=vv;exports.AI_MODELS=Nl;exports.AddCardButton=Qs;exports.AddColumnButton=Zs;exports.AttachmentUploader=xr;exports.BoardProvider=Xp;exports.BulkOperationsToolbar=Bn;exports.BurnDownChart=mi;exports.CUSTOM_FIELD_TYPES=ip;exports.CalendarBoard=hp;exports.Card=Dr;exports.CardDetailModal=ni;exports.CardDetailModalV2=li;exports.CardHistoryReplay=Tp;exports.CardHistoryTimeline=wp;exports.CardRelationshipsGraph=Sp;exports.CardStack=cv;exports.CardTemplateSelector=yi;exports.CircuitBreaker=Ls;exports.Column=To;exports.ColumnManager=Wn;exports.CommandPalette=ai;exports.ConfigMenu=wi;exports.ContextMenu=Lo;exports.DEFAULT_SHORTCUTS=Jo;exports.DEFAULT_TABLE_COLUMNS=np;exports.DEFAULT_TEMPLATES=hi;exports.DateRangePicker=Ho;exports.DependenciesSelector=Go;exports.DependencyLine=Xn;exports.DistributionCharts=pi;exports.EditableColumnTitle=Hs;exports.ErrorBoundary=Do;exports.ExportImportModal=xi;exports.FilterBar=ki;exports.GANTT_AI_SYSTEM_PROMPT=gm;exports.GanttAIAssistant=ts;exports.GanttBoard=cm;exports.GanttI18nContext=Fo;exports.GanttMilestone=Zn;exports.GanttToolbar=Hn;exports.GenerateGanttTasksDialog=Rp;exports.GeneratePlanModal=Mp;exports.GroupBySelector=fi;exports.KanbanBoard=Ur;exports.KanbanToolbar=Xs;exports.KanbanViewAdapter=Yo;exports.KeyboardShortcutsHelp=bi;exports.ListView=op;exports.MenuIcons=Wt;exports.PluginManager=ws;exports.PrioritySelector=eo;exports.RATE_LIMITS=yv;exports.STANDARD_FIELDS=sp;exports.SwimlaneBoardView=ui;exports.TagBadge=Gs;exports.TagList=Gd;exports.TagPicker=br;exports.TaskBar=Kn;exports.TaskDetailModal=no;exports.TaskFormModal=um;exports.TaskGrid=Vn;exports.ThemeModal=Di;exports.ThemeProvider=Sc;exports.ThemeSwitcher=du;exports.Timeline=es;exports.UserAssignmentSelector=ao;exports.VelocityChart=ci;exports.VirtualGrid=ou;exports.VirtualList=tu;exports.aiUsageTracker=fo;exports.borderRadius=Ll;exports.calculatePosition=xn;exports.calendarDarkTheme=xl;exports.calendarEnTranslations=pl;exports.calendarEsTranslations=ul;exports.calendarLightTheme=kl;exports.calendarNeutralTheme=wl;exports.calendarThemes=hs;exports.calendarTranslations=gs;exports.cardToGanttTask=rs;exports.cardsToGanttTasks=km;exports.cn=d;exports.createKanbanView=sc;exports.createRetryWrapper=Mu;exports.darkTheme=Ci;exports.darkTokenTheme=Ts;exports.defaultTheme=On;exports.designTokens=Cs;exports.duration=$l;exports.easing=Ul;exports.exportTokensToCSS=lu;exports.findTaskByName=Mr;exports.fontSize=Il;exports.fontWeight=Bl;exports.formatCost=mn;exports.ganttEnTranslations=Un;exports.ganttEsTranslations=Pc;exports.ganttTaskToCardUpdate=xm;exports.ganttThemes=et;exports.ganttTokens=Gl;exports.ganttTranslations=Si;exports.ganttUtils=he;exports.generateCSSVariables=Vl;exports.generateCompleteCSS=Yl;exports.generateInitialPositions=Du;exports.generateTasksContext=fm;exports.generateThemeVariables=fn;exports.getCalendarTheme=yp;exports.getCalendarTranslations=nn;exports.getListViewTheme=lp;exports.getListViewTranslations=tl;exports.getMonthNames=dp;exports.getToken=iu;exports.getTranslations=Mc;exports.getWeekdayNames=cp;exports.kanbanTokens=Wl;exports.lightTheme=Ti;exports.lightTokenTheme=jl;exports.lineHeight=Rl;exports.listViewDarkTheme=dl;exports.listViewEnTranslations=Qi;exports.listViewEsTranslations=el;exports.listViewLightTheme=cl;exports.listViewNeutralTheme=ml;exports.listViewThemes=us;exports.listViewTranslations=os;exports.mergeCalendarTranslations=fs;exports.mergeListViewTranslations=ns;exports.mergeTranslations=Ei;exports.neutralTheme=Ni;exports.neutralTokenTheme=Kl;exports.opacity=Hl;exports.parseLocalCommand=ym;exports.parseNaturalDate=Xi;exports.parseNaturalDuration=Ji;exports.parseProgress=Zi;exports.parseStatus=hm;exports.pluginManager=Ov;exports.retrySyncOperation=Pu;exports.retryWithBackoff=kn;exports.shadows=zl;exports.shouldVirtualizeGrid=su;exports.spacing=Fl;exports.themes=lo;exports.useAI=Vp;exports.useBoard=$p;exports.useBoardCore=gn;exports.useBoardStore=ks;exports.useCardStacking=Yp;exports.useDragState=Ys;exports.useFilteredCards=Zp;exports.useFilters=Hp;exports.useGanttI18n=_r;exports.useKanbanState=xs;exports.useKeyboardShortcuts=Tc;exports.useMultiSelect=jp;exports.useSelectionState=El;exports.useSortedCards=Qp;exports.useTheme=Mo;exports.useVirtualGrid=nu;exports.useVirtualList=au;exports.validateAIResponse=vm;exports.withErrorBoundary=ei;exports.wouldCreateCircularDependency=Cn;exports.zIndex=Ol;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map